# HG changeset patch # User hgs # Date 1282562849 -10800 # Node ID 4bfa887905cfc6a2be3dc63ab7f507babfcac573 # Parent 21fe8338c6bfbb8e79d8f394db6513a62b74746c 201033 diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/bwins/videocollectionwrapperu.def --- a/videocollection/bwins/videocollectionwrapperu.def Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/bwins/videocollectionwrapperu.def Mon Aug 23 14:27:29 2010 +0300 @@ -78,4 +78,5 @@ ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 77 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *, int) ??0VideoThumbnailData@@AAE@XZ @ 78 NONAME ; VideoThumbnailData::VideoThumbnailData(void) ?staticMetaObject@VideoThumbnailData@@2UQMetaObject@@B @ 79 NONAME ; struct QMetaObject const VideoThumbnailData::staticMetaObject + ?modelSorted@VideoSortFilterProxyModel@@IAEXXZ @ 80 NONAME ; void VideoSortFilterProxyModel::modelSorted(void) diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/eabi/videocollectionwrapperu.def --- a/videocollection/eabi/videocollectionwrapperu.def Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/eabi/videocollectionwrapperu.def Mon Aug 23 14:27:29 2010 +0300 @@ -78,4 +78,5 @@ _ZTV18VideoThumbnailData @ 77 NONAME _ZTV22VideoCollectionWrapper @ 78 NONAME _ZTV25VideoSortFilterProxyModel @ 79 NONAME + _ZN25VideoSortFilterProxyModel11modelSortedEv @ 80 NONAME diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -337,7 +337,6 @@ rootCondition.AddRelationConditionL( *iContainsRelationDef ); CMdELogicCondition& leftCondition = relationCondition.LeftL(); - CMdELogicCondition& rightCondition = relationCondition.RightL(); //...left side is an album... leftCondition.AddObjectConditionL( *iAlbumObjectDef ); diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestAlbums.cfg --- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestAlbums.cfg Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestAlbums.cfg Mon Aug 23 14:27:29 2010 +0300 @@ -2310,7 +2310,7 @@ waittestclass VCXMV VCXMV RenameAlbum Album1 Album2 -VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCollectionOpened +VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified waittestclass VCXMV VCXMV CheckAlbumExists Album2 @@ -2350,7 +2350,7 @@ waittestclass VCXMV VCXMV RenameAlbum Album1 Album2 -VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCollectionOpened +VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified waittestclass VCXMV VCXMV CloseLevel diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestCategories.cfg --- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestCategories.cfg Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestCategories.cfg Mon Aug 23 14:27:29 2010 +0300 @@ -433,37 +433,6 @@ #------------------------------------------------------------------------------------ # -# Tests opening 'Other videos' category when device has videos with different origins. -# -#------------------------------------------------------------------------------------ -[Test] -title Other videos - all origins -create VCXMyVideosCollectionPluginTest VCXMV -VCXMV Create -VCXMV SetFileCheck 0 - -VCXMV OpenCollection VCXCollectionMyVideos -VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened -waittestclass VCXMV - -VCXMV OpenLevel EVcxMyVideosOther -VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete -waittestclass VCXMV - -VCXMV CheckMediaCount ANY_DRIVE 2 -VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralTitle "OriginOther" -VCXMV CheckMediaDetail ANY_DRIVE 1 EVcxTestMapping_KMPXMediaGeneralTitle "OriginSideloaded" - -VCXMV CloseLevel -VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened -waittestclass VCXMV - -print OK! -delete VCXMV -[Endtest] - -#------------------------------------------------------------------------------------ -# # Creates two videos for each different origin, one with new flag and one without. # #------------------------------------------------------------------------------------ @@ -701,32 +670,6 @@ #------------------------------------------------------------------------------------ # -# Tests that category 'Other videos' has correct details when there's videos with different origins. -# -#------------------------------------------------------------------------------------ -[Test] -title Other videos - category details -create VCXMyVideosCollectionPluginTest VCXMV -VCXMV Create - -VCXMV OpenCollection VCXCollectionMyVideos -VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened -waittestclass VCXMV - -VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageListComplete -waittestclass VCXMV - -VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other" -VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4 -VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2 -VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "OriginSideloaded" - -print OK! -delete VCXMV -[Endtest] - -#------------------------------------------------------------------------------------ -# # Tests that category 'Other videos' details are updated when videos are deleted. # #------------------------------------------------------------------------------------ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/simplevideoplayback/simplevideoplayback.pro --- a/videocollection/tsrc/simplevideoplayback/simplevideoplayback.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/simplevideoplayback/simplevideoplayback.pro Mon Aug 23 14:27:29 2010 +0300 @@ -42,6 +42,8 @@ svpbplugin.cpp \ svpbview.cpp +DOCML += resources/simplevideoplayback.docml + RESOURCES = simplevideoplayback.qrc LIBS += -lcone \ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/simplevideoplayback/simplevideoplayback.qrc --- a/videocollection/tsrc/simplevideoplayback/simplevideoplayback.qrc Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/simplevideoplayback/simplevideoplayback.qrc Mon Aug 23 14:27:29 2010 +0300 @@ -1,5 +1,5 @@ - resources/simplevideoplayback.docml + resources/simplevideoplayback.docml.bin diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/inc/hblistview.h --- a/videocollection/tsrc/stubs/inc/hblistview.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/hblistview.h Mon Aug 23 14:27:29 2010 +0300 @@ -242,9 +242,7 @@ */ void scrollTo(const QModelIndex &index) { - Q_UNUSED(index); - - // nop + mLatestScrollToIndex = index; } /** @@ -404,6 +402,11 @@ static bool mLatestEnableValue; /** + * latest index setted in scrollTo + */ + static QModelIndex mLatestScrollToIndex; + + /** * index value to be returned from current index */ static QModelIndex mCurrentIndex; diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/inc/hbnamespace.h --- a/videocollection/tsrc/stubs/inc/hbnamespace.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/hbnamespace.h Mon Aug 23 14:27:29 2010 +0300 @@ -351,22 +351,22 @@ InstantBoundaryReached, InstantRotated90Degrees, InstantSelectionChanged, - /* add new standard instant interactions here */ + // add new standard instant interactions here // NumberOfInstantInteractions, // InstantUser = 1000, - /* value range for user defined custom instant interactions */ + // value range for user defined custom instant interactions // InstantMaxUser = 65535 // }; -/* enum ContinuousInteraction { +// enum ContinuousInteraction { ContinuousScrolled = 0, ContinuousDragged, ContinuousPinched, - /* add new standard continuous interactions here */ + // add new standard continuous interactions here // NumberOfContinuousInteractions, // ContinuousUser = 1000, - /* value range for user defined custom continuous interactions */ -/* ContinuousMaxUser = 65535 + // value range for user defined custom continuous interactions +// ContinuousMaxUser = 65535 }; enum InteractionModifier { diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/inc/videolistdatamodeldata.h --- a/videocollection/tsrc/stubs/inc/videolistdatamodeldata.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/videolistdatamodeldata.h Mon Aug 23 14:27:29 2010 +0300 @@ -30,6 +30,7 @@ mDataAccessCount = 0; mRowCount = 0; mRowCountDecrement = 0; + mItemId = TMPXItemId::InvalidId(); } static QModelIndex lastIndex() @@ -62,6 +63,7 @@ static int mDataAccessCount; static int mRowCount; static int mRowCountDecrement; + static TMPXItemId mItemId; }; #endif /* VIDEOLISTDATAMODELDATA_H */ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/inc/videooperatorservice_pdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/tsrc/stubs/inc/videooperatorservice_pdata.h Mon Aug 23 14:27:29 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: +* +*/ + +#ifndef VIDEOOPERATORSERVICE_PDATA_H +#define VIDEOOPERATORSERVICE_PDATA_H + +#include +#include + +class VideoOperatorServicePrivateData +{ +public: // methods + static void reset() + { + + } + +public: // data + + static bool mLoadReturnValue; + static QString mTitleReturnValue; + static QString mIconResourceReturnValue; + static int mLaunchServiceCallCount; + +}; + +#endif /* VIDEOOPERATORSERVICE_PDATA_H */ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/inc/videooperatorservicedata.h --- a/videocollection/tsrc/stubs/inc/videooperatorservicedata.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/videooperatorservicedata.h Mon Aug 23 14:27:29 2010 +0300 @@ -34,7 +34,6 @@ mTitleCallCount = 0; mIconResourceCallCount = 0; mLaunchServiceCallCount = 0; - mLaunchApplicationLCallCount = 0; } public: // data @@ -49,7 +48,6 @@ static int mTitleCallCount; static int mIconResourceCallCount; static int mLaunchServiceCallCount; - static int mLaunchApplicationLCallCount; }; #endif /* VIDEOOPERATORSERVICEDATA_H */ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/inc/xqsettingsmanagerstub.h --- a/videocollection/tsrc/stubs/inc/xqsettingsmanagerstub.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/xqsettingsmanagerstub.h Mon Aug 23 14:27:29 2010 +0300 @@ -20,6 +20,7 @@ #include #include +#include class XQCentralRepositorySettingsKey : public QObject { @@ -27,11 +28,15 @@ public: + XQCentralRepositorySettingsKey(int uid, int key) { - Q_UNUSED(uid); - Q_UNUSED(key); + mUid = uid; + mKey = key; } + + int mUid; + int mKey; }; class XQSettingsManager : QObject @@ -54,7 +59,13 @@ public: QVariant readItemValue(XQCentralRepositorySettingsKey &key, int type); - static QVariant mReadItemValueReturnValue; + bool writeItemValue(const XQCentralRepositorySettingsKey& key, const QVariant& value); + + // decrease by one at beginning of every readItemValue -method. If goes below zero method fails + static int mReadItemSucceedCounter; + // decrease by one at beginning of every writeItemValue -method. If goes below zero method fails + static int mWriteItemSucceedCounter; + static QHash mWrittenValueHash; }; #endif // XQSETTINGSMANAGER_H diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/hblistview.cpp --- a/videocollection/tsrc/stubs/src/hblistview.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/src/hblistview.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -32,5 +32,6 @@ bool HbListView::mLatestUniformItemSizes = false; bool HbListView::mLatestVisibility = false; bool HbListView::mLatestEnableValue = false; +QModelIndex HbListView::mLatestScrollToIndex = QModelIndex(); QModelIndex HbListView::mCurrentIndex = QModelIndex(); int HbListView::mAllSelectedStatus = -1; diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/videocollectionviewutils.cpp --- a/videocollection/tsrc/stubs/src/videocollectionviewutils.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videocollectionviewutils.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -121,7 +121,7 @@ Q_UNUSED(key); if(VideoCollectionViewUtilsData::mCenRepIntValues.count() > 0) { - int value = VideoCollectionViewUtilsData::mCenRepIntValues.takeFirst();; + int value = VideoCollectionViewUtilsData::mCenRepIntValues.takeFirst(); if(value != CENREP_NO_INT) { return value; diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/videolistdatamodel.cpp --- a/videocollection/tsrc/stubs/src/videolistdatamodel.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videolistdatamodel.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -25,6 +25,9 @@ int VideoListDataModelData::mDataAccessCount = 0; int VideoListDataModelData::mRowCount = 0; int VideoListDataModelData::mRowCountDecrement = 0; +TMPXItemId VideoListDataModelData::mItemId = TMPXItemId::InvalidId(); + + VideoListDataModel::VideoListDataModel(QObject *parent) : QAbstractItemModel(parent), @@ -85,14 +88,14 @@ // not stubbed } -TMPXItemId VideoListDataModel::mediaIdAtIndex(int index) const +const TMPXItemId& VideoListDataModel::mediaIdAtIndex(const int &index) const { Q_UNUSED(index); // not stubbed - return TMPXItemId(); + return VideoListDataModelData::mItemId; } -QString VideoListDataModel::mediaFilePathForId(TMPXItemId mediaId) const +QString VideoListDataModel::mediaFilePathForId(const TMPXItemId &mediaId) const { Q_UNUSED(mediaId); // not stubbed @@ -124,7 +127,7 @@ return itemData; } -QString VideoListDataModel::prepareDetailRow(int index) const +QString VideoListDataModel::prepareDetailRow(int &index) const { Q_UNUSED(index); @@ -132,7 +135,7 @@ return QString(); } -QString VideoListDataModel::prepareSizeString(int index) const +QString VideoListDataModel::prepareSizeString(int &index) const { Q_UNUSED(index); @@ -194,14 +197,14 @@ return false; } -void VideoListDataModel::setAlbumInUse(TMPXItemId albumId) +void VideoListDataModel::setAlbumInUse(const TMPXItemId &albumId) { Q_UNUSED(albumId); // not stubbed } -void VideoListDataModel::deleteStartingFailsSlot(QList ids) +void VideoListDataModel::deleteStartingFailsSlot(QList& ids) { Q_UNUSED(ids); diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/videooperatorservice.cpp --- a/videocollection/tsrc/stubs/src/videooperatorservice.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videooperatorservice.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -23,6 +23,9 @@ #include "videooperatorservicedata.h" #include "videocollectionviewutils.h" #include "videocollectioncenrepdefs.h" +#define private public +#include "videooperatorservice_p.h" +#undef private QList VideoOperatorServiceData::mTitles; QList VideoOperatorServiceData::mIcons; @@ -33,19 +36,23 @@ int VideoOperatorServiceData::mTitleCallCount = 0; int VideoOperatorServiceData::mIconResourceCallCount = 0; int VideoOperatorServiceData::mLaunchServiceCallCount = 0; -int VideoOperatorServiceData::mLaunchApplicationLCallCount = 0; // --------------------------------------------------------------------------- // Constructor // --------------------------------------------------------------------------- // VideoOperatorService::VideoOperatorService(QObject *parent) : - QObject(parent) + QObject(parent), d_ptr(new VideoOperatorServicePrivate()) { - mTitle = ""; - mIconResource = ""; - mServiceUri = ""; - mApplicationUid = 0; +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoOperatorService::~VideoOperatorService() +{ + delete d_ptr; } // --------------------------------------------------------------------------- @@ -54,30 +61,34 @@ // bool VideoOperatorService::load(int titleKey, int iconKey, int serviceUriKey, int appUidKey) { - VideoOperatorServiceData::mLoadCallCount++; - - if(VideoOperatorServiceData::mTitles.count() > 0) - { - mTitle = VideoOperatorServiceData::mTitles.takeFirst(); - } - if(VideoOperatorServiceData::mIcons.count() > 0) + Q_UNUSED(titleKey); + Q_UNUSED(iconKey); + Q_UNUSED(serviceUriKey); + Q_UNUSED(appUidKey); + if(d_ptr) { - mIconResource = VideoOperatorServiceData::mIcons.takeFirst(); + if(!VideoOperatorServiceData::mTitles.isEmpty()) + { + d_ptr->mTitle = VideoOperatorServiceData::mTitles.takeFirst(); + } + + if(!VideoOperatorServiceData::mUris.isEmpty()) + { + d_ptr->mServiceUri = VideoOperatorServiceData::mUris.takeFirst(); + } + + if(!VideoOperatorServiceData::mIcons.isEmpty()) + { + d_ptr->mIconResource = VideoOperatorServiceData::mIcons.takeFirst(); + } } - if(VideoOperatorServiceData::mUris.count() > 0) - { - mServiceUri = VideoOperatorServiceData::mUris.takeFirst(); - } - if(VideoOperatorServiceData::mUids.count() > 0) - { - mApplicationUid = VideoOperatorServiceData::mUids.takeFirst(); - } + VideoOperatorServiceData::mLoadCallCount++; // Icon is required, either service uri or application uid is required. - if(mIconResource.isEmpty() && (mServiceUri.isEmpty() || mApplicationUid > 0)) + if(d_ptr->mIconResource.isEmpty() || (d_ptr->mServiceUri.isEmpty() && d_ptr->mApplicationUid <= 0)) { return false; - } + } return true; } @@ -88,7 +99,7 @@ const QString VideoOperatorService::title() const { VideoOperatorServiceData::mTitleCallCount++; - return mTitle; + return d_ptr->mTitle; } // --------------------------------------------------------------------------- @@ -98,7 +109,7 @@ const QString VideoOperatorService::iconResource() const { VideoOperatorServiceData::mIconResourceCallCount++; - return mIconResource; + return d_ptr->mIconResource; } // --------------------------------------------------------------------------- @@ -110,15 +121,4 @@ VideoOperatorServiceData::mLaunchServiceCallCount++; } -// --------------------------------------------------------------------------- -// launchApplicationL -// --------------------------------------------------------------------------- -// -void VideoOperatorService::launchApplicationL(const TUid uid, TInt viewId) -{ - Q_UNUSED(uid); - Q_UNUSED(viewId); - VideoOperatorServiceData::mLaunchApplicationLCallCount++; -} - // End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/videooperatorservice_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/tsrc/stubs/src/videooperatorservice_p.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,135 @@ +/* +* 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: VideoOperatorServicePrivate stub class implementation. +* +*/ + +#include "videooperatorservice_p.h" +#include "videooperatorservice_pdata.h" + +bool VideoOperatorServicePrivateData::mLoadReturnValue = true; +QString VideoOperatorServicePrivateData::mTitleReturnValue = QString(); +QString VideoOperatorServicePrivateData::mIconResourceReturnValue = QString(); +int VideoOperatorServicePrivateData::mLaunchServiceCallCount = 0; + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoOperatorServicePrivate::VideoOperatorServicePrivate() +{ +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoOperatorServicePrivate::~VideoOperatorServicePrivate() +{ +} + +// --------------------------------------------------------------------------- +// load +// --------------------------------------------------------------------------- +// +bool VideoOperatorServicePrivate::load(int titleKey, int iconKey, int uriKey, int uidKey) +{ + Q_UNUSED(titleKey); + Q_UNUSED(iconKey); + Q_UNUSED(uriKey); + Q_UNUSED(uidKey); + return VideoOperatorServicePrivateData::mLoadReturnValue; +} + +// --------------------------------------------------------------------------- +// title +// --------------------------------------------------------------------------- +// +const QString VideoOperatorServicePrivate::title() const +{ + return VideoOperatorServicePrivateData::mTitleReturnValue; +} + +// --------------------------------------------------------------------------- +// iconResource +// --------------------------------------------------------------------------- +// +const QString VideoOperatorServicePrivate::iconResource() const +{ + return VideoOperatorServicePrivateData::mIconResourceReturnValue; +} + +// --------------------------------------------------------------------------- +// launchService +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::launchService() +{ + VideoOperatorServicePrivateData::mLaunchServiceCallCount++; +} + +// --------------------------------------------------------------------------- +// getApplicationFilenameL +// --------------------------------------------------------------------------- +// +QString VideoOperatorServicePrivate::getApplicationFilenameL(const TUid uid) +{ + Q_UNUSED(uid); + // Not stubbed. + return QString(); +} + +// --------------------------------------------------------------------------- +// bringApplicationToForeground +// --------------------------------------------------------------------------- +// +bool VideoOperatorServicePrivate::bringApplicationToForeground(const TUid uid) +{ + Q_UNUSED(uid); + // Not stubbed. + return true; +} + +// --------------------------------------------------------------------------- +// startApplicationL +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::startApplicationL(const TUid uid) +{ + Q_UNUSED(uid); + // Not stubbed. +} + +// --------------------------------------------------------------------------- +// processFinished +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::processFinished(int exitCode, QProcess::ExitStatus exitStatus) +{ + Q_UNUSED(exitCode); + Q_UNUSED(exitStatus); + // Not stubbed. +} + +// --------------------------------------------------------------------------- +// processError +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::processError(QProcess::ProcessError error) +{ + Q_UNUSED(error); + // Not stubbed. +} + +// End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/videosortfilterproxymodel.cpp --- a/videocollection/tsrc/stubs/src/videosortfilterproxymodel.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videosortfilterproxymodel.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -43,6 +43,8 @@ int VideoSortFilterProxyModelData::mRenameItemReturnValue = 0; QString VideoSortFilterProxyModelData::mLastAddedAlbumName = ""; +const TMPXItemId INVALID_ID = TMPXItemId::InvalidId(); + VideoSortFilterProxyModel::VideoSortFilterProxyModel(VideoCollectionCommon::TModelType type, QObject *parent): QSortFilterProxyModel(parent), mModel(0), @@ -177,7 +179,7 @@ return true; } -TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex( + const TMPXItemId& VideoSortFilterProxyModel::getMediaIdAtIndex( const QModelIndex &index) const { if (index.row() >= 0 && @@ -185,10 +187,10 @@ { return VideoSortFilterProxyModelData::mItemIds[index.row()]; } - return TMPXItemId::InvalidId(); + return INVALID_ID; } -QModelIndex VideoSortFilterProxyModel::indexOfId(TMPXItemId id) +QModelIndex VideoSortFilterProxyModel::indexOfId(const TMPXItemId &id) { //VideoListDataModel *sourceModel = qobject_cast(sourceModel()); @@ -203,7 +205,7 @@ return QModelIndex(); } -QString VideoSortFilterProxyModel::getMediaFilePathForId(TMPXItemId mediaId) +QString VideoSortFilterProxyModel::getMediaFilePathForId(const TMPXItemId &mediaId) { Q_UNUSED(mediaId); // not stubbed @@ -270,7 +272,7 @@ return VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue; } -void VideoSortFilterProxyModel::setAlbumInUse(TMPXItemId albumId) +void VideoSortFilterProxyModel::setAlbumInUse(const TMPXItemId &albumId) { VideoSortFilterProxyModelData::mLastItemId = albumId; } @@ -291,7 +293,7 @@ return VideoSortFilterProxyModelData::mOpenedItemId; } -void VideoSortFilterProxyModel::setGenericIdFilter(TMPXItemId itemId, bool filterValue) +void VideoSortFilterProxyModel::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue) { VideoSortFilterProxyModelData::mGenericFilterId = itemId; VideoSortFilterProxyModelData::mGenericFilterValue = filterValue; diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/videothumbnaildata.cpp --- a/videocollection/tsrc/stubs/src/videothumbnaildata.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videothumbnaildata.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -42,7 +42,7 @@ // not stubbed } -bool VideoThumbnailData::removeThumbnail(TMPXItemId mediaId) +bool VideoThumbnailData::removeThumbnail(const TMPXItemId &mediaId) { Q_UNUSED(mediaId); @@ -51,7 +51,7 @@ return true; } -const QIcon* VideoThumbnailData::getThumbnail(TMPXItemId mediaId) +const QIcon* VideoThumbnailData::getThumbnail(const TMPXItemId &mediaId) { Q_UNUSED(mediaId); diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/src/xqsettingsmanagerstub.cpp --- a/videocollection/tsrc/stubs/src/xqsettingsmanagerstub.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/src/xqsettingsmanagerstub.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -17,13 +17,30 @@ #include "xqsettingsmanagerstub.h" -QVariant XQSettingsManager::mReadItemValueReturnValue = QVariant(); +int XQSettingsManager::mReadItemSucceedCounter = 0; +int XQSettingsManager::mWriteItemSucceedCounter = 0; +QHash XQSettingsManager::mWrittenValueHash = QHash(); QVariant XQSettingsManager::readItemValue(XQCentralRepositorySettingsKey &key, int type) { - Q_UNUSED(key); Q_UNUSED(type); - return mReadItemValueReturnValue; + mReadItemSucceedCounter--; + if(mReadItemSucceedCounter >= 0) + { + return mWrittenValueHash.value(key.mKey); + } + return QVariant(); +} + +bool XQSettingsManager::writeItemValue(const XQCentralRepositorySettingsKey& key, const QVariant& value) +{ + mWriteItemSucceedCounter--; + if(mWriteItemSucceedCounter >= 0) + { + mWrittenValueHash.insert(key.mKey, value); + return true; + } + return false; } XQSettingsManager::XQSettingsManager() @@ -33,5 +50,4 @@ XQSettingsManager::~XQSettingsManager() { - } diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/tsrc/stubs/stubs.pro --- a/videocollection/tsrc/stubs/stubs.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/tsrc/stubs/stubs.pro Mon Aug 23 14:27:29 2010 +0300 @@ -81,6 +81,7 @@ inc/videoactivitystate.h \ inc/xqserviceutilxtra.h \ inc/videooperatorservicedata.h \ + inc/videooperatorservice_pdata.h \ # We need stub for this because it has static data and HW compilation of moc file fails because of that. inc/videoservices.h \ ../../videocollectionview/inc/videocollectionuiloader.h \ @@ -93,7 +94,8 @@ ../../videocollectionwrapper/inc/videocollectionwrapper.h \ ../../videocollectionwrapper/inc/videosortfilterproxymodel.h \ ../../videocollectionwrapper/inc/videothumbnaildata.h \ - ../../videocollectionview/inc/videooperatorservice.h + ../../videocollectionview/inc/videooperatorservice.h \ + ../../videocollectionview/inc/videooperatorservice_p.h SOURCES_TEMP = \ src/xqserviceprovider.cpp \ @@ -136,6 +138,7 @@ src/videoservicebrowse.cpp \ src/videoactivitystate.cpp \ src/videooperatorservice.cpp \ + src/videooperatorservice_p.cpp \ src/xqsettingsmanagerstub.cpp HEADERS += $$find(HEADERS_TEMP, ^(?!.*$$TESTEDCLASS).*$) diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/inc/videooperatorservice.h --- a/videocollection/videocollectionview/inc/videooperatorservice.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/inc/videooperatorservice.h Mon Aug 23 14:27:29 2010 +0300 @@ -21,15 +21,17 @@ #include -class HbPushButton; +class VideoOperatorServicePrivate; /** - * Loading and launching functionality for operator customisable services. + * Public functionality for loading and launching operator customisable services. */ class VideoOperatorService : public QObject { Q_OBJECT + Q_DISABLE_COPY(VideoOperatorService) + public: /** @@ -40,6 +42,12 @@ VideoOperatorService(QObject *parent = 0); /** + * Destructor. + * + */ + ~VideoOperatorService(); + + /** * Loads the service. * * @titleKey Central Repository key id for the service's title. @@ -65,10 +73,6 @@ */ const QString iconResource() const; -private: - - void launchApplicationL(const TUid uid, TInt viewId); - public slots: /** @@ -78,27 +82,11 @@ private: - Q_DISABLE_COPY(VideoOperatorService) - /** - * Title for the service. - */ - QString mTitle; - - /** - * Icon for the service. + * Pointer to private implementation. */ - QString mIconResource; - - /** - * Service URL if service should launch an URL. - */ - QString mServiceUri; - - /** - * Application UID if service should launch an external application. - */ - int mApplicationUid; + VideoOperatorServicePrivate *d_ptr; + }; #endif // VIDEOOPERATORSERVICE_H diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/inc/videooperatorservice_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/inc/videooperatorservice_p.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,152 @@ +/* +* 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: VideoOperatorServicePrivate class declaration. +* +*/ + +#ifndef VIDEOOPERATORSERVICEPRIVATE_H +#define VIDEOOPERATORSERVICEPRIVATE_H + +// INCLUDE FILES +#include +#include +#include + +class VideoOperatorService; + +/** + * Private functionality for loading and launching operator customisable services. + */ +class VideoOperatorServicePrivate : public QObject +{ + Q_OBJECT + + Q_DISABLE_COPY(VideoOperatorServicePrivate) + +public: + + /** + * Contructor. + * + * @param ptr pointer to public implementation + */ + VideoOperatorServicePrivate(); + + /** + * Destructor. + * + */ + ~VideoOperatorServicePrivate(); + + /** + * Loads the service. + * + * @titleKey Central Repository key id for the service's title. + * @iconKey Central Repository key id for the service's icon resource. + * @uriKey Central Repository key id for the service's URI. + * @uidKey Central Repository key id for the service's UID. + * + * @return True if service was loaded succesfully. + */ + bool load(int titleKey, int iconKey, int uriKey, int uidKey); + + /** + * Returns name for the service. + * + * @return name of the service. + */ + const QString title() const; + + /** + * Returns the icon resource for the service. + * + * @return path or resource id to the icon. + */ + const QString iconResource() const; + + /** + * Launches the service. + */ + void launchService(); + +private: + + /** + * Gets filename including path. + * + * @param TUid application UID. + * + * @return string application full filename. + */ + QString getApplicationFilenameL(const TUid uid); + + /** + * Bring application to foreground. + * + * @param TUid application UID. + * + * @return bool true if application was brought to foreground, else false. + */ + bool bringApplicationToForeground(const TUid uid); + + /** + * Starts the application. + * + * @param TUid application UID. + */ + void startApplicationL(const TUid uid); + +public slots: + + /** + * Signaled when process has finished. Brings videos application back to foreground. + */ + void processFinished(int exitCode, QProcess::ExitStatus exitStatus); + + /** + * Signaled if there's error with the process. + */ + void processError(QProcess::ProcessError error); + +private: + + /** + * Title for the service. + */ + QString mTitle; + + /** + * Icon for the service. + */ + QString mIconResource; + + /** + * Service URL if service should launch an URL. + */ + QString mServiceUri; + + /** + * Application UID if service should launch an external application. + */ + int mApplicationUid; + + /** + * Pointer to started process. + */ + QProcess *mProcess; +}; + +#endif // VIDEOOPERATORSERVICEPRIVATE_H + +// End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/src/videocollectionviewutils.cpp --- a/videocollection/videocollectionview/src/videocollectionviewutils.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/src/videocollectionviewutils.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 45 % +// Version : %version: 47 % // INCLUDE FILES #include @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "videocollectioncommon.h" @@ -101,9 +100,6 @@ int status = -1; if (target != VideoCollectionCommon::ELevelInvalid) { - CRepository *cenRep = 0; - TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid))); - int *rolePtr = &mVideosSortRole; Qt::SortOrder *orderPtr = &mVideosSortOrder; @@ -118,19 +114,23 @@ roleKey = KVideoCollectionViewCenrepCollectionsSortingRoleKey; orderKey = KVideoCollectionViewCenrepCollectionsSortingOrderKey; } - - if(cenRep) - { - status = cenRep->Set(roleKey, static_cast(role)); - if(status == KErrNone) - { - status = cenRep->Set(orderKey, static_cast(order)); - } - delete cenRep; - } - + XQSettingsManager mgr; + XQCentralRepositorySettingsKey crRoleKey(KVideoCollectionViewCenrepUid, roleKey); + XQCentralRepositorySettingsKey crOrderKey(KVideoCollectionViewCenrepUid, orderKey); + QVariant value; + value = role; + if(!mgr.writeItemValue(crRoleKey, value)) + { + return -1; + } + value = order; + if(!mgr.writeItemValue(crOrderKey, value)) + { + return -1; + } *rolePtr = role; *orderPtr = order; + status = 0; } return status; } @@ -142,7 +142,6 @@ int VideoCollectionViewUtils::loadSortingValues(int &role, Qt::SortOrder &order, VideoCollectionCommon::TCollectionLevels target) { FUNC_LOG; - int err(0); if ((target > VideoCollectionCommon::ELevelCategory) && (mVideosSortRole != -1)) @@ -158,11 +157,12 @@ } else if (target != VideoCollectionCommon::ELevelInvalid) { - int *rolePtr = &mVideosSortRole; - Qt::SortOrder *orderPtr = &mVideosSortOrder; - int roleKey(KVideoCollectionViewCenrepVideoSortingRoleKey); - int orderKey(KVideoCollectionViewCenrepVideoSortingOrderKey); - + int roleKey(KVideoCollectionViewCenrepVideoSortingRoleKey); + int orderKey(KVideoCollectionViewCenrepVideoSortingOrderKey); + + int *rolePtr = &mVideosSortRole; + Qt::SortOrder *orderPtr = &mVideosSortOrder; + if(target == VideoCollectionCommon::ELevelCategory) { roleKey = KVideoCollectionViewCenrepCollectionsSortingRoleKey; @@ -171,30 +171,22 @@ orderPtr = &mCollectionsSortOrder; } - CRepository *cenRep = 0; - TRAP(err, cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid))); - if(cenRep) - { - int sortRole(-1); - int sortOrder(-1); - err = cenRep->Get(roleKey, sortRole); - if(err == KErrNone) - { - err = cenRep->Get(orderKey, sortOrder); - if(err == KErrNone) - { - *orderPtr = static_cast(sortOrder); - *rolePtr = sortRole; - } - } - delete cenRep; - } + *rolePtr = getCenRepIntValue(roleKey); + int orderValue = getCenRepIntValue(orderKey); + if(*rolePtr < 0 || (orderValue < Qt::AscendingOrder || orderValue > Qt::DescendingOrder)) + { + *rolePtr = -1; + return -1; + } + orderValue == Qt::AscendingOrder ? + *orderPtr = Qt::AscendingOrder : *orderPtr = Qt::DescendingOrder; + role = *rolePtr; order = *orderPtr; } INFO_3("VideoCollectionViewUtils::loadSortingValues() loaded: role: %d, order: %d, target: %d", role, order, target); - return err; + return 0; } // --------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/src/videolistselectiondialog.cpp --- a/videocollection/videocollectionview/src/videolistselectiondialog.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistselectiondialog.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 30.1.2 % +// Version : %version: 30.1.3 % // INCLUDE FILES #include @@ -353,19 +353,16 @@ connectSignals(); - if(mModel->rowCount()) + if(mTypeOfSelection == ECreateCollection) { - if(mTypeOfSelection == ECreateCollection) - { - // note this does not leak memory as the dialog will destroy itself upon close. - HbInputDialog *dialog = gCreateNewAlbumNameDialog(LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION); - dialog->open(this, SLOT(newAlbumNameDialogFinished(HbAction *))); - } - else - { - // show dialog - HbDialog::open(); - } + // note this does not leak memory as the dialog will destroy itself upon close. + HbInputDialog *dialog = gCreateNewAlbumNameDialog(LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION); + dialog->open(this, SLOT(newAlbumNameDialogFinished(HbAction *))); + } + else if(mModel->rowCount()) + { + // show dialog + HbDialog::open(); } else if((mModelReady && mTypeOfSelection != ESelectCollection) || (mAlbumListReady && mTypeOfSelection == ESelectCollection)) @@ -430,7 +427,7 @@ QString text = mModel->resolveAlbumName(variant.toString()); if(!text.isEmpty()) { - if(mSelectedVideos.count() == 0) + if(mSelectedVideos.count() == 0 && mModel->rowCount()) { mNewAlbumText = text; // show video selection dialog diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/src/videolistview.cpp --- a/videocollection/videocollectionview/src/videolistview.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistview.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -1306,7 +1306,19 @@ showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS); showAction(false, DOCML_NAME_SORT_BY_SIZE); showAction(false, DOCML_NAME_SORT_MENU); + + HbAction *firstAction = (HbAction*)(toolBar()->actions().first()); + + bool isCollectionsView = mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] && + firstAction == mToolbarActions[ETBActionAllVideos]; + // Create collection action is shown even when there's no videos. + if(isCollectionsView && !mVideoServices) + { + showAction(true, DOCML_NAME_CREATE_COLLECTION); + } + + // No other actions shown if there's no videos. VideoSortFilterProxyModel *model = mCurrentList->getModel(); if (!model || !model->rowCount()) { @@ -1318,13 +1330,10 @@ Qt::SortOrder order; model->getSorting(role, order); - HbAction *firstAction = (HbAction*)(toolBar()->actions().first()); - if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionAllVideos] && firstAction == mToolbarActions[ETBActionAllVideos]) { showAction(true, DOCML_NAME_SORT_MENU); - showAction(true, DOCML_NAME_SORT_BY_DATE); showAction(true, DOCML_NAME_SORT_BY_NAME); showAction(true, DOCML_NAME_SORT_BY_SIZE); @@ -1341,13 +1350,8 @@ showAction(true, DOCML_NAME_DELETE_MULTIPLE); } } - else if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] && - firstAction == mToolbarActions[ETBActionAllVideos] ) + else if(isCollectionsView) { - if (!mVideoServices) - { - showAction(true, DOCML_NAME_CREATE_COLLECTION); - } showAction(true, DOCML_NAME_SORT_MENU); showAction(true, DOCML_NAME_SORT_BY_NAME); showAction(true, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS); diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/src/videolistwidget.cpp --- a/videocollection/videocollectionview/src/videolistwidget.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistwidget.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -255,9 +255,12 @@ !connect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot())) || !connect(this, SIGNAL(scrollPositionChanged(const QPointF &)), this, SLOT(scrollPositionChangedSlot(const QPointF &))) || - !connect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollPositionTimerSlot())) || + !connect(mScrollPositionTimer, SIGNAL(timeout()), + this, SLOT(scrollPositionTimerSlot())) || !connect(this, SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)), - this, SLOT(longPressedSlot(HbAbstractViewItem *, const QPointF &)))) + this, SLOT(longPressedSlot(HbAbstractViewItem *, const QPointF &))) || + !connect(mModel, SIGNAL(modelSorted()), this, + SLOT(fetchThumbnailsForVisibleItems()), Qt::QueuedConnection)) { return -1; } @@ -314,6 +317,8 @@ this, SLOT(scrollPositionChangedSlot(const QPointF&))); disconnect(this, SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)), this, SLOT(longPressedSlot(HbAbstractViewItem *, const QPointF &))); + disconnect(mModel, SIGNAL(modelSorted()), + this, SLOT(fetchThumbnailsForVisibleItems())); // check that scroll position timer is created if (mScrollPositionTimer) @@ -430,7 +435,7 @@ if (mService == VideoServices::EUriFetcher) { mContextMenuActions[EActionAttach] = - mContextMenu->addAction(hbTrId("txt_videos_menu_attach"), this, SLOT(openItemSlot())); + mContextMenu->addAction(hbTrId("txt_common_menu_select"), this, SLOT(openItemSlot())); mContextMenuActions[EActionAttach]->setObjectName(LIST_WIDGET_OBJECT_NAME_ACTION_ATTACH); mContextMenuActions[EActionOpen] = diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/src/videooperatorservice.cpp --- a/videocollection/videocollectionview/src/videooperatorservice.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/src/videooperatorservice.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -19,17 +19,8 @@ // INCLUDE FILES -#include -#include - -#include -#include -#include -#include - #include "videooperatorservice.h" -#include "videocollectionviewutils.h" -#include "videocollectioncenrepdefs.h" +#include "videooperatorservice_p.h" #include "videocollectiontrace.h" // --------------------------------------------------------------------------- @@ -37,11 +28,22 @@ // --------------------------------------------------------------------------- // VideoOperatorService::VideoOperatorService(QObject *parent) : - QObject(parent) + QObject(parent), d_ptr( new VideoOperatorServicePrivate() ) { FUNC_LOG; } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoOperatorService::~VideoOperatorService() +{ + FUNC_LOG; + delete d_ptr; +} + // --------------------------------------------------------------------------- // load // --------------------------------------------------------------------------- @@ -49,20 +51,7 @@ bool VideoOperatorService::load(int titleKey, int iconKey, int serviceUriKey, int appUidKey) { FUNC_LOG; - VideoCollectionViewUtils& utils = VideoCollectionViewUtils::instance(); - - mTitle = utils.getCenRepStringValue(titleKey); - mIconResource = utils.getCenRepStringValue(iconKey); - mServiceUri = utils.getCenRepStringValue(serviceUriKey); - mApplicationUid = utils.getCenRepIntValue(appUidKey); - - // Icon is required, either service uri or application uid is required. - if(mIconResource.isEmpty() || (mServiceUri.isEmpty() && mApplicationUid <= 0)) - { - return false; - } - - return true; + return d_ptr->load(titleKey, iconKey, serviceUriKey, appUidKey); } // --------------------------------------------------------------------------- @@ -71,7 +60,7 @@ // const QString VideoOperatorService::title() const { - return mTitle; + return d_ptr->title(); } // --------------------------------------------------------------------------- @@ -80,7 +69,7 @@ // const QString VideoOperatorService::iconResource() const { - return mIconResource; + return d_ptr->iconResource(); } // --------------------------------------------------------------------------- @@ -90,69 +79,7 @@ void VideoOperatorService::launchService() { FUNC_LOG; - - if(!mServiceUri.isEmpty()) - { - INFOQSTR_1("VideoOperatorService::launchService() starting url: %S", mServiceUri); - QDesktopServices::openUrl(QUrl(mServiceUri)); - } - else - { - INFO_1("VideoOperatorService::launchService() starting application 0x%x", mApplicationUid); - TRAP_IGNORE(launchApplicationL(TUid::Uid(mApplicationUid), 0)); - } -} - -// --------------------------------------------------------------------------- -// launchApplicationL -// --------------------------------------------------------------------------- -// -void VideoOperatorService::launchApplicationL(const TUid uid, TInt viewId) -{ - CEikonEnv *eikEnv = CEikonEnv::Static(); - - if (viewId > 0 && eikEnv) { - TVwsViewId view(uid, TUid::Uid(viewId)); - eikEnv->EikAppUi()->ActivateViewL(view); - } else - { - RWsSession wsSession; - User::LeaveIfError(wsSession.Connect()); - CleanupClosePushL(wsSession); - - // TApaAppInfo size is greater then 1024 bytes - // so its instances should not be created on the stack. - TApaAppInfo* appInfo = new (ELeave) TApaAppInfo; - CleanupStack::PushL(appInfo); - TApaAppCapabilityBuf capabilityBuf; - RApaLsSession appArcSession; - User::LeaveIfError(appArcSession.Connect()); - CleanupClosePushL(appArcSession); - - User::LeaveIfError(appArcSession.GetAppInfo(*appInfo, uid)); - User::LeaveIfError(appArcSession.GetAppCapability( - capabilityBuf, uid)); - - TApaAppCapability &caps = capabilityBuf(); - CApaCommandLine *cmdLine = CApaCommandLine::NewLC(); - cmdLine->SetExecutableNameL(appInfo->iFullName); - - if (caps.iLaunchInBackground) { - cmdLine->SetCommandL(EApaCommandBackground); - } else { - cmdLine->SetCommandL(EApaCommandRun); - } - - cmdLine->SetTailEndL(KNullDesC8); - - User::LeaveIfError(appArcSession.StartApp(*cmdLine)); - - CleanupStack::PopAndDestroy(cmdLine); - CleanupStack::PopAndDestroy(&appArcSession); - CleanupStack::PopAndDestroy(appInfo); - - CleanupStack::PopAndDestroy(&wsSession); - } + d_ptr->launchService(); } // End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/src/videooperatorservice_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/src/videooperatorservice_p.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,245 @@ +/* +* 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: VideoOperatorServicePrivate class implementation. +* +*/ + +// Version : + +// INCLUDE FILES +#include "videooperatorservice_p.h" +#include "videocollectionviewutils.h" +#include "videocollectioncenrepdefs.h" +#include "videocollectiontrace.h" + +#include +#include +#include +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoOperatorServicePrivate::VideoOperatorServicePrivate() : + mProcess(0) +{ + +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoOperatorServicePrivate::~VideoOperatorServicePrivate() +{ + if(mProcess) + { + disconnect(mProcess, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(processFinished(int, QProcess::ExitStatus))); + + disconnect(mProcess, SIGNAL(error(QProcess::ProcessError)), + this, SLOT(processError(QProcess::ProcessError))); + mProcess->close(); + } + delete mProcess; +} + +// --------------------------------------------------------------------------- +// load +// --------------------------------------------------------------------------- +// +bool VideoOperatorServicePrivate::load(int titleKey, int iconKey, int serviceUriKey, int appUidKey) +{ + FUNC_LOG; + VideoCollectionViewUtils& utils = VideoCollectionViewUtils::instance(); + + mTitle = utils.getCenRepStringValue(titleKey); + mIconResource = utils.getCenRepStringValue(iconKey); + mServiceUri = utils.getCenRepStringValue(serviceUriKey); + mApplicationUid = utils.getCenRepIntValue(appUidKey); + + // Icon is required, either service uri or application uid is required. + if(mIconResource.isEmpty() || (mServiceUri.isEmpty() && mApplicationUid <= 0)) + { + return false; + } + + return true; +} + +// --------------------------------------------------------------------------- +// title +// --------------------------------------------------------------------------- +// +const QString VideoOperatorServicePrivate::title() const +{ + return mTitle; +} + +// --------------------------------------------------------------------------- +// iconResource +// --------------------------------------------------------------------------- +// +const QString VideoOperatorServicePrivate::iconResource() const +{ + return mIconResource; +} + +// --------------------------------------------------------------------------- +// launchService +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::launchService() +{ + FUNC_LOG; + + if(!mServiceUri.isEmpty()) + { + INFOQSTR_1("VideoOperatorServicePrivate::launchService() starting url: %S", mServiceUri); + QDesktopServices::openUrl(QUrl(mServiceUri)); + } + else + { + INFO_1("VideoOperatorServicePrivate::launchService() starting application 0x%x", mApplicationUid); + TRAPD(err, startApplicationL(TUid::Uid(mApplicationUid))); + if(err) + { + INFO_1("VideoOperatorServicePrivate::launchService() failed to start, error: %d", err); + } + } +} + +// --------------------------------------------------------------------------- +// getApplicationFilenameL +// --------------------------------------------------------------------------- +// +QString VideoOperatorServicePrivate::getApplicationFilenameL(const TUid uid) +{ + FUNC_LOG; + + // TApaAppInfo size is greater then 1024 bytes + // so its instances should not be created on the stack. + TApaAppInfo* appInfo = new (ELeave) TApaAppInfo; + CleanupStack::PushL(appInfo); + RApaLsSession appArcSession; + User::LeaveIfError(appArcSession.Connect()); + CleanupClosePushL(appArcSession); + + User::LeaveIfError(appArcSession.GetAppInfo(*appInfo, uid)); + + QString fullName((QChar*)appInfo->iFullName.Ptr(), appInfo->iFullName.Length()); + + CleanupStack::PopAndDestroy(&appArcSession); + CleanupStack::PopAndDestroy(appInfo); + + return fullName; +} + +// --------------------------------------------------------------------------- +// bringApplicationToForeground +// --------------------------------------------------------------------------- +// +bool VideoOperatorServicePrivate::bringApplicationToForeground(const TUid uid) +{ + FUNC_LOG; + + CCoeEnv* coe = CCoeEnv::Static(); + bool ret = false; + if(coe) + { + TApaTaskList taskList(coe->WsSession()); + TApaTask task(taskList.FindApp(uid)); + + if(task.Exists()) + { + INFO("VideoOperatorServicePrivate::processFinished() task found."); + task.BringToForeground(); + ret = true; + } + } + return ret; +} + +// --------------------------------------------------------------------------- +// startApplicationL +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::startApplicationL(const TUid uid) +{ + FUNC_LOG; + + // Process handle already exists, try to bring app to foreground. + if(mProcess) + { + if(bringApplicationToForeground(uid)) + { + // App brought to foreground, all done. + return; + } + // Application is not running, cleanup previous process. + disconnect(mProcess, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(processFinished(int, QProcess::ExitStatus))); + + disconnect(mProcess, SIGNAL(error(QProcess::ProcessError)), + this, SLOT(processError(QProcess::ProcessError))); + + delete mProcess; + mProcess = 0; + } + + // Create new process and start it. + mProcess = new QProcess(); + + if(!connect(mProcess, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(processFinished(int, QProcess::ExitStatus)), Qt::UniqueConnection) || + !connect(mProcess, SIGNAL(error(QProcess::ProcessError)), + this, SLOT(processError(QProcess::ProcessError)), Qt::UniqueConnection)) + { + INFO("VideoOperatorServicePrivate::startApplicationL() failed to connect signals"); + User::Leave(KErrGeneral); + } + + QString appName = getApplicationFilenameL(uid); + if(!appName.isEmpty()) + { + mProcess->start(appName); + } +} + +// --------------------------------------------------------------------------- +// processFinished +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::processFinished(int exitCode, QProcess::ExitStatus exitStatus) +{ + Q_UNUSED(exitCode); + Q_UNUSED(exitStatus); + INFO_2("VideoOperatorServicePrivate::processFinished() code: %d, status: %d", exitCode, exitStatus); +} + +// --------------------------------------------------------------------------- +// processError +// --------------------------------------------------------------------------- +// +void VideoOperatorServicePrivate::processError(QProcess::ProcessError error) +{ + Q_UNUSED(error); + INFO_1("VideoOperatorServicePrivate::processError() error: %d", error); +} + +// End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testcollectionview/inc/testcollectionview.h --- a/videocollection/videocollectionview/tsrc/testcollectionview/inc/testcollectionview.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testcollectionview/inc/testcollectionview.h Mon Aug 23 14:27:29 2010 +0300 @@ -30,8 +30,6 @@ Q_OBJECT public: - - // test functions for the test framework private slots: @@ -61,10 +59,10 @@ void testActivateView(); void testDeactivateView(); void testDestroyView(); - void testGetView(); void testBack(); void testOrientationChange(); void testTimerEvent(); + void testGetView(); signals: diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp --- a/videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -304,25 +304,6 @@ } // --------------------------------------------------------------------------- -// testGetView -// --------------------------------------------------------------------------- -// -void TestCollectionView::testGetView() -{ - QVERIFY( mTestView->getView() == mTestView->mView ); - mTestView->createView(); - QVERIFY( mTestView->getView() == mTestView->mView ); - mTestView->activateView(); - QVERIFY( mTestView->getView() == mTestView->mView ); - mTestView->deactivateView(); - QVERIFY( mTestView->getView() == mTestView->mView ); - mTestView->destroyView(); - QVERIFY( mTestView->getView() == 0 ); - // need to create view to handle cleaning up correctly - mTestView->createView(); -} - -// --------------------------------------------------------------------------- // testBack // --------------------------------------------------------------------------- // @@ -369,7 +350,26 @@ } - +// --------------------------------------------------------------------------- +// testGetView +// --------------------------------------------------------------------------- +// +void TestCollectionView::testGetView() +{ + QVERIFY( mTestView->getView() == mTestView->mView ); + mTestView->createView(); + QVERIFY( mTestView->getView() == mTestView->mView ); + mTestView->activateView(); + QVERIFY( mTestView->getView() == mTestView->mView ); + mTestView->deactivateView(); + QVERIFY( mTestView->getView() == mTestView->mView ); + mTestView->destroyView(); + QVERIFY( mTestView->getView() == 0 ); + // need to create view to handle cleaning up correctly + mTestView->createView(); + HbMainWindow *window = hbInstance->allMainWindows().value(0); + window->removeView(mTestView->mView); +} // End of file diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h --- a/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Mon Aug 23 14:27:29 2010 +0300 @@ -100,9 +100,14 @@ void testBack(); /** - * Tests modelReadySlot. - */ - void testModelReadySlot(); + * Tests modelReadySlot. + */ + void testModelReadySlot(); + + /** + * Tests albumListReadySlot(); + */ + void testAlbumListReadySlot(); /** * Tests deleteItemsSlot. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp --- a/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 51 % +// Version : %version: 54 % #define private public #include "videoservices.h" @@ -116,6 +116,8 @@ QVERIFY(mTestView); if(initTestView) { + VideoOperatorServiceData::mIcons.clear(); + VideoOperatorServiceData::mUris.clear(); VideoOperatorServiceData::mIcons.append("qtg_mono_ovistore"); VideoOperatorServiceData::mUris.append("testuri"); QVERIFY(mTestView->initializeView() == 0); @@ -968,12 +970,59 @@ mTestView->mViewReady = false; connect( this, SIGNAL(testSignal()), mTestView, SLOT(modelReadySlot()) ); QSignalSpy spy(mTestView, SIGNAL(viewReady())); + + // test where level is ELevelCategory + mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelCategory); + emit testSignal(); + QVERIFY(mTestView->mModelReady == false); + QVERIFY(mTestView->mViewReady == false); + QCOMPARE(spy.count(), 0); + spy.clear(); + + // test where level is ELevelVideos + mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelVideos); emit testSignal(); QVERIFY(mTestView->mModelReady); QVERIFY(mTestView->mViewReady); QCOMPARE(spy.count(), 1); spy.clear(); + // test that view ready is not emitted second time. + emit testSignal(); + QCOMPARE(spy.count(), 0); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testAlbumListReadySlot +// --------------------------------------------------------------------------- +// +void TestListView::testAlbumListReadySlot() +{ + init(); + mTestView->mModelReady = false; + mTestView->mViewReady = false; + connect( this, SIGNAL(testSignal()), mTestView, SLOT(albumListReadySlot()) ); + QSignalSpy spy(mTestView, SIGNAL(viewReady())); + + // test where level is ELevelVideos + mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelVideos); + emit testSignal(); + QVERIFY(mTestView->mModelReady == false); + QVERIFY(mTestView->mViewReady == false); + QCOMPARE(spy.count(), 0); + spy.clear(); + + // test where level is ELevelCategory + mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelCategory); + emit testSignal(); + QVERIFY(mTestView->mModelReady); + QVERIFY(mTestView->mViewReady); + QCOMPARE(spy.count(), 1); + spy.clear(); + + // test that view ready is not emitted second time. emit testSignal(); QCOMPARE(spy.count(), 0); @@ -1076,16 +1125,44 @@ QCOMPARE(visible, 4); cleanup(); - // Model has no items. + // All videos is active and model has no items. init(); connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot())); mTestView->activateView(invalidId); setRowCount(0); + action = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos]; + QVERIFY(action != 0); + action->setChecked(false); + action->trigger(); emit testSignal(); visible = visibleMenuActions(); QCOMPARE(visible, 0); cleanup(); + // Collections is active and model has no items. + init(); + connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot())); + mTestView->activateView(invalidId); + setRowCount(0); + action = mTestView->mToolbarActions[VideoListView::ETBActionCollections]; + QVERIFY(action != 0); + action->setChecked(false); + action->trigger(); + emit testSignal(); + visible = visibleMenuActions(); + QCOMPARE(visible, 1); + cleanup(); + + // Album is open and model has no items. + init(); + connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot())); + mTestView->activateView(invalidId); + setRowCount(0); + emit testSignal(); + visible = visibleMenuActions(); + QCOMPARE(visible, 0); + cleanup(); + // Toolbar action group is null init(); connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot())); diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp --- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -17,9 +17,9 @@ #include #include +#include #include "xqsettingsmanagerstub.h" #include -#include "centralrepository.h" #include "testvideocollectionviewutils.h" #include "hblabel.h" #include "hbaction.h" @@ -87,7 +87,7 @@ // void TestVideoVideoCollectionViewUtils::init() { - + XQSettingsManager::mReadItemSucceedCounter = 99999; } // --------------------------------------------------------------------------- @@ -96,7 +96,7 @@ // void TestVideoVideoCollectionViewUtils::cleanup() { - + XQSettingsManager::mWrittenValueHash.clear(); } // --------------------------------------------------------------------------- @@ -321,56 +321,60 @@ void TestVideoVideoCollectionViewUtils::testSaveSortingValues() { VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); - CRepository::setNewLLeave(true); int sortRole = VideoCollectionCommon::KeyDateTime; Qt::SortOrder sortOrder = Qt::AscendingOrder; VideoCollectionCommon::TCollectionLevels target = VideoCollectionCommon::ELevelInvalid; - CRepository::mSortValues.clear(); + XQSettingsManager::mWrittenValueHash.clear(); // target invalid QVERIFY(testObject.saveSortingValues(sortRole, sortOrder, target) < 0); + QVERIFY(XQSettingsManager::mWrittenValueHash.count() == 0); // target == VideoCollectionCommon::ELevelCategory target = VideoCollectionCommon::ELevelCategory; - // cenrep creation fails - CRepository::setNewLLeave(true); + // first writing fails + XQSettingsManager::mWriteItemSucceedCounter = 0; QVERIFY(testObject.saveSortingValues(sortRole, sortOrder, target) < 0); - QCOMPARE(CRepository::mSortValues.count(), 0); + QVERIFY(XQSettingsManager::mWrittenValueHash.count() == 0); - // set fails - CRepository::setNewLLeave(false); - CRepository::setSetFail(0); + // second writing fails (writing of sortrole has succeed) + XQSettingsManager::mWriteItemSucceedCounter = 1; QVERIFY(testObject.saveSortingValues(sortRole, sortOrder, target) < 0); - QCOMPARE(CRepository::mSortValues.count(), 0); - CRepository::setSetFail(2); + QVERIFY(XQSettingsManager::mWrittenValueHash.count() == 1); + QVERIFY(XQSettingsManager::mWrittenValueHash.value(KCollectionsSortingRoleKey).toInt() == sortRole); + XQSettingsManager::mWrittenValueHash.clear(); + // succeed + XQSettingsManager::mWriteItemSucceedCounter = 2; QVERIFY(testObject.saveSortingValues(sortRole, sortOrder, target) == 0); - QCOMPARE(CRepository::mSortValues.count(), 2); - QVERIFY(CRepository::mSortValues.values().contains(sortRole)); - QVERIFY(CRepository::mSortValues.values().contains(sortOrder)); + QVERIFY(XQSettingsManager::mWrittenValueHash.count() == 2); + QVERIFY(XQSettingsManager::mWrittenValueHash.value(KCollectionsSortingRoleKey).toInt() == sortRole); + QVERIFY(XQSettingsManager::mWrittenValueHash.value(KVideoSortingOrderKey).toInt() == Qt::AscendingOrder); // target != VideoCollectionCommon::ELevelCategory - CRepository::mSortValues.clear(); + XQSettingsManager::mWrittenValueHash.clear(); target = VideoCollectionCommon::ELevelVideos; - // cenrep creation fails - CRepository::setNewLLeave(true); + // writing fails + XQSettingsManager::mWriteItemSucceedCounter = 0; QVERIFY(testObject.saveSortingValues(sortRole, sortOrder, target) < 0); - QCOMPARE(CRepository::mSortValues.count(), 0); + QVERIFY(XQSettingsManager::mWrittenValueHash.count() == 0); - // set fails - CRepository::setNewLLeave(false); - CRepository::setSetFail(0); + // second writing fails (writing of sortrole has succeed) + XQSettingsManager::mWriteItemSucceedCounter = 1; QVERIFY(testObject.saveSortingValues(sortRole, sortOrder, target) < 0); - QCOMPARE(CRepository::mSortValues.count(), 0); - CRepository::setSetFail(2); + QVERIFY(XQSettingsManager::mWrittenValueHash.count() == 1); + QVERIFY(XQSettingsManager::mWrittenValueHash.value(KVideoSortingRoleKey).toInt() == sortRole); + + XQSettingsManager::mWrittenValueHash.clear(); // succeed + XQSettingsManager::mWriteItemSucceedCounter = 2; QVERIFY(testObject.saveSortingValues(sortRole, sortOrder, target) == 0); - QCOMPARE(CRepository::mSortValues.count(), 2); - QVERIFY(CRepository::mSortValues.values().contains(sortRole)); - QVERIFY(CRepository::mSortValues.values().contains(sortOrder)); + QVERIFY(XQSettingsManager::mWrittenValueHash.count() == 2); + QVERIFY(XQSettingsManager::mWrittenValueHash.value(KVideoSortingRoleKey).toInt() == sortRole); + QVERIFY(XQSettingsManager::mWrittenValueHash.value(KVideoSortingOrderKey).toInt() == Qt::AscendingOrder); } // ----------------------------------------------------------------------------- @@ -379,12 +383,11 @@ // void TestVideoVideoCollectionViewUtils::testLoadSortingValues() { - CRepository::setSetFail(255); - CRepository::mSortValues[KVideoSortingRoleKey] = VideoCollectionCommon::KeyDateTime; - CRepository::mSortValues[KVideoSortingOrderKey] = Qt::DescendingOrder; - CRepository::mSortValues[KCollectionsSortingRoleKey] = VideoCollectionCommon::KeyTitle; - CRepository::mSortValues[KCollectionsSortingOrderKey] = Qt::DescendingOrder; + XQSettingsManager::mWrittenValueHash.insert(KVideoSortingRoleKey, VideoCollectionCommon::KeyDateTime); + XQSettingsManager::mWrittenValueHash.insert(KVideoSortingOrderKey, Qt::DescendingOrder); + XQSettingsManager::mWrittenValueHash.insert(KCollectionsSortingRoleKey, VideoCollectionCommon::KeyTitle); + XQSettingsManager::mWrittenValueHash.insert(KCollectionsSortingOrderKey, Qt::DescendingOrder); VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); @@ -409,8 +412,8 @@ // target is VideoCollectionCommon::ELevelCategory target = VideoCollectionCommon::ELevelCategory; - // cerep creation fails - CRepository::setNewLLeave(true); + // first read fails + XQSettingsManager::mReadItemSucceedCounter = 0; QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) < 0); QVERIFY(testObject.mVideosSortRole == -1); QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder); @@ -418,10 +421,10 @@ QVERIFY(testObject.mCollectionsSortOrder == Qt::AscendingOrder); QVERIFY(sortRole == -1); QVERIFY(sortOrder == Qt::AscendingOrder); - CRepository::setNewLLeave(false); + - // getting from cenrep fails from first - CRepository::setGetFail(0); + // second read fails + XQSettingsManager::mReadItemSucceedCounter = 1; QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) < 0); QVERIFY(testObject.mVideosSortRole == -1); QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder); @@ -430,18 +433,9 @@ QVERIFY(sortRole == -1); QVERIFY(sortOrder == Qt::AscendingOrder); - // getiing from cenrep fails from the second - CRepository::setGetFail(1); - QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) < 0); - QVERIFY(testObject.mVideosSortRole == -1); - QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder); - QVERIFY(testObject.mCollectionsSortRole == -1); - QVERIFY(testObject.mCollectionsSortOrder == Qt::AscendingOrder); - QVERIFY(sortRole == -1); - QVERIFY(sortOrder == Qt::AscendingOrder); - CRepository::setGetFail(2); // succeeds + XQSettingsManager::mReadItemSucceedCounter = 2; QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) == 0); QVERIFY(testObject.mVideosSortRole == -1); QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder); @@ -465,20 +459,9 @@ // target is different than VideoCollectionCommon::ELevelCategory target = VideoCollectionCommon::ELevelVideos; - - // cerep creation fails - CRepository::setNewLLeave(true); - QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) < 0); - QVERIFY(testObject.mVideosSortRole == -1); - QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder); - QVERIFY(testObject.mCollectionsSortRole == VideoCollectionCommon::KeyTitle); - QVERIFY(testObject.mCollectionsSortOrder == Qt::DescendingOrder); - QVERIFY(sortRole == -1); - QVERIFY(sortOrder == Qt::AscendingOrder); - CRepository::setNewLLeave(false); - - CRepository::setGetFail(0); - // getting from cenrep fails from first + + // first read fails + XQSettingsManager::mReadItemSucceedCounter = 0; QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) < 0); QVERIFY(testObject.mVideosSortRole == -1); QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder); @@ -487,8 +470,8 @@ QVERIFY(sortRole == -1); QVERIFY(sortOrder == Qt::AscendingOrder); - CRepository::setGetFail(1); - // getting from cenrep fails from second + // second read fails + XQSettingsManager::mReadItemSucceedCounter = 1; QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) < 0); QVERIFY(testObject.mVideosSortRole == -1); QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder); @@ -497,9 +480,9 @@ QVERIFY(sortRole == -1); QVERIFY(sortOrder == Qt::AscendingOrder); - CRepository::setGetFail(2); // succeeds + XQSettingsManager::mReadItemSucceedCounter = 2; QVERIFY(testObject.loadSortingValues(sortRole, sortOrder, target) == 0); QVERIFY(testObject.mVideosSortRole == VideoCollectionCommon::KeyDateTime); QVERIFY(testObject.mVideosSortOrder == Qt::DescendingOrder); @@ -530,12 +513,12 @@ { VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); - // Invalid - XQSettingsManager::mReadItemValueReturnValue = QVariant(); + // no data + XQSettingsManager::mWrittenValueHash.clear(); QVERIFY(testObject.getCenRepStringValue(0) == ""); // Ok - XQSettingsManager::mReadItemValueReturnValue = QVariant("test"); + XQSettingsManager::mWrittenValueHash.insert(0, QVariant("test")); QVERIFY(testObject.getCenRepStringValue(0) == "test"); } @@ -547,12 +530,12 @@ { VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); - // Invalid - XQSettingsManager::mReadItemValueReturnValue = QVariant(); + // no data + XQSettingsManager::mWrittenValueHash.clear(); QVERIFY(testObject.getCenRepIntValue(0) == -1); // Ok - XQSettingsManager::mReadItemValueReturnValue = QVariant(13); + XQSettingsManager::mWrittenValueHash.insert(0, QVariant(13)); QVERIFY(testObject.getCenRepIntValue(0) == 13); } @@ -623,18 +606,17 @@ // void TestVideoVideoCollectionViewUtils::testSortModel() { - CRepository::setGetFail(255); - + VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); testObject.mVideosSortRole = -1; testObject.mVideosSortOrder = Qt::AscendingOrder; testObject.mCollectionsSortRole = -1; testObject.mCollectionsSortOrder = Qt::AscendingOrder; - CRepository::mSortValues[KVideoSortingRoleKey] = VideoCollectionCommon::KeyDateTime; - CRepository::mSortValues[KVideoSortingOrderKey] = Qt::DescendingOrder; - CRepository::mSortValues[KCollectionsSortingRoleKey] = VideoCollectionCommon::KeyTitle; - CRepository::mSortValues[KCollectionsSortingOrderKey] = Qt::DescendingOrder; + XQSettingsManager::mWrittenValueHash.insert(KVideoSortingRoleKey, VideoCollectionCommon::KeyDateTime); + XQSettingsManager::mWrittenValueHash.insert(KVideoSortingOrderKey, Qt::DescendingOrder); + XQSettingsManager::mWrittenValueHash.insert(KCollectionsSortingRoleKey, VideoCollectionCommon::KeyTitle); + XQSettingsManager::mWrittenValueHash.insert(KCollectionsSortingOrderKey, Qt::DescendingOrder); VideoCollectionCommon::TCollectionLevels target = VideoCollectionCommon::ELevelInvalid; @@ -692,6 +674,7 @@ QVERIFY(testObject.mVideosSortOrder == Qt::DescendingOrder); QVERIFY(testObject.mCollectionsSortRole == VideoCollectionCommon::KeyTitle); QVERIFY(testObject.mCollectionsSortOrder == Qt::DescendingOrder); + } // ----------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stubs/inc/centralrepository.h --- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stubs/inc/centralrepository.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: stub central repository -class for testing CVideoCollectionClient -* -*/ - -#ifndef __CENTRALREPOSITORY_H__ -#define __CENTRALREPOSITORY_H__ - -#include -#include - -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 gSettedTDesValue; - */ - static TDesC& getTDesValue(); - - /** - * sets gSettedTDesValue; - */ - static void setTDesValue(const TDesC& value); - - - static QMap mSortValues; - - /** - * if gCRNewLLeave is true, will leave - * if gCRNewLLeave is false returns new CRepository - */ - static CRepository* NewL(TUid aRepositoryUid); - - /** - * contructor - */ - CRepository(); - - /** - * destructor - */ - virtual ~CRepository(); - - /** - * if gCRGetFail is true, returns KErrGeneral - * if gCRGetFail is false, returns gSettedValue and returns KErrNone - */ - TInt Get(TUint32 aKey, TInt& aValue); - - /** - * if gCRSetFail is true, returns KErrGeneral - * if gCRSetFail is false, saves value to gSettedValue and returns KErrNone - */ - TInt Set(TUint32 aKey, TInt aValue); - - /** - * if gCRGetFail is true, returns KErrGeneral - * if gCRGetFail is false, returns gSettedValue and returns KErrNone - */ - TInt Get(TUint32 aKey, TDes& aValue); - - -}; - -#endif // __CENTRALREPOSITORY_H__ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stubs/src/centralrepository.cpp --- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stubs/src/centralrepository.cpp Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: stub central repository -class for testing CVideoCollectionClient -* -*/ - - -#include "centralrepository.h" - -const int KVideoCollectionViewCenrepSortingRoleKey(0x5); -const int KVideoCollectionViewCenrepSortingOrderKey(0x6); - -/** - * if true, Newl will leave - */ -bool gCRNewLLeave = false; - -/** - * if zero, Set will fail. Every Set call decreases this value by one. - */ -int gCRSetFail = 255; - -/** - * if zero, Get will fail. Every Get call decreases this value by one. - */ -int gCRGetFail = 255; - -/** - * order value will be saved here in correct cases - */ -TBuf<255> gSettedTDesValue = TBuf<255>(); - - -QMap CRepository::mSortValues = QMap(); - - -// ----------------------------------------------------------------------------- -// setNewLLeave -// ----------------------------------------------------------------------------- -// -void CRepository::setNewLLeave(bool leave) -{ - gCRNewLLeave = leave; -} - -// ----------------------------------------------------------------------------- -// setSetFail -// ----------------------------------------------------------------------------- -// -void CRepository::setSetFail(int amount) -{ - gCRSetFail = amount; -} - -// ----------------------------------------------------------------------------- -// setGetFail -// ----------------------------------------------------------------------------- -// -void CRepository::setGetFail(int amount) -{ - gCRGetFail = amount; -} - -// ----------------------------------------------------------------------------- -// getTDesValue -// ----------------------------------------------------------------------------- -// -TDesC& CRepository::getTDesValue() -{ - return gSettedTDesValue; -} - -// ----------------------------------------------------------------------------- -// setOrderValue -// ----------------------------------------------------------------------------- -// -void CRepository::setTDesValue(const TDesC& value) -{ - gSettedTDesValue = value; -} - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -// -CRepository* CRepository::NewL(TUid /*aRepositoryUid*/) -{ - if(gCRNewLLeave) - { - User::Leave(KErrGeneral); - } - return new CRepository(); -} - -// ----------------------------------------------------------------------------- -// CRepository -// ----------------------------------------------------------------------------- -// -CRepository::CRepository() -{ - -} - -// ----------------------------------------------------------------------------- -// ~CRepository -// ----------------------------------------------------------------------------- -// -CRepository::~CRepository() -{ - -} - -// ----------------------------------------------------------------------------- -// Get -// ----------------------------------------------------------------------------- -// -TInt CRepository::Get(TUint32 aKey, TInt& aValue) -{ - if(gCRGetFail == 0) - { - return KErrGeneral; - } else { - gCRGetFail--; - } - - aValue = mSortValues.value(aKey); - - return KErrNone; -} - -// ----------------------------------------------------------------------------- -// Set -// ----------------------------------------------------------------------------- -// -TInt CRepository::Set(TUint32 aKey, TInt aValue) -{ - if(gCRSetFail == 0) - { - return KErrGeneral; - } else { - gCRSetFail--; - } - - mSortValues[aKey] = aValue; - - return KErrNone; -} - -// ----------------------------------------------------------------------------- -// Get -// ----------------------------------------------------------------------------- -// -TInt CRepository::Get(TUint32 /*aKey*/, TDes& aValue) -{ - if(gCRGetFail == 0) - { - return KErrGeneral; - } else { - gCRGetFail--; - } - - aValue = gSettedTDesValue; - - return KErrNone; -} diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideocollectionviewutils/testvideocollectionviewutils.pro --- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/testvideocollectionviewutils.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/testvideocollectionviewutils.pro Mon Aug 23 14:27:29 2010 +0300 @@ -21,12 +21,10 @@ DEPENDPATH += . \ inc \ src \ - stubs \ ../../../tsrc/stubs INCLUDEPATH = . \ inc \ - stubs/inc \ ../../../tsrc/stubs/inc \ \ # keep these at bottom so that stubbed headers are taken first ../../../inc \ @@ -44,12 +42,10 @@ # Input HEADERS += inc/testvideocollectionviewutils.h \ - stubs/inc/centralrepository.h \ \ # headers needed in test ../../inc/videocollectionviewutils.h SOURCES += src/testvideocollectionviewutils.cpp \ - stubs/src/centralrepository.cpp \ \ # sources needed in test ../../src/videocollectionviewutils.cpp diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp --- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -250,6 +250,8 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue); + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); VideoSortFilterProxyModelData::reset(); @@ -273,6 +275,8 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue); + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); delete mTestObject; mTestObject = new VideoListSelectionDialog(mTestUiLoader); @@ -300,6 +304,8 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue); + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); delete mTestObject; mTestObject = new VideoListSelectionDialog(mTestUiLoader); @@ -327,7 +333,9 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue); - + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); + // No data. type ECreateCollection:. Default mpx item setRowCount(0); mpxId = TMPXItemId(); @@ -350,6 +358,8 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue); + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); delete mTestObject; mTestObject = new VideoListSelectionDialog(mTestUiLoader); @@ -377,6 +387,8 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue); + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); delete mTestObject; mTestObject = new VideoListSelectionDialog(mTestUiLoader); @@ -404,7 +416,9 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue); - + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); + delete mTestObject; mTestObject = new VideoListSelectionDialog(mTestUiLoader); VideoSortFilterProxyModelData::reset(); @@ -430,7 +444,9 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue); - + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); + delete mTestObject; mTestObject = new VideoListSelectionDialog(mTestUiLoader); VideoSortFilterProxyModelData::reset(); @@ -456,7 +472,9 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue); - + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); + VideoSortFilterProxyModelData::reset(); // some data, second initialization without widget and model, for coverity delete mTestObject->mListWidget; @@ -482,6 +500,8 @@ QVERIFY(mTestObject->mSecondaryAction != 0); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue); + QVERIFY(mTestObject->mModelReady == false); + QVERIFY(mTestObject->mAlbumListReady == false); } // --------------------------------------------------------------------------- @@ -569,12 +589,46 @@ // empty model row count setRowCount(0); + mTestObject->mTypeOfSelection = VideoListSelectionDialog::EDeleteVideos; + mTestObject->mModelReady = true; + mTestObject->mAlbumListReady = false; mTestObject->exec(); QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusDeleteInProgress); QCOMPARE(HbDialog::openAmount, 0); QCOMPARE(HbInputDialog::mOpenCallCount, 0); VideoCollectionViewUtilsData::mLastError = -1; + // empty model row count, mModelReady is false. + mTestObject->mModelReady = false; + mTestObject->mAlbumListReady = true; + mTestObject->exec(); + QVERIFY(VideoCollectionViewUtilsData::mLastError == -1); + QCOMPARE(HbDialog::openAmount, 0); + QCOMPARE(HbInputDialog::mOpenCallCount, 0); + VideoCollectionViewUtilsData::mLastError = -1; + + // empty model row count, type is ESelectCollection + mTestObject->mTypeOfSelection = VideoListSelectionDialog::ESelectCollection; + mTestObject->mSelectedAlbumId = TMPXItemId(1,0); + mTestObject->mModelReady = false; + mTestObject->mAlbumListReady = true; + mTestObject->exec(); + QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusVideosAddedToCollection); + QCOMPARE(HbDialog::openAmount, 0); + QCOMPARE(HbInputDialog::mOpenCallCount, 0); + VideoCollectionViewUtilsData::mLastError = -1; + + // empty model row count, mAlbumListReady is false, type is ESelectCollection + mTestObject->mTypeOfSelection = VideoListSelectionDialog::ESelectCollection; + mTestObject->mModelReady = true; + mTestObject->mAlbumListReady = false; + mTestObject->exec(); + QVERIFY(VideoCollectionViewUtilsData::mLastError == -1); + QCOMPARE(HbDialog::openAmount, 0); + QCOMPARE(HbInputDialog::mOpenCallCount, 0); + VideoCollectionViewUtilsData::mLastError = -1; + mTestObject->mTypeOfSelection = VideoListSelectionDialog::EDeleteVideos; + // model contains data setRowCount(10); mTestObject->exec(); @@ -612,6 +666,8 @@ TMPXItemId mpxId = TMPXItemId(1, KVcxMvcMediaTypeAlbum); mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, mpxId); + mTestObject->mModelReady = true; + mTestObject->mAlbumListReady = true; // finished with secondary action VideoCollectionViewUtilsData::mLastError = -1; HbDialog::execReturnPrimary = false; @@ -940,25 +996,60 @@ mTestHelper->mTestable = mTestObject; mTestHelper->connectSignals(); - mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, TMPXItemId(1,2)); + mTestObject->setupContent(VideoListSelectionDialog::ESelectCollection, TMPXItemId(1,2)); mTestObject->mPrimaryAction->mTriggeredCount = 0; + setRowCount(0); + VideoCollectionViewUtilsData::mLastError = -1; - // type of selection != ESelectCollection + // type of selection == ESelectCollection mTestHelper->emitModelReadySlot(); - QVERIFY(mTestObject->mPrimaryAction->mTriggeredCount == 0); + QVERIFY(VideoCollectionViewUtilsData::mLastError == -1); + + ////////////////////////// + // Tests with empty model. + + // type EDeleteVideos + mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, TMPXItemId(1,2)); + mTestHelper->emitModelReadySlot(); + QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusDeleteInProgress); + + // type EAddToCollection + mTestObject->mPrimaryAction->mTriggeredCount = 0; + mTestObject->setupContent(VideoListSelectionDialog::EAddToCollection, TMPXItemId(1,2)); + mTestHelper->emitModelReadySlot(); + QCOMPARE(mTestObject->mPrimaryAction->mTriggeredCount, 1); - mTestObject->setupContent(VideoListSelectionDialog::ESelectCollection, TMPXItemId(1,2)); - // no items in model - setRowCount(0); + // type ERemoveFromCollection + mTestObject->mPrimaryAction->mTriggeredCount = 0; + mTestObject->setupContent(VideoListSelectionDialog::ERemoveFromCollection, TMPXItemId(1,2)); mTestHelper->emitModelReadySlot(); - QVERIFY(mTestObject->mPrimaryAction->mTriggeredCount == 1); + QCOMPARE(mTestObject->mPrimaryAction->mTriggeredCount, 1); + + ////////////////////////// + // Tests with items in model. + setRowCount(10); + QModelIndex index = mModel->index(5, 0); - mTestObject->mPrimaryAction->mTriggeredCount = 0; - setRowCount(10); - // type of selection is ESelectCollection and there are items in model + // type ECreateCollection, dialog hidden + mTestObject->setupContent(VideoListSelectionDialog::ECreateCollection, TMPXItemId::InvalidId()); + mTestObject->hide(); + HbListView::mLatestScrollToIndex = index; mTestHelper->emitModelReadySlot(); - QVERIFY(mTestObject->mPrimaryAction->mTriggeredCount == 0); + QCOMPARE(HbListView::mLatestScrollToIndex, index); + + // type EDeleteVideos, dialog hidden. + mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, TMPXItemId(1,2)); + mTestObject->hide(); + mTestHelper->emitModelReadySlot(); + QCOMPARE(HbListView::mLatestScrollToIndex, mModel->index(0, 0)); + + // type EDeleteVideos, dialog visible. + mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, TMPXItemId(1,2)); + HbListView::mLatestScrollToIndex = index; + mTestObject->setVisible(true); + mTestHelper->emitModelReadySlot(); + QCOMPARE(HbListView::mLatestScrollToIndex, index); mTestHelper->disconnectSignals(); } diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice/inc/testvideooperatorservice.h --- a/videocollection/videocollectionview/tsrc/testvideooperatorservice/inc/testvideooperatorservice.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice/inc/testvideooperatorservice.h Mon Aug 23 14:27:29 2010 +0300 @@ -16,9 +16,9 @@ */ #ifndef TESTVIDEOOPERATORSERVICE_H -#define TESTVIDEOCOLLECTIONUILOADER_H +#define TESTVIDEOOPERATORSERVICE_H -// INCLUDES +// INCLUDE FILES #include // FORWARD DECLARATIONS @@ -39,18 +39,12 @@ private slots: - void testLoad(); - void testTitle(); - void testIconResource(); - void testLaunchService(); - -signals: + void test(); private: /** class under test */ VideoOperatorService *mTestObject; - }; -#endif//TESTVIDEOCOLLECTIONUILOADER_H +#endif//TESTVIDEOOPERATORSERVICE_H diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice/src/testvideooperatorservice.cpp --- a/videocollection/videocollectionview/tsrc/testvideooperatorservice/src/testvideooperatorservice.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice/src/testvideooperatorservice.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,17 +15,17 @@ * */ +// INCLUDE FILES #include #include #include #include #include "testvideooperatorservice.h" -#include "videocollectionviewutilsdata.h" +#include "videooperatorservice_pdata.h" #define private public #include "videooperatorservice.h" -#include "videooperatorservicedata.h" #undef private int main(int argc, char *argv[]) @@ -66,11 +66,11 @@ // --------------------------------------------------------------------------- // void TestVideoOperatorService::init() -{ +{ // create test object if (!mTestObject) { - mTestObject = new VideoOperatorService; + mTestObject = new VideoOperatorService(); } } @@ -88,80 +88,33 @@ // TEST CASES START ---------------------------------------------------------- // --------------------------------------------------------------------------- -// testLoad -// --------------------------------------------------------------------------- -// -void TestVideoOperatorService::testLoad() -{ - // Good case - VideoCollectionViewUtilsData::mCenRepStringValues.append("test title"); - VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); - VideoCollectionViewUtilsData::mCenRepStringValues.append("test uri"); - VideoCollectionViewUtilsData::mCenRepIntValues.append(5050); - QVERIFY(mTestObject->load(0, 0, 0, 0) == true); - QVERIFY(mTestObject->mTitle == "test title"); - QVERIFY(mTestObject->mIconResource == "test icon"); - QVERIFY(mTestObject->mServiceUri == "test uri"); - QCOMPARE(mTestObject->mApplicationUid, 5050); - - // Only icon is defined for service. - VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); - VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); - QVERIFY(mTestObject->load(0, 0, 0, 0) == false); - QVERIFY(mTestObject->mTitle == ""); - QVERIFY(mTestObject->mIconResource == "test icon"); - QVERIFY(mTestObject->mServiceUri == ""); - QCOMPARE(mTestObject->mApplicationUid, -1); - - // Only icon and uri are defined for service. - VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); - VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); - VideoCollectionViewUtilsData::mCenRepStringValues.append("test uri"); - QVERIFY(mTestObject->load(0, 0, 0, 0) == true); - QVERIFY(mTestObject->mTitle == ""); - QVERIFY(mTestObject->mIconResource == "test icon"); - QVERIFY(mTestObject->mServiceUri == "test uri"); - QCOMPARE(mTestObject->mApplicationUid, -1); - - // Only icon and app uid are defined for service. - VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); - VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); - VideoCollectionViewUtilsData::mCenRepIntValues.append(5050); - QVERIFY(mTestObject->load(0, 0, 0, 0) == true); - QVERIFY(mTestObject->mTitle == ""); - QVERIFY(mTestObject->mIconResource == "test icon"); - QVERIFY(mTestObject->mServiceUri == ""); - QCOMPARE(mTestObject->mApplicationUid, 5050); -} - -// --------------------------------------------------------------------------- -// testTitle -// --------------------------------------------------------------------------- -// -void TestVideoOperatorService::testTitle() -{ - mTestObject->mTitle = "test title"; - QVERIFY(mTestObject->title() == "test title"); -} - -// --------------------------------------------------------------------------- -// testIconResource -// --------------------------------------------------------------------------- -// -void TestVideoOperatorService::testIconResource() -{ - mTestObject->mIconResource = "test icon"; - QVERIFY(mTestObject->iconResource() == "test icon"); -} - -// --------------------------------------------------------------------------- // test // --------------------------------------------------------------------------- // -void TestVideoOperatorService::testLaunchService() +void TestVideoOperatorService::test() { - mTestObject->mApplicationUid = 0; + init(); + + VideoOperatorServicePrivateData::mLoadReturnValue = true; + QVERIFY(mTestObject->load(0, 0, 0, 0) == true); + VideoOperatorServicePrivateData::mLoadReturnValue = false; + QVERIFY(mTestObject->load(0, 0, 0, 0) == false); + + VideoOperatorServicePrivateData::mTitleReturnValue = "test1"; + QVERIFY(mTestObject->title() == QString("test1")); + VideoOperatorServicePrivateData::mTitleReturnValue = "test2"; + QVERIFY(mTestObject->title() == QString("test2")); + + VideoOperatorServicePrivateData::mIconResourceReturnValue = "test3"; + QVERIFY(mTestObject->iconResource() == QString("test3")); + VideoOperatorServicePrivateData::mIconResourceReturnValue = "test4"; + QVERIFY(mTestObject->iconResource() == QString("test4")); + + VideoOperatorServicePrivateData::mLaunchServiceCallCount = 0; mTestObject->launchService(); + QCOMPARE(VideoOperatorServicePrivateData::mLaunchServiceCallCount, 1); + + cleanup(); } // end of file diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice/testvideooperatorservice.pro --- a/videocollection/videocollectionview/tsrc/testvideooperatorservice/testvideooperatorservice.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice/testvideooperatorservice.pro Mon Aug 23 14:27:29 2010 +0300 @@ -50,11 +50,13 @@ -lcone HEADERS += inc/testvideooperatorservice.h \ - ../../../videocollectionview/inc/videooperatorservice.h + ../../../videocollectionview/inc/videooperatorservice.h \ + ../../../videocollectionview/inc/videooperatorservice_p.h SOURCES += src/testvideooperatorservice.cpp \ \ # sources needed in test - ../../../videocollectionview/src/videooperatorservice.cpp + ../../../videocollectionview/src/videooperatorservice.cpp \ + ../../../tsrc/stubs/src/videooperatorservice_p.cpp TESTEDCLASS = videooperatorservice include(../../../tsrc/stubs/stubs.pro) diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/inc/testvideooperatorservice_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/inc/testvideooperatorservice_p.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,60 @@ +/** +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tests for VideoOperatorService +* +*/ + +#ifndef TESTVIDEOOPERATORSERVICE_P_H +#define TESTVIDEOOPERATORSERVICE_P_H + +// INCLUDE FILES +#include +#include "apgclistub.h" +#include "apaidstub.h" +#include "coemainstub.h" +#include "apgtaskstub.h" + +// FORWARD DECLARATIONS +class VideoOperatorServicePrivate; + +class TestVideoOperatorServicePrivate : public QObject +{ + Q_OBJECT + +public: + TestVideoOperatorServicePrivate(); + virtual ~TestVideoOperatorServicePrivate(); + +private slots: // test functions for the test framework + void init(); + + void cleanup(); + +private slots: + + void testLoad(); + void testTitle(); + void testIconResource(); + void testLaunchService(); + void testSlots(); + +signals: + +private: + /** class under test */ + VideoOperatorServicePrivate *mTestObject; + +}; + +#endif//TESTVIDEOOPERATORSERVICE_P_H diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/src/testvideooperatorservice_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/src/testvideooperatorservice_p.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,250 @@ +/** +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tests for VideoOperatorService +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "testvideooperatorservice_p.h" +#include "videocollectionviewutilsdata.h" + +#define private public +#include "videooperatorservice_p.h" +#undef private + +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + HbMainWindow window; + TestVideoOperatorServicePrivate tv; + int res; + if (argc > 1) + { + res = QTest::qExec(&tv, argc, argv); + } + else + { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\testvideooperatorservice_p.txt"; + res = QTest::qExec(&tv, 3, pass); + } + + return res; +} + +TestVideoOperatorServicePrivate::TestVideoOperatorServicePrivate(): + mTestObject(0) +{ + +} + +TestVideoOperatorServicePrivate::~TestVideoOperatorServicePrivate() +{ + cleanup(); +} + +// --------------------------------------------------------------------------- +// init +// --------------------------------------------------------------------------- +// +void TestVideoOperatorServicePrivate::init() +{ + TApaTask::mExistsReturnValue = false; + TApaTaskList::mFindAppCallCount = 0; + CCoeEnv::mStaticReturnsNull = false; + CCoeEnv::mCCoeEnvCallCount = 0; + TApaTask::mExistsReturnValue = true; + TApaTask::mExistsCallCount = 0; + TApaTask::mBringToForegroundCallcount = 0; + RApaLsSession::mGetAppInfoCallCount = 0; + TApaAppInfo::mConstructCount = 0; + + // create test object + if (!mTestObject) + { + mTestObject = new VideoOperatorServicePrivate(); + } +} + +// --------------------------------------------------------------------------- +// cleanup +// --------------------------------------------------------------------------- +// +void TestVideoOperatorServicePrivate::cleanup() +{ + // delete test object + delete mTestObject; + mTestObject = 0; +} + +// TEST CASES START ---------------------------------------------------------- + +// --------------------------------------------------------------------------- +// testLoad +// --------------------------------------------------------------------------- +// +void TestVideoOperatorServicePrivate::testLoad() +{ + // Good case + VideoCollectionViewUtilsData::mCenRepStringValues.append("test title"); + VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); + VideoCollectionViewUtilsData::mCenRepStringValues.append("test uri"); + VideoCollectionViewUtilsData::mCenRepIntValues.append(5050); + QVERIFY(mTestObject->load(0, 0, 0, 0) == true); + QVERIFY(mTestObject->mTitle == "test title"); + QVERIFY(mTestObject->mIconResource == "test icon"); + QVERIFY(mTestObject->mServiceUri == "test uri"); + QCOMPARE(mTestObject->mApplicationUid, 5050); + + // Only icon is defined for service. + VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); + VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); + QVERIFY(mTestObject->load(0, 0, 0, 0) == false); + QVERIFY(mTestObject->mTitle == ""); + QVERIFY(mTestObject->mIconResource == "test icon"); + QVERIFY(mTestObject->mServiceUri == ""); + QCOMPARE(mTestObject->mApplicationUid, -1); + + // Only icon and uri are defined for service. + VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); + VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); + VideoCollectionViewUtilsData::mCenRepStringValues.append("test uri"); + QVERIFY(mTestObject->load(0, 0, 0, 0) == true); + QVERIFY(mTestObject->mTitle == ""); + QVERIFY(mTestObject->mIconResource == "test icon"); + QVERIFY(mTestObject->mServiceUri == "test uri"); + QCOMPARE(mTestObject->mApplicationUid, -1); + + // Only icon and app uid are defined for service. + VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); + VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); + VideoCollectionViewUtilsData::mCenRepIntValues.append(5050); + QVERIFY(mTestObject->load(0, 0, 0, 0) == true); + QVERIFY(mTestObject->mTitle == ""); + QVERIFY(mTestObject->mIconResource == "test icon"); + QVERIFY(mTestObject->mServiceUri == ""); + QCOMPARE(mTestObject->mApplicationUid, 5050); +} + +// --------------------------------------------------------------------------- +// testTitle +// --------------------------------------------------------------------------- +// +void TestVideoOperatorServicePrivate::testTitle() +{ + mTestObject->mTitle = "test title"; + QVERIFY(mTestObject->title() == "test title"); +} + +// --------------------------------------------------------------------------- +// testIconResource +// --------------------------------------------------------------------------- +// +void TestVideoOperatorServicePrivate::testIconResource() +{ + mTestObject->mIconResource = "test icon"; + QVERIFY(mTestObject->iconResource() == "test icon"); +} + +// --------------------------------------------------------------------------- +// test +// --------------------------------------------------------------------------- +// +void TestVideoOperatorServicePrivate::testLaunchService() +{ + // Good case. + init(); + mTestObject->mApplicationUid = 123456; + RApaLsSession::mFileName.Copy(_L("test.exe")); + mTestObject->launchService(); + QCOMPARE(RApaLsSession::mGetAppInfoCallCount, 1); + QCOMPARE(TApaAppInfo::mConstructCount, 1); + QCOMPARE(TApaTask::mBringToForegroundCallcount, 0); + QCOMPARE(TApaTaskList::mFindAppCallCount, 0); + cleanup(); + + // Uid returns empty string. + init(); + mTestObject->mApplicationUid = 123456; + RApaLsSession::mFileName.Copy(_L("")); + mTestObject->launchService(); + QCOMPARE(RApaLsSession::mGetAppInfoCallCount, 1); + QCOMPARE(TApaAppInfo::mConstructCount, 1); + QCOMPARE(TApaTask::mBringToForegroundCallcount, 0); + QCOMPARE(TApaTaskList::mFindAppCallCount, 0); + cleanup(); + + // Process exists and app already running. + init(); + TApaTask::mExistsReturnValue = true; + mTestObject->mProcess = new QProcess(); + mTestObject->mApplicationUid = 123456; + RApaLsSession::mFileName.Copy(_L("test.exe")); + mTestObject->launchService(); + QCOMPARE(RApaLsSession::mGetAppInfoCallCount, 0); + QCOMPARE(TApaAppInfo::mConstructCount, 0); + QCOMPARE(TApaTask::mBringToForegroundCallcount, 1); + QCOMPARE(TApaTaskList::mFindAppCallCount, 1); + cleanup(); + + // Process exists but app not running. + init(); + TApaTask::mExistsReturnValue = false; + mTestObject->mProcess = new QProcess(); + mTestObject->mApplicationUid = 123456; + RApaLsSession::mFileName.Copy(_L("test.exe")); + mTestObject->mProcess = new QProcess(); + mTestObject->launchService(); + QCOMPARE(RApaLsSession::mGetAppInfoCallCount, 1); + QCOMPARE(TApaAppInfo::mConstructCount, 1); + QCOMPARE(TApaTask::mBringToForegroundCallcount, 0); + QCOMPARE(TApaTaskList::mFindAppCallCount, 1); + cleanup(); + + // CCoeEnv is null + init(); + CCoeEnv::mStaticReturnsNull = true; + mTestObject->mApplicationUid = 123456; + RApaLsSession::mFileName.Copy(_L("test.exe")); + mTestObject->launchService(); + QCOMPARE(RApaLsSession::mGetAppInfoCallCount, 1); + QCOMPARE(TApaAppInfo::mConstructCount, 1); + QCOMPARE(TApaTask::mBringToForegroundCallcount, 0); + QCOMPARE(TApaTaskList::mFindAppCallCount, 0); + cleanup(); +} + +// --------------------------------------------------------------------------- +// testSlots +// --------------------------------------------------------------------------- +// +void TestVideoOperatorServicePrivate::testSlots() +{ + init(); + mTestObject->processError(QProcess::FailedToStart); + // Nothing to verify + + mTestObject->processFinished(0, QProcess::NormalExit); + // Nothing to verify + cleanup(); +} + +// end of file diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/apaidstub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/apaidstub.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 __APAID_H__ +#define __APAID_H__ + +#include +#include + +class TApaAppInfo + { +public: + TApaAppInfo() { mConstructCount++; iFullName.Copy(_L("")); } +public: + /** The full path name of the application DLL. */ + TFileName iFullName; + + static TInt mConstructCount; + }; + +#endif + +// EOF diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/apgclistub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/apgclistub.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __APGCLI_H__ +#define __APGCLI_H__ + +#include +#include "apaidstub.h" + +class RApaLsSession : public RSessionBase + { +public: + +public: + RApaLsSession() {} + + TInt GetAppInfo(TApaAppInfo& aInfo, TUid /*aAppUid*/) const + { + aInfo.iFullName = mFileName; + mGetAppInfoCallCount++; + return 0; + } + + TInt Connect() { return 0; } + void Close() {} + + static TFileName mFileName; + static TInt mGetAppInfoCallCount; + }; + +#endif // __APGCLI_H__ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/apgtaskstub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/apgtaskstub.h Mon Aug 23 14:27:29 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: +* +*/ + +#ifndef __APGTASK_H__ +#define __APGTASK_H__ + +#include "coemainstub.h" +#include + +class TApaTask +{ +public: + TApaTask(RWsSession& /*aWsSession*/) {} + + TBool Exists() const { return mExistsReturnValue; } + void BringToForeground() { mBringToForegroundCallcount++; } + + static bool mExistsReturnValue; + static int mExistsCallCount; + static int mBringToForegroundCallcount; +}; + +class TApaTaskList +{ +public: + TApaTaskList(RWsSession& /*aWsSession*/) {} + TApaTask FindApp(TUid /*aAppUid*/) { mFindAppCallCount++; return TApaTask(CCoeEnv::mSession); } + + static int mFindAppCallCount; +}; + +#endif + +// End of file diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/coemainstub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/coemainstub.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __COEMAIN_H__ +#define __COEMAIN_H__ + +typedef int RWsSession; + +#include + +class CCoeEnv; + +extern CCoeEnv *g_Env; + +class CCoeEnv +{ +public: + + static CCoeEnv* Static() + { + if(mStaticReturnsNull) + return 0; + if(!g_Env) + g_Env = new (ELeave) CCoeEnv; + return g_Env; + } + + /** + * Must be called before test exits if it has called the static method. + */ + static void Reset() { delete g_Env; g_Env = 0; } + + RWsSession &WsSession() { return mSession; } + + // Construction and destruction + CCoeEnv() { } + ~CCoeEnv() {} + + static int mCCoeEnvCallCount; + static RWsSession mSession; + static bool mStaticReturnsNull; +}; + +#endif + +// End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/videocollectiontrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/inc/videocollectiontrace.h Mon Aug 23 14:27:29 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: tracing stub used to get stubs included first +* +*/ + +#ifndef VIDEOCOLLETIONTRACE_H +#define VIDEOCOLLETIONTRACE_H + +#include "apaidstub.h" +#include "apgclistub.h" +#include "coemainstub.h" +#include "apgtaskstub.h" + +#define ERROR( aErr, aMsg ) +#define ERROR_1( aErr, aMsg, aP1 ) +#define ERROR_2( aErr, aMsg, aP1, aP2 ) +#define ERROR_3( aErr, aMsg, aP1, aP2, aP3 ) +#define ERROR_GEN( aMsg ) +#define ERROR_GEN_1( aMsg, aP1 ) +#define ERROR_GEN_2( aMsg, aP1, aP2 ) +#define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) + +#define ERROR_PARAM(_p) + +#define TRAPD_ERR( aErr, aStmt ) TRAP_IGNORE( aStmt ) +#define TRAP_ERR( aErr, aStmt ) TRAP_IGNORE( aStmt ) + +#define TRAP_AND_LEAVE(_s,_t) { _s; } + + +#define INFO( aMsg ) +#define INFO_1( aMsg, aP1 ) +#define INFO_2( aMsg, aP1, aP2 ) +#define INFO_3( aMsg, aP1, aP2, aP3 ) +#define INFO_4( aMsg, aP1, aP2, aP3, aP4 ) +#define INFO_5( aMsg, aP1, aP2, aP3, aP4, aP5 ) +#define INFO_PARAM( aParam ) +#define INFOQSTR_1( aMsg, aP1 ); +#define INFOQSTR_2( aMsg, aP1, aP2 ); + + +#define CURRENT_CLIENT( aMsg ) +#define CLIENT( aRMessage2 ) +#define CLIENT_1( aRMessage2, aMsg ) + + +#define HEAP( aMsg ) +#define HEAP_1( aMsg, aP1 ) +#define HEAP_2( aMsg, aP1, aP2 ) +#define HEAP_3( aMsg, aP1, aP2, aP3 ) +#define HEAP_4( aMsg, aP1, aP2, aP3, aP4 ) + +#define FUNC_LOG +#define FUNC_LOG_ADDR(P1) +#define FUNC_LOG_LC( ptr ) +#define FUNC_LOG_WITH_CLIENT +#define FUNC_LOG_WITH_CLIENT_LC( ptr ) + +#define TIMESTAMP( aCaption ) +#define TIMESTAMP_1( aCaption, aP1 ) +#define TIMESTAMP_2( aCaption, aP1, aP2 ) +#define TIMESTAMP_3( aCaption, aP1, aP2, aP3 ) + + +#define ASSERT_ALWAYS_TRACE +#define ASSERT_TRACE( _s ) + +#endif // VIDEOCOLLETIONTRACE_H diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/apaidstub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/apaidstub.cpp Mon Aug 23 14:27:29 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: +* +*/ + +#include "apaidstub.h" + +TInt TApaAppInfo::mConstructCount = 0; + +// EOF diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/apgclistub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/apgclistub.cpp Mon Aug 23 14:27:29 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: +* +*/ + +#include "apgclistub.h" + +TFileName RApaLsSession::mFileName = TFileName(); +TInt RApaLsSession::mGetAppInfoCallCount = 0; + +// EOF diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/apgtask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/apgtask.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "apgtaskstub.h" + +bool TApaTask::mExistsReturnValue = true; +int TApaTask::mExistsCallCount = 0; +int TApaTask::mBringToForegroundCallcount = 0; +int TApaTaskList::mFindAppCallCount = 0; + +// End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/coemain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/stub/src/coemain.cpp Mon Aug 23 14:27:29 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: +* +*/ + +#include "coemainstub.h" + +int CCoeEnv::mCCoeEnvCallCount = 0; +bool CCoeEnv::mStaticReturnsNull = false; +RWsSession CCoeEnv::mSession = 0; + +CCoeEnv *g_Env; + +// End of file. diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/tsrc/testvideooperatorservice_p/testvideooperatorservice_p.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/tsrc/testvideooperatorservice_p/testvideooperatorservice_p.pro Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,73 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app + +TARGET = +TARGET.CAPABILITY = ALL -TCB + +DEPENDPATH += . \ + inc \ + src \ + ../../../tsrc/stubs \ + stub/inc \ + stub/src + +INCLUDEPATH += . \ + inc \ + ../../../tsrc/stubs/inc \ + stub/inc \ + \ # keep these at bottom so that stub headers are taken first + ../../../inc \ + ../../../videocollectionview/inc \ + ../../../videocollectionwrapper/inc \ + ../../../../inc \ + ../../../../videoplayerapp/inc \ + ../../../../videoplayerapp/videoplayerengine/inc + +CONFIG += qtestlib \ + hb + +LIBS += -lestor.dll \ + -lfbscli.dll \ + -lbitgdi.dll \ + -lgdi.dll \ + -lcentralrepository.dll \ + -lxqservice.dll \ + -lxqserviceutil.dll \ + -lapparc \ + -lapgrfx \ + -lws32 \ + -lcone + +HEADERS += stub/inc/apaidstub.h \ + stub/inc/apgclistub.h \ + stub/inc/videocollectiontrace.h \ + stub/inc/apgtaskstub.h \ + stub/inc/coemainstub.h \ + inc/testvideooperatorservice_p.h \ + ../../../videocollectionview/inc/videooperatorservice_p.h \ + +SOURCES += src/testvideooperatorservice_p.cpp \ + \ # sources needed in test + ../../../videocollectionview/src/videooperatorservice_p.cpp \ + stub/src/apaidstub.cpp \ + stub/src/apgclistub.cpp \ + stub/src/apgtask.cpp \ + stub/src/coemain.cpp + +TESTEDCLASS = videooperatorservice_p +include(../../../tsrc/stubs/stubs.pro) diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionview/videocollectionview.pro --- a/videocollection/videocollectionview/videocollectionview.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionview/videocollectionview.pro Mon Aug 23 14:27:29 2010 +0300 @@ -24,7 +24,6 @@ BLD_INF_RULES.prj_exports += \ "rom/videocollectionview.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videocollectionview.iby)" \ "conf/videolistview.confml APP_LAYER_CONFML(videolistview.confml)" \ - "conf/CI_videoplayerservicelist.confml APP_LAYER_CONFML(CI_videoplayerservicelist.confml)" \ "conf/videoplayerservicelist.confml APP_LAYER_CONFML(videoplayerservicelist.confml)" \ "conf/videolistview_2002BC63.crml APP_LAYER_CRML(videolistview_2002BC63.crml)" @@ -61,7 +60,8 @@ inc/videocollectionuiloader.h \ inc/videolistselectiondialog.h \ inc/videocollectioncenrepdefs.h \ - inc/videooperatorservice.h + inc/videooperatorservice.h \ + inc/videooperatorservice_p.h SOURCES += src/videocollectionviewplugin.cpp \ src/videolistview.cpp \ @@ -70,7 +70,8 @@ src/videocollectionviewutils.cpp \ src/videocollectionuiloader.cpp \ src/videolistselectiondialog.cpp \ - src/videooperatorservice.cpp + src/videooperatorservice.cpp \ + src/videooperatorservice_p.cpp DOCML += data/collectionview.docml \ data/videolistselectiondialog.docml @@ -79,7 +80,6 @@ LIBS += -lmpxviewframeworkqt.dll \ -lvideocollectionwrapper.dll \ - -lcentralrepository.dll \ -lxqserviceutil.dll \ -lvideoplayerengine.dll \ -lflogger.dll \ diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h --- a/videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h Mon Aug 23 14:27:29 2010 +0300 @@ -244,7 +244,6 @@ signals: - /** * Signal to be emitted if detail fetching started ok * @@ -259,12 +258,17 @@ void modelReady(); /** - * notifies that model's physical data structure has changed: + * Notifies that model's physical data structure has changed: * - item inserted * - item removed */ void modelChanged(); + /** + * Notifies that model has been sorted. + */ + void modelSorted(); + protected: // from QSortFilterProxyModel /** diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/src/videocollectionlistener.cpp --- a/videocollection/videocollectionwrapper/src/videocollectionlistener.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videocollectionlistener.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 34 % +// Version : %version: 35 % // INCLUDE FILES #include @@ -458,9 +458,11 @@ INFO("VideoCollectionListener::handleMyVideosItemsChanged EMPXItemModified"); // Inform that item data has changed. mSignalReceiver.itemModifiedSlot(itemId); - // Update category contents. - if(itemId.iId2 == KVcxMvcMediaTypeAlbum || - itemId.iId2 == KVcxMvcMediaTypeCategory) + // Update contents for albums and captured and downloads categories. + if( itemId.iId2 == KVcxMvcMediaTypeAlbum || + (itemId.iId2 == KVcxMvcMediaTypeCategory && + (itemId.iId1 == KVcxMvcCategoryIdCaptured || + itemId.iId1 == KVcxMvcCategoryIdDownloads)) ) { INFO("VideoCollectionListener::handleMyVideosItemsChanged album or category modified, opening."); mCollectionClient.openItem(itemId); diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp --- a/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 66.1.8 % +// Version : %version: 66.1.9 % // INCLUDE FILES #include @@ -360,9 +360,8 @@ // 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, 0); + + emit modelSorted(); } // ----------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/src/testvideocollectionlistener.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/src/testvideocollectionlistener.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/src/testvideocollectionlistener.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -197,6 +197,10 @@ QVERIFY(arrayToTest != 0); QVERIFY(arrayToTest->Count() == array->Count()); + ///////////////// + // Tests with all videos collection level. + ///////////////// + delete collectionPath; // empty array, path exists level correct collectionPath = 0; @@ -215,7 +219,8 @@ arrayToTest = static_cast(mSignalReceiver->getLatestPointerAddr()); QVERIFY(arrayToTest != 0); QVERIFY(arrayToTest->Count() == array->Count()); - QVERIFY(mSignalReceiver->getListComplete() == false); + QVERIFY(mSignalReceiver->getVideoListComplete() == false); + QVERIFY(mSignalReceiver->getAlbumListComplete() == false); mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos); delete array; @@ -235,7 +240,24 @@ arrayToTest = static_cast(mSignalReceiver->getLatestPointerAddr()); QVERIFY(arrayToTest != 0); QVERIFY(arrayToTest->Count() == array->Count()); - QVERIFY(mSignalReceiver->getListComplete() == false); + QVERIFY(mSignalReceiver->getVideoListComplete() == false); + QVERIFY(mSignalReceiver->getAlbumListComplete() == false); + + // third call contains KVcxMediaMyVideosInt32Value with value EVcxMyVideosVideoListComplete. + int listComplete(EVcxMyVideosVideoListComplete); + mMediaFactory->putTValue(media, KVcxMediaMyVideosInt32Value, listComplete); + + mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 ); + + QVERIFY(mSignalReceiver->getVideoListComplete()); + QVERIFY(mSignalReceiver->getAlbumListComplete() == false); + + mSignalReceiver->resetLatestItems(); + mMediaFactory->putTValue(media, KVcxMediaMyVideosInt32Value, invalid); + + ///////////////// + // Tests with default category collection level. + ///////////////// delete collectionPath; collectionPath = 0; @@ -245,16 +267,13 @@ collectionPath->AppendL( KVcxMvcMediaTypeCategory);); mMediaFactory->putValuePtr(media, KMPXMediaGeneralContainerPath, collectionPath); - // third call contains KVcxMediaMyVideosInt32Value with value EVcxMyVideosVideoListComplete. - int listComplete(EVcxMyVideosVideoListComplete); - mMediaFactory->putTValue(media, KVcxMediaMyVideosInt32Value, listComplete); - mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 ); arrayToTest = static_cast(mSignalReceiver->getLatestPointerAddr()); QVERIFY(arrayToTest != 0); QVERIFY(arrayToTest->Count() == array->Count()); - QVERIFY(mSignalReceiver->getListComplete()); + QVERIFY(mSignalReceiver->getVideoListComplete() == false); + QVERIFY(mSignalReceiver->getAlbumListComplete() == false); CMPXMediaArray *gottenArray = static_cast(mSignalReceiver->getLatestPointerAddr()); QVERIFY(gottenArray->Count() == 3); @@ -266,7 +285,44 @@ QVERIFY(mediaId.iId1 == 2); VideoCollectionUtils::instance().mediaValue((*gottenArray)[2], KMPXMediaGeneralId, mediaId ); QVERIFY(mediaId.iId1 == 3); - + + ///////////////// + // Tests with categories list collection level. + ///////////////// + + delete collectionPath; + collectionPath = 0; + TRAP_IGNORE( + collectionPath = CMPXCollectionPath::NewL(); + collectionPath->AppendL( KVcxUidMyVideosMpxCollection ); + ); + mMediaFactory->putValuePtr(media, KMPXMediaGeneralContainerPath, collectionPath); + + // first collection level call does not contain the KVcxMediaMyVideosVideoListIsPartial. + mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 ); + QVERIFY(mSignalReceiver->getVideoListComplete() == false); + QVERIFY(mSignalReceiver->getAlbumListComplete() == false); + + // second collection level call contains the KVcxMediaMyVideosVideoListIsPartial, but it's true + bool listIsPartial(true); + mMediaFactory->putTValue(media, KVcxMediaMyVideosVideoListIsPartial, listIsPartial); + + mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 ); + QVERIFY(mSignalReceiver->getVideoListComplete() == false); + QVERIFY(mSignalReceiver->getAlbumListComplete() == false); + + // third collection level call contains the KVcxMediaMyVideosVideoListIsPartial, and it's false + listIsPartial = false; + mMediaFactory->putTValue(media, KVcxMediaMyVideosVideoListIsPartial, listIsPartial); + + mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 ); + QVERIFY(mSignalReceiver->getVideoListComplete() == false); + QVERIFY(mSignalReceiver->getAlbumListComplete()); + + ///////////////// + // Tests with user created album collection level. + ///////////////// + collectionPath->Reset(); delete collectionPath; TMPXItemId albumId(100,2); diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/inc/stubsignalreceiver.h --- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/inc/stubsignalreceiver.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/inc/stubsignalreceiver.h Mon Aug 23 14:27:29 2010 +0300 @@ -75,9 +75,14 @@ int getLatestIntegerData(); /** - * return mListComplete + * return mVideoListComplete */ - bool getListComplete(); + bool getVideoListComplete(); + + /** + * return mAlbumListComplete + */ + bool getAlbumListComplete(); public slots: @@ -120,7 +125,7 @@ * Saves provided integer to mLatestItemId and provided pointer to * mLatestPtr */ - void albumListAvailableSlot(TMPXItemId albumId, + void albumListAvailableSlot(TMPXItemId &albumId, CMPXMediaArray *albumItems); /** @@ -131,7 +136,7 @@ /** * saves provided item id into mLatestItemId */ - void itemDeletedSlot(TMPXItemId id); + void itemDeletedSlot(TMPXItemId &id); /** * saves provided item id into mLatestModifiedItemId @@ -139,9 +144,14 @@ virtual void itemModifiedSlot(const TMPXItemId &itemId); /** - * Sets boolean mListComplete to true; + * Sets boolean mVideoListComplete to true; */ - void listCompleteSlot(); + void videoListCompleteSlot(); + + /** + * Sets boolean mAlbumListcomplete to true; + */ + void albumListCompleteSlot(); private: /** @@ -170,9 +180,14 @@ QList mLatesListData; /** - * True if listCompleteSlot has been called. + * True if videoListCompleteSlot has been called. */ - bool mListComplete; + bool mVideoListComplete; + + /** + * True if albumListCompleteSlot has been called. + */ + bool mAlbumListComplete; }; #endif diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/src/stubsignalreceiver.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/src/stubsignalreceiver.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/src/stubsignalreceiver.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -26,7 +26,8 @@ mLatestItemId(TMPXItemId::InvalidId()), mLatestModifiedItemId(TMPXItemId::InvalidId()), mLatestInteger(-1), -mListComplete(false) +mVideoListComplete(false), +mAlbumListComplete(false) { } @@ -51,7 +52,8 @@ mLatestModifiedItemId = TMPXItemId::InvalidId(); mLatesListData.clear(); mLatestInteger = -1; - mListComplete = false; + mVideoListComplete = false; + mAlbumListComplete = false; } // ----------------------------------------------------------------------------- @@ -101,12 +103,21 @@ } // ----------------------------------------------------------------------------- -// getListComplete +// getVideoListComplete // ----------------------------------------------------------------------------- // -bool StubSignalReceiver::getListComplete() +bool StubSignalReceiver::getVideoListComplete() { - return mListComplete; + return mVideoListComplete; +} + +// ----------------------------------------------------------------------------- +// getAlbumListComplete +// ----------------------------------------------------------------------------- +// +bool StubSignalReceiver::getAlbumListComplete() +{ + return mAlbumListComplete; } // ----------------------------------------------------------------------------- @@ -189,7 +200,7 @@ // albumListAvailableSlot // ----------------------------------------------------------------------------- // -void StubSignalReceiver::albumListAvailableSlot(TMPXItemId albumId, +void StubSignalReceiver::albumListAvailableSlot(TMPXItemId &albumId, CMPXMediaArray *albumItems) { mLatestItemId = albumId; @@ -200,7 +211,7 @@ // itemDeletedSlot // ----------------------------------------------------------------------------- // -void StubSignalReceiver::itemDeletedSlot(TMPXItemId id) +void StubSignalReceiver::itemDeletedSlot(TMPXItemId &id) { mLatestItemId = id; } @@ -215,12 +226,21 @@ } // ----------------------------------------------------------------------------- -// listCompleteSlot +// videoListCompleteSlot // ----------------------------------------------------------------------------- // -void StubSignalReceiver::listCompleteSlot() +void StubSignalReceiver::videoListCompleteSlot() { - mListComplete = true; + mVideoListComplete = true; +} + +// ----------------------------------------------------------------------------- +// albumListCompleteSlot +// ----------------------------------------------------------------------------- +// +void StubSignalReceiver::albumListCompleteSlot() +{ + mAlbumListComplete = true; } // ----------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideodeleteworker/src/testvideodeleteworker.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker/src/testvideodeleteworker.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker/src/testvideodeleteworker.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -100,6 +100,8 @@ // void TestVideoDeleteWorker::testRequestDelete() { + qRegisterMetaType >("QList& "); + mDummyCollection->mDeleteFails = false; QList itemIds; // empty list @@ -125,7 +127,8 @@ QVERIFY(mTestObject->mRemoveBuffer.count() == 2); // delete -call fails - QSignalSpy spysignal(mTestObject, SIGNAL( deleteStartupFailed(QList))); + + QSignalSpy spysignal(mTestObject, SIGNAL(deleteStartupFailed(QList&))); mDummyCollection->mDeleteFails = true; itemIds.clear(); itemIds.append(TMPXItemId(0,0)); @@ -133,7 +136,7 @@ QVERIFY(mTestObject->mRemoveBuffer.count() == 3); QCoreApplication::processEvents(); - QVERIFY(mTestObject->mRemoveBuffer.count() == 0); + QCOMPARE(mTestObject->mRemoveBuffer.count(), 0); QVERIFY(spysignal.count() == 1); } diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideomodel_p/inc/testvideomodel_p.h --- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/inc/testvideomodel_p.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/inc/testvideomodel_p.h Mon Aug 23 14:27:29 2010 +0300 @@ -257,12 +257,12 @@ /** * verifies videoListCompleteSlot */ - void testListCompleteSlot(); - + void testVideoListCompleteSlot(); + /** - * verifies albumListCompleteSlot; + * verifies albumListCompleteSlot */ - void testalbumListCompleteSlot(); + void testAlbumListCompleteSlot(); private: diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideomodel_p/src/testvideomodel_p.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/src/testvideomodel_p.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/src/testvideomodel_p.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -104,6 +104,7 @@ // void TestVideoModel_p::cleanup() { + disconnect(); if(mTestObject) { delete mTestObject; @@ -1425,27 +1426,31 @@ } // ----------------------------------------------------------------------------- -// testListCompleteSlot +// testVideoListCompleteSlot // ----------------------------------------------------------------------------- // -void TestVideoModel_p::testListCompleteSlot() +void TestVideoModel_p::testVideoListCompleteSlot() { QVERIFY(connect(this, SIGNAL(signalListCompleteSlot()), mTestObject, SLOT(videoListCompleteSlot()))); - QSignalSpy spy(mStubModel, SIGNAL(modelReady())); + QSignalSpy modelReadySpy(mStubModel, SIGNAL(modelReady())); + QSignalSpy albumListReadySpy(mStubModel, SIGNAL(albumListReady())); emit signalListCompleteSlot(); - QCOMPARE(spy.count(), 1); + QCOMPARE(modelReadySpy.count(), 1); + QCOMPARE(albumListReadySpy.count(), 0); } // ----------------------------------------------------------------------------- -// testalbumListCompleteSlot +// testAlbumListCompleteSlot // ----------------------------------------------------------------------------- // -void TestVideoModel_p::testalbumListCompleteSlot() +void TestVideoModel_p::testAlbumListCompleteSlot() { QVERIFY(connect(this, SIGNAL(signalListCompleteSlot()), mTestObject, SLOT(albumListCompleteSlot()))); - QSignalSpy spy(mStubModel, SIGNAL(albumListReady())); + QSignalSpy modelReadySpy(mStubModel, SIGNAL(modelReady())); + QSignalSpy albumListReadySpy(mStubModel, SIGNAL(albumListReady())); emit signalListCompleteSlot(); - QCOMPARE(spy.count(), 1); + QCOMPARE(albumListReadySpy.count(), 1); + QCOMPARE(modelReadySpy.count(), 0); } // End of file diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videodatacontainer.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videodatacontainer.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videodatacontainer.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -160,7 +160,7 @@ // idFromIndex // ----------------------------------------------------------------------------- // -TMPXItemId& VideoDataContainer::idFromIndex(const int &index) const +const TMPXItemId& VideoDataContainer::idFromIndex(const int &index) const { if(index >= 0 && index < mMediaIds.count()) { diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -812,6 +812,7 @@ // these signals are emitted during sorting procedure from the fw QSignalSpy spyAboutToChange(mTestObject, SIGNAL(layoutAboutToBeChanged())); QSignalSpy spyChanged(mTestObject, SIGNAL(layoutChanged())); + QSignalSpy spySorted(mTestObject, SIGNAL(modelSorted())); QString name1 = "cc"; QString name2 = "bb"; @@ -851,7 +852,6 @@ Qt::SortOrder sortingOrder; // first sort call, includes timer creation and setup - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->doSorting(VideoCollectionCommon::KeyTitle, Qt::AscendingOrder); // need to wait for awhile to make sure zero-counter gets // processing time. @@ -860,7 +860,7 @@ QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyTitle); QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyTitle); QCOMPARE(sortingOrder, Qt::AscendingOrder); @@ -868,23 +868,24 @@ // reset spys spyAboutToChange.clear(); spyChanged.clear(); + spySorted.clear(); // second sort call, should use same timer appropriately - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->doSorting(VideoCollectionCommon::KeyTitle, Qt::DescendingOrder); QTest::qWait(500); QCOMPARE(spyAboutToChange.count(), 1); QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyTitle); QCOMPARE(mTestObject->sortOrder(), Qt::DescendingOrder); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyTitle); QCOMPARE(sortingOrder, Qt::DescendingOrder); // reset spys spyAboutToChange.clear(); - spyChanged.clear(); + spyChanged.clear(); + spySorted.clear(); // double call without first letting timer to timeout VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; @@ -895,130 +896,132 @@ QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyTitle); QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyTitle); QCOMPARE(sortingOrder, Qt::AscendingOrder); spyAboutToChange.clear(); spyChanged.clear(); + spySorted.clear(); // syncronous call checks - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->doSorting(VideoCollectionCommon::KeyTitle, Qt::DescendingOrder, false); QCOMPARE(spyAboutToChange.count(), 1); QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyTitle); QCOMPARE(mTestObject->sortOrder(), Qt::DescendingOrder); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyTitle); QCOMPARE(sortingOrder, Qt::DescendingOrder); spyAboutToChange.clear(); spyChanged.clear(); + spySorted.clear(); - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->doSorting(VideoCollectionCommon::KeyTitle, Qt::AscendingOrder, false); QCOMPARE(spyAboutToChange.count(), 1); QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyTitle); QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyTitle); QCOMPARE(sortingOrder, Qt::AscendingOrder); spyAboutToChange.clear(); spyChanged.clear(); + spySorted.clear(); // check that layout signals are not send if the sorting values don't change. - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->doSorting(VideoCollectionCommon::KeyTitle, Qt::AscendingOrder); QCOMPARE(spyAboutToChange.count(), 0); QCOMPARE(spyChanged.count(), 0); + QCOMPARE(spySorted.count(), 0); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyTitle); QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 0); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyTitle); QCOMPARE(sortingOrder, Qt::AscendingOrder); spyAboutToChange.clear(); spyChanged.clear(); + spySorted.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); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyDateTime); QCOMPARE(sortingOrder, Qt::AscendingOrder); spyAboutToChange.clear(); spyChanged.clear(); + spySorted.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); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeySizeValue); QCOMPARE(sortingOrder, Qt::AscendingOrder); spyAboutToChange.clear(); spyChanged.clear(); + spySorted.clear(); // number of items role check - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->doSorting(VideoCollectionCommon::KeyNumberOfItems, Qt::AscendingOrder); QTest::qWait(500); QCOMPARE(spyAboutToChange.count(), 1); QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyNumberOfItems); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + QCOMPARE(spySorted.count(), 1); mTestObject->getSorting(sortingRole, sortingOrder); QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyNumberOfItems); QCOMPARE(sortingOrder, Qt::AscendingOrder); spyAboutToChange.clear(); - spyChanged.clear(); + spyChanged.clear(); + spySorted.clear(); // invalid role call, sorting should be set to date - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->mType = VideoCollectionCommon::EModelTypeAllVideos; mTestObject->doSorting(VideoCollectionCommon::KeyTitle - 100, Qt::AscendingOrder); QTest::qWait(500); QCOMPARE(spyAboutToChange.count(), 1); QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyDateTime); + QCOMPARE(spySorted.count(), 1); + spyAboutToChange.clear(); spyChanged.clear(); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + spySorted.clear(); // invalid role call, model type is categories, sorting should be set to VideoCollectionCommon::KeyTitle - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->mType = VideoCollectionCommon::EModelTypeCollections; mTestObject->doSorting(VideoCollectionCommon::KeyTitle - 100, Qt::AscendingOrder); QTest::qWait(500); QCOMPARE(spyAboutToChange.count(), 1); QCOMPARE(spyChanged.count(), 1); QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyTitle); + QCOMPARE(spySorted.count(), 1); + spyAboutToChange.clear(); spyChanged.clear(); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1); + spySorted.clear(); // sync sorting call for non -changing sort order (for coverity) - VideoThumbnailData::mStartBackgroundFetchingCallCount = 0; mTestObject->mType = VideoCollectionCommon::EModelTypeAllVideos; mTestObject->mIdleSortTimer = 0; mTestObject->doSorting(VideoCollectionCommon::KeyTitle - 100, Qt::AscendingOrder, false); @@ -1030,7 +1033,7 @@ QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyDateTime); spyAboutToChange.clear(); spyChanged.clear(); - QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 2); + QCOMPARE(spySorted.count(), 2); } // --------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videocollectionwrapper.h --- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videocollectionwrapper.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videocollectionwrapper.h Mon Aug 23 14:27:29 2010 +0300 @@ -52,7 +52,7 @@ /** * returns mProxyModel */ - VideoSortFilterProxyModel* getModel(int type) + VideoSortFilterProxyModel* getModel(int /*type*/) { return mProxyModel; } diff -r 21fe8338c6bf -r 4bfa887905cf videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp --- a/videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 76.1.7 % +// Version : %version: 76.1.8 % // INCLUDE FILES #include @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -231,6 +232,15 @@ } list->setEnabledAnimations(HbAbstractItemView::None); + + list->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); + + HbScrollBar* bar = list->verticalScrollBar(); + + if(bar) + { + bar->setInteractive(true); + } } // --------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/inc/mpxhelixplaybackplugindefs.h --- a/videoplayback/videoplaybackview/inc/mpxhelixplaybackplugindefs.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Externalizable container for DSA region -* -*/ - -// Version : %version: da1mmcf#2 % - - - -#ifndef MPXHELIXPLAYBACKPLUGINDEFS_H_ -#define MPXHELIXPLAYBACKPLUGINDEFS_H_ - -enum TMPXVideoPlaybackState -{ - EMPXVideoNotInitialized, - EMPXVideoInitializing, - EMPXVideoInitialized, - EMPXVideoBuffering, - EMPXVideoPlaying, - EMPXVideoPaused, - EMPXVideoStopped, - EMPXVideoSeeking, - EMPXNumberOfStates -}; - - -enum TMPXVideoMode -{ - EMPXVideoLocal, - EMPXVideoStreaming, - EMPXVideoLiveStreaming, - EMPXVideoProgressiveDownload, - EMPXNumberOfModes -}; - - - -#endif /*MPXHELIXPLAYBACKPLUGINDEFS_H_*/ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/resources/videoplaybackview.qrc --- a/videoplayback/videoplaybackview/resources/videoplaybackview.qrc Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/resources/videoplaybackview.qrc Mon Aug 23 14:27:29 2010 +0300 @@ -3,7 +3,7 @@ animations/rn_preroll_anim.axml animations/generic_preroll_anim.axml - videoplaybackview.docml + videoplaybackview.docml.bin effects/controlbar_appear.fxml effects/controlbar_disappear.fxml diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testcontrolscontroller/stub/inc/mpxvideoplaybackdisplayhandler.h --- a/videoplayback/videoplaybackview/tsrc/testcontrolscontroller/stub/inc/mpxvideoplaybackdisplayhandler.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of video playback display handler -* -*/ - -// Version : %version: 2 % - - -#ifndef __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ -#define __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ - -// INCLUDES - -#include -#include -#include -#ifdef SYMBIAN_BUILD_GCE -#include -#else -#include -#endif - - -// -// CLASS DECLARATION -// -class MMPXPlaybackUtility; -class CMPXVideoViewWrapper; -class VideoPlaybackViewFileDetails; - -/* - * CMPXVideoPlaybackDisplayHandler - * - */ -class CMPXVideoPlaybackDisplayHandler : public CBase -#ifndef SYMBIAN_BUILD_GCE - , public MDirectScreenAccess -#endif -{ - // - // To save user's preference for scaling type in video ratio + screen ratio - // - typedef struct - { - TReal32 videoRatio; - TReal32 screenRatio; - TMMFScalingType scalingType; - } TMPXAspectRatio ; - - public: - - ~CMPXVideoPlaybackDisplayHandler(); - - static CMPXVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ); - - void CreateDisplayWindowL( RWsSession& aWs, - CWsScreenDevice& aScreenDevice, - RWindow& aWin, - TRect aDisplayRect ); - - void RemoveDisplayWindow(); - - void HandleVideoDisplayMessageL( CMPXMessage* aMessage ); - - TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ); - - TInt SetDefaultAspectRatioL( VideoPlaybackViewFileDetails* aFileDetails, - TReal aDisplayAspectRatio ); - - void UpdateVideoRectL( TRect aRect, TBool transitionEffect ); - - private: - - CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ); - - void ConstructL(); - - void LoadAspectRatioL(); - - void SaveAspectRatioL(); - - void SetVideoRectL( TRect aClipRect ); - - void CalculateVideoRectL(); - - static TInt UpdateVideoRectTimeOutL( TAny* aPtr ); - -#ifdef SYMBIAN_BUILD_GCE - - private: - void AddDisplayWindowL( CWsScreenDevice& aScreenDevice, - RWindowBase& aWindowBase, - RWindow* aWin ); - - void SurfaceCreatedL( CMPXMessage* aMessage ); - void SurfaceChangedL( CMPXMessage* aMessage ); - void SurfaceRemoved(); - TInt SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd ); - -#else - - private: - // - // MDirectScreenAccess Implementation - // - void AbortNow( RDirectScreenAccess::TTerminationReasons aReason ); - void Restart( RDirectScreenAccess::TTerminationReasons aReason ); - - TInt CreateAspectRatioCommandL( TMPXVideoPlaybackCommand aCmd ); - - void SetDisplayWindowL( RWsSession& aWs, - CWsScreenDevice& aScreenDevice, - RWindowBase& aWin, - TRect aClipRect ); - void RestartDsaL(); - void CreateAbortDsaCmdL(); - -#endif - - public: - MMPXPlaybackUtility* iPlaybackUtility; - - RArray iAspectRatioArray; - TInt iCurrentIndexForAspectRatio; - TReal iDisplayAspectRatio; - - TRect iWindowRect; - - TReal32 iTlXDiff; - TReal32 iTlYDiff; - TReal32 iBrXDiff; - TReal32 iBrYDiff; - - TInt iTransitionEffectCnt; - - CPeriodic* iResizingTimer; - CMPXVideoViewWrapper* iViewWrapper; - -#ifdef SYMBIAN_BUILD_GCE - CMediaClientVideoDisplay* iVideoDisplay; - - RWindowBase* iWindowBase; - TBool iSurfaceCached; - TSurfaceId iSurfaceId; - TRect iCropRect; - TVideoAspectRatio iAspectRatio; - TReal32 iScaleWidth; - TReal32 iScaleHeight; - TInt iHorizontalPosition; - TInt iVerticalPosition; - TVideoRotation iRotation; - TAutoScaleType iAutoScale; -#else - CDirectScreenAccess* iDirectScreenAccess; -#endif - -}; - -#endif // __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testcontrolscontroller/testcontrolscontroller.pro --- a/videoplayback/videoplaybackview/tsrc/testcontrolscontroller/testcontrolscontroller.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testcontrolscontroller/testcontrolscontroller.pro Mon Aug 23 14:27:29 2010 +0300 @@ -14,16 +14,16 @@ # Description: Project file for building testcontrolscontroller # # -# Version : %version: 8 % +# Version : %version: 9 % TEMPLATE = app TARGET = testcontrolscontroller CONFIG += qtestlib hb qt -LIBS += -lxqserviceutil.dll \ - -lefsrv.dll +LIBS = -lefsrv.dll +INCLUDEPATH = hbstub INCLUDEPATH += stub/inc \ ../inc \ ../../inc \ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp --- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 15 % +// Version : %version: 16 % #include #include @@ -40,7 +40,7 @@ #include "../stub/inc/videobaseplaybackview.h" #include "../stub/inc/videoplaybackviewfiledetails.h" -#include "../stub/inc/mpxvideoplaybackdisplayhandler.h" +#include "../stub/inc/videoplaybackdisplayhandler.h" #include "../stub/inc/videoplaybackcontrolscontroller.h" diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxvideoplaybackdisplayhandler.h --- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxvideoplaybackdisplayhandler.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of video playback display handler -* -*/ - -// Version : %version: 7 % - - -#ifndef __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ -#define __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ - -// INCLUDES - -#include -#include -#include -#include - - -// -// CLASS DECLARATION -// -class MMPXPlaybackUtility; -class CMPXVideoViewWrapper; -class VideoPlaybackViewFileDetails; - -/* - * CMPXVideoPlaybackDisplayHandler - * - */ -class CMPXVideoPlaybackDisplayHandler : public CBase -{ - public: - - ~CMPXVideoPlaybackDisplayHandler(); - - static CMPXVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ); - - void CreateDisplayWindowL( RWsSession& aWs, - CWsScreenDevice& aScreenDevice, - RWindow& aWin, - TRect aDisplayRect ); - - void RemoveDisplayWindow(); - - void HandleVideoDisplayMessageL( CMPXMessage* aMessage ); - - TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ); - - TInt SetDefaultAspectRatioL( VideoPlaybackViewFileDetails* aFileDetails, - TReal32 aDisplayAspectRatio ); - - void UpdateVideoRectL( TRect aRect, TBool transitionEffect ); - - private: - - CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ); - - void ConstructL(); - - public: - MMPXPlaybackUtility* iPlaybackUtility; - CMPXVideoViewWrapper* iViewWrapper; - CMediaClientVideoDisplay* iVideoDisplay; - - TRect iRect; - TInt iAspectRatio; - TInt iCommand; -}; - -#endif // __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxvideoplaybackuserinputhandler.h --- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxvideoplaybackuserinputhandler.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of MPXVideoPlaybackUserInputHandler -* -*/ - -// Version : %version: 4 % - - - -#ifndef MPXVIDEOPLAYBACKUSERINPUTHANDLER_H_ -#define MPXVIDEOPLAYBACKUSERINPUTHANDLER_H_ - -// INCLUDES - - -// FORWARD DECLARATIONS -class CMPXVideoViewWrapper; - -// CLASS DECLARATION - -class CMPXVideoPlaybackUserInputHandler : public CBase -{ - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CMPXVideoPlaybackUserInputHandler* NewL( - CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ); - - /** - * Destructor. - */ - IMPORT_C virtual ~CMPXVideoPlaybackUserInputHandler(); - - private: - - /** - * C++ default constructor. - */ - CMPXVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ); - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL( TBool aTvOutConnected ); - - public: - void ProcessKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - void SetForeground( TBool aForeground ); - - void HandleTVOutEventL(TBool aTVOutConnected); - - private: - TBool iTVOutConnected; // Flag to indicate if TV is connected - TBool iForeground; - CMPXVideoViewWrapper* iViewWrapper; -}; - - -#endif /*MPXVIDEOPLAYBACKUSERINPUTHANDLER_H_*/ - -// End of File diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/videoplaybackdisplayhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/videoplaybackdisplayhandler.h Mon Aug 23 14:27:29 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: Implementation of video playback display handler +* +*/ + +// Version : %version: 8 % + + +#ifndef __CVIDEOPLAYBACKDISPLAYHANDLER_H__ +#define __CVIDEOPLAYBACKDISPLAYHANDLER_H__ + +// INCLUDES + +#include +#include +#include +#include + + +// +// CLASS DECLARATION +// +class MMPXPlaybackUtility; +class CMPXVideoViewWrapper; +class VideoPlaybackViewFileDetails; + +/* + * CVideoPlaybackDisplayHandler + * + */ +class CVideoPlaybackDisplayHandler : public CBase +{ + public: + + ~CVideoPlaybackDisplayHandler(); + + static CVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ); + + void CreateDisplayWindowL( RWsSession& aWs, + CWsScreenDevice& aScreenDevice, + RWindow& aWin, + TRect aDisplayRect ); + + void RemoveDisplayWindow(); + + void HandleVideoDisplayMessageL( CMPXMessage* aMessage ); + + TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ); + + TInt SetDefaultAspectRatioL( VideoPlaybackViewFileDetails* aFileDetails, + TReal32 aDisplayAspectRatio ); + + void UpdateVideoRectL( TRect aRect, TBool transitionEffect ); + + private: + + CVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ); + + void ConstructL(); + + public: + MMPXPlaybackUtility* iPlaybackUtility; + CMPXVideoViewWrapper* iViewWrapper; + CMediaClientVideoDisplay* iVideoDisplay; + + TRect iRect; + TInt iAspectRatio; + TInt iCommand; +}; + +#endif // __CVIDEOPLAYBACKDISPLAYHANDLER_H__ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/videoplaybackuserinputhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/videoplaybackuserinputhandler.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,76 @@ +/* +* 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: Implementation of VideoPlaybackUserInputHandler +* +*/ + +// Version : %version: 5 % + + + +#ifndef VIDEOPLAYBACKUSERINPUTHANDLER_H_ +#define VIDEOPLAYBACKUSERINPUTHANDLER_H_ + +// INCLUDES + + +// FORWARD DECLARATIONS +class CMPXVideoViewWrapper; + +// CLASS DECLARATION + +class CVideoPlaybackUserInputHandler : public CBase +{ + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CVideoPlaybackUserInputHandler* NewL( + CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CVideoPlaybackUserInputHandler(); + + private: + + /** + * C++ default constructor. + */ + CVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL( TBool aTvOutConnected ); + + public: + void ProcessKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + void SetForeground( TBool aForeground ); + + void HandleTVOutEventL(TBool aTVOutConnected); + + private: + TBool iTVOutConnected; // Flag to indicate if TV is connected + TBool iForeground; + CMPXVideoViewWrapper* iViewWrapper; +}; + + +#endif /*VIDEOPLAYBACKUSERINPUTHANDLER_H_*/ + +// End of File diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp --- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of video playback display handler -* -*/ - -// Version : %version: 8 % - -#include -#include -#include -#include -#include -#include - -#include "mpxvideoviewwrapper.h" -#include "mpxvideoplaybackdisplayhandler.h" -#include "mpxvideoregion.h" -#include "videoplaybackviewfiledetails.h" - - -CMPXVideoPlaybackDisplayHandler::CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ) - : iPlaybackUtility( aPlayUtil ) - , iViewWrapper( aViewWrapper ) -{ -} - -CMPXVideoPlaybackDisplayHandler::~CMPXVideoPlaybackDisplayHandler() -{ -} - -CMPXVideoPlaybackDisplayHandler* -CMPXVideoPlaybackDisplayHandler::NewL( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ) -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::NewL()")); - - CMPXVideoPlaybackDisplayHandler* self = - new(ELeave) CMPXVideoPlaybackDisplayHandler( aPlayUtil, aViewWrapper ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::ConstructL() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackDisplayHandler::ConstructL() -{ -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL( - RWsSession& aWs, - CWsScreenDevice& aScreenDevice, - RWindow& aWin, - TRect aDisplayRect ) -{ - Q_UNUSED( aWs ); - Q_UNUSED( aScreenDevice ); - Q_UNUSED( aWin ); - Q_UNUSED( aDisplayRect ); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow() -{ - if ( iVideoDisplay ) - { - delete iVideoDisplay; - iVideoDisplay = NULL; - } -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* /*aMessage*/ ) -{ -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::SetAspectRatioL() -// ------------------------------------------------------------------------------------------------- -// -TInt CMPXVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ) -{ - iCommand = aCmd; - - switch ( aCmd ) - { - case EPbCmdNaturalAspectRatio: - { - iAspectRatio = EMMFNatural; - break; - } - case EPbCmdZoomAspectRatio: - { - iAspectRatio = EMMFZoom; - break; - } - case EPbCmdStretchAspectRatio: - { - iAspectRatio = EMMFStretch; - break; - } - } - - return iAspectRatio; -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL -// ------------------------------------------------------------------------------------------------- -// -TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( - VideoPlaybackViewFileDetails* aFileDetails, - TReal32 aDisplayAspectRatio ) -{ - Q_UNUSED( aFileDetails ); - Q_UNUSED( aDisplayAspectRatio ); - - return iAspectRatio; -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL( TRect aClipRect, TBool transitionEffect ) -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()")); - - Q_UNUSED( transitionEffect ); - - iRect = aClipRect; -} - -// End of File diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackuserinputhandler.cpp --- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackuserinputhandler.cpp Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of playback view's input handler -* -*/ - -// Version : %version: 6 % - - -// INCLUDE FILES -#include -#include -#include // RWindowBase -#include -#include -#include -#include -#include -#include - -#include "mpxvideo_debug.h" -#include "mpxvideoviewwrapper.h" -#include "mpxcommonvideoplaybackview.hrh" -#include "../inc/mpxvideoplaybackuserinputhandler.h" - - -// CONSTANTS -const TInt KMPXMicroSecondsInASecond = 1000000; - - -// ======== MEMBER FUNCTIONS ======================================================================= - -// ------------------------------------------------------------------------------------------------- -// MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler() -// ------------------------------------------------------------------------------------------------- -// -CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ) - : iViewWrapper( aWrapper ) -{ -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::NewL() -// ------------------------------------------------------------------------------------------------- -// -CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL( - CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ) -{ - MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::NewL()")); - - CMPXVideoPlaybackUserInputHandler* self = - new (ELeave) CMPXVideoPlaybackUserInputHandler( aWrapper ); - CleanupStack::PushL( self ); - self->ConstructL( aTvOutConnected ); - CleanupStack::Pop(); - return self; -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::ConstructL -// Symbian 2nd phase constructor can leave. -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::ConstructL( TBool aTvOutConnected ) -{ - Q_UNUSED( aTvOutConnected ); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler() -// ------------------------------------------------------------------------------------------------- -// -CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler() -{ - -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) -{ - Q_UNUSED( aKeyEvent ); - Q_UNUSED( aType ); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::SetForeground() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::SetForeground(TBool aForeground) -{ - Q_UNUSED( aForeground ); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::HandleTVOutEventL( TBool aTVOutConnected ) -{ - Q_UNUSED( aTVOutConnected ); -} - -// EOF diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/videoplaybackdisplayhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/videoplaybackdisplayhandler.cpp Mon Aug 23 14:27:29 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: Implementation of video playback display handler +* +*/ + +// Version : %version: 9 % + +#include +#include +#include +#include +#include +#include + +#include "mpxvideoviewwrapper.h" +#include "videoplaybackdisplayhandler.h" +#include "mpxvideoregion.h" +#include "videoplaybackviewfiledetails.h" + + +CVideoPlaybackDisplayHandler::CVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ) + : iPlaybackUtility( aPlayUtil ) + , iViewWrapper( aViewWrapper ) +{ +} + +CVideoPlaybackDisplayHandler::~CVideoPlaybackDisplayHandler() +{ +} + +CVideoPlaybackDisplayHandler* +CVideoPlaybackDisplayHandler::NewL( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::NewL()")); + + CVideoPlaybackDisplayHandler* self = + new(ELeave) CVideoPlaybackDisplayHandler( aPlayUtil, aViewWrapper ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::ConstructL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::ConstructL() +{ +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::CreateDisplayWindowL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::CreateDisplayWindowL( + RWsSession& aWs, + CWsScreenDevice& aScreenDevice, + RWindow& aWin, + TRect aDisplayRect ) +{ + Q_UNUSED( aWs ); + Q_UNUSED( aScreenDevice ); + Q_UNUSED( aWin ); + Q_UNUSED( aDisplayRect ); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::RemoveDisplayWindow() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::RemoveDisplayWindow() +{ + if ( iVideoDisplay ) + { + delete iVideoDisplay; + iVideoDisplay = NULL; + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* /*aMessage*/ ) +{ +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SetAspectRatioL() +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ) +{ + iCommand = aCmd; + + switch ( aCmd ) + { + case EPbCmdNaturalAspectRatio: + { + iAspectRatio = EMMFNatural; + break; + } + case EPbCmdZoomAspectRatio: + { + iAspectRatio = EMMFZoom; + break; + } + case EPbCmdStretchAspectRatio: + { + iAspectRatio = EMMFStretch; + break; + } + } + + return iAspectRatio; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SetDefaultAspectRatioL +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( + VideoPlaybackViewFileDetails* aFileDetails, + TReal32 aDisplayAspectRatio ) +{ + Q_UNUSED( aFileDetails ); + Q_UNUSED( aDisplayAspectRatio ); + + return iAspectRatio; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::UpdateVideoRectL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::UpdateVideoRectL( TRect aClipRect, TBool transitionEffect ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::UpdateVideoRectL()")); + + Q_UNUSED( transitionEffect ); + + iRect = aClipRect; +} + +// End of File diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/videoplaybackuserinputhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/videoplaybackuserinputhandler.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of playback view's input handler +* +*/ + +// Version : %version: 7 % + + +// INCLUDE FILES +#include +#include +#include // RWindowBase +#include +#include +#include +#include +#include +#include + +#include "mpxvideo_debug.h" +#include "mpxvideoviewwrapper.h" +#include "mpxcommonvideoplaybackview.hrh" +#include "../inc/videoplaybackuserinputhandler.h" + + +// CONSTANTS +const TInt KMPXMicroSecondsInASecond = 1000000; + + +// ======== MEMBER FUNCTIONS ======================================================================= + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::CVideoPlaybackUserInputHandler() +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaybackUserInputHandler::CVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ) + : iViewWrapper( aWrapper ) +{ +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::NewL() +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaybackUserInputHandler* CVideoPlaybackUserInputHandler::NewL( + CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ) +{ + MPX_DEBUG(_L("CVideoPlaybackUserInputHandler::NewL()")); + + CVideoPlaybackUserInputHandler* self = + new (ELeave) CVideoPlaybackUserInputHandler( aWrapper ); + CleanupStack::PushL( self ); + self->ConstructL( aTvOutConnected ); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::ConstructL +// Symbian 2nd phase constructor can leave. +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::ConstructL( TBool aTvOutConnected ) +{ + Q_UNUSED( aTvOutConnected ); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::~CVideoPlaybackUserInputHandler() +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaybackUserInputHandler::~CVideoPlaybackUserInputHandler() +{ + +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::ProcessKeyEvent() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) +{ + Q_UNUSED( aKeyEvent ); + Q_UNUSED( aType ); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::SetForeground() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::SetForeground(TBool aForeground) +{ + Q_UNUSED( aForeground ); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleTVOutEvent() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::HandleTVOutEventL( TBool aTVOutConnected ) +{ + Q_UNUSED( aTVOutConnected ); +} + +// EOF diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/testmpxvideoviewwrapper.pro --- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/testmpxvideoviewwrapper.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/testmpxvideoviewwrapper.pro Mon Aug 23 14:27:29 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building testmpxvideoviewwrapper # # -# Version : %version: 9 % +# Version : %version: 10 % TEMPLATE = app @@ -23,6 +23,7 @@ DEPENDPATH += inc src stub/src stub/inc +INCLUDEPATH = hbstub INCLUDEPATH += stub/inc \ ../inc \ ../../inc \ @@ -37,7 +38,7 @@ # Input HEADERS += testmpxvideoviewwrapper.h \ stub/inc/videobaseplaybackview.h \ - mpxvideoplaybackuserinputhandler.h \ + videoplaybackuserinputhandler.h \ videoplaybackcontrolscontroller.h \ videoplaybackviewfiledetails.h \ mpxplaybackutility.h \ @@ -47,11 +48,11 @@ SOURCES += testmpxvideoviewwrapper.cpp \ stub/src/videobaseplaybackview.cpp \ - mpxvideoplaybackdisplayhandler.cpp \ + videoplaybackdisplayhandler.cpp \ videoplaybackviewfiledetails.cpp \ videoplaybackcontrolscontroller.cpp \ mpxplaybackutility.cpp \ mpxcollectionutility.cpp \ mpxcollectionplaylist.cpp \ - mpxvideoplaybackuserinputhandler.cpp \ + videoplaybackuserinputhandler.cpp \ ../../viewsrc/mpxvideoviewwrapper.cpp diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testuserinputhandler/inc/testuserinputhandler.h --- a/videoplayback/videoplaybackview/tsrc/testuserinputhandler/inc/testuserinputhandler.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testuserinputhandler/inc/testuserinputhandler.h Mon Aug 23 14:27:29 2010 +0300 @@ -26,7 +26,7 @@ // forward declaration class CMPXVideoViewWrapper; -class CMPXVideoPlaybackUserInputHandler; +class CVideoPlaybackUserInputHandler; class VideoBasePlaybackView; @@ -68,7 +68,7 @@ signals: private: - CMPXVideoPlaybackUserInputHandler* mUserInputHdlr; + CVideoPlaybackUserInputHandler* mUserInputHdlr; VideoBasePlaybackView* mBaseVideoView; CMPXVideoViewWrapper* mVideoViewWrapper; diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testuserinputhandler/src/testuserinputhandler.cpp --- a/videoplayback/videoplaybackview/tsrc/testuserinputhandler/src/testuserinputhandler.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testuserinputhandler/src/testuserinputhandler.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -28,7 +28,7 @@ #include "../stub/inc/videobaseplaybackview.h" #define private public -#include "mpxvideoplaybackuserinputhandler.h" +#include "videoplaybackuserinputhandler.h" #undef private @@ -63,7 +63,7 @@ mBaseVideoView = new VideoBasePlaybackView(); mVideoViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView ); - mUserInputHdlr = CMPXVideoPlaybackUserInputHandler::NewL(mVideoViewWrapper, false); + mUserInputHdlr = CVideoPlaybackUserInputHandler::NewL(mVideoViewWrapper, false); } // --------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testuserinputhandler/testuserinputhandler.pro --- a/videoplayback/videoplaybackview/tsrc/testuserinputhandler/testuserinputhandler.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testuserinputhandler/testuserinputhandler.pro Mon Aug 23 14:27:29 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building testuserinputhandler # # -# Version : %version: 3 % +# Version : %version: 4 % TEMPLATE = app TARGET = testuserinputhandler @@ -41,7 +41,7 @@ stub/inc/hal.h \ stub/inc/centralrepository.h \ inc/testuserinputhandler.h \ - ../../viewinc/mpxvideoplaybackuserinputhandler.h + ../../viewinc/videoplaybackuserinputhandler.h SOURCES += stub/src/mpxvideoviewwrapper.cpp \ stub/src/videobaseplaybackview.cpp \ @@ -49,4 +49,4 @@ stub/src/hal.cpp \ stub/src/centralrepository.cpp \ src/testuserinputhandler.cpp \ - ../../viewsrc/mpxvideoplaybackuserinputhandler.cpp + ../../viewsrc/videoplaybackuserinputhandler.cpp diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/inc/testvideodisplayhandler.h --- a/videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/inc/testvideodisplayhandler.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/inc/testvideodisplayhandler.h Mon Aug 23 14:27:29 2010 +0300 @@ -23,7 +23,7 @@ #include // forward declaration -class CMPXVideoPlaybackDisplayHandler; +class CVideoPlaybackDisplayHandler; class MMPXPlaybackUtility; class VideoBasePlaybackView; class CMPXVideoViewWrapper; @@ -65,7 +65,7 @@ private: - CMPXVideoPlaybackDisplayHandler* mDispHdlr; + CVideoPlaybackDisplayHandler* mDispHdlr; MMPXPlaybackUtility* mPlaybackUtility; VideoBasePlaybackView* mBaseVideoView; CMPXVideoViewWrapper* mVideoViewWrapper; diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/src/testvideodisplayhandler.cpp --- a/videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/src/testvideodisplayhandler.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/src/testvideodisplayhandler.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -31,7 +31,7 @@ #include "mpxvideoviewwrapper.h" #define private public -#include "mpxvideoplaybackdisplayhandler.h" +#include "videoplaybackdisplayhandler.h" #undef private @@ -65,10 +65,10 @@ { mPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault ); - mBaseVideoView = new VideoBasePlaybackView(); - mVideoViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView ); + mBaseVideoView = new VideoBasePlaybackView(); + mVideoViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView ); - mDispHdlr = CMPXVideoPlaybackDisplayHandler::NewL(mPlaybackUtility, mVideoViewWrapper); + mDispHdlr = CVideoPlaybackDisplayHandler::NewL(mPlaybackUtility, mVideoViewWrapper); } // --------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/testvideodisplayhandler.pro --- a/videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/testvideodisplayhandler.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/tsrc/testvideodisplayhandler/testvideodisplayhandler.pro Mon Aug 23 14:27:29 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building Videoplayer components # # -# Version : %version: 5 % +# Version : %version: 6 % TEMPLATE = app TARGET = testvideodisplayhandler @@ -45,7 +45,7 @@ alfcompositionutility.h \ mediaclientvideodisplay.h \ testvideodisplayhandler.h \ - ../../viewinc/mpxvideoplaybackdisplayhandler.h + ../../viewinc/videoplaybackdisplayhandler.h SOURCES += mpxvideoviewwrapper.cpp \ videobaseplaybackview.cpp \ @@ -54,4 +54,4 @@ alfcompositionutility.cpp \ mediaclientvideodisplay.cpp \ testvideodisplayhandler.cpp \ - ../../viewsrc/mpxvideoplaybackdisplayhandler.cpp + ../../viewsrc/videoplaybackdisplayhandler.cpp diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/videoplaybackview.pro --- a/videoplayback/videoplaybackview/videoplaybackview.pro Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/videoplaybackview.pro Mon Aug 23 14:27:29 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building Videoplayer components # # -# Version : %version: da1mmcf#30 % +# Version : %version: 32 % TEMPLATE = lib @@ -70,7 +70,7 @@ videoplaybackviewfiledetails.h \ mpxvideoviewwrapper.h \ mpxvideoregion.h \ - mpxvideoplaybackdisplayhandler.h \ + videoplaybackdisplayhandler.h \ videoplaybackfullscreencontrol.h \ videoplaybackstatuspanecontrol.h \ videoplaybackprogressbar.h \ @@ -81,7 +81,7 @@ videoplaybackcontrolscontroller.h \ videoplaybackdocumentloader.h \ videoplaybackfiledetailswidget.h \ - mpxvideoplaybackuserinputhandler.h \ + videoplaybackuserinputhandler.h \ videoplaybackdetailsplaybackwindow.h \ videocontainer.h @@ -89,7 +89,7 @@ videoplaybackview.cpp \ videoplaybackviewfiledetails.cpp \ mpxvideoviewwrapper.cpp \ - mpxvideoplaybackdisplayhandler.cpp \ + videoplaybackdisplayhandler.cpp \ videoplaybackfullscreencontrol.cpp \ videoplaybackstatuspanecontrol.cpp \ videoplaybackprogressbar.cpp \ @@ -100,8 +100,10 @@ videoplaybackcontrolconfiguration.cpp \ videoplaybackdocumentloader.cpp \ videoplaybackfiledetailswidget.cpp \ - mpxvideoplaybackuserinputhandler.cpp \ + videoplaybackuserinputhandler.cpp \ videoplaybackdetailsplaybackwindow.cpp \ videocontainer.cpp +DOCML += resources/videoplaybackview.docml + RESOURCES += resources/videoplaybackview.qrc diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewinc/mpxhelixplaybackplugindefs.h --- a/videoplayback/videoplaybackview/viewinc/mpxhelixplaybackplugindefs.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Externalizable container for DSA region -* -*/ - -// Version : %version: da1mmcf#2 % - - - -#ifndef MPXHELIXPLAYBACKPLUGINDEFS_H_ -#define MPXHELIXPLAYBACKPLUGINDEFS_H_ - -enum TMPXVideoPlaybackState -{ - EMPXVideoNotInitialized, - EMPXVideoInitializing, - EMPXVideoInitialized, - EMPXVideoBuffering, - EMPXVideoPlaying, - EMPXVideoPaused, - EMPXVideoStopped, - EMPXVideoSeeking, - EMPXNumberOfStates -}; - - -enum TMPXVideoMode -{ - EMPXVideoLocal, - EMPXVideoStreaming, - EMPXVideoLiveStreaming, - EMPXVideoProgressiveDownload, - EMPXNumberOfModes -}; - - - -#endif /*MPXHELIXPLAYBACKPLUGINDEFS_H_*/ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewinc/mpxvideoplaybackdisplayhandler.h --- a/videoplayback/videoplaybackview/viewinc/mpxvideoplaybackdisplayhandler.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of video playback display handler -* -*/ - -// Version : %version: 11 % - - -#ifndef __VIDEOPLAYBACKDISPLAYHANDLER_H__ -#define __VIDEOPLAYBACKDISPLAYHANDLER_H__ - -// INCLUDES - -#include -#include -#include -#include - - -// -// CLASS DECLARATION -// -class CVideoContainer; -class MMPXPlaybackUtility; -class CMPXVideoViewWrapper; -class VideoPlaybackViewFileDetails; - -/* - * CMPXVideoPlaybackDisplayHandler - * - */ -class CMPXVideoPlaybackDisplayHandler : public CBase -{ - // - // To save user's preference for scaling type in video ratio + screen ratio - // - typedef struct - { - TReal32 videoRatio; - TReal32 screenRatio; - TMMFScalingType scalingType; - } TMPXAspectRatio ; - - public: - - ~CMPXVideoPlaybackDisplayHandler(); - - static CMPXVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ); - - void CreateDisplayWindowL( RWsSession& aWs, - CWsScreenDevice& aScreenDevice, - RWindow& aWin, - TRect aDisplayRect ); - - void RemoveDisplayWindow(); - - void HandleVideoDisplayMessageL( CMPXMessage* aMessage ); - - TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ); - - TInt SetDefaultAspectRatioL( VideoPlaybackViewFileDetails* aFileDetails, - TReal32 aDisplayAspectRatio ); - - void UpdateVideoRectL( TRect aRect, TBool transitionEffect ); - - private: - - CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, - CMPXVideoViewWrapper* aViewWrapper ); - - void ConstructL(); - - void LoadAspectRatioL(); - - void SaveAspectRatioL(); - - void SetVideoRectL( TRect aClipRect ); - - void CalculateVideoRectL(); - - static TInt UpdateVideoRectTimeOutL( TAny* aPtr ); - - private: - void AddDisplayWindowL( CWsScreenDevice& aScreenDevice, - RWindowBase& aWindowBase, - RWindow* aWin ); - - void SurfaceCreatedL( CMPXMessage* aMessage ); - void SurfaceChangedL( CMPXMessage* aMessage ); - void SurfaceRemoved(); - TInt SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd ); - - private: - MMPXPlaybackUtility* iPlaybackUtility; - - RArray iAspectRatioArray; - TInt iCurrentIndexForAspectRatio; - TReal iDisplayAspectRatio; - - TRect iWindowRect; - - TReal32 iTlXDiff; - TReal32 iTlYDiff; - TReal32 iBrXDiff; - TReal32 iBrYDiff; - - TInt iTransitionEffectCnt; - - CPeriodic* iResizingTimer; - CMPXVideoViewWrapper* iViewWrapper; - - CMediaClientVideoDisplay* iVideoDisplay; - - RWindowBase* iWindowBase; - TBool iSurfaceCached; - TSurfaceId iSurfaceId; - TRect iCropRect; - TVideoAspectRatio iAspectRatio; - TReal32 iScaleWidth; - TReal32 iScaleHeight; - TInt iHorizontalPosition; - TInt iVerticalPosition; - TVideoRotation iRotation; - TAutoScaleType iAutoScale; - CVideoContainer* iVideoContainer; -}; - -#endif // __VIDEOPLAYBACKDISPLAYHANDLER_H__ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewinc/mpxvideoplaybackuids.hrh --- a/videoplayback/videoplaybackview/viewinc/mpxvideoplaybackuids.hrh Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource headers for video UIDs - * -*/ - -// Version : %version: da1mmcf#2 % - - - - -#ifndef __MPXPLAYBACKUIDS_HRH__ -#define __MPXPLAYBACKUIDS_HRH__ - -// CONSTANTS - -#define KMPXVIDEOPLAYBACKVIEWPLUGINUID 0x200159AC -#define KMPXVIDEOPLAYBACKVIEWPLUGINIMPLEMENTATIONUID 0x200159AD - -#define KMPXVIDEOPDLPLAYBACKVIEWPLUGINUID 0x2001E5A7 -#define KMPXVIDEOPDLPLAYBACKVIEWPLUGINIMPLEMENTATIONUID 0x2001E5A8 - -#define KMPXVIDEOPLAYBACKPLUGINIMPLEMENTATIONUID 0x10282551 - -#define KMPXVIDEOPLAYBACKVIEWUID 0x200159B4 -#define KMPXVIDEOPDLPLAYBACKVIEWUID 0x2001E5A9 - -#define KBROWSERUID 0x10008D39 - -#endif // __MPXPLAYBACKUIDS_HRH__ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewinc/mpxvideoplaybackuserinputhandler.h --- a/videoplayback/videoplaybackview/viewinc/mpxvideoplaybackuserinputhandler.h Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of MPXVideoPlaybackUserInputHandler -* -*/ - -// Version : %version: 6 % - - - -#ifndef MPXVIDEOPLAYBACKUSERINPUTHANDLER_H_ -#define MPXVIDEOPLAYBACKUSERINPUTHANDLER_H_ - -// INCLUDES -#include // Side volume key - - -// FORWARD DECLARATIONS -class CRemConInterfaceSelector; // Side volume key -class CRemConCoreApiTarget; -class CMPXVideoViewWrapper; - -// CLASS DECLARATION - -class CMPXVideoPlaybackUserInputHandler : public CBase, - public MRemConCoreApiTargetObserver -{ - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CMPXVideoPlaybackUserInputHandler* NewL( - CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ); - - /** - * Destructor. - */ - virtual ~CMPXVideoPlaybackUserInputHandler(); - - private: - - /** - * C++ default constructor. - */ - CMPXVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ); - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL( TBool aTvOutConnected ); - - public: - void ProcessKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - void ProcessMediaKey( TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ); - - void DoHandleMediaKey( TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ); - - // From MRemConCoreApiTargetObserver - /** - * Side volume key API from MRemConCoreApiTargetObserver - * @since 3.2 - * @see MRemConCoreApiTargetObserver - */ - virtual void MrccatoPlay( - TRemConCoreApiPlaybackSpeed aSpeed, - TRemConCoreApiButtonAction aButtonAct ); - - virtual void MrccatoCommand( - TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ); - - /** - * Setter method for iForeground - * @param aForeground - the value to be set - * @return void - */ - void SetForeground( TBool aForeground ); - - void HandleTVOutEventL( TBool aTVOutConnected ); - - private: - /** - * Handles volume repeat timer timout - * @return TInt - */ - static TInt HandleVolumeRepeatTimeoutL( TAny* aPtr ); - - /** - * Adjust volume(+1/-1) for media key - * @return void - */ - void HandleVolumeRepeatL(); - - void HandleFastForward( TRemConCoreApiButtonAction aButtonAct ); - - void HandleRewind( TRemConCoreApiButtonAction aButtonAct ); - - void HandleVolumeUp( TRemConCoreApiButtonAction aButtonAct ); - - void HandleVolumeDown( TRemConCoreApiButtonAction aButtonAct ); - - // Handles the Display light timer timeout - static TInt HandleDisplayTimeout( TAny* aPtr ); - - // Disable the display backlight - void DisableBacklight(); - - // Enable the display backlight - void EnableBacklight(); - - // Restarts the timer for display light time-out - void RestartDisplayTimer(); - - private: - - TVideoUserInputType iProcessingInputType; // the type of input being processed - TUint iLastPressedKeyCode; // keycode of last key that sent EEventKeyDown - TInt iLastPressedKeyScanCode; // scancode of last key that sent EEventKeyDown - TRemConCoreApiOperationId iLastMediaKeyPressed; // Id of last mediakey thats sent a button-press - - CRemConInterfaceSelector* iInterfaceSelector; // Side volume key, owned - CRemConCoreApiTarget* iCoreTarget; // Owned by CRemConInterfaceSelector - - CPeriodic* iVolumeRepeatTimer; // owned - TBool iVolumeRepeatUp; - TBool iTVOutConnected; // Flag to indicate if TV is connected - CPeriodic* iDisplayTimer; // Timer to timeout the lights time-out - TInt iDisplayTimeOut; // Value of the lights time-out - - TBool iForeground; - CMPXVideoViewWrapper* iViewWrapper; -}; - - -#endif /*MPXVIDEOPLAYBACKUSERINPUTHANDLER_H_*/ - -// End of File diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewinc/mpxvideoviewwrapper.h --- a/videoplayback/videoplaybackview/viewinc/mpxvideoviewwrapper.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/viewinc/mpxvideoviewwrapper.h Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#23 % +// Version : %version: da1mmcf#24 % @@ -46,9 +46,9 @@ class MMPXPlaybackUtility; class MMPXCollectionUtility; class VideoBasePlaybackView; -class CMPXVideoPlaybackDisplayHandler; +class CVideoPlaybackDisplayHandler; class VideoPlaybackViewFileDetails; -class CMPXVideoPlaybackUserInputHandler; +class CVideoPlaybackUserInputHandler; class VideoPlaybackControlsController; // Class Definitions @@ -273,8 +273,8 @@ CIdle* iCloseAO; VideoBasePlaybackView* iView; - CMPXVideoPlaybackDisplayHandler* iDisplayHandler; - CMPXVideoPlaybackUserInputHandler* iUserInputHandler; + CVideoPlaybackDisplayHandler* iDisplayHandler; + CVideoPlaybackUserInputHandler* iUserInputHandler; VideoPlaybackControlsController* iControlsController; TMPXMediaRequestStatus iMediaRequestStatus; diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewinc/videoplaybackdisplayhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/viewinc/videoplaybackdisplayhandler.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of video playback display handler +* +*/ + +// Version : %version: 12 % + + +#ifndef __VIDEOPLAYBACKDISPLAYHANDLER_H__ +#define __VIDEOPLAYBACKDISPLAYHANDLER_H__ + +// INCLUDES + +#include +#include +#include +#include + + +// +// CLASS DECLARATION +// +class CVideoContainer; +class MMPXPlaybackUtility; +class CMPXVideoViewWrapper; +class VideoPlaybackViewFileDetails; + +/* + * CVideoPlaybackDisplayHandler + * + */ +class CVideoPlaybackDisplayHandler : public CBase +{ + // + // To save user's preference for scaling type in video ratio + screen ratio + // + typedef struct + { + TReal32 videoRatio; + TReal32 screenRatio; + TMMFScalingType scalingType; + } TMPXAspectRatio ; + + public: + + ~CVideoPlaybackDisplayHandler(); + + static CVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ); + + void CreateDisplayWindowL( RWsSession& aWs, + CWsScreenDevice& aScreenDevice, + RWindow& aWin, + TRect aDisplayRect ); + + void RemoveDisplayWindow(); + + void HandleVideoDisplayMessageL( CMPXMessage* aMessage ); + + TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ); + + TInt SetDefaultAspectRatioL( VideoPlaybackViewFileDetails* aFileDetails, + TReal32 aDisplayAspectRatio ); + + void UpdateVideoRectL( TRect aRect, TBool transitionEffect ); + + private: + + CVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ); + + void ConstructL(); + + void LoadAspectRatioL(); + + void SaveAspectRatioL(); + + void SetVideoRectL( TRect aClipRect ); + + void CalculateVideoRectL(); + + static TInt UpdateVideoRectTimeOutL( TAny* aPtr ); + + private: + void AddDisplayWindowL( CWsScreenDevice& aScreenDevice, + RWindowBase& aWindowBase, + RWindow* aWin ); + + void SurfaceCreatedL( CMPXMessage* aMessage ); + void SurfaceChangedL( CMPXMessage* aMessage ); + void SurfaceRemoved(); + TInt SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd ); + + private: + MMPXPlaybackUtility* iPlaybackUtility; + + RArray iAspectRatioArray; + TInt iCurrentIndexForAspectRatio; + TReal iDisplayAspectRatio; + + TRect iWindowRect; + + TReal32 iTlXDiff; + TReal32 iTlYDiff; + TReal32 iBrXDiff; + TReal32 iBrYDiff; + + TInt iTransitionEffectCnt; + + CPeriodic* iResizingTimer; + CMPXVideoViewWrapper* iViewWrapper; + + CMediaClientVideoDisplay* iVideoDisplay; + + RWindowBase* iWindowBase; + TBool iSurfaceCached; + TSurfaceId iSurfaceId; + TRect iCropRect; + TVideoAspectRatio iAspectRatio; + TReal32 iScaleWidth; + TReal32 iScaleHeight; + TInt iHorizontalPosition; + TInt iVerticalPosition; + TVideoRotation iRotation; + TAutoScaleType iAutoScale; + CVideoContainer* iVideoContainer; +}; + +#endif // __VIDEOPLAYBACKDISPLAYHANDLER_H__ diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewinc/videoplaybackuserinputhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/viewinc/videoplaybackuserinputhandler.h Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,152 @@ +/* +* 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: Implementation of VideoPlaybackUserInputHandler +* +*/ + +// Version : %version: 7 % + + + +#ifndef VIDEOPLAYBACKUSERINPUTHANDLER_H_ +#define VIDEOPLAYBACKUSERINPUTHANDLER_H_ + +// INCLUDES +#include // Side volume key + + +// FORWARD DECLARATIONS +class CRemConInterfaceSelector; // Side volume key +class CRemConCoreApiTarget; +class CMPXVideoViewWrapper; + +// CLASS DECLARATION + +class CVideoPlaybackUserInputHandler : public CBase, + public MRemConCoreApiTargetObserver +{ + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CVideoPlaybackUserInputHandler* NewL( + CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ); + + /** + * Destructor. + */ + virtual ~CVideoPlaybackUserInputHandler(); + + private: + + /** + * C++ default constructor. + */ + CVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL( TBool aTvOutConnected ); + + public: + void ProcessKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + void ProcessMediaKey( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + void DoHandleMediaKey( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + // From MRemConCoreApiTargetObserver + /** + * Side volume key API from MRemConCoreApiTargetObserver + * @since 3.2 + * @see MRemConCoreApiTargetObserver + */ + virtual void MrccatoPlay( + TRemConCoreApiPlaybackSpeed aSpeed, + TRemConCoreApiButtonAction aButtonAct ); + + virtual void MrccatoCommand( + TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + /** + * Setter method for iForeground + * @param aForeground - the value to be set + * @return void + */ + void SetForeground( TBool aForeground ); + + void HandleTVOutEventL( TBool aTVOutConnected ); + + private: + /** + * Handles volume repeat timer timout + * @return TInt + */ + static TInt HandleVolumeRepeatTimeoutL( TAny* aPtr ); + + /** + * Adjust volume(+1/-1) for media key + * @return void + */ + void HandleVolumeRepeatL(); + + void HandleFastForward( TRemConCoreApiButtonAction aButtonAct ); + + void HandleRewind( TRemConCoreApiButtonAction aButtonAct ); + + void HandleVolumeUp( TRemConCoreApiButtonAction aButtonAct ); + + void HandleVolumeDown( TRemConCoreApiButtonAction aButtonAct ); + + // Handles the Display light timer timeout + static TInt HandleDisplayTimeout( TAny* aPtr ); + + // Disable the display backlight + void DisableBacklight(); + + // Enable the display backlight + void EnableBacklight(); + + // Restarts the timer for display light time-out + void RestartDisplayTimer(); + + private: + + TVideoUserInputType iProcessingInputType; // the type of input being processed + TUint iLastPressedKeyCode; // keycode of last key that sent EEventKeyDown + TInt iLastPressedKeyScanCode; // scancode of last key that sent EEventKeyDown + TRemConCoreApiOperationId iLastMediaKeyPressed; // Id of last mediakey thats sent a button-press + + CRemConInterfaceSelector* iInterfaceSelector; // Side volume key, owned + CRemConCoreApiTarget* iCoreTarget; // Owned by CRemConInterfaceSelector + + CPeriodic* iVolumeRepeatTimer; // owned + TBool iVolumeRepeatUp; + TBool iTVOutConnected; // Flag to indicate if TV is connected + CPeriodic* iDisplayTimer; // Timer to timeout the lights time-out + TInt iDisplayTimeOut; // Value of the lights time-out + + TBool iForeground; + CMPXVideoViewWrapper* iViewWrapper; +}; + + +#endif /*VIDEOPLAYBACKUSERINPUTHANDLER_H_*/ + +// End of File diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewsrc/mpxvideoplaybackdisplayhandler.cpp --- a/videoplayback/videoplaybackview/viewsrc/mpxvideoplaybackdisplayhandler.cpp Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,697 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of video playback display handler -* -*/ - -// Version : %version: 28 % - -#include -#include -#include -#include -#include -#include - -#include "videocontainer.h" -#include "mpxvideoviewwrapper.h" -#include "mpxvideoplaybackdisplayhandler.h" -#include "mpxvideoregion.h" -#include "videoplaybackviewfiledetails.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()")); - - if ( ! iVideoContainer ) - { - iVideoContainer = new ( ELeave ) CVideoContainer(); - 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()); - - 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; - } - - iSurfaceId = TSurfaceId::CreateNullId(); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* aMessage ) -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessage()")); - - TMPXVideoDisplayCommand message = - ( *(aMessage->Value(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( - VideoPlaybackViewFileDetails* aFileDetails, TReal32 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 - // aspectRatioDiff = videoAspectRatio - aDisplayAspectRatio - // aspectRatioDiff == 0 ==> natural - // aspectRatioDiff > 0.1 ==> zoom - // aspectRatioDiff < - 0.3 ==> natural - // aspectRatioDiff >= - 0.3 and <= 0.1 ==> stretch - // - - if ( i == cnt ) - { - if ( videoAspectRatio - aDisplayAspectRatio > 0.1 ) - { - scalingType = EMMFZoom; - } - else if ( ( videoAspectRatio != aDisplayAspectRatio ) && - ( videoAspectRatio - aDisplayAspectRatio > (- 0.3) ) ) - { - 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( 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( 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(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 = EVideoRotationClockwise90; - } - - 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; - - // - // Let ControlsController know that we get the surface. - // - iViewWrapper->SurfacedAttached( true ); - } -} - -// ------------------------------------------------------------------------------------------------- -// 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( KMPXMediaVideoDisplayTSurfaceId ); - iCropRect = aMessage->ValueTObjectL( KMPXMediaVideoDisplayCropRect ); - iAspectRatio = aMessage->ValueTObjectL( KMPXMediaVideoDisplayAspectRatio ); - - if ( iVideoDisplay ) - { - // - // Remove old surface if one exists - // - if ( ! oldSurfaceId.IsNull() ) - { - iVideoDisplay->RemoveSurface(); - } - - // - // Add new surface - // - iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); - - // - // Let ControlsController know that we get the surface. - // - iViewWrapper->SurfacedAttached( true ); - } - 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( KMPXMediaVideoDisplayTSurfaceId ); - iCropRect = aMessage->ValueTObjectL( KMPXMediaVideoDisplayCropRect ); - iAspectRatio = aMessage->ValueTObjectL( 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()")); - - // - // Let ControlsController know that we get the surface. - // - iViewWrapper->SurfacedAttached( false ); - - 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 diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewsrc/mpxvideoplaybackuserinputhandler.cpp --- a/videoplayback/videoplaybackview/viewsrc/mpxvideoplaybackuserinputhandler.cpp Fri Aug 06 09:43:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,618 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of playback view's input handler -* -*/ - -// Version : %version: 8 % - - -// INCLUDE FILES -#include -#include // RWindowBase -#include -#include -#include -#include -#include -#include // Side volume key -#include -#include // for peripheral display timeout setting -#include // display timeout setting keys -#include -#include - -#include -#include - -#include "mpxvideo_debug.h" -#include "mpxvideoviewwrapper.h" -#include "mpxcommonvideoplaybackview.hrh" -#include "mpxvideoplaybackuserinputhandler.h" - - -// CONSTANTS -const TInt KMPXMicroSecondsInASecond = 1000000; - - -// ======== MEMBER FUNCTIONS ======================================================================= - -// ------------------------------------------------------------------------------------------------- -// MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler() -// ------------------------------------------------------------------------------------------------- -// -CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ) - : iViewWrapper( aWrapper ) -{ -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::NewL() -// ------------------------------------------------------------------------------------------------- -// -CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL( - CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ) -{ - MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::NewL()")); - - CMPXVideoPlaybackUserInputHandler* self = - new (ELeave) CMPXVideoPlaybackUserInputHandler( aWrapper ); - CleanupStack::PushL( self ); - self->ConstructL( aTvOutConnected ); - CleanupStack::Pop(); - return self; -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::ConstructL -// Symbian 2nd phase constructor can leave. -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::ConstructL( TBool aTvOutConnected ) -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ConstructL()")); - - iVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityStandard ); - iDisplayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); - iInterfaceSelector = CRemConInterfaceSelector::NewL(); - iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); - - iTVOutConnected = aTvOutConnected; - - // Start the timer if TV out is connected - if ( iTVOutConnected ) - { - // Get the display light time-out value from CenRep - CRepository* repository = CRepository::NewLC( KCRUidLightSettings ); - - // What's the timeout value (in seconds ) for the display light? - repository->Get( KDisplayLightsTimeout, iDisplayTimeOut ); - MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut); - - CleanupStack::PopAndDestroy( repository ); - - // Convert the timeout value to microseconds - iDisplayTimeOut *= KMPXMicroSecondsInASecond; - - RestartDisplayTimer(); - } - - // not detrimental if Media Keys dont work - so ignore any errors here - TRAP_IGNORE( iInterfaceSelector->OpenTargetL() ); - - iProcessingInputType = EVideoNone; - iForeground = ETrue; -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler() -// ------------------------------------------------------------------------------------------------- -// -CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler() -{ - if ( iVolumeRepeatTimer ) - { - iVolumeRepeatTimer->Cancel(); - delete iVolumeRepeatTimer; - } - - if ( iDisplayTimer ) - { - iDisplayTimer->Cancel(); - delete iDisplayTimer; - } - - if ( iInterfaceSelector ) - { - delete iInterfaceSelector; - iCoreTarget = NULL; - iInterfaceSelector = NULL; - } - - // make sure that backlight enabled when - // the view updates or deactivates - EnableBacklight(); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::MrccatoPlay() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/, - TRemConCoreApiButtonAction aButtonAct ) -{ - MPX_ENTER_EXIT( - _L("CMPXVideoPlaybackUserInputHandler::MrccatoPlay"), - _L("aButtonAct = %d"), aButtonAct ); - - ProcessMediaKey(ERemConCoreApiPlay, aButtonAct); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::MrccatoCommand() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::MrccatoCommand(TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ) -{ - MPX_ENTER_EXIT( - _L("CMPXVideoPlaybackUserInputHandler::MrccatoCommand"), - _L("aButtonAct = %d"), aButtonAct ); - - ProcessMediaKey(aOperationId, aButtonAct); -} - - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ) -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()")); - - switch ( aOperationId ) - { - case ERemConCoreApiStop: - { - if ( aButtonAct == ERemConCoreApiButtonClick ) - { - TRAP_IGNORE(iViewWrapper->HandleCommandL( EMPXPbvCmdStop )); - } - break; - } - case ERemConCoreApiRewind: - { - HandleRewind(aButtonAct); - break; - } - case ERemConCoreApiFastForward: - { - HandleFastForward(aButtonAct); - break; - } - case ERemConCoreApiVolumeUp: - { - HandleVolumeUp(aButtonAct); - break; - } - case ERemConCoreApiVolumeDown: - { - HandleVolumeDown(aButtonAct); - break; - } - case ERemConCoreApiPausePlayFunction: - { - if ( aButtonAct == ERemConCoreApiButtonClick ) - { - TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlayPause)); - } - break; - } - case ERemConCoreApiPause: - { - TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPause)); - break; - } - case ERemConCoreApiPlay: - { - if ( aButtonAct == ERemConCoreApiButtonClick ) - { - TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlay)); - } - break; - } - default: - break; - } -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleFastForward() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::HandleFastForward(TRemConCoreApiButtonAction aButtonAct) -{ - if (aButtonAct == ERemConCoreApiButtonPress) - { - TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekForward)); - } - else if (aButtonAct == ERemConCoreApiButtonRelease) - { - TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek)); - } -} - - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleRewind() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::HandleRewind(TRemConCoreApiButtonAction aButtonAct) -{ - if (aButtonAct == ERemConCoreApiButtonPress) - { - TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekBackward)); - } - else if (aButtonAct == ERemConCoreApiButtonRelease) - { - TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek)); - } -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleVolumeUp() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::HandleVolumeUp(TRemConCoreApiButtonAction aButtonAct) -{ - switch ( aButtonAct ) - { - case ERemConCoreApiButtonPress: - { - // Volume Up - Pressed - if ( iVolumeRepeatTimer->IsActive() ) - { - iVolumeRepeatTimer->Cancel(); - } - - iVolumeRepeatUp = ETrue; - iVolumeRepeatTimer->Start( - KAknStandardKeyboardRepeatRate, - KAknStandardKeyboardRepeatRate, - TCallBack( - CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL, - this ) ); - - break; - } - case ERemConCoreApiButtonRelease: - { - // Volume Up - Released - iVolumeRepeatTimer->Cancel(); - break; - } - case ERemConCoreApiButtonClick: - { - // Volume Up - Clicked - TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdIncreaseVolume ) ); - break; - } - } -} - - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleVolumeDown() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown(TRemConCoreApiButtonAction aButtonAct) -{ - switch ( aButtonAct ) - { - case ERemConCoreApiButtonPress: - { - // Volume Up - Pressed - if ( iVolumeRepeatTimer->IsActive() ) - { - iVolumeRepeatTimer->Cancel(); - } - - iVolumeRepeatUp = EFalse; - iVolumeRepeatTimer->Start( - KAknStandardKeyboardRepeatRate, - KAknStandardKeyboardRepeatRate, - TCallBack( - CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL, - this ) ); - - break; - } - case ERemConCoreApiButtonRelease: - { - // Volume Up - Released - iVolumeRepeatTimer->Cancel(); - break; - } - case ERemConCoreApiButtonClick: - { - // Volume Down - Clicked - TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdDecreaseVolume ) ); - break; - } - } -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& /*aKeyEvent*/, - TEventCode /*aType*/ ) -{ - MPX_DEBUG(_L("MPXVideoPlaybackUserInputHandler::ProcessKeyEvent")); - - /* - switch (iProcessingInputType) - { - case EVideoNone: - { - if (aType == EEventKeyDown && iForeground) - { - iProcessingInputType = EVideoKeyboard; - iLastPressedKeyCode = aKeyEvent.iCode; - iLastPressedKeyScanCode = aKeyEvent.iScanCode; - if ( iTVOutConnected ) - { - RestartDisplayTimer(); - } - iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType ); - } - break; - } - case EVideoKeyboard: - { - if (aType == EEventKeyUp) - { - // only handle up event for the key being handled - // ignore spurious key presses - if (aKeyEvent.iCode == iLastPressedKeyCode && - aKeyEvent.iScanCode == iLastPressedKeyScanCode) - { - iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType ); - - // reset the value only on key up event - iProcessingInputType = EVideoNone; - } - } - break; - } - default: - { - // user input is disallowed - break; - } - } // switch*/ -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::ProcessMediaKey() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::ProcessMediaKey(TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct) -{ - MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ProcessMediaKey")); - - switch (iProcessingInputType) - { - case EVideoNone: - { - if (aButtonAct == ERemConCoreApiButtonPress && iForeground) - { - iProcessingInputType = EVideoMediaKeys; - iLastMediaKeyPressed = aOperationId; - DoHandleMediaKey(aOperationId, aButtonAct); - if ( iTVOutConnected ) - { - RestartDisplayTimer(); - } - } - else if (aButtonAct == ERemConCoreApiButtonClick && iForeground) - { - DoHandleMediaKey(aOperationId, aButtonAct); - if ( iTVOutConnected ) - { - RestartDisplayTimer(); - } - // reset on click AND/OR release - iProcessingInputType = EVideoNone; - } - break; - } - case EVideoMediaKeys: - { - if (aButtonAct == ERemConCoreApiButtonRelease) - { - // handle only if this release is for media-key being currently handled - // ignore spurious media key presses - if (iLastMediaKeyPressed == aOperationId) - { - DoHandleMediaKey(aOperationId, aButtonAct); - // reset on click AND/OR release - iProcessingInputType = EVideoNone; - } - } - break; - } - default: - { - // user input is disallowed - break; - } - } // switch -} - - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL() -// ------------------------------------------------------------------------------------------------- -// -TInt CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr ) -{ - MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()")); - - static_cast(aPtr)->HandleVolumeRepeatL(); - - return KErrNone; -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL() -{ - MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()")); - - TMPXVideoPlaybackViewCommandIds command = EMPXPbvCmdDecreaseVolume; - - if ( iVolumeRepeatUp ) - { - command = EMPXPbvCmdIncreaseVolume; - } - - iViewWrapper->HandleCommandL( command ); -} - - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::SetForeground() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::SetForeground(TBool aForeground) -{ - iForeground = aForeground; - - if ( !iForeground ) - { - // we are in background so reset iProcessingInputType value - iProcessingInputType = EVideoNone; - } -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::DisableBacklight() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::DisableBacklight() -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DisableBacklight")); - - // cancel the timer - iDisplayTimer->Cancel(); - - // disable the backlight - HAL::Set( HALData::EBacklightState, 0 ); -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::EnableBacklight() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::EnableBacklight() -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::EnableBacklight")); - - // enable the backlight - HAL::Set( HALData::EBacklightState, 1 ); -} - - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent() -// ------------------------------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::HandleTVOutEventL(TBool aTVOutConnected) -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent")); - - iTVOutConnected = aTVOutConnected; - - if ( iTVOutConnected ) - { - // Get the display light time-out value from CenRep - CRepository* repository = CRepository::NewLC( KCRUidLightSettings ); - - // What's the timeout value (in seconds ) for the display light? - repository->Get( KDisplayLightsTimeout, iDisplayTimeOut ); - MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut); - - CleanupStack::PopAndDestroy( repository ); - - // Convert the timeout value to microseconds - iDisplayTimeOut *= KMPXMicroSecondsInASecond; - - RestartDisplayTimer(); - } - else - { - iDisplayTimer->Cancel(); - EnableBacklight(); - } -} - -// ------------------------------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout -// ------------------------------------------------------------------------------------------------- -// -TInt CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout( TAny* aPtr ) -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout")); - - static_cast(aPtr)->DisableBacklight(); - - return KErrNone; -} - -// ----------------------------------------------------------------------------- -// CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer -// ----------------------------------------------------------------------------- -// -void CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer() -{ - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer")); - - // check if the display timer is running if so cancelit - if ( iDisplayTimer->IsActive() ) - { - iDisplayTimer->Cancel(); - } - else - { - // timeout has happened and the backlight is disabled - // enable the backlight - HAL::Set( HALData::EBacklightState, 1 ); - } - - TBool backlightState; - TInt ret = HAL::Get( HALData::EBacklightState, backlightState ); - - // Re start the display backlight timer - iDisplayTimer->Start( iDisplayTimeOut, iDisplayTimeOut, - TCallBack( CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout, this ) ); -} - -// EOF diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp --- a/videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#44 % +// Version : %version: da1mmcf#45 % @@ -48,10 +48,10 @@ #include "videobaseplaybackview.h" #include "videoplaybackcontrol.hrh" #include "videoplaybackviewfiledetails.h" -#include "mpxvideoplaybackdisplayhandler.h" +#include "videoplaybackdisplayhandler.h" #include "mpxcommonvideoplaybackview.hrh" #include "videoplaybackcontrolscontroller.h" -#include "mpxvideoplaybackuserinputhandler.h" +#include "videoplaybackuserinputhandler.h" // Member Functions @@ -115,7 +115,7 @@ // // Create Video Playback Display Handler // - iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this ); + iDisplayHandler = CVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this ); // // Create control's controller @@ -125,7 +125,7 @@ // // Create user input handler // - iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( this, iFileDetails->mTvOutConnected ); + iUserInputHandler = CVideoPlaybackUserInputHandler::NewL( this, iFileDetails->mTvOutConnected ); } // ------------------------------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp --- a/videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#48 % +// Version : %version: da1mmcf#49 % @@ -206,18 +206,20 @@ { MPX_DEBUG( _L("VideoBasePlaybackView::saveActivityData()") ); + VideoActivityState& videoActivityState = VideoActivityState::instance(); + // save the activity data QVariant data = QString( mVideoMpxWrapper->iFileDetails->mClipName ); - VideoActivityState::instance().setActivityData(data, KEY_LAST_PLAYED_CLIP); + videoActivityState.setActivityData( data, KEY_LAST_PLAYED_CLIP ); data = int( mVideoMpxWrapper->iPlayPosition ); - VideoActivityState::instance().setActivityData(data, KEY_LAST_PLAY_POSITION_ID); + videoActivityState.setActivityData( data, KEY_LAST_PLAY_POSITION_ID ); data = bool( mVideoMpxWrapper->iFileDetails->mPlaybackMode == EMPXVideoLocal ); - VideoActivityState::instance().setActivityData(data, KEY_LAST_LOCAL_PLAYBACK); - + videoActivityState.setActivityData( data, KEY_LAST_LOCAL_PLAYBACK ); + data = uint ( mVideoMpxWrapper->GetMediaId() ); - VideoActivityState::instance().setActivityData(data, KEY_LAST_PLAYED_MEDIA_ID); + videoActivityState.setActivityData( data, KEY_LAST_PLAYED_MEDIA_ID ); } // ------------------------------------------------------------------------------------------------- diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewsrc/videoplaybackdisplayhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/viewsrc/videoplaybackdisplayhandler.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,697 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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: 29 % + +#include +#include +#include +#include +#include +#include + +#include "videocontainer.h" +#include "mpxvideoviewwrapper.h" +#include "videoplaybackdisplayhandler.h" +#include "mpxvideoregion.h" +#include "videoplaybackviewfiledetails.h" + +const TInt KVIDEORESIZINGREPEATRATE = 50000; +const TReal32 KTRANSITIONEFFECTCNT = 8; + +_LIT( KAspectRatioFile, "c:\\private\\200159b2\\mpxvideoplayer_aspect_ratio.dat" ); + + +CVideoPlaybackDisplayHandler::CVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ) + : iPlaybackUtility( aPlayUtil ) + , iTransitionEffectCnt( 0 ) + , iViewWrapper( aViewWrapper ) + , iScaleWidth( 100.0f ) + , iScaleHeight( 100.0f ) + , iHorizontalPosition( EHorizontalAlignCenter ) + , iVerticalPosition( EVerticalAlignCenter ) + , iRotation( EVideoRotationNone ) + , iAutoScale( EAutoScaleBestFit ) +{ +} + +CVideoPlaybackDisplayHandler::~CVideoPlaybackDisplayHandler() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::~CVideoPlaybackDisplayHandler()")); + + 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; + } +} + +CVideoPlaybackDisplayHandler* +CVideoPlaybackDisplayHandler::NewL( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::NewL()")); + + CVideoPlaybackDisplayHandler* self = + new(ELeave) CVideoPlaybackDisplayHandler( aPlayUtil, aViewWrapper ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::ConstructL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::ConstructL() +{ + iResizingTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + LoadAspectRatioL(); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::CreateDisplayWindowL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::CreateDisplayWindowL( + RWsSession& /*aWs*/, + CWsScreenDevice& aScreenDevice, + RWindow& aWin, + TRect aDisplayRect ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::CreateDisplayWindowL()")); + + if ( ! iVideoContainer ) + { + iVideoContainer = new ( ELeave ) CVideoContainer(); + 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()); + + AddDisplayWindowL( aScreenDevice, *videoWindow, (RWindow*)videoWindow ); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::RemoveDisplayWindow() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::RemoveDisplayWindow() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::RemoveDisplayWindow()")); + + if ( iVideoDisplay ) + { + SurfaceRemoved(); + delete iVideoDisplay; + iVideoDisplay = NULL; + } + + if ( iVideoContainer ) + { + delete iVideoContainer; + iVideoContainer = NULL; + } + + iSurfaceId = TSurfaceId::CreateNullId(); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* aMessage ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::HandleVideoDisplayMessage()")); + + TMPXVideoDisplayCommand message = + ( *(aMessage->Value(KMPXMediaVideoDisplayCommand)) ); + + MPX_DEBUG( + _L("CVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL() message = %d"), message ); + + switch ( message ) + { + case EPbMsgVideoSurfaceCreated: + { + SurfaceCreatedL( aMessage ); + break; + } + case EPbMsgVideoSurfaceChanged: + { + SurfaceChangedL( aMessage ); + break; + } + case EPbMsgVideoSurfaceRemoved: + { + SurfaceRemoved(); + break; + } + } +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SetAspectRatioL() +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ) +{ + MPX_DEBUG(_L("CVideoPlaybackDisplayHandler::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; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SetDefaultAspectRatioL +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( + VideoPlaybackViewFileDetails* aFileDetails, TReal32 aDisplayAspectRatio ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::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 + // aspectRatioDiff = videoAspectRatio - aDisplayAspectRatio + // aspectRatioDiff == 0 ==> natural + // aspectRatioDiff > 0.1 ==> zoom + // aspectRatioDiff < - 0.3 ==> natural + // aspectRatioDiff >= - 0.3 and <= 0.1 ==> stretch + // + + if ( i == cnt ) + { + if ( videoAspectRatio - aDisplayAspectRatio > 0.1 ) + { + scalingType = EMMFZoom; + } + else if ( ( videoAspectRatio != aDisplayAspectRatio ) && + ( videoAspectRatio - aDisplayAspectRatio > (- 0.3) ) ) + { + 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; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SaveAspectRatioL +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::SaveAspectRatioL() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::SaveAspectRatioL")); + + RFs fs; + TInt err = fs.Connect(); + CleanupClosePushL( 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(); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::LoadAspectRatioL +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::LoadAspectRatioL() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::LoadAspectRatioL()")); + + RFs fs; + RFileReadStream in; + + TInt err = fs.Connect(); + CleanupClosePushL( 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(); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::UpdateVideoRectL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::UpdateVideoRectL( TRect aClipRect, TBool transitionEffect ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::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( CVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL, this ) ); + } + else + { + SetVideoRectL( aClipRect ); + + iWindowRect = aClipRect; + + iViewWrapper->UpdateVideoRectDone(); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL() +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL( TAny* aPtr ) +{ + MPX_DEBUG(_L("CVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL()")); + + static_cast(aPtr)->CalculateVideoRectL(); + + return KErrNone; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::CalculateVideoRectL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::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("CVideoPlaybackDisplayHandler::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("CVideoPlaybackDisplayHandler::CalculateVideoRectL() Done")); + + iViewWrapper->UpdateVideoRectDone(); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SetVideoRectL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::SetVideoRectL( TRect aRect ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::SetVideoRectL()")); + + if ( iVideoDisplay ) + { + iVideoDisplay->SetVideoExtentL( *iWindowBase, aRect, TRect( iWindowBase->Size() ) ); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::AddDisplayWindowL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::AddDisplayWindowL( CWsScreenDevice& aScreenDevice, + RWindowBase& aWindowBase, + RWindow* aWin ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::AddDisplayWindowL()")); + + iWindowBase = &aWindowBase; + + TInt displayId = aScreenDevice.GetScreenNumber(); + + MPX_DEBUG(_L("CVideoPlaybackDisplayHandler::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 = EVideoRotationClockwise90; + } + + iWindowRect = cropRect; + + MPX_DEBUG(_L("CVideoPlaybackDisplayHandler::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("CVideoPlaybackDisplayHandler::AddDisplayWindowL() Display Added")); + // + // Check if surface was created before window was ready + // + if ( iSurfaceCached ) + { + iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); + + iSurfaceCached = EFalse; + + // + // Let ControlsController know that we get the surface. + // + iViewWrapper->SurfacedAttached( true ); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SurfaceCreatedL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::SurfaceCreatedL( CMPXMessage* aMessage ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::SurfaceCreatedL()")); + + TSurfaceId oldSurfaceId = iSurfaceId; + + // + // Extract the surface parameters from the message + // + iSurfaceId = aMessage->ValueTObjectL( KMPXMediaVideoDisplayTSurfaceId ); + iCropRect = aMessage->ValueTObjectL( KMPXMediaVideoDisplayCropRect ); + iAspectRatio = aMessage->ValueTObjectL( KMPXMediaVideoDisplayAspectRatio ); + + if ( iVideoDisplay ) + { + // + // Remove old surface if one exists + // + if ( ! oldSurfaceId.IsNull() ) + { + iVideoDisplay->RemoveSurface(); + } + + // + // Add new surface + // + iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); + + // + // Let ControlsController know that we get the surface. + // + iViewWrapper->SurfacedAttached( true ); + } + else + { + // + // Video display has not been created yet, save surface information to create + // the surface when the display is created + // + iSurfaceCached = ETrue; + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SurfaceChangedL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::SurfaceChangedL( CMPXMessage* aMessage ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::SurfaceChangedL()")); + + // + // Extract the surface parameters from the message + // + iSurfaceId = aMessage->ValueTObjectL( KMPXMediaVideoDisplayTSurfaceId ); + iCropRect = aMessage->ValueTObjectL( KMPXMediaVideoDisplayCropRect ); + iAspectRatio = aMessage->ValueTObjectL( KMPXMediaVideoDisplayAspectRatio ); + + if ( iVideoDisplay ) + { + // + // Add new surface + // + iVideoDisplay->SurfaceParametersChanged( iSurfaceId, iCropRect, iAspectRatio ); + + iVideoDisplay->RedrawWindows( iCropRect ); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SurfaceRemoved() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackDisplayHandler::SurfaceRemoved() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::SurfaceRemoved()")); + + // + // Let ControlsController know that we get the surface. + // + iViewWrapper->SurfacedAttached( false ); + + if ( iVideoDisplay ) + { + iVideoDisplay->RemoveSurface(); + } + + iSurfaceId = TSurfaceId::CreateNullId(); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackDisplayHandler::SetNgaAspectRatioL() +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackDisplayHandler::SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackDisplayHandler::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 diff -r 21fe8338c6bf -r 4bfa887905cf videoplayback/videoplaybackview/viewsrc/videoplaybackuserinputhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videoplaybackview/viewsrc/videoplaybackuserinputhandler.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -0,0 +1,618 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of playback view's input handler +* +*/ + +// Version : %version: 9 % + + +// INCLUDE FILES +#include +#include // RWindowBase +#include +#include +#include +#include +#include +#include // Side volume key +#include +#include // for peripheral display timeout setting +#include // display timeout setting keys +#include +#include + +#include +#include + +#include "mpxvideo_debug.h" +#include "mpxvideoviewwrapper.h" +#include "mpxcommonvideoplaybackview.hrh" +#include "videoplaybackuserinputhandler.h" + + +// CONSTANTS +const TInt KMPXMicroSecondsInASecond = 1000000; + + +// ======== MEMBER FUNCTIONS ======================================================================= + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::CVideoPlaybackUserInputHandler() +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaybackUserInputHandler::CVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper ) + : iViewWrapper( aWrapper ) +{ +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::NewL() +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaybackUserInputHandler* CVideoPlaybackUserInputHandler::NewL( + CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected ) +{ + MPX_DEBUG(_L("CVideoPlaybackUserInputHandler::NewL()")); + + CVideoPlaybackUserInputHandler* self = + new (ELeave) CVideoPlaybackUserInputHandler( aWrapper ); + CleanupStack::PushL( self ); + self->ConstructL( aTvOutConnected ); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::ConstructL +// Symbian 2nd phase constructor can leave. +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::ConstructL( TBool aTvOutConnected ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackUserInputHandler::ConstructL()")); + + iVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + iDisplayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); + iInterfaceSelector = CRemConInterfaceSelector::NewL(); + iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); + + iTVOutConnected = aTvOutConnected; + + // Start the timer if TV out is connected + if ( iTVOutConnected ) + { + // Get the display light time-out value from CenRep + CRepository* repository = CRepository::NewLC( KCRUidLightSettings ); + + // What's the timeout value (in seconds ) for the display light? + repository->Get( KDisplayLightsTimeout, iDisplayTimeOut ); + MPX_DEBUG(_L("CVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut); + + CleanupStack::PopAndDestroy( repository ); + + // Convert the timeout value to microseconds + iDisplayTimeOut *= KMPXMicroSecondsInASecond; + + RestartDisplayTimer(); + } + + // not detrimental if Media Keys dont work - so ignore any errors here + TRAP_IGNORE( iInterfaceSelector->OpenTargetL() ); + + iProcessingInputType = EVideoNone; + iForeground = ETrue; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::~CVideoPlaybackUserInputHandler() +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaybackUserInputHandler::~CVideoPlaybackUserInputHandler() +{ + if ( iVolumeRepeatTimer ) + { + iVolumeRepeatTimer->Cancel(); + delete iVolumeRepeatTimer; + } + + if ( iDisplayTimer ) + { + iDisplayTimer->Cancel(); + delete iDisplayTimer; + } + + if ( iInterfaceSelector ) + { + delete iInterfaceSelector; + iCoreTarget = NULL; + iInterfaceSelector = NULL; + } + + // make sure that backlight enabled when + // the view updates or deactivates + EnableBacklight(); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::MrccatoPlay() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/, + TRemConCoreApiButtonAction aButtonAct ) +{ + MPX_ENTER_EXIT( + _L("CVideoPlaybackUserInputHandler::MrccatoPlay"), + _L("aButtonAct = %d"), aButtonAct ); + + ProcessMediaKey(ERemConCoreApiPlay, aButtonAct); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::MrccatoCommand() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::MrccatoCommand( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) +{ + MPX_ENTER_EXIT( + _L("CVideoPlaybackUserInputHandler::MrccatoCommand"), + _L("aButtonAct = %d"), aButtonAct ); + + ProcessMediaKey(aOperationId, aButtonAct); +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::DoHandleMediaKey() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackUserInputHandler::DoHandleMediaKey()")); + + switch ( aOperationId ) + { + case ERemConCoreApiStop: + { + if ( aButtonAct == ERemConCoreApiButtonClick ) + { + TRAP_IGNORE(iViewWrapper->HandleCommandL( EMPXPbvCmdStop )); + } + break; + } + case ERemConCoreApiRewind: + { + HandleRewind(aButtonAct); + break; + } + case ERemConCoreApiFastForward: + { + HandleFastForward(aButtonAct); + break; + } + case ERemConCoreApiVolumeUp: + { + HandleVolumeUp(aButtonAct); + break; + } + case ERemConCoreApiVolumeDown: + { + HandleVolumeDown(aButtonAct); + break; + } + case ERemConCoreApiPausePlayFunction: + { + if ( aButtonAct == ERemConCoreApiButtonClick ) + { + TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlayPause)); + } + break; + } + case ERemConCoreApiPause: + { + TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPause)); + break; + } + case ERemConCoreApiPlay: + { + if ( aButtonAct == ERemConCoreApiButtonClick ) + { + TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlay)); + } + break; + } + default: + break; + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleFastForward() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::HandleFastForward( TRemConCoreApiButtonAction aButtonAct ) +{ + if (aButtonAct == ERemConCoreApiButtonPress) + { + TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekForward)); + } + else if (aButtonAct == ERemConCoreApiButtonRelease) + { + TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek)); + } +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleRewind() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::HandleRewind( TRemConCoreApiButtonAction aButtonAct ) +{ + if (aButtonAct == ERemConCoreApiButtonPress) + { + TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekBackward)); + } + else if (aButtonAct == ERemConCoreApiButtonRelease) + { + TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek)); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleVolumeUp() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::HandleVolumeUp( TRemConCoreApiButtonAction aButtonAct ) +{ + switch ( aButtonAct ) + { + case ERemConCoreApiButtonPress: + { + // Volume Up - Pressed + if ( iVolumeRepeatTimer->IsActive() ) + { + iVolumeRepeatTimer->Cancel(); + } + + iVolumeRepeatUp = ETrue; + iVolumeRepeatTimer->Start( + KAknStandardKeyboardRepeatRate, + KAknStandardKeyboardRepeatRate, + TCallBack( + CVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL, + this ) ); + + break; + } + case ERemConCoreApiButtonRelease: + { + // Volume Up - Released + iVolumeRepeatTimer->Cancel(); + break; + } + case ERemConCoreApiButtonClick: + { + // Volume Up - Clicked + TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdIncreaseVolume ) ); + break; + } + } +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleVolumeDown() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::HandleVolumeDown( TRemConCoreApiButtonAction aButtonAct ) +{ + switch ( aButtonAct ) + { + case ERemConCoreApiButtonPress: + { + // Volume Up - Pressed + if ( iVolumeRepeatTimer->IsActive() ) + { + iVolumeRepeatTimer->Cancel(); + } + + iVolumeRepeatUp = EFalse; + iVolumeRepeatTimer->Start( + KAknStandardKeyboardRepeatRate, + KAknStandardKeyboardRepeatRate, + TCallBack( + CVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL, + this ) ); + + break; + } + case ERemConCoreApiButtonRelease: + { + // Volume Up - Released + iVolumeRepeatTimer->Cancel(); + break; + } + case ERemConCoreApiButtonClick: + { + // Volume Down - Clicked + TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdDecreaseVolume ) ); + break; + } + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::ProcessKeyEvent() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& /*aKeyEvent*/, + TEventCode /*aType*/ ) +{ + MPX_DEBUG(_L("VideoPlaybackUserInputHandler::ProcessKeyEvent")); + + /* + switch (iProcessingInputType) + { + case EVideoNone: + { + if (aType == EEventKeyDown && iForeground) + { + iProcessingInputType = EVideoKeyboard; + iLastPressedKeyCode = aKeyEvent.iCode; + iLastPressedKeyScanCode = aKeyEvent.iScanCode; + if ( iTVOutConnected ) + { + RestartDisplayTimer(); + } + iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType ); + } + break; + } + case EVideoKeyboard: + { + if (aType == EEventKeyUp) + { + // only handle up event for the key being handled + // ignore spurious key presses + if (aKeyEvent.iCode == iLastPressedKeyCode && + aKeyEvent.iScanCode == iLastPressedKeyScanCode) + { + iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType ); + + // reset the value only on key up event + iProcessingInputType = EVideoNone; + } + } + break; + } + default: + { + // user input is disallowed + break; + } + } // switch*/ +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::ProcessMediaKey() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::ProcessMediaKey( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) +{ + MPX_DEBUG(_L("CVideoPlaybackUserInputHandler::ProcessMediaKey")); + + switch (iProcessingInputType) + { + case EVideoNone: + { + if (aButtonAct == ERemConCoreApiButtonPress && iForeground) + { + iProcessingInputType = EVideoMediaKeys; + iLastMediaKeyPressed = aOperationId; + DoHandleMediaKey(aOperationId, aButtonAct); + if ( iTVOutConnected ) + { + RestartDisplayTimer(); + } + } + else if (aButtonAct == ERemConCoreApiButtonClick && iForeground) + { + DoHandleMediaKey(aOperationId, aButtonAct); + if ( iTVOutConnected ) + { + RestartDisplayTimer(); + } + // reset on click AND/OR release + iProcessingInputType = EVideoNone; + } + break; + } + case EVideoMediaKeys: + { + if (aButtonAct == ERemConCoreApiButtonRelease) + { + // handle only if this release is for media-key being currently handled + // ignore spurious media key presses + if (iLastMediaKeyPressed == aOperationId) + { + DoHandleMediaKey(aOperationId, aButtonAct); + // reset on click AND/OR release + iProcessingInputType = EVideoNone; + } + } + break; + } + default: + { + // user input is disallowed + break; + } + } // switch +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL() +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr ) +{ + MPX_DEBUG(_L("CVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()")); + + static_cast(aPtr)->HandleVolumeRepeatL(); + + return KErrNone; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleVolumeRepeatL() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::HandleVolumeRepeatL() +{ + MPX_DEBUG(_L("CVideoPlaybackUserInputHandler::HandleVolumeRepeatL()")); + + TMPXVideoPlaybackViewCommandIds command = EMPXPbvCmdDecreaseVolume; + + if ( iVolumeRepeatUp ) + { + command = EMPXPbvCmdIncreaseVolume; + } + + iViewWrapper->HandleCommandL( command ); +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::SetForeground() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::SetForeground( TBool aForeground ) +{ + iForeground = aForeground; + + if ( !iForeground ) + { + // we are in background so reset iProcessingInputType value + iProcessingInputType = EVideoNone; + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::DisableBacklight() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::DisableBacklight() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackUserInputHandler::DisableBacklight")); + + // cancel the timer + iDisplayTimer->Cancel(); + + // disable the backlight + HAL::Set( HALData::EBacklightState, 0 ); +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::EnableBacklight() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::EnableBacklight() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackUserInputHandler::EnableBacklight")); + + // enable the backlight + HAL::Set( HALData::EBacklightState, 1 ); +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleTVOutEvent() +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::HandleTVOutEventL(TBool aTVOutConnected) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackUserInputHandler::HandleTVOutEvent")); + + iTVOutConnected = aTVOutConnected; + + if ( iTVOutConnected ) + { + // Get the display light time-out value from CenRep + CRepository* repository = CRepository::NewLC( KCRUidLightSettings ); + + // What's the timeout value (in seconds ) for the display light? + repository->Get( KDisplayLightsTimeout, iDisplayTimeOut ); + MPX_DEBUG(_L("CVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut); + + CleanupStack::PopAndDestroy( repository ); + + // Convert the timeout value to microseconds + iDisplayTimeOut *= KMPXMicroSecondsInASecond; + + RestartDisplayTimer(); + } + else + { + iDisplayTimer->Cancel(); + EnableBacklight(); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::HandleDisplayTimeout +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaybackUserInputHandler::HandleDisplayTimeout( TAny* aPtr ) +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackUserInputHandler::HandleDisplayTimeout")); + + static_cast(aPtr)->DisableBacklight(); + + return KErrNone; +} + +// ----------------------------------------------------------------------------- +// CVideoPlaybackUserInputHandler::RestartDisplayTimer +// ----------------------------------------------------------------------------- +// +void CVideoPlaybackUserInputHandler::RestartDisplayTimer() +{ + MPX_ENTER_EXIT(_L("CVideoPlaybackUserInputHandler::RestartDisplayTimer")); + + // check if the display timer is running if so cancelit + if ( iDisplayTimer->IsActive() ) + { + iDisplayTimer->Cancel(); + } + else + { + // timeout has happened and the backlight is disabled + // enable the backlight + HAL::Set( HALData::EBacklightState, 1 ); + } + + TBool backlightState; + TInt ret = HAL::Get( HALData::EBacklightState, backlightState ); + + // Re start the display backlight timer + iDisplayTimer->Start( iDisplayTimeOut, iDisplayTimeOut, + TCallBack( CVideoPlaybackUserInputHandler::HandleDisplayTimeout, this ) ); +} + +// EOF diff -r 21fe8338c6bf -r 4bfa887905cf videoplayerapp/bwins/videoplayerengineu.def --- a/videoplayerapp/bwins/videoplayerengineu.def Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayerapp/bwins/videoplayerengineu.def Mon Aug 23 14:27:29 2010 +0300 @@ -64,4 +64,5 @@ ?viewReadySlot@VideoPlayerEngine@@QAEXXZ @ 63 NONAME ; void VideoPlayerEngine::viewReadySlot(void) ?handlePlaybackFailure@VideoPlayerEngine@@AAEXH@Z @ 64 NONAME ; void VideoPlayerEngine::handlePlaybackFailure(int) ?playURI@VideoPlayerEngine@@QAEXVQString@@@Z @ 65 NONAME ; void VideoPlayerEngine::playURI(class QString) + ?serviceQuit@VideoPlayerEngine@@AAEXXZ @ 66 NONAME ; void VideoPlayerEngine::serviceQuit(void) diff -r 21fe8338c6bf -r 4bfa887905cf videoplayerapp/eabi/videoplayerengineu.def --- a/videoplayerapp/eabi/videoplayerengineu.def Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayerapp/eabi/videoplayerengineu.def Mon Aug 23 14:27:29 2010 +0300 @@ -68,4 +68,5 @@ _ZN17VideoPlayerEngine16applicationReadyEv @ 67 NONAME _ZN17VideoPlayerEngine21handlePlaybackFailureEi @ 68 NONAME _ZN17VideoPlayerEngine7playURIE7QString @ 69 NONAME + _ZN17VideoPlayerEngine11serviceQuitEv @ 70 NONAME diff -r 21fe8338c6bf -r 4bfa887905cf videoplayerapp/inc/videoplayerengine.h --- a/videoplayerapp/inc/videoplayerengine.h Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayerapp/inc/videoplayerengine.h Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 19 % +// Version : %version: 20 % #ifndef VIDEOPLAYERENGINE_H #define VIDEOPLAYERENGINE_H @@ -68,6 +68,7 @@ private slots: void handleQuit(); + void serviceQuit(); private: void activateView( MpxHbVideoCommon::MpxHbVideoViewType viewType ); diff -r 21fe8338c6bf -r 4bfa887905cf videoplayerapp/videoplayerengine/src/videoplayerengine.cpp --- a/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Fri Aug 06 09:43:48 2010 +0300 +++ b/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Mon Aug 23 14:27:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#42 % +// Version : %version: da1mmcf#43 % #include @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "videoplayerengine.h" #include "videoactivitystate.h" @@ -323,8 +323,7 @@ { if ( shouldExit() ) { - qApp->quit(); - XQServiceUtil::toBackground( false ); + serviceQuit(); } else if ( shouldActivateCollectionView() ) { @@ -707,7 +706,9 @@ if ( mIsPlayService ) { - HbDeviceNotificationDialog* dlg = new HbDeviceNotificationDialog(); + HbNotificationDialog* dlg = new HbNotificationDialog(); + + connect( dlg, SIGNAL( aboutToClose() ), this, SLOT( serviceQuit() ) ); switch ( errorCode ) { @@ -739,10 +740,22 @@ } dlg->show(); - - - qApp->quit(); - XQServiceUtil::toBackground( false ); + } } + + +// ------------------------------------------------------------------------------------------------- +// serviceQuit() +// ------------------------------------------------------------------------------------------------- +// +void VideoPlayerEngine::serviceQuit() +{ + MPX_DEBUG(_L("VideoPlayerEngine::serviceQuit()")); + + qApp->quit(); + XQServiceUtil::toBackground( false ); +} + + // End of file