# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1286140638 -10800 # Node ID a91aa46552bef19f42db880f2aa474c6693293be # Parent 199e6e1e0b544973366502c4297cf7b524f1664a Revision: 201037 Kit: 201039 diff -r 199e6e1e0b54 -r a91aa46552be commonutilities/common/bwins/glxcommonu.def --- a/commonutilities/common/bwins/glxcommonu.def Fri Sep 17 08:29:24 2010 +0300 +++ b/commonutilities/common/bwins/glxcommonu.def Mon Oct 04 00:17:18 2010 +0300 @@ -46,4 +46,5 @@ ?CreateCameraAlbumExclusionFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@XZ @ 45 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(void) ?NewL@CGlxTNMonitor@@SAPAV1@PAVMGlxTNObserver@@@Z @ 46 NONAME ; class CGlxTNMonitor * CGlxTNMonitor::NewL(class MGlxTNObserver *) ?CreateExcludeDrmImageTypeFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@W4TGlxFilterItemType@@@Z @ 47 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateExcludeDrmImageTypeFilterL(enum TGlxFilterItemType) + ?CreateMimeTypeFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@ABVTDesC16@@@Z @ 48 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateMimeTypeFilterL(class TDesC16 const &) diff -r 199e6e1e0b54 -r a91aa46552be commonutilities/common/eabi/glxcommonu.def --- a/commonutilities/common/eabi/glxcommonu.def Fri Sep 17 08:29:24 2010 +0300 +++ b/commonutilities/common/eabi/glxcommonu.def Mon Oct 04 00:17:18 2010 +0300 @@ -49,4 +49,5 @@ _ZTI13CGlxTNMonitor @ 48 NONAME _ZTV13CGlxTNMonitor @ 49 NONAME _ZN17TGlxFilterFactory32CreateExcludeDrmImageTypeFilterLE18TGlxFilterItemType @ 50 NONAME + _ZN17TGlxFilterFactory21CreateMimeTypeFilterLERK7TDesC16 @ 51 NONAME diff -r 199e6e1e0b54 -r a91aa46552be commonutilities/common/inc/glxfilterfactory.h --- a/commonutilities/common/inc/glxfilterfactory.h Fri Sep 17 08:29:24 2010 +0300 +++ b/commonutilities/common/inc/glxfilterfactory.h Mon Oct 04 00:17:18 2010 +0300 @@ -179,6 +179,15 @@ CMPXCollectionPath* aSelectedListPath = NULL, TBool aReverseSortDirection = EFalse); + + /** + * Creates a MimeType filter, Used to specify item of perticulr mime type. + * + * @param const TDesC& aMimeType ( mime type of item) + * @return a filter object with array elements set specifying mime type filter type + */ + IMPORT_C static CMPXFilter* TGlxFilterFactory::CreateMimeTypeFilterL(const TDesC& aMimeType); + /** * Creates a combined filter. items will be sorted by the filters specified * diff -r 199e6e1e0b54 -r a91aa46552be commonutilities/common/src/glxfilterfactory.cpp --- a/commonutilities/common/src/glxfilterfactory.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/commonutilities/common/src/glxfilterfactory.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -223,7 +223,20 @@ filterProperties.iExcludeAnimation = ETrue;; return CreateCombinedFilterL(filterProperties, aOriginalFilter); } - + +// --------------------------------------------------------------------------- +// Creates a URI filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateMimeTypeFilterL(const TDesC& aMimeType) + { + TGlxFilterProperties filterProperties; + filterProperties.iItemType = EGlxFilterImage; + filterProperties.iNoDRM = ETrue; + filterProperties.iMimeType = &aMimeType; + return CreateCombinedFilterL(filterProperties); + } + // --------------------------------------------------------------------------- // Creates a combined filter object. // --------------------------------------------------------------------------- @@ -470,7 +483,19 @@ { filter->SetTextValueL(KGlxFilterGeneralUri, *uri); } - + const TDesC* mimeType = aFilterProperties.iMimeType; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralMimeType) ) + { + if( !aOverrideOriginal || ( !aFilterProperties.iMimeType ) ) + { + mimeType = &aOriginalFilter->ValueText(KGlxFilterGeneralMimeType); + } + } + if( mimeType ) + { + filter->SetTextValueL(KGlxFilterGeneralMimeType, *mimeType); + } + CleanupStack::Pop(filter); return filter; } @@ -548,6 +573,10 @@ { filterProperties.iUri = &aFilter->ValueText(KGlxFilterGeneralUri); } + if( aFilter->IsSupported(KGlxFilterGeneralMimeType) ) + { + filterProperties.iMimeType = &aFilter->ValueText(KGlxFilterGeneralMimeType); + } return filterProperties; } diff -r 199e6e1e0b54 -r a91aa46552be engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -71,6 +71,7 @@ _LIT(KPropertyDefNameTitle, "Title"); _LIT(KPropertyDefNameFrameCount, "FrameCount"); _LIT(KPropertyDefNameOrigin, "Origin"); +_LIT(KPropertyDefNameMymetype, "ItemType"); // ---------------------------------------------------------------------------- // Constructor @@ -360,7 +361,12 @@ logicCondition.AddObjectConditionL( DataSource()->ImageDef() ); } } - + if(aFilterProperties.iMimeType) + { + CMdEPropertyDef& mimetypeProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameMymetype); + aLogicCondition.AddPropertyConditionL(mimetypeProperty, ETextPropertyConditionCompareEndsWith,*aFilterProperties.iMimeType); + } + if( aFilterProperties.iExcludeAnimation ) { // Exclude any image with a frame count > 1 diff -r 199e6e1e0b54 -r a91aa46552be gallery/sis/photos.pkg --- a/gallery/sis/photos.pkg Fri Sep 17 08:29:24 2010 +0300 +++ b/gallery/sis/photos.pkg Mon Oct 04 00:17:18 2010 +0300 @@ -93,6 +93,9 @@ "\epoc32\release\armv5\urel\glxmedialists.dll" -"!:\sys\bin\glxmedialists.dll" "\epoc32\release\armv5\urel\glxdrmutility.dll" -"!:\sys\bin\glxdrmutility.dll" +; OOM plugin +"\epoc32\release\armv5\urel\glxmemoryplugin.dll" -"!:\sys\bin\glxmemoryplugin.dll" + ; viewmanagement "\epoc32\release\armv5\urel\glxstatehandler.dll" -"!:\sys\bin\glxstatehandler.dll" "\epoc32\release\armv5\urel\glxviewmanager.dll" -"!:\sys\bin\glxviewmanager.dll" diff -r 199e6e1e0b54 -r a91aa46552be gallery/sis/photos.sis Binary file gallery/sis/photos.sis has changed diff -r 199e6e1e0b54 -r a91aa46552be gallery/sis/photos.sisx Binary file gallery/sis/photos.sisx has changed diff -r 199e6e1e0b54 -r a91aa46552be gallery/sis/photos_stub.pkg --- a/gallery/sis/photos_stub.pkg Fri Sep 17 08:29:24 2010 +0300 +++ b/gallery/sis/photos_stub.pkg Mon Oct 04 00:17:18 2010 +0300 @@ -82,6 +82,9 @@ "" - "z:\sys\bin\glxmedialists.dll" "" - "z:\sys\bin\glxtvout.dll" +;OOM plugin +"" - "z:\sys\bin\glxmemoryplugin.dll" + ; viewmanagement "" - "z:\sys\bin\glxstatehandler.dll" "" - "z:\sys\bin\glxviewmanager.dll" diff -r 199e6e1e0b54 -r a91aa46552be gallery/sis/photos_stub.sis Binary file gallery/sis/photos_stub.sis has changed diff -r 199e6e1e0b54 -r a91aa46552be group/bld_glx.inf --- a/group/bld_glx.inf Fri Sep 17 08:29:24 2010 +0300 +++ b/group/bld_glx.inf Mon Oct 04 00:17:18 2010 +0300 @@ -61,3 +61,5 @@ #include "../ui/uiengine/medialists/group/bld.inf" #include "../tvout/tvoutengine/group/bld.inf" + +#include "../memoryplugin/group/bld.inf" diff -r 199e6e1e0b54 -r a91aa46552be inc/glxfiltergeneraldefs.h --- a/inc/glxfiltergeneraldefs.h Fri Sep 17 08:29:24 2010 +0300 +++ b/inc/glxfiltergeneraldefs.h Mon Oct 04 00:17:18 2010 +0300 @@ -87,6 +87,7 @@ const TMPXAttributeData KGlxFilterGeneralNoDRM = { KGlxFilterIdGeneral, EGlxFilterNoDRM }; /// TBool const TMPXAttributeData KGlxFilterGeneralNavigationalStateOnly = { KGlxFilterIdGeneral, 0x4000 }; /// TBool const TMPXAttributeData KGlxFilterGeneralMaxCount = { KGlxFilterIdGeneral, 0x8000 }; // TInt +const TMPXAttributeData KGlxFilterGeneralMimeType = { KGlxFilterIdGeneral, 0x10000 }; // Text enum TGlxFilterSortOrder { @@ -116,7 +117,8 @@ EGlxFilterAlbum, EGlxFilterTag, EGlxFilterMonth, - EGlxFilterExcludeCamera + EGlxFilterExcludeCamera, + EGlxFilterFetcherMimeType }; enum TGlxFilterOrigin diff -r 199e6e1e0b54 -r a91aa46552be inc/glxfilterproperties.h --- a/inc/glxfilterproperties.h Fri Sep 17 08:29:24 2010 +0300 +++ b/inc/glxfilterproperties.h Mon Oct 04 00:17:18 2010 +0300 @@ -52,7 +52,8 @@ iUri(NULL), iStartDate(0), iEndDate(0), - iNoDRM(EFalse) + iNoDRM(EFalse), + iMimeType(NULL) {} public: @@ -73,6 +74,7 @@ TTime iStartDate; TTime iEndDate; TBool iNoDRM; + const TDesC* iMimeType; }; diff -r 199e6e1e0b54 -r a91aa46552be main/glxaiwservicehandler.cpp --- a/main/glxaiwservicehandler.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/main/glxaiwservicehandler.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -41,7 +42,7 @@ #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image") #define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image") #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView") - +#define XQINFO_KEY_FILTER_TYPE QLatin1String("GlxFetcherFilter") // ---------------------------------------------------------------------------- // GlxAiwServiceHandler() @@ -148,7 +149,7 @@ } -void GlxAiwServiceHandler::launchFetcher(QString viewTitle) +void GlxAiwServiceHandler::launchFetcher(QString viewTitle,int fetcherFilterType) { qDebug() << "GlxAiwServiceHandler::launchFetcher START"; qApp->setApplicationName(viewTitle); @@ -161,7 +162,7 @@ SLOT( itemSelected(const QModelIndex &,QAbstractItemModel &))); qDebug() << "GlxAiwServiceHandler::launchFetcher err = "<< err; - mStateMgr->launchFetcher(); + mStateMgr->launchFetcher(fetcherFilterType); return; } @@ -254,8 +255,18 @@ void GlxGetImageService::fetch() { mImageRequestIndex = setCurrentRequestAsync(); - QString title = GLX_TITLE; - mServiceApp->launchFetcher(title); + + QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString(); + if(title.isNull()){ + title = GLX_TITLE; + } + + int fetcherFilterType = 0; //no filter + if(requestInfo().info(XQINFO_KEY_FILTER_TYPE).canConvert()){ + fetcherFilterType = (requestInfo().info(XQINFO_KEY_FILTER_TYPE)).toInt(); + qDebug()<< "GlxGetImageService::fetch() fetcherFilterType = " << fetcherFilterType; + } + mServiceApp->launchFetcher(title,fetcherFilterType); } // ---------------------------------------------------------------------------- @@ -344,7 +355,12 @@ { qDebug() << "GlxGetImageServiceNSDI::fetch START"; mImageRequestIndex = setCurrentRequestAsync(); - QString title = GLX_TITLE; + + QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString(); + if(title.isNull()){ + title = GLX_TITLE; + } + mServiceApp->launchFetcher(title); qDebug() << "GlxGetImageServiceNSDI::fetch END"; } @@ -424,7 +440,11 @@ Q_UNUSED(filter) Q_UNUSED(flag) mImageRequestIndex = setCurrentRequestAsync(); - QString title = GLX_TITLE; + QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString(); + if(title.isNull()){ + title = GLX_TITLE; + } + mServiceApp->launchFetcher(title); } @@ -488,7 +508,7 @@ mAsyncReqId = setCurrentRequestAsync(); } - QString title = requestInfo().info("WindowTitle").toString(); + QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString(); if(title.isNull()){ title =GLX_IMAGE_VIEWER; } @@ -499,6 +519,20 @@ bool GlxImageViewerService::view(XQSharableFile sf) { + XQApplicationManager appmgr; + QFile tempfile(sf.fileName()); + QVariantList attrValues; + QList attrNames; + attrNames.append(XQApplicationManager::IsProtected); + bool ok1 = appmgr.getDrmAttributes(tempfile, attrNames, attrValues); + if(ok1 && attrValues.at(0).toBool()){ + HbNotificationDialog::launchDialog("NOT SUPPORTED"); + connect(this, SIGNAL(returnValueDelivered()), mServiceApp, + SLOT(handleAnswerDelivered())); + complete(true); + return false; + } + if (!mImageViewerInstance) { mImageViewerInstance = CGlxImageViewerManager::InstanceL(); @@ -511,7 +545,7 @@ sf.close(); } - QString title = requestInfo().info("WindowTitle").toString(); + QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString(); if(title.isNull()){ title = GLX_IMAGE_VIEWER; } diff -r 199e6e1e0b54 -r a91aa46552be main/glxaiwservicehandler.h --- a/main/glxaiwservicehandler.h Fri Sep 17 08:29:24 2010 +0300 +++ b/main/glxaiwservicehandler.h Mon Oct 04 00:17:18 2010 +0300 @@ -56,7 +56,7 @@ * launch image fetcher view * @param viewTitle title for image fetcher */ - void launchFetcher(QString viewTitle); + void launchFetcher(QString viewTitle,int fetcherFilterType = 0); /** * launch image viewer diff -r 199e6e1e0b54 -r a91aa46552be memoryplugin/data/0x200104E3.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memoryplugin/data/0x200104E3.rss Mon Oct 04 00:17:18 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for memoryplugin +* +*/ + + + +#include +#include + +RESOURCE REGISTRY_INFO theInfo +{ + dll_uid = 0x200104E3; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KOomPluginInterfaceUidValue; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x200104E3; + version_no = 1 ; + display_name = "photos"; + default_data = "photos"; + opaque_data = "photos"; + } + }; + } + }; +} + diff -r 199e6e1e0b54 -r a91aa46552be memoryplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memoryplugin/group/bld.inf Mon Oct 04 00:17:18 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information for project memoryplugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +glxmemoryplugin.mmp + +PRJ_EXPORTS diff -r 199e6e1e0b54 -r a91aa46552be memoryplugin/group/glxmemoryplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memoryplugin/group/glxmemoryplugin.mmp Mon Oct 04 00:17:18 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project glxmemoryplugin.DLL +* +*/ + +TARGET glxmemoryplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200104E3 + +#include +#include +#include + + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +USERINCLUDE . +APP_LAYER_SYSTEMINCLUDE + + +TARGETPATH resource/apps +START RESOURCE ../data/0x200104E3.rss +TARGET glxmemoryplugin.rsc +END + +SOURCEPATH ../src +SOURCE glxmemoryplugin.cpp + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY oommonitor.lib diff -r 199e6e1e0b54 -r a91aa46552be memoryplugin/src/glxmemoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memoryplugin/src/glxmemoryplugin.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 OOM memory plugin. Registers Photos UID with +* the framework to receive OOM notifications. +* +*/ + + +#include +#include +#include + +TAny* CreatePhotosOOMPluginL() + { + const TUid KGlxGalleryApplicationUid = { 0x20000A14 }; + return CAppOomMonitorPlugin::NewL(KGlxGalleryApplicationUid); + } + +const TImplementationProxy ImplementationTable[] = + { + {{0x200104E3}, ::CreatePhotosOOMPluginL} + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ; + return ImplementationTable; + } diff -r 199e6e1e0b54 -r a91aa46552be rom/photos.iby --- a/rom/photos.iby Fri Sep 17 08:29:24 2010 +0300 +++ b/rom/photos.iby Mon Oct 04 00:17:18 2010 +0300 @@ -49,6 +49,8 @@ ECOM_PLUGIN( glxcollectionpluginimageviewer.dll, glxcollectionpluginimageviewer.rsc ) +ECOM_PLUGIN( glxmemoryplugin.dll, glxmemoryplugin.rsc ) + // logger file=ABI_DIR/BUILD_DIR/glxlogging.dll SHARED_LIB_DIR/glxlogging.dll diff -r 199e6e1e0b54 -r a91aa46552be tsrc/unittest/unittest.pro --- a/tsrc/unittest/unittest.pro Fri Sep 17 08:29:24 2010 +0300 +++ b/tsrc/unittest/unittest.pro Mon Oct 04 00:17:18 2010 +0300 @@ -26,3 +26,4 @@ SUBDIRS += unittest_imagedecoderwrapper SUBDIRS += unittest_medialistwrapper SUBDIRS += unittest_statehandler +SUBDIRS += unittest_mediamodel diff -r 199e6e1e0b54 -r a91aa46552be tsrc/unittest/unittest_mediamodel/unittest_mediamodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/unittest/unittest_mediamodel/unittest_mediamodel.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -0,0 +1,457 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "unittest_mediamodel.h" +#include "glxmediamodel.h" +#include "glxmlwrapper.h" +#include "glxmodelparm.h" +#include "glxcollectionpluginall.hrh" +#include "hbicon.h" + + +// ----------------------------------------------------------------------------- +// initTestCase +// ----------------------------------------------------------------------------- +// +void TestGlxMediaModel::initTestCase() +{ + GlxModelParm modelParm; + modelParm.setCollection( KGlxCollectionPluginAllImplementationUid ); + modelParm.setDepth(0); + modelParm.setContextMode( GlxContextLsGrid ) ; + mModel = new GlxMediaModel( modelParm ); + QTest::qWait(2000); + + QVERIFY( mModel ); + QVERIFY( mModel->mMLWrapper ); + QVERIFY( mModel->mDRMUtilityWrapper ); + QVERIFY( mModel->m_DefaultIcon ); + QVERIFY( mModel->m_CorruptIcon ); + QCOMPARE( mModel->thumbnailPopulatedFlag, false ); + QCOMPARE( mModel->mPaintPage, true ); +} + +// ----------------------------------------------------------------------------- +// init +// ----------------------------------------------------------------------------- +// +void TestGlxMediaModel::init() +{ + +} + +void TestGlxMediaModel::rowCountTestCase() +{ + QVERIFY( mModel->rowCount() >= 0 ); +} + +void TestGlxMediaModel::columnCountTestCase() +{ + QCOMPARE( mModel->columnCount(), 1 ); +} + +void TestGlxMediaModel::parentTestCase() +{ + QModelIndex index = mModel->parent( mModel->index( 0, 0 ) ); + QCOMPARE( index.isValid(), false); +} + +void TestGlxMediaModel::itemImageDataInvalidIndexTestCase() +{ + QVariant variant = mModel->itemImageData( QModelIndex(), GlxFsImageRole ); + QCOMPARE( variant.isValid(), false ); + + variant = mModel->itemImageData( mModel->createIndex( mModel->rowCount(), 0 ), GlxFsImageRole ); + QCOMPARE( variant.isValid(), false ); +} + +void TestGlxMediaModel::itemImageDataGridImagetestCase() +{ + mModel->itemIconCache.insert( 0, NULL ); + QVariant variant = mModel->itemImageData( mModel->index( 0, 0), Qt::DecorationRole ); + QCOMPARE( variant.isValid(), true ); + + mModel->itemIconCache.insert( 0, new HbIcon() ); + variant = mModel->itemImageData( mModel->index( 0, 0), Qt::DecorationRole ); + QCOMPARE( variant.isValid(), true ); +} + +void TestGlxMediaModel::itemImageDataHdmiBitmapTestCase() +{ + QVariant variant = mModel->itemImageData( mModel->index( 0, 0), GlxHdmiBitmap ); + QCOMPARE( variant.isValid(), true ); +} + +void TestGlxMediaModel::ItemPropertyViewTitleTestCase() +{ + QVariant variant = mModel->collectionProperty( GlxViewTitle ); + QCOMPARE( variant.isValid(), true ); +} + +void TestGlxMediaModel::ItemPropertyImageTitleTestCase() +{ + QVariant variant = mModel->collectionProperty( GlxImageTitle ); + QCOMPARE( variant.isValid(), false ); +} + +void TestGlxMediaModel::ItemPropertyDateTestCase() +{ + QVariant variant = mModel->collectionProperty( GlxDateRole ); + QCOMPARE( variant.isValid(), false ); +} + +void TestGlxMediaModel::ItemPropertyCorruptImageTestCase() +{ + QVariant variant = mModel->collectionProperty( GlxImageCorruptRole ); + QCOMPARE( variant.isValid(), false ); +} + +void TestGlxMediaModel::ItemPropertyTimeTestCase() +{ + QVariant variant = mModel->collectionProperty( GlxTimeRole ); + QCOMPARE( variant.isValid(), false ); +} + +void TestGlxMediaModel::ItemPropertySizeTestCase() +{ + QVariant variant = mModel->collectionProperty( GlxSizeRole ); + QCOMPARE( variant.isValid(), false ); +} + +void TestGlxMediaModel::ItemPropertyDescTestCase() +{ + QVariant variant = mModel->collectionProperty( GlxDescRole ); + QCOMPARE( variant.isValid(), false ); +} + +void TestGlxMediaModel::indexTestCase() +{ + QModelIndex index = mModel->index( -1, 0 ); + QCOMPARE( index.isValid(), false); + + index = mModel->index( 0, -1 ); + QCOMPARE( index.isValid(), false); + + index = mModel->index( mModel->rowCount(), 1 ); + QCOMPARE( index.isValid(), false); + + index = mModel->index( 0, 0 ); + QCOMPARE( index.isValid(), true); +} + +void TestGlxMediaModel::setDataContextRoleTestCase() +{ + mModel->setData( mModel->index( 0, 0 ), GlxContextPtGrid, GlxContextRole ); + QCOMPARE( mModel->mContextMode, GlxContextPtGrid ); + + mModel->setData( mModel->index( 0, 0), QVariant( QVariant::Invalid ), GlxContextRole ); + QCOMPARE( mModel->mContextMode, GlxContextPtGrid ); +} + +void TestGlxMediaModel::setDataRemoveContextRoleTestCase() +{ + mModel->setData( mModel->index( 0, 0), GlxContextPtGrid, GlxContextRole ); + + mModel->setData( mModel->index( 0, 0), QVariant( QVariant::Invalid ), GlxRemoveContextRole ); + QCOMPARE( mModel->mContextMode, GlxContextPtGrid ); +} + +void TestGlxMediaModel::setDataFocusIndexRoleTestCase() +{ + mModel->setData( mModel->index( 0, 0), 1, GlxFocusIndexRole ); + QCOMPARE( mModel->mFocusIndex, 1 ); + + mModel->setData( mModel->index( 0, 0), QVariant( QVariant::Invalid ), GlxFocusIndexRole ); + QCOMPARE( mModel->mFocusIndex, 1 ); +} + +void TestGlxMediaModel::setDataVisualIndexTestCase() +{ + mModel->setData( mModel->index( 0, 0), 1, GlxVisualWindowIndex ); + int visualIndex = mModel->mMLWrapper->getVisibleWindowIndex(); + QCOMPARE( visualIndex, 1 ); + + mModel->setData( mModel->index( 0, 0), QVariant( QVariant::Invalid ), GlxVisualWindowIndex ); + visualIndex = mModel->mMLWrapper->getVisibleWindowIndex(); + QCOMPARE( visualIndex, 1 ); +} + +void TestGlxMediaModel::setDataSelectedIndexTestCase() +{ + bool result = mModel->setData( mModel->index( 0, 0), 1, GlxSelectedIndexRole ); + QCOMPARE( result, true ); + + result = mModel->setData( mModel->index( 0, 0), QVariant( QVariant::Invalid ), GlxSelectedIndexRole ); + QCOMPARE( result, false ); +} + +void TestGlxMediaModel::setDataSubStateTestCase() +{ + bool result = mModel->setData( mModel->index( 0, 0), 5, GlxSubStateRole ); + QCOMPARE( result, true ); + QCOMPARE( mModel->mSubState, 5 ); + + result = mModel->setData( mModel->index( 0, 0), QVariant( QVariant::Invalid ), GlxSubStateRole ); + QCOMPARE( result, false ); + QCOMPARE( mModel->mSubState, 5 ); +} + +void TestGlxMediaModel::setDataTempVisualIndexTestCase() +{ + bool result = mModel->setData( mModel->index( 0, 0), 2, GlxTempVisualWindowIndex ); + QCOMPARE( result, true ); + QCOMPARE( mModel->mTempVisibleWindowIndex, 2 ); + + result = mModel->setData( mModel->index( 0, 0), QVariant( QVariant::Invalid ), GlxTempVisualWindowIndex ); + QCOMPARE( result, false ); + QCOMPARE( mModel->mTempVisibleWindowIndex, 2 ); +} + +void TestGlxMediaModel::GetGridIconItemTestCase() +{ + QTest::qWait( 2000 ); + + mModel->itemIconCache.insert( 0, NULL ); + HbIcon *icon = mModel->GetGridIconItem( 0, GlxTBContextGrid ); + QVERIFY( icon || icon == NULL ); + + mModel->itemIconCache.insert( 0, new HbIcon() ); + icon = mModel->GetGridIconItem( 0, GlxTBContextGrid ); + QVERIFY( icon ); +} + +void TestGlxMediaModel::GetFsIconItemTestCase() +{ + mModel->setContextMode( GlxContextPtFs ); + HbIcon *icon = mModel->GetFsIconItem( 0, GlxTBContextPtFs ); + QTest::qWait( 2000 ); + QVERIFY( icon || icon == NULL ); + mModel->setContextMode( GlxContextLsGrid ); +} + +void TestGlxMediaModel::getFullScreenIconTestCase() +{ + HbIcon icon = mModel->getFullScreenIcon( 0 ); + QCOMPARE( icon.isNull(), false ); + + mModel->itemIconCache.insert( 0, NULL ); + icon = mModel->getFullScreenIcon( 0 ); + QCOMPARE( icon.isNull(), false ); + + mModel->itemIconCache.insert( 0, new HbIcon() ); + icon = mModel->getFullScreenIcon( 0 ); + QCOMPARE( icon.isNull(), false ); +} + +void TestGlxMediaModel::getFullScreenImagetestCase() +{ + mModel->setContextMode( GlxContextLsFs ); + QTest::qWait( 2000 ); + QImage img = mModel->getFullScreenImage( 0 ); + QVERIFY( img.isNull() == true || img.isNull() == false ); + + mModel->setContextMode( GlxContextPtFs ); + QTest::qWait( 2000 ); + img = mModel->getFullScreenImage( 0 ); + QVERIFY( img.isNull() == true || img.isNull() == false ); +} + +void TestGlxMediaModel::setContextModeTestCase() +{ + mModel->setContextMode( GlxContextPtFs ); + QCOMPARE( mModel->mContextMode, GlxContextPtFs ); + + mModel->setContextMode( GlxContextComment ); + QCOMPARE( mModel->mContextMode, GlxContextPtFs ); + mModel->removeContextMode( GlxContextComment ); + + mModel->setContextMode( GlxContextLsGrid ); + QCOMPARE( mModel->mContextMode, GlxContextLsGrid ); + QCOMPARE( mModel->itemFsIconCache.size(), 0 ); + QCOMPARE( mModel->itemIconCache.size(), 0 ); +} + +void TestGlxMediaModel::removeContextModeTestCase() +{ + mModel->removeContextMode( GlxContextComment ); + QCOMPARE( mModel->mContextMode, GlxContextLsGrid ); +} + +void TestGlxMediaModel::setFocusIndexTestCase() +{ + mModel->setFocusIndex( mModel->index( 1, 0 ) ); + QModelIndex modelIndex = mModel->getFocusIndex(); + QCOMPARE( mModel->mFocusIndex, 1 ); + QCOMPARE( 1, modelIndex.row() ); + + int index = mModel->rowCount() - 1; + mModel->setFocusIndex( mModel->index( index, 0 ) ); + modelIndex = mModel->getFocusIndex(); + QCOMPARE( mModel->mFocusIndex, modelIndex.row() ); + QCOMPARE( index, modelIndex.row() ); + + index = mModel->rowCount(); + mModel->setFocusIndex( mModel->index( index, 0 ) ); + modelIndex = mModel->getFocusIndex(); + QCOMPARE( mModel->mFocusIndex, modelIndex.row() ); + QCOMPARE( 0, modelIndex.row() ); +} + +void TestGlxMediaModel::getFocusIndexTestcase() +{ + mModel->mFocusIndex = -1; + mModel->setFocusIndex( mModel->index( 1, 0 ) ); + QModelIndex index = mModel->getFocusIndex(); + QCOMPARE( 1, index.row() ); + + mModel->mFocusIndex = 2; + mModel->setFocusIndex( mModel->index( 1, 0 ) ); + index = mModel->getFocusIndex(); + QCOMPARE( 1, index.row() ); +} + +void TestGlxMediaModel::setSelectedIndexTestCase() +{ + mModel->setSelectedIndex( mModel->index( 1, 0 ) ); +} + +void TestGlxMediaModel::getCorruptDefaultIconTestCase() +{ + HbIcon *icon = mModel->getCorruptDefaultIcon( mModel->index( 0, 0 ) ); + QVERIFY( icon ); +} + +void TestGlxMediaModel::thumbnailPopulatedCheckTestCase() +{ + mModel->thumbnailPopulatedFlag = false; + mModel->thumbnailPopulatedCheck( 1 ); + QCOMPARE( mModel->thumbnailPopulatedFlag, false ); + + mModel->thumbnailPopulatedCheck( 30 ); + QCOMPARE( mModel->thumbnailPopulatedFlag, true ); +} + +void TestGlxMediaModel::itemUpdatedTestCase() +{ + mModel->itemUpdated( 0, GlxTBContextGrid ); + QVERIFY( mModel->itemIconCache[0] == NULL ); + + mModel->thumbnailPopulatedFlag = false; + mModel->itemUpdated( 0, GlxTBContextGrid ); + QVERIFY( mModel->itemIconCache[0] == NULL ); + + mModel->itemUpdated( 0, GlxTBContextPtFs ); + QVERIFY( mModel->itemFsIconCache[0] == NULL ); + + mModel->itemUpdated( 0, GlxTBContextPtFs ); + QVERIFY( mModel->itemFsIconCache[0] == NULL ); +} + +void TestGlxMediaModel::itemsAddedTestCase() +{ + mModel->itemsAdded( 1, 5 ); + QCOMPARE( mModel->mFocusIndex, -1 ); + QCOMPARE( mModel->itemIconCache.size(), 0 ); + QCOMPARE( mModel->itemFsIconCache.size(), 0 ); +} + +void TestGlxMediaModel::itemsRemovedTestCase() +{ + mModel->itemsRemoved( 1, 5 ); + QCOMPARE( mModel->mFocusIndex, -1 ); + QCOMPARE( mModel->itemIconCache.size(), 0 ); + QCOMPARE( mModel->itemFsIconCache.size(), 0 ); +} + +void TestGlxMediaModel::itemCorruptedTestCase() +{ + mModel->thumbnailPopulatedFlag = false; + mModel->itemCorrupted( 1 ); + QCOMPARE( mModel->thumbnailPopulatedFlag, false ); + + mModel->itemCorrupted( 30 ); + QCOMPARE( mModel->thumbnailPopulatedFlag, true ); +} + +void TestGlxMediaModel::albumTitleUpdatedTestCase() +{ + mModel->albumTitleUpdated( QString( "Album" ) ); +} + +void TestGlxMediaModel::modelpopulatedTestCase() +{ + int visualIndex = mModel->mMLWrapper->getVisibleWindowIndex(); + mModel->mTempVisibleWindowIndex = -1; + mModel->modelpopulated(); + QCOMPARE( mModel->mTempVisibleWindowIndex, -1 ); + QCOMPARE( visualIndex, mModel->mMLWrapper->getVisibleWindowIndex() ); + + mModel->mTempVisibleWindowIndex = mModel->rowCount() - 1; + mModel->modelpopulated(); + visualIndex = mModel->mMLWrapper->getVisibleWindowIndex(); + QCOMPARE( mModel->mTempVisibleWindowIndex, -1 ); + QCOMPARE( visualIndex, mModel->rowCount() - 1 ); + + mModel->mTempVisibleWindowIndex = mModel->rowCount(); + mModel->modelpopulated(); + visualIndex = mModel->mMLWrapper->getVisibleWindowIndex(); + QCOMPARE( mModel->mTempVisibleWindowIndex, -1 ); + QCOMPARE( visualIndex, 0 ); +} + +void TestGlxMediaModel::updateDetailItemsTestCase() +{ + mModel->updateDetailItems(); +} + +void TestGlxMediaModel::updateItemIconTestCase() +{ + mModel->updateItemIcon( 1, new HbIcon(), GlxTBContextGrid ); + QVERIFY( mModel->itemIconCache[1] ); + + mModel->updateItemIcon( 1, new HbIcon(), GlxTBContextLsFs ); + QVERIFY( mModel->itemFsIconCache[1] ); + + mModel->updateItemIcon( 1, new HbIcon(), GlxTBContextPtFs ); + QVERIFY( mModel->itemFsIconCache[1] ); +} + + + +// ----------------------------------------------------------------------------- +// cleanup +// ----------------------------------------------------------------------------- +// +void TestGlxMediaModel::cleanup() +{ + +} + +// ----------------------------------------------------------------------------- +// cleanupTestCase +// ----------------------------------------------------------------------------- +// +void TestGlxMediaModel::cleanupTestCase() +{ + if( mModel ) { + delete mModel; + mModel = 0; + } +} + +QTEST_MAIN(TestGlxMediaModel) +#include "moc_unittest_mediamodel.cpp" diff -r 199e6e1e0b54 -r a91aa46552be tsrc/unittest/unittest_mediamodel/unittest_mediamodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/unittest/unittest_mediamodel/unittest_mediamodel.h Mon Oct 04 00:17:18 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __UNITTEST_MEDIAMODEL_H__ +#define __UNITTEST_MEDIAMODEL_H__ + +#include + +class GlxMediaModel; + +class TestGlxMediaModel : public QObject +{ + Q_OBJECT + +signals: + +private slots: + /** + * called before anything else when test starts + */ + void initTestCase(); + + /** + * will be called before each testfunction is executed. + * + */ + void init(); + + void rowCountTestCase(); + void columnCountTestCase(); + void parentTestCase(); + + void itemImageDataInvalidIndexTestCase(); + void itemImageDataGridImagetestCase(); + void itemImageDataHdmiBitmapTestCase(); + + void ItemPropertyViewTitleTestCase(); + void ItemPropertyImageTitleTestCase(); + void ItemPropertyDateTestCase(); + void ItemPropertyCorruptImageTestCase(); + void ItemPropertyTimeTestCase(); + void ItemPropertySizeTestCase(); + void ItemPropertyDescTestCase(); + + void indexTestCase(); + void setDataContextRoleTestCase(); + void setDataRemoveContextRoleTestCase(); + void setDataFocusIndexRoleTestCase(); + void setDataVisualIndexTestCase(); + void setDataSelectedIndexTestCase(); + void setDataSubStateTestCase(); + void setDataTempVisualIndexTestCase(); + void GetGridIconItemTestCase(); + void GetFsIconItemTestCase(); + void getFullScreenIconTestCase(); + void getFullScreenImagetestCase(); + void setContextModeTestCase(); + void removeContextModeTestCase(); + void setFocusIndexTestCase(); + void getFocusIndexTestcase(); + void setSelectedIndexTestCase(); + void getCorruptDefaultIconTestCase(); + void thumbnailPopulatedCheckTestCase(); + void itemUpdatedTestCase(); + void itemsAddedTestCase(); + void itemsRemovedTestCase(); + void itemCorruptedTestCase(); + + void albumTitleUpdatedTestCase(); + void modelpopulatedTestCase(); + void updateDetailItemsTestCase(); + void updateItemIconTestCase(); + + /** + * will be called after every testfunction. + * + */ + void cleanup(); + + /** + * will be called after testing ends + * + */ + void cleanupTestCase(); + +private: + + /** + * object under test + */ + GlxMediaModel *mModel; +}; + +#endif //__UNITTEST_MEDIAMODEL_H__ diff -r 199e6e1e0b54 -r a91aa46552be tsrc/unittest/unittest_mediamodel/unittest_mediamodel.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/unittest/unittest_mediamodel/unittest_mediamodel.pro Mon Oct 04 00:17:18 2010 +0300 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = +DEPENDPATH += . + +INCLUDEPATH += . +INCLUDEPATH += ../../../ui/uiengine/model/mediamodel/inc +INCLUDEPATH += ../../../ui/uiengine/medialistwrapper/inc +INCLUDEPATH += ../../../ui/inc +INCLUDEPATH += ../../../inc + +INCLUDEPATH += /epoc32/include/mw/QtTest + +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + + +CONFIG += qtestlib \ + Hb + +symbian: { + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCHEAPSIZE = 0x20000 0x1600000 + TARGET.UID3 = 0x200009EE + MMP_RULES += SMPSAFE +} + +LIBS += -lflogger.dll +LIBS += -lglxmediamodel.dll +LIBS += -lglxmedialistwrapper.dll + +# Input +HEADERS += unittest_mediamodel.h + + +SOURCES += unittest_mediamodel.cpp diff -r 199e6e1e0b54 -r a91aa46552be tsrc/unittest/unittest_statehandler/unittest_statehandler.cpp --- a/tsrc/unittest/unittest_statehandler/unittest_statehandler.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/tsrc/unittest/unittest_statehandler/unittest_statehandler.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -32,12 +32,12 @@ { mStateManager = new GlxStateManager(); //mStateManager->setupItems(); - mStateManager->mCurrentState = mStateManager->createState(GLX_GRIDVIEW_ID); - mStateManager->mCurrentState->setState(ALL_ITEM_S); + mStateManager->mCurrentState = mStateManager->createState( GLX_GRIDVIEW_ID ); + mStateManager->mCurrentState->setState( ALL_ITEM_S ); - QVERIFY(mStateManager); - QVERIFY(mStateManager->mViewManager); - QVERIFY(mStateManager->mActionHandler == 0); + QVERIFY( mStateManager ); + QVERIFY( mStateManager->mViewManager ); + QVERIFY( mStateManager->mActionHandler == 0 ); } // ----------------------------------------------------------------------------- @@ -49,61 +49,128 @@ } -void TestGlxStateManager::removeModelTestCase1() +void TestGlxStateManager::removeModelGridTestCase() +{ + mStateManager->createGridModel( ALL_ITEM_S, NO_DIR ); + mStateManager->removeCurrentModel(); + QVERIFY( mStateManager->mAllMediaModel == 0 ); +} + +void TestGlxStateManager::removeModelAlbumGridTestCase() { - mStateManager->createGridModel(ALBUM_ITEM_S, FORWARD_DIR); + mStateManager->createGridModel( ALBUM_ITEM_S, FORWARD_DIR ); mStateManager->removeCurrentModel(); - QVERIFY(mStateManager->mAlbumGridMediaModel == 0 ); + QVERIFY( mStateManager->mAlbumGridMediaModel == 0 ); +} + +void TestGlxStateManager::removeModelAlbumListTestCase() +{ + mStateManager->createModel( GLX_LISTVIEW_ID ); + mStateManager->removeCurrentModel(); + QVERIFY( mStateManager->mAlbumMediaModel == 0 ); } -void TestGlxStateManager::removeModelTestCase2() +void TestGlxStateManager::cleanModelGridTestCase() { - mStateManager->createModel(GLX_LISTVIEW_ID); - mStateManager->removeCurrentModel(); - QVERIFY(mStateManager->mAlbumMediaModel == 0 ); + mStateManager->createGridModel( ALL_ITEM_S, NO_DIR ); + mStateManager->createGridModel( ALBUM_ITEM_S, FORWARD_DIR ); + mStateManager->cleanAllModel(); + QVERIFY( mStateManager->mAllMediaModel == 0 ); + QVERIFY( mStateManager->mAlbumGridMediaModel == 0 ); + QVERIFY( mStateManager->mAlbumMediaModel == 0 ); + QVERIFY( mStateManager->mImageviewerMediaModel == 0 ); + QVERIFY( mStateManager->mCurrentModel == 0 ); +} + +void TestGlxStateManager::cleanModelAlbumListTestCase() +{ + mStateManager->createModel( GLX_LISTVIEW_ID ); + mStateManager->cleanAllModel(); + QVERIFY( mStateManager->mAllMediaModel == 0 ); + QVERIFY( mStateManager->mAlbumGridMediaModel == 0 ); + QVERIFY( mStateManager->mAlbumMediaModel == 0 ); + QVERIFY( mStateManager->mImageviewerMediaModel == 0 ); + QVERIFY( mStateManager->mCurrentModel == 0 ); } - -void TestGlxStateManager::createStateTestCase() +void TestGlxStateManager::createStateGridTestCase() { - GlxState * state = mStateManager->createState(GLX_GRIDVIEW_ID); + GlxState * state = mStateManager->createState( GLX_GRIDVIEW_ID ); QVERIFY(state); - QCOMPARE(state->id(), GLX_GRIDVIEW_ID); + QCOMPARE( state->id(), GLX_GRIDVIEW_ID ); delete state; - state = NULL; - - state = mStateManager->createState(GLX_LISTVIEW_ID); + state = NULL; +} + +void TestGlxStateManager::createStateListTestCase() +{ + GlxState * state = mStateManager->createState( GLX_LISTVIEW_ID ); QVERIFY(state); - QCOMPARE(state->id(), GLX_LISTVIEW_ID); + QCOMPARE( state->id(), GLX_LISTVIEW_ID ); delete state; - state = NULL; - - state = mStateManager->createState(1000); - QVERIFY(state == 0); + state = NULL; } -void TestGlxStateManager::createModelTestCase1() +void TestGlxStateManager::createStateSettingTestCase() +{ + GlxState * state = mStateManager->createState( GLX_SLIDESHOWSETTINGSVIEW_ID ); + QVERIFY(state); + QCOMPARE( state->id(), GLX_SLIDESHOWSETTINGSVIEW_ID ); + delete state; + state = NULL; +} + +void TestGlxStateManager::createStateDetailTestCase() { - mStateManager->createModel(GLX_LISTVIEW_ID); - QVERIFY(mStateManager->mAlbumMediaModel); + GlxState * state = mStateManager->createState( GLX_DETAILSVIEW_ID ); + QVERIFY(state); + QCOMPARE( state->id(), GLX_DETAILSVIEW_ID ); + delete state; + state = NULL; +} + +void TestGlxStateManager::createStateNoneTestCase() +{ + GlxState * state = mStateManager->createState( 0xFFFFFFFF ); + QVERIFY( state == 0 ); +} + +void TestGlxStateManager::createModelAlbumListTestCase() +{ + mStateManager->createModel( GLX_LISTVIEW_ID ); + QVERIFY( mStateManager->mAlbumMediaModel ); mStateManager->removeCurrentModel(); } -void TestGlxStateManager::createModelTestCase2() +void TestGlxStateManager::createModelImageViewerTestCase() { - mStateManager->mCurrentState = mStateManager->createState(GLX_FULLSCREENVIEW_ID); - mStateManager->mCurrentState->setState(EXTERNAL_S); - mStateManager->createModel(GLX_FULLSCREENVIEW_ID); - QVERIFY(mStateManager->mAllMediaModel); + mStateManager->mCurrentState = mStateManager->createState( GLX_FULLSCREENVIEW_ID ); + mStateManager->mCurrentState->setState( IMAGEVIEWER_S ); + mStateManager->createModel( GLX_FULLSCREENVIEW_ID ); + QVERIFY( mStateManager->mImageviewerMediaModel ); - mStateManager->removeCurrentModel(); + mStateManager->cleanAllModel(); GlxState *state = mStateManager->mCurrentState; mStateManager->mCurrentState = state->previousState(); delete state; state = NULL; } -void TestGlxStateManager::createGridModelTestCase1() +void TestGlxStateManager::createModelAlbumSlideShowTestCase() +{ + mStateManager->mCurrentState = mStateManager->createState( GLX_SLIDESHOWVIEW_ID ); + mStateManager->mCurrentState->setState( SLIDESHOW_ALBUM_ITEM_S ); + mStateManager->createModel( GLX_SLIDESHOWVIEW_ID ); + QVERIFY( mStateManager->mAlbumGridMediaModel ); + + mStateManager->cleanAllModel(); + GlxState *state = mStateManager->mCurrentState; + mStateManager->mCurrentState = state->previousState(); + delete state; + state = NULL; +} + +void TestGlxStateManager::createGridModelAllTestCase() { mStateManager->createGridModel(ALL_ITEM_S, NO_DIR); QCOMPARE(mStateManager->mCollectionId, KGlxCollectionPluginAllImplementationUid); @@ -111,14 +178,172 @@ mStateManager->removeCurrentModel(); } -void TestGlxStateManager::createGridModelTestCase2() +void TestGlxStateManager::createGridModelAlbumTestCase() { mStateManager->createGridModel(ALBUM_ITEM_S, FORWARD_DIR); - QCOMPARE(mStateManager->mCollectionId, (int )KGlxAlbumsMediaId); + QCOMPARE(mStateManager->mCollectionId, ( int )KGlxAlbumsMediaId ); QVERIFY(mStateManager->mAlbumGridMediaModel); mStateManager->removeCurrentModel(); } +void TestGlxStateManager::gridInternalStateTestCase() +{ + GlxState * state = mStateManager->createState( GLX_GRIDVIEW_ID ); + QVERIFY( state ); + + state->setState( ALL_ITEM_S ); + QCOMPARE( state->state(), (int )ALL_ITEM_S ); + + state->setState( FETCHER_ALBUM_ITEM_S ); + QCOMPARE( state->state(), (int )FETCHER_ALBUM_ITEM_S ); + delete state; +} + +void TestGlxStateManager::gridTransitionParameterTestCase() +{ + GlxEffect effect = NO_EFFECT ; + GlxViewEffect viewEffect = NO_VIEW ; + + GlxState * state = mStateManager->createState( GLX_GRIDVIEW_ID ); + QVERIFY( state ); + + state->setTranstionParameter( FORWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, ALBUMLIST_TO_GRID ); + QCOMPARE( viewEffect, BOTH_VIEW ); + + state->setTranstionParameter( BACKWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, GRID_TO_ALBUMLIST ); + QCOMPARE( viewEffect, BOTH_VIEW ); + + delete state; +} + +void TestGlxStateManager::listInternalStateTestCase() +{ + GlxState * state = mStateManager->createState( GLX_LISTVIEW_ID ); + QVERIFY( state ); + + state->setState( NO_LIST_S ); + QCOMPARE( state->state(), (int )NO_LIST_S ); + + state->setState( FETCHER_ALBUM_S ); + QCOMPARE( state->state(), (int )FETCHER_ALBUM_S ); + delete state; +} + +void TestGlxStateManager::listTransitionParameterTestCase() +{ + GlxEffect effect = NO_EFFECT ; + GlxViewEffect viewEffect = NO_VIEW ; + + GlxState * state = mStateManager->createState( GLX_LISTVIEW_ID ); + QVERIFY( state ); + + state->setTranstionParameter( NO_DIR, effect, viewEffect ); + QCOMPARE( effect, GRID_TO_ALBUMLIST ); + QCOMPARE( viewEffect, BOTH_VIEW ); + + state->setTranstionParameter( BACKWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, NO_EFFECT ); + QCOMPARE( viewEffect, NO_VIEW ); + + delete state; +} + +void TestGlxStateManager::fullScreenInternalStateTestCase() +{ + GlxState * state = mStateManager->createState( GLX_FULLSCREENVIEW_ID ); + QVERIFY( state ); + + state->setState( ALBUM_FULLSCREEN_S ); + QCOMPARE( state->state(), (int )ALBUM_FULLSCREEN_S ); + + state->setState( IMAGEVIEWER_S ); + QCOMPARE( state->state(), (int )IMAGEVIEWER_S ); + delete state; +} + +void TestGlxStateManager::fullScreenTransitionParameterTestCase() +{ + GlxEffect effect = NO_EFFECT ; + GlxViewEffect viewEffect = NO_VIEW ; + + GlxState * state = mStateManager->createState( GLX_FULLSCREENVIEW_ID ); + QVERIFY( state ); + + state->setTranstionParameter( FORWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, GRID_TO_FULLSCREEN ); + QCOMPARE( viewEffect, BOTH_VIEW ); + + state->setTranstionParameter( BACKWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, FULLSCREEN_TO_GRID ); + QCOMPARE( viewEffect, LAUNCH_VIEW ); + + delete state; +} + +void TestGlxStateManager::slideShowInternalStateTestCase() +{ + GlxState * state = mStateManager->createState( GLX_SLIDESHOWVIEW_ID ); + QVERIFY( state ); + + state->setState( SLIDESHOW_GRID_ITEM_S ); + QCOMPARE( state->state(), (int )SLIDESHOW_GRID_ITEM_S ); + + state->setState( SLIDESHOW_GRID_ITEM_S ); + QCOMPARE( state->state(), (int )SLIDESHOW_GRID_ITEM_S ); + delete state; +} + +void TestGlxStateManager::detailInternalStateTestCase() +{ + GlxState * state = mStateManager->createState( GLX_DETAILSVIEW_ID ); + QVERIFY( state ); + + state->setState( NO_DETAIL_S ); + QCOMPARE( state->state(), (int )NO_DETAIL_S ); + + state->setState( IMAGEVIEWER_DETAIL_S ); + QCOMPARE( state->state(), (int )IMAGEVIEWER_DETAIL_S ); + delete state; +} + +void TestGlxStateManager::detailTransitionParameterNegativeTestCase() +{ + GlxEffect effect = NO_EFFECT ; + GlxViewEffect viewEffect = NO_VIEW ; + + GlxState * state = mStateManager->createState( GLX_DETAILSVIEW_ID ); + QVERIFY( state ); + + state->setTranstionParameter( FORWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, NO_EFFECT ); + QCOMPARE( viewEffect, NO_VIEW ); + delete state; +} + +void TestGlxStateManager::detailTransitionParameterTestCase() +{ + GlxEffect effect = NO_EFFECT ; + GlxViewEffect viewEffect = NO_VIEW ; + + mStateManager->mCurrentState = mStateManager->createState( GLX_FULLSCREENVIEW_ID ); + GlxState * state = mStateManager->createState( GLX_DETAILSVIEW_ID ); + QVERIFY( state ); + + state->setTranstionParameter( FORWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, FULLSCREEN_TO_DETAIL ); + QCOMPARE( viewEffect, BOTH_VIEW ); + + state->setTranstionParameter( BACKWARD_DIR, effect, viewEffect ); + QCOMPARE( effect, DETAIL_TO_FULLSCREEN ); + QCOMPARE( viewEffect, BOTH_VIEW ); + + delete state; + state = mStateManager->mCurrentState; + mStateManager->mCurrentState = state->previousState(); + delete state; +} // ----------------------------------------------------------------------------- // cleanup diff -r 199e6e1e0b54 -r a91aa46552be tsrc/unittest/unittest_statehandler/unittest_statehandler.h --- a/tsrc/unittest/unittest_statehandler/unittest_statehandler.h Fri Sep 17 08:29:24 2010 +0300 +++ b/tsrc/unittest/unittest_statehandler/unittest_statehandler.h Mon Oct 04 00:17:18 2010 +0300 @@ -38,14 +38,36 @@ * */ void init(); - void removeModelTestCase1(); - void removeModelTestCase2(); - void createStateTestCase(); - void createModelTestCase1(); - void createModelTestCase2(); - void createGridModelTestCase1(); - void createGridModelTestCase2(); + + void removeModelGridTestCase(); + void removeModelAlbumGridTestCase(); + void removeModelAlbumListTestCase(); + + void cleanModelGridTestCase(); + void cleanModelAlbumListTestCase(); + + void createStateGridTestCase(); + void createStateListTestCase(); + void createStateSettingTestCase(); + void createStateDetailTestCase(); + void createStateNoneTestCase(); + void createModelAlbumListTestCase(); + void createModelImageViewerTestCase(); + void createModelAlbumSlideShowTestCase(); + void createGridModelAllTestCase(); + void createGridModelAlbumTestCase(); + + void gridInternalStateTestCase(); + void gridTransitionParameterTestCase(); + void listInternalStateTestCase(); + void listTransitionParameterTestCase(); + void fullScreenInternalStateTestCase(); + void fullScreenTransitionParameterTestCase(); + void slideShowInternalStateTestCase(); + void detailInternalStateTestCase(); + void detailTransitionParameterNegativeTestCase(); + void detailTransitionParameterTestCase(); /** * will be called after every testfunction. diff -r 199e6e1e0b54 -r a91aa46552be tvout/tvoutengine/src/glxhdmisurfaceupdater.cpp --- a/tvout/tvoutengine/src/glxhdmisurfaceupdater.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/tvout/tvoutengine/src/glxhdmisurfaceupdater.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -186,7 +186,7 @@ if (iEffectsOn) { GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ConstructL() Creating iAnimTimer"); - iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard-1 ); + iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard ); } TInt error = iFsSession.Connect (); @@ -301,7 +301,7 @@ if(!iSurfBufferAO) { iSurfBufferAO = new(ELeave) CGlxActiveCallBack(TCallBack(SurfBuffer0Ready, this), - CActive::EPriorityStandard-1); + CActive::EPriorityStandard); CActiveScheduler::Add(iSurfBufferAO); } } @@ -781,7 +781,7 @@ if (iEffectsOn && !iAnimTimer) { GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() Creating iAnimTimer"); - iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard-1 ); + iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard ); } if(iSurfManager) { @@ -901,7 +901,7 @@ if (iEffectsOn && !iAnimTimer) { GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::FadeTheSurface() Creating iAnimTimer"); - iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard-1 ); + iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard ); } if (!ialfCompositionSurface) { diff -r 199e6e1e0b54 -r a91aa46552be tvout/tvoutwrapper/src/glxtvoutwrapper_p.cpp --- a/tvout/tvoutwrapper/src/glxtvoutwrapper_p.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/tvout/tvoutwrapper/src/glxtvoutwrapper_p.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -180,20 +180,20 @@ // setToNativeMode // ----------------------------------------------------------------------------- void GlxTvOutWrapperPrivate::SetToNativeMode() - { +{ TRACER("GlxTvOutWrapperPrivate::SetToNativeMode()"); iIsPhotosInForeground = true; - - if(iHdmiController && iHdmiConnected) { - if (!isImageSetToHdmi){ + + if ( iHdmiConnected ) { + if ( !isImageSetToHdmi ) { + SetNewImage(); // this case can occur when FS image is opened and set to background + // HDMI cable connected and then FS is brought to foreground + } } - SetNewImage(); // this case can occur when FS image is opened and set to background - // HDMI cable connected and then FS is brought to foreground + else { + iHdmiController->ShiftToPostingMode(); } - else{ - iHdmiController->ShiftToPostingMode(); - } - } +} // ----------------------------------------------------------------------------- // itemNotSupported diff -r 199e6e1e0b54 -r a91aa46552be ui/inc/glxicondefs.h --- a/ui/inc/glxicondefs.h Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/inc/glxicondefs.h Mon Oct 04 00:17:18 2010 +0300 @@ -33,6 +33,10 @@ #define GLXICON_CAMERA "qtg_mono_camera" #define GLXICON_OVI "qtg_small_ovi" +//ALBUM GRID TOOLBAR +#define GLXICON_ADD "qtg_mono_add_to_video_collection" +#define GLXICON_REMOVE "qtg_mono_remove_from_video_collection" + //CORRUPT ICON #define GLXICON_CORRUPT "qtg_large_corrupted" diff -r 199e6e1e0b54 -r a91aa46552be ui/inc/glxmodelparm.h --- a/ui/inc/glxmodelparm.h Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/inc/glxmodelparm.h Mon Oct 04 00:17:18 2010 +0300 @@ -32,7 +32,8 @@ mDepth(depth) , mFilterType( filterType ), mContextMode( contextMode ), - mUri(uri) + mUri(uri), + mFetcherFiletrType(EGlxFetcherFilterNone) { } @@ -44,8 +45,11 @@ QString path() { return mUri; } void setPath(QString uri = NULL) { mUri=uri; } TGlxFilterItemType filterType() { return mFilterType; } + void setFilterType(TGlxFilterItemType filterType) { mFilterType = filterType; } void setContextMode( GlxContextMode contextMode ) { mContextMode = contextMode ; } GlxContextMode contextMode() { return mContextMode ; } + void setFetcherFiterType(GlxFetcherFilterType filterType ){mFetcherFiletrType = filterType;} + GlxFetcherFilterType fetcherFiterType() { return mFetcherFiletrType;} private: qint32 mCollectionId; @@ -53,6 +57,7 @@ TGlxFilterItemType mFilterType; GlxContextMode mContextMode; QString mUri; + GlxFetcherFilterType mFetcherFiletrType; }; diff -r 199e6e1e0b54 -r a91aa46552be ui/inc/glxuistd.h --- a/ui/inc/glxuistd.h Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/inc/glxuistd.h Mon Oct 04 00:17:18 2010 +0300 @@ -31,6 +31,15 @@ EGlxHuiCustomEventBackToSharpPath }; +enum GlxFetcherFilterType + { + EGlxFetcherFilterNone = 0x00, + EGlxFetcherFilterJpeg = 0x01, + EGlxFetcherFilterNonJpeg = 0x02, + EGlxFetcherFilterJp2 = 0x04, + EGlxFetcherFilterNonJp2 = 0x08, + EGlxFetcherFilterLast = 0xFF + }; enum GlxContextMode { GlxContextInvalid = -1, diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/bwins/glxmedialistwrapperu.def --- a/ui/uiengine/bwins/glxmedialistwrapperu.def Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/bwins/glxmedialistwrapperu.def Mon Oct 04 00:17:18 2010 +0300 @@ -55,7 +55,7 @@ ?qt_metacast@GlxMLWrapper@@UAEPAXPBD@Z @ 54 NONAME ; void * GlxMLWrapper::qt_metacast(char const *) ?retrieveItemImage@GlxMLWrapper@@QAE?AVQImage@@HW4GlxTBContextType@@@Z @ 55 NONAME ; class QImage GlxMLWrapper::retrieveItemImage(int, enum GlxTBContextType) ?setSelectedIndex@GlxMLWrapper@@QAEXH@Z @ 56 NONAME ; void GlxMLWrapper::setSelectedIndex(int) - ??0GlxMLWrapper@@QAE@HHW4TGlxFilterItemType@@VQString@@@Z @ 57 NONAME ; GlxMLWrapper::GlxMLWrapper(int, int, enum TGlxFilterItemType, class QString) + ??0GlxMLWrapper@@QAE@HHW4TGlxFilterItemType@@VQString@@W4GlxFetcherFilterType@@@Z @ 57 NONAME ; GlxMLWrapper::GlxMLWrapper(int, int, enum TGlxFilterItemType, class QString, enum GlxFetcherFilterType) ?retrieveItemIcon@GlxMLWrapper@@QAEPAVHbIcon@@HW4GlxTBContextType@@@Z @ 58 NONAME ; class HbIcon * GlxMLWrapper::retrieveItemIcon(int, enum GlxTBContextType) ?itemsAdded@GlxMLWrapper@@QAEXHH@Z @ 59 NONAME ; void GlxMLWrapper::itemsAdded(int, int) diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/eabi/glxmedialistwrapperu.def --- a/ui/uiengine/eabi/glxmedialistwrapperu.def Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/eabi/glxmedialistwrapperu.def Mon Oct 04 00:17:18 2010 +0300 @@ -46,8 +46,8 @@ _ZN12GlxMLWrapper23handleListItemAvailableEi @ 45 NONAME _ZN12GlxMLWrapper26handleDetailsItemAvailableEi @ 46 NONAME _ZN12GlxMLWrapper9populatedEv @ 47 NONAME - _ZN12GlxMLWrapperC1Eii18TGlxFilterItemType7QString @ 48 NONAME - _ZN12GlxMLWrapperC2Eii18TGlxFilterItemType7QString @ 49 NONAME + _ZN12GlxMLWrapperC1Eii18TGlxFilterItemType7QString20GlxFetcherFilterType @ 48 NONAME + _ZN12GlxMLWrapperC2Eii18TGlxFilterItemType7QString20GlxFetcherFilterType @ 49 NONAME _ZN12GlxMLWrapperD0Ev @ 50 NONAME _ZN12GlxMLWrapperD1Ev @ 51 NONAME _ZN12GlxMLWrapperD2Ev @ 52 NONAME diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/medialists/src/glxcachemanager.cpp --- a/ui/uiengine/medialists/src/glxcachemanager.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/medialists/src/glxcachemanager.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -710,8 +710,8 @@ { CGlxImageViewerManager *imageVwrMgr = CGlxImageViewerManager::InstanceL(); CleanupClosePushL(*imageVwrMgr); -#ifdef _DEBUG - TInt mediaCnt = list->Count(); +#ifdef GLX_LOGGING_ENABLED + TInt mediaCnt = list->Count(); #endif TInt errInImage = KErrNone; diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/medialistwrapper/inc/glxmlwrapper.h --- a/ui/uiengine/medialistwrapper/inc/glxmlwrapper.h Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/medialistwrapper/inc/glxmlwrapper.h Mon Oct 04 00:17:18 2010 +0300 @@ -52,7 +52,7 @@ /** *constructor */ - GlxMLWrapper(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri = NULL); + GlxMLWrapper(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri = NULL,GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone); /** *destructor **/ diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h --- a/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h Mon Oct 04 00:17:18 2010 +0300 @@ -51,7 +51,7 @@ * * @return Pointer to newly created object. NULL if creation fails. Avoiding Leave as would be called by a QT wrapper Class */ - static GlxMLWrapperPrivate* Instance(GlxMLWrapper* aMLWrapper, int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri); + static GlxMLWrapperPrivate* Instance(GlxMLWrapper* aMLWrapper, int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType); /** * Destructor. */ @@ -149,14 +149,14 @@ /** * By default Symbian 2nd phase constructor is private. */ - void ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri=NULL); + void ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri=NULL,GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone); /** * Create an instance of Media List. * * @leave with error code if creation fails. */ - void CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType); - void CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType); + void CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone); + void CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType); void CreateMediaListFavoritesItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri); void SetThumbnailContextL(GlxContextMode aContextMode); void SetListContextL(GlxContextMode aContextMode); diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/medialistwrapper/src/glxmlwrapper.cpp --- a/ui/uiengine/medialistwrapper/src/glxmlwrapper.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/medialistwrapper/src/glxmlwrapper.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -28,9 +28,9 @@ // constructor. // --------------------------------------------------------------------------- // -GlxMLWrapper::GlxMLWrapper(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri) +GlxMLWrapper::GlxMLWrapper(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType) { - mMLWrapperPrivate = GlxMLWrapperPrivate::Instance(this, aCollectionId, aHierarchyId, aFilterType,uri); + mMLWrapperPrivate = GlxMLWrapperPrivate::Instance(this, aCollectionId, aHierarchyId, aFilterType,uri,fetcherFilterType); } // --------------------------------------------------------------------------- diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp --- a/ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -61,6 +61,8 @@ const TInt KFullScreenTNLSHeight (360); const TInt KFullScreenTNPTWidth (360); const TInt KFullScreenTNPTHeight (640); +_LIT(KMymeTypeJpeg, "jpeg"); +_LIT(KMymeTypeJp2, "jp2"); // ======== MEMBER FUNCTIONS ======== @@ -69,13 +71,13 @@ // --------------------------------------------------------------------------- // GlxMLWrapperPrivate* GlxMLWrapperPrivate::Instance(GlxMLWrapper* aMLWrapper, - int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri) + int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType) { TRACER("GlxMLWrapperPrivate::NewLC()"); GlxMLWrapperPrivate* self = new GlxMLWrapperPrivate(aMLWrapper); if(self){ - TRAPD(err,self->ConstructL(aCollectionId, aHierarchyId, aFilterType,uri)); + TRAPD(err,self->ConstructL(aCollectionId, aHierarchyId, aFilterType,uri,fetcherFilterType)); if(err != KErrNone){ delete self; self = NULL; @@ -116,7 +118,7 @@ // Symbian 2nd phase constructor can leave. // --------------------------------------------------------------------------- // -void GlxMLWrapperPrivate::ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri) +void GlxMLWrapperPrivate::ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType) { TRACER("GlxMLWrapperPrivate::ConstructL"); if(aCollectionId == KGlxCollectionPluginFavoritesAlbumId) @@ -125,12 +127,12 @@ } else if(aCollectionId != KGlxAlbumsMediaId) { - CreateMediaListL(aCollectionId, aHierarchyId,aFilterType); + CreateMediaListL(aCollectionId, aHierarchyId,aFilterType,fetcherFilterType); } else { //for creating Medial List for Albums Media path Items - CreateMediaListAlbumItemL(aCollectionId, aHierarchyId,aFilterType); + CreateMediaListAlbumItemL(aCollectionId, aHierarchyId,aFilterType,fetcherFilterType); } iMLGenericObserver = CGlxMLGenericObserver::NewL(*iMediaList,this); iBlockyIteratorForFilmStrip.SetRangeOffsets(0,0); @@ -552,7 +554,7 @@ // CreateMediaListAlbumItemL() // Creates the media list for the album Item // --------------------------------------------------------------------------- -void GlxMLWrapperPrivate::CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) +void GlxMLWrapperPrivate::CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType) { TRACER("GlxMLWrapperPrivate::CreateMediaListAlbumItemL"); Q_UNUSED(aCollectionId); @@ -565,7 +567,30 @@ iMediaList->Close(); iMediaList = NULL; //create new media list with the derived path - CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType); //todo take actual filter type + GLX_LOG_INFO1("GlxMLWrapperPrivate::CreateMediaListAlbumItemL - Filter Type = %d",aFilterType); + CMPXFilter* filter = NULL; + if( EGlxFilterExcludeCamera == aFilterType) + { + filter = TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(); + } + else if(EGlxFilterImage == aFilterType) + { + filter = TGlxFilterFactory::CreateExcludeDrmImageTypeFilterL(aFilterType); + } + else if( EGlxFilterFetcherMimeType == aFilterType ) + { + if(fetcherFilterType == EGlxFetcherFilterJpeg) + { + filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJpeg); + } + else if(fetcherFilterType == EGlxFetcherFilterJp2){ + filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJp2); + } + } + else + { + filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType); //todo take actual filter type + } CleanupStack::PushL(filter); iMediaList = MGlxMediaList::InstanceL( *path, TGlxHierarchyId(0), filter ); //todo take actual hierarchy @@ -581,7 +606,7 @@ // Create a filter as requested filtertype // Creates the medialist // --------------------------------------------------------------------------- -void GlxMLWrapperPrivate::CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) +void GlxMLWrapperPrivate::CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType) { TRACER("GlxMLWrapperPrivate::CreateMediaListL"); Q_UNUSED(aHierarchyId); @@ -603,6 +628,17 @@ filter = TGlxFilterFactory::CreateExcludeDrmImageTypeFilterL(aFilterType); CleanupStack::PushL(filter); } + else if( EGlxFilterFetcherMimeType == aFilterType ) + { + if(fetcherFilterType == EGlxFetcherFilterJpeg) + { + filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJpeg); + } + else if(fetcherFilterType == EGlxFetcherFilterJp2){ + filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJp2); + } + CleanupStack::PushL(filter); + } else { filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType); //todo take actual filter type diff -r 199e6e1e0b54 -r a91aa46552be ui/uiengine/model/mediamodel/src/glxmediamodel.cpp --- a/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -45,7 +45,7 @@ thumbnailPopulatedFlag = modelParm.collection() == KGlxCollectionPluginAllImplementationUid ? false : true; mPaintPage = modelParm.collection() == KGlxCollectionPluginAllImplementationUid ? true : false; - mMLWrapper = new GlxMLWrapper(modelParm.collection(),0,EGlxFilterImage); + mMLWrapper = new GlxMLWrapper(modelParm.collection(),0,modelParm.filterType(),NULL,modelParm.fetcherFiterType()); mMLWrapper->setContextMode( modelParm.contextMode() ); mContextMode = modelParm.contextMode( ) ; mDRMUtilityWrapper = new GlxDRMUtilityWrapper(); diff -r 199e6e1e0b54 -r a91aa46552be ui/viewmanagement/bwins/glxstatehandleru.def --- a/ui/viewmanagement/bwins/glxstatehandleru.def Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/viewmanagement/bwins/glxstatehandleru.def Mon Oct 04 00:17:18 2010 +0300 @@ -1,44 +1,44 @@ EXPORTS - ?launchFetcher@GlxStateManager@@QAEXXZ @ 1 NONAME ; void GlxStateManager::launchFetcher(void) - ?saveData@GlxStateManager@@QAEXXZ @ 2 NONAME ; void GlxStateManager::saveData(void) - ?metaObject@GlxStateManager@@UBEPBUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const * GlxStateManager::metaObject(void) const - ?actionTriggered@GlxStateManager@@QAEXH@Z @ 4 NONAME ; void GlxStateManager::actionTriggered(int) - ?setupItemsSignal@GlxStateManager@@IAEXXZ @ 5 NONAME ; void GlxStateManager::setupItemsSignal(void) - ??_EGlxStateManager@@UAE@I@Z @ 6 NONAME ; GlxStateManager::~GlxStateManager(unsigned int) - ?updateTNProgress@GlxStateManager@@QAEXH@Z @ 7 NONAME ; void GlxStateManager::updateTNProgress(int) - ?goBack@GlxStateManager@@QAEXHH@Z @ 8 NONAME ; void GlxStateManager::goBack(int, int) - ?eventFilter@GlxStateManager@@UAE_NPAVQObject@@PAVQEvent@@@Z @ 9 NONAME ; bool GlxStateManager::eventFilter(class QObject *, class QEvent *) - ?enterMarkingMode@GlxStateManager@@QAEXXZ @ 10 NONAME ; void GlxStateManager::enterMarkingMode(void) - ??1GlxStateManager@@UAE@XZ @ 11 NONAME ; GlxStateManager::~GlxStateManager(void) - ?getStaticMetaObject@GlxStateManager@@SAABUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const & GlxStateManager::getStaticMetaObject(void) - ?trUtf8@GlxStateManager@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString GlxStateManager::trUtf8(char const *, char const *, int) - ?eventHandler@GlxStateManager@@AAEXAAH@Z @ 14 NONAME ; void GlxStateManager::eventHandler(int &) - ?executeCommand@GlxStateManager@@QAE_NH@Z @ 15 NONAME ; bool GlxStateManager::executeCommand(int) - ?thumbnailPopulated@GlxStateManager@@QAEXXZ @ 16 NONAME ; void GlxStateManager::thumbnailPopulated(void) - ?setupItems@GlxStateManager@@QAEXXZ @ 17 NONAME ; void GlxStateManager::setupItems(void) - ?previousState@GlxStateManager@@QAEXXZ @ 18 NONAME ; void GlxStateManager::previousState(void) - ?createState@GlxStateManager@@AAEPAVGlxState@@H@Z @ 19 NONAME ; class GlxState * GlxStateManager::createState(int) - ?exitApplication@GlxStateManager@@AAEXXZ @ 20 NONAME ; void GlxStateManager::exitApplication(void) - ?changeState@GlxStateManager@@QAEXHH@Z @ 21 NONAME ; void GlxStateManager::changeState(int, int) - ?qt_metacall@GlxStateManager@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 22 NONAME ; int GlxStateManager::qt_metacall(enum QMetaObject::Call, int, void * *) - ??0GlxStateManager@@QAE@XZ @ 23 NONAME ; GlxStateManager::GlxStateManager(void) - ?vanishProgressDialog@GlxStateManager@@AAEXXZ @ 24 NONAME ; void GlxStateManager::vanishProgressDialog(void) - ?saveImage@GlxStateManager@@AAEXXZ @ 25 NONAME ; void GlxStateManager::saveImage(void) - ?cleanupExternal@GlxStateManager@@QAEXXZ @ 26 NONAME ; void GlxStateManager::cleanupExternal(void) - ?gridItemSelected@GlxStateManager@@IAEXABVQModelIndex@@AAVQAbstractItemModel@@@Z @ 27 NONAME ; void GlxStateManager::gridItemSelected(class QModelIndex const &, class QAbstractItemModel &) - ?setFullScreenContext@GlxStateManager@@AAEXXZ @ 28 NONAME ; void GlxStateManager::setFullScreenContext(void) - ?trUtf8@GlxStateManager@@SA?AVQString@@PBD0@Z @ 29 NONAME ; class QString GlxStateManager::trUtf8(char const *, char const *) - ?cleanAllModel@GlxStateManager@@QAEXXZ @ 30 NONAME ; void GlxStateManager::cleanAllModel(void) - ?tr@GlxStateManager@@SA?AVQString@@PBD0H@Z @ 31 NONAME ; class QString GlxStateManager::tr(char const *, char const *, int) - ?staticMetaObject@GlxStateManager@@2UQMetaObject@@B @ 32 NONAME ; struct QMetaObject const GlxStateManager::staticMetaObject - ?qt_metacast@GlxStateManager@@UAEPAXPBD@Z @ 33 NONAME ; void * GlxStateManager::qt_metacast(char const *) - ?tr@GlxStateManager@@SA?AVQString@@PBD0@Z @ 34 NONAME ; class QString GlxStateManager::tr(char const *, char const *) - ?nextState@GlxStateManager@@QAEXHH@Z @ 35 NONAME ; void GlxStateManager::nextState(int, int) - ?launchFromExternal@GlxStateManager@@QAEXXZ @ 36 NONAME ; void GlxStateManager::launchFromExternal(void) - ?externalCommand@GlxStateManager@@IAEXH@Z @ 37 NONAME ; void GlxStateManager::externalCommand(int) - ?createGridModel@GlxStateManager@@AAEXHW4NavigationDir@@@Z @ 38 NONAME ; void GlxStateManager::createGridModel(int, enum NavigationDir) - ?launchApplication@GlxStateManager@@QAEXXZ @ 39 NONAME ; void GlxStateManager::launchApplication(void) - ?exitMarkingMode@GlxStateManager@@QAEXXZ @ 40 NONAME ; void GlxStateManager::exitMarkingMode(void) + ?saveData@GlxStateManager@@QAEXXZ @ 1 NONAME ; void GlxStateManager::saveData(void) + ?metaObject@GlxStateManager@@UBEPBUQMetaObject@@XZ @ 2 NONAME ; struct QMetaObject const * GlxStateManager::metaObject(void) const + ?actionTriggered@GlxStateManager@@QAEXH@Z @ 3 NONAME ; void GlxStateManager::actionTriggered(int) + ?setupItemsSignal@GlxStateManager@@IAEXXZ @ 4 NONAME ; void GlxStateManager::setupItemsSignal(void) + ??_EGlxStateManager@@UAE@I@Z @ 5 NONAME ; GlxStateManager::~GlxStateManager(unsigned int) + ?updateTNProgress@GlxStateManager@@QAEXH@Z @ 6 NONAME ; void GlxStateManager::updateTNProgress(int) + ?goBack@GlxStateManager@@QAEXHH@Z @ 7 NONAME ; void GlxStateManager::goBack(int, int) + ?eventFilter@GlxStateManager@@UAE_NPAVQObject@@PAVQEvent@@@Z @ 8 NONAME ; bool GlxStateManager::eventFilter(class QObject *, class QEvent *) + ?enterMarkingMode@GlxStateManager@@QAEXXZ @ 9 NONAME ; void GlxStateManager::enterMarkingMode(void) + ??1GlxStateManager@@UAE@XZ @ 10 NONAME ; GlxStateManager::~GlxStateManager(void) + ?getStaticMetaObject@GlxStateManager@@SAABUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const & GlxStateManager::getStaticMetaObject(void) + ?trUtf8@GlxStateManager@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString GlxStateManager::trUtf8(char const *, char const *, int) + ?eventHandler@GlxStateManager@@AAEXAAH@Z @ 13 NONAME ; void GlxStateManager::eventHandler(int &) + ?executeCommand@GlxStateManager@@QAE_NH@Z @ 14 NONAME ; bool GlxStateManager::executeCommand(int) + ?thumbnailPopulated@GlxStateManager@@QAEXXZ @ 15 NONAME ; void GlxStateManager::thumbnailPopulated(void) + ?setupItems@GlxStateManager@@QAEXXZ @ 16 NONAME ; void GlxStateManager::setupItems(void) + ?previousState@GlxStateManager@@QAEXXZ @ 17 NONAME ; void GlxStateManager::previousState(void) + ?createState@GlxStateManager@@AAEPAVGlxState@@H@Z @ 18 NONAME ; class GlxState * GlxStateManager::createState(int) + ?exitApplication@GlxStateManager@@AAEXXZ @ 19 NONAME ; void GlxStateManager::exitApplication(void) + ?changeState@GlxStateManager@@QAEXHH@Z @ 20 NONAME ; void GlxStateManager::changeState(int, int) + ?qt_metacall@GlxStateManager@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 21 NONAME ; int GlxStateManager::qt_metacall(enum QMetaObject::Call, int, void * *) + ??0GlxStateManager@@QAE@XZ @ 22 NONAME ; GlxStateManager::GlxStateManager(void) + ?vanishProgressDialog@GlxStateManager@@AAEXXZ @ 23 NONAME ; void GlxStateManager::vanishProgressDialog(void) + ?saveImage@GlxStateManager@@AAEXXZ @ 24 NONAME ; void GlxStateManager::saveImage(void) + ?cleanupExternal@GlxStateManager@@QAEXXZ @ 25 NONAME ; void GlxStateManager::cleanupExternal(void) + ?gridItemSelected@GlxStateManager@@IAEXABVQModelIndex@@AAVQAbstractItemModel@@@Z @ 26 NONAME ; void GlxStateManager::gridItemSelected(class QModelIndex const &, class QAbstractItemModel &) + ?setFullScreenContext@GlxStateManager@@AAEXXZ @ 27 NONAME ; void GlxStateManager::setFullScreenContext(void) + ?trUtf8@GlxStateManager@@SA?AVQString@@PBD0@Z @ 28 NONAME ; class QString GlxStateManager::trUtf8(char const *, char const *) + ?cleanAllModel@GlxStateManager@@QAEXXZ @ 29 NONAME ; void GlxStateManager::cleanAllModel(void) + ?tr@GlxStateManager@@SA?AVQString@@PBD0H@Z @ 30 NONAME ; class QString GlxStateManager::tr(char const *, char const *, int) + ?staticMetaObject@GlxStateManager@@2UQMetaObject@@B @ 31 NONAME ; struct QMetaObject const GlxStateManager::staticMetaObject + ?qt_metacast@GlxStateManager@@UAEPAXPBD@Z @ 32 NONAME ; void * GlxStateManager::qt_metacast(char const *) + ?tr@GlxStateManager@@SA?AVQString@@PBD0@Z @ 33 NONAME ; class QString GlxStateManager::tr(char const *, char const *) + ?nextState@GlxStateManager@@QAEXHH@Z @ 34 NONAME ; void GlxStateManager::nextState(int, int) + ?launchFromExternal@GlxStateManager@@QAEXXZ @ 35 NONAME ; void GlxStateManager::launchFromExternal(void) + ?externalCommand@GlxStateManager@@IAEXH@Z @ 36 NONAME ; void GlxStateManager::externalCommand(int) + ?createGridModel@GlxStateManager@@AAEXHW4NavigationDir@@@Z @ 37 NONAME ; void GlxStateManager::createGridModel(int, enum NavigationDir) + ?launchApplication@GlxStateManager@@QAEXXZ @ 38 NONAME ; void GlxStateManager::launchApplication(void) + ?exitMarkingMode@GlxStateManager@@QAEXXZ @ 39 NONAME ; void GlxStateManager::exitMarkingMode(void) + ?launchFetcher@GlxStateManager@@QAEXH@Z @ 40 NONAME ; void GlxStateManager::launchFetcher(int) ?removeCurrentModel@GlxStateManager@@QAEXXZ @ 41 NONAME ; void GlxStateManager::removeCurrentModel(void) ?launchProgressDialog@GlxStateManager@@AAEXXZ @ 42 NONAME ; void GlxStateManager::launchProgressDialog(void) ?launchActivity@GlxStateManager@@AAE_NXZ @ 43 NONAME ; bool GlxStateManager::launchActivity(void) diff -r 199e6e1e0b54 -r a91aa46552be ui/viewmanagement/eabi/glxstatehandleru.def --- a/ui/viewmanagement/eabi/glxstatehandleru.def Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/viewmanagement/eabi/glxstatehandleru.def Mon Oct 04 00:17:18 2010 +0300 @@ -8,7 +8,7 @@ _ZN15GlxStateManager11qt_metacastEPKc @ 7 NONAME _ZN15GlxStateManager12eventHandlerERi @ 8 NONAME _ZN15GlxStateManager13cleanAllModelEv @ 9 NONAME - _ZN15GlxStateManager13launchFetcherEv @ 10 NONAME + _ZN15GlxStateManager13launchFetcherEi @ 10 NONAME _ZN15GlxStateManager13previousStateEv @ 11 NONAME _ZN15GlxStateManager14executeCommandEi @ 12 NONAME _ZN15GlxStateManager14launchActivityEv @ 13 NONAME diff -r 199e6e1e0b54 -r a91aa46552be ui/viewmanagement/statehandler/inc/glxstatemanager.h --- a/ui/viewmanagement/statehandler/inc/glxstatemanager.h Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/viewmanagement/statehandler/inc/glxstatemanager.h Mon Oct 04 00:17:18 2010 +0300 @@ -65,7 +65,7 @@ /** * launchFetcher() - launch image fetcher */ - void launchFetcher(); + void launchFetcher(int fetcherFilterType); /** * launchFromExternal() - Fuction to launch the application from some external world @@ -277,6 +277,7 @@ int mCollectionId; bool isProgressbarRunning; QMap mSaveActivity; + GlxFetcherFilterType mFetcherFilterType; }; diff -r 199e6e1e0b54 -r a91aa46552be ui/viewmanagement/statehandler/src/glxstatemanager.cpp --- a/ui/viewmanagement/statehandler/src/glxstatemanager.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/viewmanagement/statehandler/src/glxstatemanager.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -62,7 +62,8 @@ mCurrentState( NULL ), mActionHandler( NULL ), mTNObserver ( NULL ), - isProgressbarRunning ( false ) + isProgressbarRunning ( false ), + mFetcherFilterType ( EGlxFetcherFilterNone ) { qDebug("GlxStateManager::GlxStateManager"); PERFORMANCE_ADV ( d1, "view manager creation time") { @@ -121,12 +122,12 @@ return QObject::eventFilter(obj, event); } -void GlxStateManager::launchFetcher() +void GlxStateManager::launchFetcher(int fetcherFilterType) { qDebug("GlxStateManager::launchFetcher"); mCurrentState = createState(GLX_GRIDVIEW_ID); mCurrentState->setState(FETCHER_ITEM_S); - + mFetcherFilterType = (GlxFetcherFilterType)fetcherFilterType; createModel(GLX_GRIDVIEW_ID); mViewManager->launchApplication( GLX_GRIDVIEW_ID, mCurrentModel); } @@ -578,7 +579,7 @@ { GlxModelParm modelParm; GlxContextMode mode; - + modelParm.setFilterType(EGlxFilterImage); if ( mViewManager->orientation() == Qt::Horizontal ) { mode = GlxContextLsGrid ; } @@ -588,7 +589,6 @@ switch( internalState) { case ALL_ITEM_S : - case FETCHER_ITEM_S: if ( mAllMediaModel == NULL ) { modelParm.setCollection( KGlxCollectionPluginAllImplementationUid ); modelParm.setDepth(0); @@ -599,9 +599,24 @@ mCurrentModel = mAllMediaModel; mViewManager->updateToolBarIcon(GLX_ALL_ACTION_ID); break; + + case FETCHER_ITEM_S: + if ( mAllMediaModel == NULL ) { + modelParm.setCollection( KGlxCollectionPluginAllImplementationUid ); + modelParm.setDepth(0); + if(EGlxFetcherFilterNone != mFetcherFilterType ){ + modelParm.setFilterType(EGlxFilterFetcherMimeType); + modelParm.setFetcherFiterType(mFetcherFilterType); + } + modelParm.setContextMode( mode ) ; + mAllMediaModel = new GlxMediaModel( modelParm ); + } + mCollectionId = KGlxCollectionPluginAllImplementationUid; + mCurrentModel = mAllMediaModel; + mViewManager->updateToolBarIcon(GLX_ALL_ACTION_ID); + break; case ALBUM_ITEM_S : - case FETCHER_ALBUM_ITEM_S : if ( dir != BACKWARD_DIR ) { modelParm.setCollection( KGlxAlbumsMediaId ); modelParm.setDepth(0); @@ -610,7 +625,21 @@ } mCollectionId = KGlxAlbumsMediaId; mCurrentModel = mAlbumGridMediaModel ; - mViewManager->updateToolBarIcon(NO_ACTION_ID); + break; + + case FETCHER_ALBUM_ITEM_S : + if ( dir != BACKWARD_DIR ) { + modelParm.setCollection( KGlxAlbumsMediaId ); + modelParm.setDepth(0); + if(EGlxFetcherFilterNone != mFetcherFilterType){ + modelParm.setFilterType(EGlxFilterFetcherMimeType); + modelParm.setFetcherFiterType(mFetcherFilterType); + } + modelParm.setContextMode( mode ) ; + mAlbumGridMediaModel = new GlxMediaModel( modelParm ); + } + mCollectionId = KGlxAlbumsMediaId; + mCurrentModel = mAlbumGridMediaModel ; break; default : diff -r 199e6e1e0b54 -r a91aa46552be ui/views/detailsview/src/glxdetailsview.cpp --- a/ui/views/detailsview/src/glxdetailsview.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/views/detailsview/src/glxdetailsview.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -95,21 +95,22 @@ if (!mDocLoader) { mDocLoader = new GlxDetailsViewDocLoader(); } - mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded); + + if ( mDocLoader ) { + mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded); - if (!mView) { + if (!mView) { - mView = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_VIEW)); - mImageBackGround = static_cast (mDocLoader->findWidget( - GLX_DETAILSVIEW_IMGBCKGROUND)); - mDetailsIcon = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_IMAGE)); - } + mView = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_VIEW)); + mImageBackGround = static_cast (mDocLoader->findWidget( + GLX_DETAILSVIEW_IMGBCKGROUND)); + mDetailsIcon = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_IMAGE)); + } - mFavIcon = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_FAVICON)); - - mShareButton = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_SHAREBUTTON)); - - mListView = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_LISTWIDGET)); + mFavIcon = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_FAVICON)); + mShareButton = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_SHAREBUTTON)); + mListView = static_cast (mDocLoader->findWidget(GLX_DETAILSVIEW_LISTWIDGET)); + } //Set the Model mModel = model; @@ -125,9 +126,7 @@ mImageBackGround->show(); mDetailsIcon->show(); - setWidget(mView); - - + setWidget(mView); OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT ); } diff -r 199e6e1e0b54 -r a91aa46552be ui/views/detailsview/src/glxdetailsviewitemprototype.cpp --- a/ui/views/detailsview/src/glxdetailsviewitemprototype.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/views/detailsview/src/glxdetailsviewitemprototype.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -32,8 +32,13 @@ //-------------------------------------------------------------------------------------------------------------------------------------------- //GlxDetailsViewItemProtoType //-------------------------------------------------------------------------------------------------------------------------------------------- -GlxDetailsViewItemProtoType::GlxDetailsViewItemProtoType(QGraphicsItem* parent) : - HbListViewItem(parent) +GlxDetailsViewItemProtoType::GlxDetailsViewItemProtoType(QGraphicsItem* parent) + : HbListViewItem(parent), + mImageNameEditor( NULL ), + mDescriptionEditor( NULL ), + mDateLabel( NULL ), + mTimeLabel( NULL ), + mSizeLabel( NULL ) { } diff -r 199e6e1e0b54 -r a91aa46552be ui/views/gridview/inc/glxgridview.h --- a/ui/views/gridview/inc/glxgridview.h Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/views/gridview/inc/glxgridview.h Mon Oct 04 00:17:18 2010 +0300 @@ -71,6 +71,21 @@ void initializeNewModel(); void showAlbumTitle(QString aTitle); void populated(); + + /** + * rowsInserted() - call back of new row inserted in the model. + */ + void rowsInserted(); + + /** + * rowsRemoved() - call back of new row removed in the model. + */ + void rowsRemoved( ); + + /** + * rowsRemoved() - call back to handle the user action in album grid view toolbar. + */ + void handleToolBarAction(); protected : @@ -93,6 +108,11 @@ //It is used to hide and show the toolbar //In album grid it is not required to show the tool bar void updateToolBar(); + + /** + * createAlbumGridToolBar() - Create a new album grid view toolbar. + */ + void createAlbumGridToolBar(); HbMainWindow *mWindow; // no ownership QAbstractItemModel *mModel ; @@ -110,7 +130,12 @@ HbGroupBox *mAlbumNameHeading; QGraphicsLinearLayout *mMarkContainer; GlxSettingInterface *mSettings; - HbWidget *mMarkingWidget; + HbWidget *mMarkingWidget; + HbToolBar *mToolBar; //This toolbar is used for album grid + //no ownership only pointed to the current toolbar, this view have three toolbar + //View manager has ownership of two tool bar and above one is ownership by itself. + // This variable is required to tackle the complexity of these three tool bar + HbToolBar *mCurrentToolBar; }; #endif /* GLXGRIDVIEW_H_ */ diff -r 199e6e1e0b54 -r a91aa46552be ui/views/gridview/src/glxgridview.cpp --- a/ui/views/gridview/src/glxgridview.cpp Fri Sep 17 08:29:24 2010 +0300 +++ b/ui/views/gridview/src/glxgridview.cpp Mon Oct 04 00:17:18 2010 +0300 @@ -22,7 +22,8 @@ #include #include #include -#include // Temp +#include +#include #include #include #include @@ -66,7 +67,9 @@ mZeroItemLabel(NULL), mAlbumNameHeading(NULL), mMarkContainer(NULL), - mMarkingWidget(NULL) + mMarkingWidget(NULL), + mToolBar( NULL ), + mCurrentToolBar( NULL ) { OstTraceFunctionEntry0( GLXGRIDVIEW_GLXGRIDVIEW_ENTRY ); mModelWrapper = new GlxModelWrapper(); @@ -134,52 +137,53 @@ void GlxGridView::clearCurrentModel() { if ( mModel ) { - disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(showItemCount())); - disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(showItemCount())); - disconnect(mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel())); - disconnect(mModel, SIGNAL(albumTitleAvailable(QString)), this, SLOT(showAlbumTitle(QString))); - disconnect(mModel, SIGNAL(populated()), this, SLOT( populated())); - mModel = NULL ; + disconnect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( rowsInserted() ) ); + disconnect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( rowsRemoved() ) ); + disconnect( mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel() ) ); + disconnect( mModel, SIGNAL( albumTitleAvailable( QString ) ), this, SLOT( showAlbumTitle( QString ) ) ); + disconnect( mModel, SIGNAL( populated() ), this, SLOT( populated() ) ); + mModel = NULL; } } void GlxGridView::initializeNewModel() { if ( mModel ) { - connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(showItemCount())); - connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(showItemCount())); - connect(mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel())); - if(getSubState() == ALBUM_ITEM_S){ - connect(mModel, SIGNAL(albumTitleAvailable(QString)), this, SLOT(showAlbumTitle(QString))); + connect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( rowsInserted() ) ); + connect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( rowsRemoved() ) ); + connect( mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel() ) ); + if ( getSubState() == ALBUM_ITEM_S ) { + connect( mModel, SIGNAL( albumTitleAvailable( QString ) ), this, SLOT( showAlbumTitle( QString ) ) ); } - connect(mModel, SIGNAL(populated()), this, SLOT( populated())); + connect( mModel, SIGNAL( populated() ), this, SLOT( populated() ) ); } } -void GlxGridView::setModel(QAbstractItemModel *model) +void GlxGridView::setModel( QAbstractItemModel *model ) { OstTraceFunctionEntry0( GLXGRIDVIEW_SETMODEL_ENTRY ); - if(model) - { + if( model ) { clearCurrentModel(); mModel = model; initializeNewModel(); + QVariant variantimage = mModel->data(mModel->index(0,0),GlxDefaultImage); - if (mWidget && variantimage.isValid() && variantimage.canConvert () ) - { - mWidget->setDefaultImage(variantimage.value()); - } - mModelWrapper->setModel(mModel); - mWidget->setModel(mModelWrapper); - if(!mSelectionModel) - { - mSelectionModel = new QItemSelectionModel(mModelWrapper, this); - connect(mSelectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(visibleIndexChanged(const QModelIndex &, const QModelIndex &))); - mWidget->setSelectionModel(mSelectionModel); - } - scrolltofocus(); // Need to do it here ? + if ( variantimage.isValid() && variantimage.canConvert () ) { + mWidget->setDefaultImage( variantimage.value() ); + } + + mModelWrapper->setModel( mModel ); + mWidget->setModel( mModelWrapper ); + + if( !mSelectionModel ) { + mSelectionModel = new QItemSelectionModel( mModelWrapper, this ); + connect( mSelectionModel, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( visibleIndexChanged( const QModelIndex &, const QModelIndex & ) ) ); + mWidget->setSelectionModel( mSelectionModel ); + } + + scrolltofocus(); // Need to do it here ? showItemCount(); - } + } OstTraceFunctionExit0( GLXGRIDVIEW_SETMODEL_EXIT ); } @@ -198,7 +202,38 @@ void GlxGridView::addToolBar( HbToolBar *toolBar ) { OstTraceFunctionEntry0( GLXGRIDVIEW_ADDTOOLBAR_ENTRY ); - setToolBar(toolBar); + + //For album grid view, add and remove from album tool bar will be shown + int subState = getSubState(); + if ( subState == ALBUM_ITEM_S && mWidget->selectionMode() == HgWidget::NoSelection ) { + if ( !mToolBar ) { + createAlbumGridToolBar(); + } + if ( mToolBar ) { + //remove from action will be disable if number of images in the album grid is zero. + if ( mModel->rowCount() ) { + mToolBar->actions().at(0)->setEnabled( true ); //To:Do remove once selection dialog is implemented + mToolBar->actions().at(1)->setEnabled( true ); + } + else { + mToolBar->actions().at(0)->setEnabled( false ); + mToolBar->actions().at(1)->setEnabled( false ); + } + if ( mToolBar != mCurrentToolBar ) { + takeToolBar(); + setToolBar( mToolBar ); + mCurrentToolBar = mToolBar; + } + } + } + else { + if ( toolBar != mCurrentToolBar ) { + takeToolBar(); + setToolBar( toolBar ); + mCurrentToolBar = toolBar; + } + } + showHbItems(); OstTraceFunctionExit0( GLXGRIDVIEW_ADDTOOLBAR_EXIT ); } @@ -270,33 +305,30 @@ { int count = mModel->rowCount(); QModelIndexList indexList = mWidget->selectionModel()->selectedIndexes(); - int markItemCount = indexList.count(); - - QString text= HbParameterLengthLimiter(GLX_LABEL_MARK_COUNT).arg(markItemCount).arg(count); - + int markItemCount = indexList.count(); + QString text= HbParameterLengthLimiter(GLX_LABEL_MARK_COUNT).arg(markItemCount).arg(count); mMarkCountLabel->setPlainText( text ); } void GlxGridView::showItemCount() { int count = 0; - if(mModel) { + if( mModel ) { count = mModel->rowCount(); QSize deviceSize = HbDeviceProfile::current().logicalSize(); QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() ) : QSize( deviceSize.height(), deviceSize.width() ) ; - if(count) { + if( count ) { if(mZeroItemLabel) { mZeroItemLabel->hide(); } - if(isItemVisible(Hb::TitleBarItem)) { + if( isItemVisible( Hb::TitleBarItem ) ) { QString text; - if(XQServiceUtil::isService()) - { + if(XQServiceUtil::isService()) { showAlbumTitle(GLX_SELECT_IMAGE); - } - else if (getSubState() == ALL_ITEM_S) { + } + else if ( getSubState() == ALL_ITEM_S ) { if (mAlbumNameHeading) { mAlbumNameHeading->hide(); } @@ -305,7 +337,7 @@ mTotalImagesCount->setHeading ( text ); mTotalImagesCount->show(); } - else if (getSubState() == ALBUM_ITEM_S) { + else if ( getSubState() == ALBUM_ITEM_S ) { mTotalImagesCount->hide(); QVariant variant = mModel->data(mModel->index(0,0),GlxViewTitle); if (variant.toString() != NULL) { @@ -406,13 +438,38 @@ void GlxGridView::populated() { - QVariant variant = mModelWrapper->data(mModelWrapper->index(0,0), GlxVisualWindowIndex ); - int visualIndex = 0; - if ( variant.isValid() && variant.canConvert () ) { - visualIndex = variant.value(); - } - mWidget->scrollTo(mModelWrapper->index(visualIndex,0)); + QVariant variant = mModelWrapper->data(mModelWrapper->index(0,0), GlxVisualWindowIndex ); + int visualIndex = 0; + if ( variant.isValid() && variant.canConvert () ) { + visualIndex = variant.value(); + } + mWidget->scrollTo(mModelWrapper->index(visualIndex,0)); + showItemCount(); +} + +void GlxGridView::rowsInserted() +{ showItemCount(); + if( getSubState() == ALBUM_ITEM_S && mToolBar ) { + mToolBar->actions().at(0)->setEnabled( true ); //To:Do remove once selection dialog is implemented + mToolBar->actions().at(1)->setEnabled( true ); + } +} + +void GlxGridView::rowsRemoved() +{ + showItemCount(); + if( getSubState() == ALBUM_ITEM_S && mModel->rowCount() == 0 && mToolBar ) { + mToolBar->actions().at(0)->setEnabled( false ); //To:Do remove once selection dialog is implemented + mToolBar->actions().at(1)->setEnabled( false ); + } +} + +void GlxGridView::handleToolBarAction() +{ + HbAction *action = qobject_cast( sender() ); + qint32 commandId = action->data().toInt(); + emit actionTriggered( commandId ); } void GlxGridView::handleUserAction(qint32 commandId) @@ -671,25 +728,23 @@ void GlxGridView::scrollingEnded() { mScrolling = FALSE; - if (mUiOnButton && (mWindow->orientation() == Qt::Horizontal)) - { + if ( mUiOnButton && ( mWindow->orientation() == Qt::Horizontal ) ) { mUiOnButton->show(); - } + } + QList visibleIndex = mWidget->getVisibleItemIndices(); - if (visibleIndex.count() <= 0) - { + if ( visibleIndex.count() <= 0 ) { return; - } + } QModelIndex index = visibleIndex.at(0); - if ( index.row() < 0 || index.row() >= mModel->rowCount() ) - { - return; + + if(mModel) { + if ( index.row() < 0 || index.row() >= mModel->rowCount() ) { + return; } - if(mModel) - { - mModel->setData( index, index.row(), GlxVisualWindowIndex); + mModel->setData( index, index.row(), GlxVisualWindowIndex ); mModel->setData( index, index.row(), GlxFocusIndexRole ); - } + } } GlxGridView::~GlxGridView() @@ -716,6 +771,7 @@ delete mMarkCountLabel; delete mMarkingWidget; delete mZeroItemLabel; + delete mToolBar; OstTraceFunctionExit0( DUP1_GLXGRIDVIEW_GLXGRIDVIEW_EXIT ); } @@ -779,9 +835,9 @@ return ; } - //In Album grid it is not required to show tool bar + //In the case of fetcher, there is no tool bar for album grid view int subState = getSubState(); - if ( subState == ALBUM_ITEM_S || subState == FETCHER_ALBUM_ITEM_S ) { + if ( subState == FETCHER_ALBUM_ITEM_S ) { setItemVisible( Hb::ToolBarItem, FALSE ) ; } else { @@ -789,3 +845,25 @@ } } +void GlxGridView::createAlbumGridToolBar() +{ + mToolBar = new HbToolBar(); + mToolBar->setOrientation( Qt::Horizontal ); + mToolBar->setVisible(true); + mToolBar->clearActions(); + + HbAction *action = new HbAction(); + action->setData( EGlxCmdAddToAlbum ); + action->setIcon( HbIcon( GLXICON_ADD ) ); + action->setObjectName( "Add Action" ); + mToolBar->addAction( action ); + connect( action, SIGNAL( triggered( ) ), this, SLOT( handleToolBarAction( ) ) ); + + action = new HbAction(); + action->setData( EGlxCmdRemoveFrom ); + action->setIcon( HbIcon( GLXICON_REMOVE ) ); + action->setObjectName( "Remove Action" ); + mToolBar->addAction( action ); + connect( action, SIGNAL( triggered( ) ), this, SLOT( handleToolBarAction( ) ) ); +} +