# HG changeset patch # User hgs # Date 1281131496 18000 # Node ID 4cc1412daed01ec1c27b5b7bbad52b4ab5fd0a69 # Parent 612c4815aebedd322cc475fad2859bf7c54a5ccf 201031 diff -r 612c4815aebe -r 4cc1412daed0 app/app.pro --- a/app/app.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/app/app.pro Fri Aug 06 16:51:36 2010 -0500 @@ -23,7 +23,7 @@ TARGET.EPOCSTACKSIZE = 0x14000 TARGET.EPOCHEAPSIZE = 0x020000 0x1F00000 TARGET.CAPABILITY = CAP_APPLICATION NetworkControl DRM - SKINICON = qtg_large_music_player + SKINICON = qtg_large_music BLD_INF_RULES.prj_exports += \ "../sis/musicplayer_stub.sis z:/system/install/musicplayer_stub.sis" \ @@ -57,7 +57,8 @@ -lxqserviceutil \ -lmusicservices \ -lmpsettingsmanager \ - -lmpengine + -lmpengine \ + -lmpmediacontroller # Input HEADERS += inc/mpmainwindow.h \ diff -r 612c4815aebe -r 4cc1412daed0 app/inc/mpmainwindow.h --- a/app/inc/mpmainwindow.h Fri Jul 23 17:31:12 2010 -0500 +++ b/app/inc/mpmainwindow.h Fri Aug 06 16:51:36 2010 -0500 @@ -30,6 +30,7 @@ class MusicServices; class MpGlobalPopupHandler; class HbActivityManager; +class MpMediaController; // Class declaration class MpMainWindow: public MpxViewFramework @@ -90,7 +91,8 @@ MusicServices *mMusicServices; // Own MpGlobalPopupHandler *mPopupHandler; // Own bool mUserExit; - HbActivityManager *mActivityManager; //Not Own + HbActivityManager *mActivityManager; // Not Own + MpMediaController *mMpMediaController; // Own }; diff -r 612c4815aebe -r 4cc1412daed0 app/rom/musicplayer.iby --- a/app/rom/musicplayer.iby Fri Jul 23 17:31:12 2010 -0500 +++ b/app/rom/musicplayer.iby Fri Aug 06 16:51:36 2010 -0500 @@ -21,7 +21,6 @@ #include S60_APP_EXE(musicplayer) -data = ZRESOURCE\apps\musicplayer.mif APP_RESOURCE_DIR\musicplayer.mif data = ZPRIVATE\10003A3F\import\APPS\musicplayer_reg.rsc PRIVATE\10003a3f\import\apps\musicplayer_reg.rsc data = ZSYSTEM\install\musicplayer_stub.sis system\install\musicplayer_stub.sis diff -r 612c4815aebe -r 4cc1412daed0 app/src/mpglobalpopuphandler.cpp --- a/app/src/mpglobalpopuphandler.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/app/src/mpglobalpopuphandler.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -116,7 +116,7 @@ HbProgressDialog* scanProgressDialog = new HbProgressDialog( HbProgressDialog::WaitDialog ); connect( scanProgressDialog, SIGNAL( cancelled() ), mMpSongScanner, SLOT( cancelScan() ) ); scanProgressDialog->setModal( true ); - HbLabel *title = new HbLabel( hbTrId( "txt_mus_info_refreshingnln_songs_added" ) ); + HbLabel *title = new HbLabel( hbTrId( "txt_mus_title_refreshing" ) ); title->setFontSpec(HbFontSpec(HbFontSpec::Primary)); scanProgressDialog->setHeadingWidget( title ); diff -r 612c4815aebe -r 4cc1412daed0 app/src/mpmainwindow.cpp --- a/app/src/mpmainwindow.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/app/src/mpmainwindow.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -31,6 +31,7 @@ #include "mpenginefactory.h" #include "mpsettingsmanager.h" #include "mpglobalpopuphandler.h" +#include "mpmediacontroller.h" #include "mptrace.h" const QString MUSIC_MAIN_VIEW = "MusicMainView"; @@ -60,7 +61,8 @@ mMusicServices(0), mPopupHandler(0), mUserExit( false ), - mActivityManager(0) + mActivityManager(0), + mMpMediaController(0) { TX_LOG } @@ -94,7 +96,10 @@ if (mMediaWallViewPlugin) { mMediaWallViewPlugin->destroyView(); delete mMediaWallViewPlugin; - } + } + + delete mMpMediaController; + MpEngineFactory::close(); @@ -183,6 +188,7 @@ mActivityManager->removeActivity( MUSIC_NOW_PLAYING_VIEW ); connect( app, SIGNAL( activate() ), this , SLOT( handleActivity() ) ); connect( app, SIGNAL( aboutToQuit() ), this, SLOT( saveActivity() ) ); + mMpMediaController = new MpMediaController(); emit applicationReady(); } @@ -395,6 +401,7 @@ Q_ASSERT_X(false, "MpMainWindow::initializeServiceView", "undefined service"); break; } + mMpMediaController = new MpMediaController(); emit applicationReady(); } diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/tsrc.pro --- a/app/tsrc/tsrc.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/app/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -17,6 +17,7 @@ TEMPLATE = subdirs # SUBDIRS += unittest_mpmtpinfolink +# SUBDIRS += unittest_mpglobalpopuphandler CONFIG += ordered diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/inc/unittest_mpglobalpopuphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/inc/unittest_mpglobalpopuphandler.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpGlobalPopupHandler +* +*/ + +#ifndef TESTMPGLOBALPOPUPHANDLER_H +#define TESTMPGLOBALPOPUPHANDLER_H + +#include + +class MpGlobalPopupHandler; + +class TestMpGlobalPopupHandler : public QObject +{ + Q_OBJECT + +public: + + TestMpGlobalPopupHandler(); + ~TestMpGlobalPopupHandler(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void testHandleLibraryAboutToUpdate(); + void testScanCountChanged(); + void testHandleScanFinished(); + void testLaunchUnableToCotinueDueUsb(); + void testLaunchUsbBlockingNote(); + void testLaunchMTPInfoDialog(); + void testOutstandingPopupClosing(); + void testLaunchScanFinishedDialog(); + void testLaunchDiskFullDialog(); + void testSetOutstandingPopup(); + +private: + + MpGlobalPopupHandler *mTest; + QTranslator *mMpTranslator; + +}; + +#endif // TESTMPGLOBALPOPUPHANDLER_H diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/src/unittest_mpglobalpopuphandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/src/unittest_mpglobalpopuphandler.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpMediaWallDocumentLoader +*/ + +#include "unittest_mpglobalpopuphandler.h" +#include "mpsongscanner.h" +#include "mpengine.h" +#include +#include +#include +#include +#include +#include + +/* +* Following methods were skipped on purpose since theres nothing valuable to test +* CloseUsbBlockingNote() +* HanldeMTPInfoDialogFinished +*/ + +// Do this so we can access all member variables. +#define private public +#include "mpglobalpopuphandler.h" +#undef private + +#include "../../../src/mpglobalpopuphandler.cpp" + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + TestMpGlobalPopupHandler tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpglobalpopuphandler.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpGlobalPopupHandler::TestMpGlobalPopupHandler() + : mTest(0), + mMpTranslator(0) +{ +} + +TestMpGlobalPopupHandler::~TestMpGlobalPopupHandler() +{ + delete mTest; + delete mMpTranslator; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpGlobalPopupHandler::initTestCase() +{ + QString lang = QLocale::system().name(); + QString path = QString("z:/resource/qt/translations/"); + bool translatorLoaded = false; + + mMpTranslator = new QTranslator(this); + translatorLoaded = mMpTranslator->load(path + "musicplayer_" + lang); + if ( translatorLoaded ) { + qApp->installTranslator(mMpTranslator); + } +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpGlobalPopupHandler::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpGlobalPopupHandler::init() +{ + mTest = new MpGlobalPopupHandler( new QObject() ); +} + +/*! + Called after every testfunction. + */ +void TestMpGlobalPopupHandler::cleanup() +{ + delete mTest; + mTest = 0; +} + +/*! + test handleLibraryAboutToUpdate + */ +void TestMpGlobalPopupHandler::testHandleLibraryAboutToUpdate() +{ + mTest->mMpSongScanner = 0; + mTest->mMpEngine->mSongScanner = new MpSongScanner(); + + mTest->handleLibraryAboutToUpdate(); + QCOMPARE( mTest->mMpSongScanner, mTest->mMpEngine->mSongScanner ); +} + +/*! + test scanCountChanged + */ +void TestMpGlobalPopupHandler::testScanCountChanged() +{ + HbProgressDialog* dialog = new HbProgressDialog( HbProgressDialog::WaitDialog ); + dialog->setModal( true ); + dialog->setText( QString("") ); + dialog->setObjectName( KScanProgressDialog ); + + mTest->mOutstandingPopup = dialog; + + mTest->scanCountChanged( 2 ); + HbProgressDialog *dialogNew = qobject_cast( mTest->mOutstandingPopup ); + QCOMPARE( dialogNew->text(), hbTrId( "txt_mus_info_ln_songs_found" , 2 )); + +} + +/*! + test handleScanFinished + */ +void TestMpGlobalPopupHandler::testHandleScanFinished() +{ + HbProgressDialog* dialog = new HbProgressDialog( HbProgressDialog::WaitDialog ); + dialog->setModal( true ); + HbLabel *title = new HbLabel( hbTrId( "testScanCountChanged" ) ); + title->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + + dialog->setHeadingWidget( title ); + dialog->setText( QString("") ); + dialog->setObjectName( KScanProgressDialog ); + + mTest->mOutstandingPopup = dialog; + mTest->handleScanFinished( MpSongScanner::ScanErrorNone, 0 ); + QVERIFY( mTest->mOutstandingPopup->objectName() == KScanFinished ); + QVERIFY( qobject_cast( mTest->mOutstandingPopup )->title() == hbTrId( "txt_mus_dpophead_refresh_complete" ) ); + + mTest->mOutstandingPopup = dialog; + mTest->handleScanFinished( MpSongScanner::ScanGeneralError, 0 ); + QVERIFY( mTest->mOutstandingPopup->objectName() == KScanFinished ); + QVERIFY( qobject_cast( mTest->mOutstandingPopup )->title() == hbTrId( "txt_mus_dpophead_refresh_cancelled" ) ); + + mTest->mOutstandingPopup = dialog; + mTest->handleScanFinished( MpSongScanner::ScanErrorDiskFull, 0 ); + QVERIFY( mTest->mOutstandingPopup->objectName() == KDiskFullDialog ); + +} + +/*! + test launchUnableToCotinueDueUsb + */ +void TestMpGlobalPopupHandler::testLaunchUnableToCotinueDueUsb() +{ + mTest->launchUnableToCotinueDueUsb(); + QVERIFY( mTest->mOutstandingPopup->objectName() == KUnableToContinueDueUSB ); +} + +/*! + test launchUsbBlockingNote + */ +void TestMpGlobalPopupHandler::testLaunchUsbBlockingNote() +{ + mTest->launchUsbBlockingNote(); + QVERIFY( mTest->mOutstandingPopup->objectName() == KUsbBlockingNote ); +} + + +/*! + test launchMTPInfoDialog + */ +void TestMpGlobalPopupHandler::testLaunchMTPInfoDialog() +{ + mTest->launchMTPInfoDialog(); + QVERIFY( mTest->mOutstandingPopup->objectName() == KMTPInfoDialog ); +} + + +/*! + test outstandingPopupClosing + */ +void TestMpGlobalPopupHandler::testOutstandingPopupClosing() +{ + HbPopup *dialog = new HbPopup(); + connect( dialog, SIGNAL( aboutToClose() ), mTest, SLOT( outstandingPopupClosing() ) ); + mTest->mOutstandingPopup = dialog; + + dialog->close(); + delete dialog; + QVERIFY( mTest->mOutstandingPopup == 0 ); +} + +/*! + test launchScanFinishedDialog + */ +void TestMpGlobalPopupHandler::testLaunchScanFinishedDialog() +{ + mTest->launchScanFinishedDialog( true, 1 ); + QVERIFY( mTest->mOutstandingPopup->objectName() == KScanFinished ); + QVERIFY( qobject_cast( mTest->mOutstandingPopup )->title() == hbTrId( "txt_mus_dpophead_refresh_complete" ) ); + + mTest->launchScanFinishedDialog( false, 1 ); + QVERIFY( mTest->mOutstandingPopup->objectName() == KScanFinished ); + QVERIFY( qobject_cast( mTest->mOutstandingPopup )->title() == hbTrId( "txt_mus_dpophead_refresh_cancelled" ) ); +} + + +/*! + test launchDiskFullDialog + */ + +void TestMpGlobalPopupHandler::testLaunchDiskFullDialog() +{ + mTest->launchDiskFullDialog(); + QVERIFY( mTest->mOutstandingPopup->objectName() == KDiskFullDialog ); +} + +/*! + test setOutstandingPopup + */ +void TestMpGlobalPopupHandler::testSetOutstandingPopup() +{ + HbPopup *dialog = new HbPopup(); + mTest->mOutstandingPopup = 0; + mTest->setOutstandingPopup( dialog ); + QVERIFY( mTest->mOutstandingPopup == dialog ); +} + + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpengine.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpengine stub +* +*/ + +#ifndef MPENGINE_H +#define MPENGINE_H + +#include + +class MpSongScanner; + +class MpEngine : public QObject +{ + Q_OBJECT + +public: + enum EngineMode{ + StandAlone, + Fetch, + Embedded, + MediaBrowsing + }; + friend class MpEngineFactory; + +public: + MpSongScanner *songScanner(); + +private: + explicit MpEngine(); + void initialize( TUid hostUid, EngineMode mode); + +signals: + void libraryAboutToUpdate(); + void unableToCotinueDueUSB(); + void usbSynchronizationStarted(); + void usbSynchronizationFinished(); + +public: + virtual ~MpEngine(); + +public: + MpSongScanner *mSongScanner; +}; + +#endif // MPENGINE_H diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpenginefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpenginefactory.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub +* +*/ + +#ifndef MPENGINEFACTORY_H +#define MPENGINEFACTORY_H + +#include +#include "mpcommondefs.h" +#include "mpengine.h" + +class MpEngineFactory : QObject +{ + Q_OBJECT +private: + explicit MpEngineFactory(); + +public: + virtual ~MpEngineFactory(); + static MpEngineFactory * instance(); + static MpEngine *sharedEngine(); + static MpEngine *createIsolatedEngine( MpEngine::EngineMode mode ); + static void close(); + static MpEngine *createSharedEngine( TUid uid = TUid::Uid( MpCommon::KMusicPlayerUid ), MpEngine::EngineMode mode = MpEngine::StandAlone ); + + +private: + MpEngine *mSharedEngine; + QList mEngines; +}; + + +#endif // MPENGINEFACTORY_H diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpmtpinfolink.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpmtpinfolink.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player MTP info link. +* +*/ + + +#ifndef MPMTPINFOLINK_H +#define MPMTPINFOLINK_H + +#include + +class MpMtpInfoLink: public HbLabel +{ + Q_OBJECT + +public: + explicit MpMtpInfoLink(); + virtual ~MpMtpInfoLink(); +}; + +#endif // MPMTPINFOLINK_H + diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpsettingsmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpsettingsmanager.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpSettingsManager stub for testing MpMtpInfoLink. +* +*/ + +#ifndef MPSETTINGSMANAGER_H +#define MPSETTINGSMANAGER_H + +#include +#include + +class MpSettingsManager: public QObject +{ + +Q_OBJECT + +private: + explicit MpSettingsManager(); + +public: + virtual ~MpSettingsManager(); + static MpSettingsManager *instance(); + static void SetUrl( QString url ); + static QString mtpInfoUrl(); + static bool showMtpInfo(); + static void stopShowingMtpInfo(); + +public: + QString mMtpInfoUrl; + bool mShowMtpInfo; + +private: + Q_DISABLE_COPY(MpSettingsManager) +}; + +#endif // MPSETTINGSMANAGER_H diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpsongscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/inc/mpsongscanner.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for song scanner. +* +*/ + + +#ifndef MPSONGSCANNER_H +#define MPSONGSCANNER_H + +class MpMpxHarvesterFrameworkWrapper; + +#include + +class MpSongScanner : public QObject +{ + Q_OBJECT + +public: + enum ScanError{ + ScanErrorNone, + ScanGeneralError, + ScanErrorDiskFull, + ScanInterrupted + }; + + MpSongScanner(); + virtual ~MpSongScanner(); + + void scan( bool automaticScan ); + bool isAutomaticScan(); + +signals: + void scanStarted(); + void scanCountChanged( int count ); + void scanFinished( int error, int itemsAdded ); + +public: + bool mAutomaticScan; +}; + +#endif // MPSONGSCANNER_H + diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpengine.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -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: Stub for mpengine. +* +*/ + +#include "mpengine.h" +#include "mpsongscanner.h" + +MpEngine::MpEngine() +{ + +} + +/*! + Destructs music player engine. + */ +MpEngine::~MpEngine() +{ + +} + +/*! + Initialize engine + */ +void MpEngine::initialize( TUid hostUid, EngineMode mode ) +{ + Q_UNUSED( hostUid ); + Q_UNUSED( mode ); +} + +/*! + \ + Returs the current songScanner instance + */ +MpSongScanner *MpEngine::songScanner() +{ + return mSongScanner; +} diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpenginefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpenginefactory.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub for testing MpNowPlayingWidget +* +*/ + + +#include "mpenginefactory.h" + + +/*! + * Stub function + */ +MpEngineFactory::MpEngineFactory() + : mSharedEngine( 0 ) +{ +} + +/*! + * Stub function + */ +MpEngineFactory::~MpEngineFactory() +{ +} + +/*! + * Stub function + */ +MpEngineFactory * MpEngineFactory::instance() +{ + static MpEngineFactory instance; + return &instance; +} + +/*! + * Stub function + */ +MpEngine *MpEngineFactory::sharedEngine() +{ + if ( !instance()->mSharedEngine ) { + instance()->mSharedEngine = new MpEngine(); + } + return instance()->mSharedEngine; +} + +/*! + Returns an instance to an isolated engine with \a mode. + */ +MpEngine *MpEngineFactory::createIsolatedEngine( MpEngine::EngineMode mode ) +{ + instance()->mEngines.append( new MpEngine() ); + instance()->mEngines.last()->initialize( TUid::Uid( MpCommon::KMusicPlayerUid + instance()->mEngines.count() ), mode ); + return instance()->mEngines.last(); +} + +/*! + Closes all engines created on this process. + */ +void MpEngineFactory::close() +{ + if ( instance()->mSharedEngine ) { + delete instance()->mSharedEngine; + instance()->mSharedEngine = 0; + + } + MpEngine *ptr; + foreach ( ptr, instance()->mEngines ) { + delete ptr; + ptr = 0; + } +} + +/*! + Returns an instance to an engine with \a hostUid, and \a mode, if the shared engine is + already created parameters are ignored. + */ +MpEngine *MpEngineFactory::createSharedEngine( TUid hostUid , MpEngine::EngineMode mode ) +{ + if ( !instance()->mSharedEngine ) { + instance()->mSharedEngine = new MpEngine(); + instance()->mSharedEngine->initialize( hostUid, mode ); + } + return instance()->mSharedEngine; +} + diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpmtpinfolink.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpmtpinfolink.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player MTP info link. This class is used to provide a link +* to educate the user about MTP after a successful manual refresh. +* Basically this class inherits from HbLabel and catches mouse events, +* when clicked it opens a url already specified in settings. +* +*/ + + +#include "mpmtpinfolink.h" + + +/*! + Constructs MpMtpInfoLink. + */ +MpMtpInfoLink::MpMtpInfoLink() +{ +} + +/*! + Destructs the MpMtpInfoLink. + */ +MpMtpInfoLink::~MpMtpInfoLink() +{ + +} diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpsettingsmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpsettingsmanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpSettingsManager stub for testing MpMtpInfoLink. +* +*/ + +#include "mpsettingsmanager.h" + + +/*! + Constructs the MP Settings Manager. + */ +MpSettingsManager::MpSettingsManager() +{ + mMtpInfoUrl = QString( "http://nokia.com/" ); +} + +/*! + Destructs the settings manager. + */ +MpSettingsManager::~MpSettingsManager() +{ +} + +/*! + Returns the singleton instance to the settings manager. + */ +MpSettingsManager * MpSettingsManager::instance() +{ + static MpSettingsManager instance; + return &instance; +} + +void MpSettingsManager::SetUrl( QString url ) +{ + instance()->mMtpInfoUrl = url; +} + +/*! + Returns mtp info url. + */ +QString MpSettingsManager::mtpInfoUrl() +{ + return instance()->mMtpInfoUrl; +} + +/*! + Returns wheter mtp info should be showed. + */ +bool MpSettingsManager::showMtpInfo() +{ + return instance()->mShowMtpInfo; +} + +/*! + Slot to be called to stop showing mtp info. + */ +void MpSettingsManager::stopShowingMtpInfo() +{ + +} diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpsongscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/stub/src/mpsongscanner.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for song scanner. +* +*/ + +#include "../inc/mpsongscanner.h" + +/*! + Constructs the song scanner. + */ +MpSongScanner::MpSongScanner() +{ + +} + +/*! + Destructs the song scanner. + */ +MpSongScanner::~MpSongScanner() +{ +} + +/*! + Initiates song scanning. + */ +void MpSongScanner::scan( bool /*automaticScan*/ ) +{ + +} + +bool MpSongScanner::isAutomaticScan() +{ + return mAutomaticScan; +} + diff -r 612c4815aebe -r 4cc1412daed0 app/tsrc/unittest_mpglobalpopuphandler/unittest_mpglobalpopuphandler.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/tsrc/unittest_mpglobalpopuphandler/unittest_mpglobalpopuphandler.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,48 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpglobalpopuphandler unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpglobalpopuphandler +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + stub/inc \ + ../../inc \ + ../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lestor.dll \ + -lfbscli.dll \ + +HEADERS += inc/unittest_mpglobalpopuphandler.h \ + ../../inc/mpglobalpopuphandler.h \ + stub/inc/mpmtpinfolink.h \ + stub/inc/mpsongscanner.h \ + stub/inc/mpenginefactory.h \ + stub/inc/mpsettingsmanager.h \ + stub/inc/mpengine.h \ + +SOURCES += src/unittest_mpglobalpopuphandler.cpp \ + #../../src/mpglobalpopuphandler.cpp \ + stub/src/mpmtpinfolink.cpp \ + stub/src/mpsongscanner.cpp \ + stub/src/mpenginefactory.cpp \ + stub/src/mpsettingsmanager.cpp \ + stub/src/mpengine.cpp \ + + \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 inc/mpcommondefs.h --- a/inc/mpcommondefs.h Fri Jul 23 17:31:12 2010 -0500 +++ b/inc/mpcommondefs.h Fri Aug 06 16:51:36 2010 -0500 @@ -20,6 +20,8 @@ #ifndef MPCOMMONDEFS_H #define MPCOMMONDEFS_H +#include + namespace MpCommon { // UID definition @@ -63,6 +65,18 @@ TBoneThumb, MediaWallThumb, }; + + /*! + Volume property, used in MpMpxPlaybackFramework and MpVolumeSlider. + */ + enum MpVolumeProperty{ + MaxVolume, + Volume, + MuteState + }; } + // Register MpVolumeProperty so can be used in signal and slot connection + Q_DECLARE_METATYPE( MpCommon::MpVolumeProperty ) + #endif // MPCOMMONDEFS_H diff -r 612c4815aebe -r 4cc1412daed0 inc/mpengine.h --- a/inc/mpengine.h Fri Jul 23 17:31:12 2010 -0500 +++ b/inc/mpengine.h Fri Aug 06 16:51:36 2010 -0500 @@ -27,7 +27,6 @@ class QStringList; class MpMpxHarvesterFrameworkWrapper; class MpSongScanner; -class MpMediaKeyHandler; class MpMpxCollectionFrameworkWrapper; class MpMpxPlaybackFrameworkWrapper; class MpMpxCollectionData; @@ -146,6 +145,9 @@ void containerContentsChanged(); void restorePathFailed(); + // Playback related + void volumePropertyChanged( MpCommon::MpVolumeProperty property, int value ); + // Equalizer related void equalizerReady(); @@ -168,6 +170,8 @@ // Playback related void playEmbedded( QString aFilename ); void playEmbedded( const XQSharableFile& file ); + void play(); + void pause(); void playPause(); void stop(); void skipForward(); @@ -178,6 +182,14 @@ void setPosition( int position ); void setShuffle( bool mode ); void setRepeat( bool mode ); + void getMaxVolume(); + void getVolume(); + void increaseVolume(); + void decreaseVolume(); + void setVolume( int value ); + void getMuteState(); + void mute(); + void unmute(); // Audio Effects related void setBalance( int balance ); @@ -205,7 +217,6 @@ // Harvesting related MpMpxHarvesterFrameworkWrapper *mMpxHarvesterWrapper; // Own MpSongScanner *mSongScanner; // Own - MpMediaKeyHandler *mMediaKeyHandler; // Own // Collection related MpMpxCollectionFrameworkWrapper *mMpxCollectionWrapper; //Own @@ -224,7 +235,8 @@ // General UsbBlockingState mUsbBlockingState; - UsbBlockingState mPreviousUsbState; + UsbBlockingState mPreviousUsbState; + bool mHandleMediaCommands; TUid mHostUid; }; diff -r 612c4815aebe -r 4cc1412daed0 inc/mpmediacontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/mpmediacontroller.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player Media Controller. +* +*/ + +#ifndef MPMEDIACONTROLLER_H +#define MPMEDIACONTROLLER_H + +#include +#include + +class MpMediaKeyHandler; +class MpVolumeSlider; + +#ifdef BUILD_MPMEDIACONTROLLER +#define BUILD_MPMEDIACONTROLLER_EXPORT Q_DECL_EXPORT +#else +#define BUILD_MPMEDIACONTROLLER_EXPORT Q_DECL_IMPORT +#endif +class BUILD_MPMEDIACONTROLLER_EXPORT MpMediaController: public QObject +{ + +Q_OBJECT + +public: + + explicit MpMediaController( QObject *parent = 0 ); + virtual ~MpMediaController(); + +private: + Q_DISABLE_COPY(MpMediaController) + MpMediaKeyHandler *mMpMediaKeyHandler; // own + MpVolumeSlider *mMpVolumeSlider; // own +}; + +#endif // MPMEDIACONTROLLER_H diff -r 612c4815aebe -r 4cc1412daed0 mpdata/src/mpsongdata_p.cpp --- a/mpdata/src/mpsongdata_p.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpdata/src/mpsongdata_p.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -28,6 +28,9 @@ #include #include #include +#include +#include +#include #include @@ -371,7 +374,9 @@ TX_LOG_ARGS( "Create album art file " << mTempAlbumArt ); QFile file( mTempAlbumArt ); - file.open( QIODevice::WriteOnly ); + if ( !file.open( QIODevice::WriteOnly ) ) { + return QString(""); + } if ( mAlbumArt && !mAlbumArt->isNull() && !mAlbumArt->qicon().isNull() ) { QPixmap p = mAlbumArt->qicon().pixmap( QSize( 74, 74 ), QIcon::Normal, QIcon::Off ); @@ -541,19 +546,25 @@ QFileInfo info( fullName ); changed |= setSize( info.size() ); + // Localization of timestamp is somewhat complex operation: + // 1. Localize the date and time parts separately + // 2. Concatenate the resulting localized strings + // 3. Finally, convert all of the digits in resulting single string + // to their localized versions (not all scripts have same numerals + // as latin/arabic) QDateTime lastModified = info.lastModified(); - QDate date = lastModified.date(); - int day = date.day(); - int month = date.month(); - int year = date.year(); - QTime time = lastModified.time(); - int sec = time.second(); - int min = time.minute(); - int hr = time.hour(); + QDate date( lastModified.date() ); + QTime time( lastModified.time() ); + + HbExtendedLocale locale = HbExtendedLocale::system(); - QString lastModifiedStr("%1.%2.%3 %4:%5:%6"); - lastModifiedStr = lastModifiedStr.arg( day ).arg( month ).arg( year ).arg( hr ).arg( min ).arg( sec ); - changed |= setModified( lastModifiedStr ); + QString dateStr = locale.format( date, r_qtn_date_usual_with_zero ); + QString timeStr = locale.format( time, r_qtn_time_long_with_zero ); + QString timestampStr( dateStr + " " + timeStr ); + TX_LOG_ARGS( "Timestamp before corrections: " << timestampStr ); + QString convertedTimestampStr( HbStringUtil::convertDigits(timestampStr) ); + + changed |= setModified( convertedTimestampStr ); // get file name without suffix @@ -1004,7 +1015,17 @@ bool change = false; if ( musicURL != mMusicURL ) { change = true; - mMusicURL = musicURL; + + // Make sure URL contains the correct protocol definition (HTTP). + if ( (musicURL.length() > 0) && + (musicURL.indexOf( "://", 0, Qt::CaseInsensitive ) == -1) ) { + mMusicURL = "http://" + musicURL; + TX_LOG_ARGS("Changed music url to " << mMusicURL); + } + else { + mMusicURL = musicURL; + TX_LOG_ARGS("Music url unchanged: " << mMusicURL); + } } TX_EXIT return change; diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpcollectiondatamodel/stub/inc/mpcollectionalbumartmanager.h --- a/mpdata/tsrc/unittest_mpcollectiondatamodel/stub/inc/mpcollectionalbumartmanager.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpdata/tsrc/unittest_mpcollectiondatamodel/stub/inc/mpcollectionalbumartmanager.h Fri Aug 06 16:51:36 2010 -0500 @@ -44,6 +44,7 @@ void cacheFirstScreen(); void cancel(); void setThumbnailSize( MpCommon::MpThumbType type ); + void enableDefaultArt( bool enabled ); signals: diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpcollectiondatamodel/stub/src/mpcollectionalbumartmanager.cpp --- a/mpdata/tsrc/unittest_mpcollectiondatamodel/stub/src/mpcollectionalbumartmanager.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpdata/tsrc/unittest_mpcollectiondatamodel/stub/src/mpcollectionalbumartmanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -95,3 +95,10 @@ mThumbType = type; } +/*! + Stub function. + */ +void MpCollectionAlbumArtManager::enableDefaultArt( bool enabled ) +{ + Q_UNUSED(enabled); +} diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/inc/mpmpxcollectiondata.h --- a/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/inc/mpmpxcollectiondata.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/inc/mpmpxcollectiondata.h Fri Aug 06 16:51:36 2010 -0500 @@ -50,7 +50,9 @@ virtual ~MpMpxCollectionData(); int albumSongsCount() const; + int albumSongId( int index ); QString albumSongData( int index, MpMpxCollectionData::DataType type ) const; + int albumSongIndex( int songUniqueId ); signals: diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/inc/mpplaybackdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/inc/mpplaybackdata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpplaybackdata stub for testing mpmediawallview +* +*/ + +#ifndef MPPLAYBACKDATA_H +#define MPPLAYBACKDATA_H + +//includes +#include +#include +#include + +class MpPlaybackData : public QObject +{ + Q_OBJECT + +public: + + enum SimplifiedState { + NotPlaying, + Playing, + Paused, + Stopped + }; + + + explicit MpPlaybackData(); + virtual ~MpPlaybackData(); + +signals: + void playbackStateChanged(); + void playbackInfoChanged(); + +public: + + int id(); + void setPlaybackState( const SimplifiedState state ); + MpPlaybackData::SimplifiedState playbackState() const; + +public: + + MpPlaybackData::SimplifiedState mPlaybackState; +}; + +#endif // MPPLAYBACKDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/src/mpmpxcollectiondata.cpp --- a/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/src/mpmpxcollectiondata.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/src/mpmpxcollectiondata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -69,6 +69,15 @@ /*! Stub function. */ +int MpMpxCollectionData::albumSongId( int index ) +{ + Q_UNUSED(index); + return 0; +} + +/*! + Stub function. + */ QString MpMpxCollectionData::albumSongData( int index, MpMpxCollectionData::DataType type ) const { QString data; @@ -87,3 +96,11 @@ return data; } +/*! + Stub function. + */ +int MpMpxCollectionData::albumSongIndex( int songUniqueId ) +{ + Q_UNUSED(songUniqueId); + return 0; +} diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/src/mpplaybackdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/src/mpplaybackdata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpPlaybackData stub for testing mpnowplayingwidget +* +*/ + +#include "stub/inc/mpplaybackdata.h" + + +int gUpdateCounter = 0; + + +/*! + Stub function. + */ +MpPlaybackData::MpPlaybackData() + : mPlaybackState(NotPlaying) +{ + gUpdateCounter++; +} + +/*! + Stub function. + */ +MpPlaybackData::~MpPlaybackData() +{ +} + +/*! + Stub function. + */ +int MpPlaybackData::id() +{ + return 0; +} + +/*! + Stub function. + */ +void MpPlaybackData::setPlaybackState(MpPlaybackData::SimplifiedState state) +{ + mPlaybackState=state; +} + +/*! + Stub function. + */ +MpPlaybackData::SimplifiedState MpPlaybackData::playbackState() const +{ + return mPlaybackState; +} diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/unittest_mpcollectiontbonelistdatamodel.pro --- a/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/unittest_mpcollectiontbonelistdatamodel.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/unittest_mpcollectiontbonelistdatamodel.pro Fri Aug 06 16:51:36 2010 -0500 @@ -32,11 +32,13 @@ HEADERS += inc/unittest_mpcollectiontbonelistdatamodel.h \ inc/unittest_helper.h \ stub/inc/mpmpxcollectiondata.h \ - ../../../inc/mpcollectiontbonelistdatamodel.h \ + stub/inc/mpplaybackdata.h \ + ../../../inc/mpcollectiontbonelistdatamodel.h SOURCES += src/unittest_mpcollectiontbonelistdatamodel.cpp \ src/unittest_helper.cpp \ stub/src/mpmpxcollectiondata.cpp \ + stub/src/mpplaybackdata.cpp \ ../../src/mpcollectiontbonelistdatamodel.cpp DEFINES += BUILD_MPDATA_LIB diff -r 612c4815aebe -r 4cc1412daed0 mpdata/tsrc/unittest_mpplaybackdata/src/unittest_mpplaybackdata.cpp --- a/mpdata/tsrc/unittest_mpplaybackdata/src/unittest_mpplaybackdata.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpdata/tsrc/unittest_mpplaybackdata/src/unittest_mpplaybackdata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -102,7 +102,6 @@ QCOMPARE(mTest->mThumbnailManager->getInitCounter(), 1); QVERIFY(mTest->mDuration == 0); QVERIFY(mTest->mPosition == 0); - QVERIFY(mTest->mDefaultAlbumArt != 0); } @@ -228,18 +227,6 @@ void TestMpPlaybackData::testSetAlbumArtUri() { QSignalSpy spy(mTest, SIGNAL(albumArtReady())); - //Empty string - mTest->setAlbumArtUri(QString("")); - QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); - QCOMPARE(spy.count(),1); - spy.clear(); - - //Request failed - mTest->mThumbnailManager->mGetThumbFails = true; - mTest->setAlbumArtUri(QString("AlbumArt")); - QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); - QCOMPARE(spy.count(),1); - spy.clear(); //Succesful requests mTest->mThumbnailManager->mGetThumbFails = false; @@ -269,21 +256,6 @@ QSignalSpy spy(mTest, SIGNAL(albumArtReady())); QPixmap albumArt(100,100); HbIcon albumArtIcon; - - //Error - mTest->thumbnailReady(albumArt,temp,KUndefined,KUndefined); - QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); - QCOMPARE(mTest->mReqId, KUndefined); - QCOMPARE(spy.count(),1); - spy.clear(); - - //Wrong id - mTest->mReqId = 1; - mTest->thumbnailReady(albumArt,temp,KUndefined,0); - QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); - QCOMPARE(mTest->mReqId, KUndefined); - QCOMPARE(spy.count(),1); - spy.clear(); //Update album art mTest->mReqId = 1; diff -r 612c4815aebe -r 4cc1412daed0 mpengine/bwins/mpengineu.def --- a/mpengine/bwins/mpengineu.def Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/bwins/mpengineu.def Fri Aug 06 16:51:36 2010 -0500 @@ -1,130 +1,141 @@ EXPORTS - ?metaObject@MpEngine@@UBEPBUQMetaObject@@XZ @ 1 NONAME ; struct QMetaObject const * MpEngine::metaObject(void) const - ?instance@MpEngineFactory@@SAPAV1@XZ @ 2 NONAME ; class MpEngineFactory * MpEngineFactory::instance(void) - ?createIsolatedEngine@MpEngineFactory@@SAPAVMpEngine@@W4EngineMode@2@@Z @ 3 NONAME ; class MpEngine * MpEngineFactory::createIsolatedEngine(enum MpEngine::EngineMode) - ??_EMpSongScanner@@UAE@I@Z @ 4 NONAME ; MpSongScanner::~MpSongScanner(unsigned int) - ?findAlbumSongs@MpEngine@@QAEXH@Z @ 5 NONAME ; void MpEngine::findAlbumSongs(int) - ?equalizerReady@MpEngine@@IAEXXZ @ 6 NONAME ; void MpEngine::equalizerReady(void) - ?setPosition@MpEngine@@QAEXH@Z @ 7 NONAME ; void MpEngine::setPosition(int) - ?saveToCurrentPlaylist@MpEngine@@QAEXAAV?$QList@H@@PAVMpMpxCollectionData@@@Z @ 8 NONAME ; void MpEngine::saveToCurrentPlaylist(class QList &, class MpMpxCollectionData *) - ?metaObject@MpEngineFactory@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * MpEngineFactory::metaObject(void) const - ?handleDeleteStarted@MpEngine@@QAEXW4TCollectionContext@@H@Z @ 10 NONAME ; void MpEngine::handleDeleteStarted(enum TCollectionContext, int) - ?handleEqualizerReady@MpEngine@@QAEXXZ @ 11 NONAME ; void MpEngine::handleEqualizerReady(void) - ?collectionData@MpEngine@@QAEPAVMpMpxCollectionData@@XZ @ 12 NONAME ; class MpMpxCollectionData * MpEngine::collectionData(void) - ?createPlaylist@MpEngine@@QAEXAAVQString@@AAV?$QList@H@@PAVMpMpxCollectionData@@@Z @ 13 NONAME ; void MpEngine::createPlaylist(class QString &, class QList &, class MpMpxCollectionData *) - ?collectionPlaylistOpened@MpEngine@@IAEXXZ @ 14 NONAME ; void MpEngine::collectionPlaylistOpened(void) - ?tr@MpSongScanner@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString MpSongScanner::tr(char const *, char const *) - ?renamePlaylist@MpEngine@@QAEXAAVQString@@H@Z @ 16 NONAME ; void MpEngine::renamePlaylist(class QString &, int) - ?scanCountChanged@MpSongScanner@@IAEXH@Z @ 17 NONAME ; void MpSongScanner::scanCountChanged(int) - ?handleUsbMtpEndEvent@MpEngine@@AAEXXZ @ 18 NONAME ; void MpEngine::handleUsbMtpEndEvent(void) - ?setBalance@MpEngine@@QAEXH@Z @ 19 NONAME ; void MpEngine::setBalance(int) - ?songData@MpEngine@@QAEPAVMpSongData@@XZ @ 20 NONAME ; class MpSongData * MpEngine::songData(void) - ?skipForward@MpEngine@@QAEXXZ @ 21 NONAME ; void MpEngine::skipForward(void) - ??_EMpEngineFactory@@UAE@I@Z @ 22 NONAME ; MpEngineFactory::~MpEngineFactory(unsigned int) - ?playAlbumSongs@MpEngine@@QAEXHHPAVMpMpxCollectionData@@@Z @ 23 NONAME ; void MpEngine::playAlbumSongs(int, int, class MpMpxCollectionData *) - ?setShuffle@MpEngine@@QAEX_N@Z @ 24 NONAME ; void MpEngine::setShuffle(bool) - ?openIsolatedCollection@MpEngine@@QAEXW4TCollectionContext@@@Z @ 25 NONAME ; void MpEngine::openIsolatedCollection(enum TCollectionContext) - ?usbSynchronizationFinished@MpEngine@@IAEXXZ @ 26 NONAME ; void MpEngine::usbSynchronizationFinished(void) - ?trUtf8@MpSongScanner@@SA?AVQString@@PBD0H@Z @ 27 NONAME ; class QString MpSongScanner::trUtf8(char const *, char const *, int) - ?close@MpEngineFactory@@SAXXZ @ 28 NONAME ; void MpEngineFactory::close(void) - ?qt_metacall@MpEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 29 NONAME ; int MpEngine::qt_metacall(enum QMetaObject::Call, int, void * *) - ?playlistSaved@MpEngine@@IAEX_N@Z @ 30 NONAME ; void MpEngine::playlistSaved(bool) - ?playbackData@MpEngine@@QAEPAVMpPlaybackData@@XZ @ 31 NONAME ; class MpPlaybackData * MpEngine::playbackData(void) - ?stop@MpEngine@@QAEXXZ @ 32 NONAME ; void MpEngine::stop(void) - ?libraryAboutToUpdate@MpEngine@@IAEXXZ @ 33 NONAME ; void MpEngine::libraryAboutToUpdate(void) - ?scan@MpSongScanner@@QAEX_N@Z @ 34 NONAME ; void MpSongScanner::scan(bool) - ?openCollection@MpEngine@@QAEXW4TCollectionContext@@@Z @ 35 NONAME ; void MpEngine::openCollection(enum TCollectionContext) - ?trUtf8@MpEngine@@SA?AVQString@@PBD0H@Z @ 36 NONAME ; class QString MpEngine::trUtf8(char const *, char const *, int) - ?reopenCollection@MpEngine@@QAEXXZ @ 37 NONAME ; void MpEngine::reopenCollection(void) - ?songsDeleted@MpEngine@@IAEX_N@Z @ 38 NONAME ; void MpEngine::songsDeleted(bool) - ??0MpEngineFactory@@AAE@XZ @ 39 NONAME ; MpEngineFactory::MpEngineFactory(void) - ?refreshLibrary@MpEngine@@QAEX_N@Z @ 40 NONAME ; void MpEngine::refreshLibrary(bool) - ?qt_metacast@MpEngine@@UAEPAXPBD@Z @ 41 NONAME ; void * MpEngine::qt_metacast(char const *) - ?startSeekForward@MpEngine@@QAEXXZ @ 42 NONAME ; void MpEngine::startSeekForward(void) - ?saveToPlaylist@MpEngine@@QAEXHAAV?$QList@H@@@Z @ 43 NONAME ; void MpEngine::saveToPlaylist(int, class QList &) - ?qt_metacall@MpEngineFactory@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 44 NONAME ; int MpEngineFactory::qt_metacall(enum QMetaObject::Call, int, void * *) - ?qt_metacall@MpSongScanner@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 45 NONAME ; int MpSongScanner::qt_metacall(enum QMetaObject::Call, int, void * *) - ?handleDiskEvent@MpSongScanner@@QAEXW4MpxDiskEvents@@@Z @ 46 NONAME ; void MpSongScanner::handleDiskEvent(enum MpxDiskEvents) - ?tr@MpEngineFactory@@SA?AVQString@@PBD0H@Z @ 47 NONAME ; class QString MpEngineFactory::tr(char const *, char const *, int) - ?tr@MpEngine@@SA?AVQString@@PBD0H@Z @ 48 NONAME ; class QString MpEngine::tr(char const *, char const *, int) - ?trUtf8@MpEngine@@SA?AVQString@@PBD0@Z @ 49 NONAME ; class QString MpEngine::trUtf8(char const *, char const *) - ?findPlaylists@MpEngine@@QAEXAAVQStringList@@@Z @ 50 NONAME ; void MpEngine::findPlaylists(class QStringList &) - ?presetNames@MpEngine@@QAE?AVQStringList@@XZ @ 51 NONAME ; class QStringList MpEngine::presetNames(void) - ?isAutomaticScan@MpSongScanner@@QAE_NXZ @ 52 NONAME ; bool MpSongScanner::isAutomaticScan(void) - ??1MpEngineFactory@@UAE@XZ @ 53 NONAME ; MpEngineFactory::~MpEngineFactory(void) - ?previewItem@MpEngine@@QAEXH@Z @ 54 NONAME ; void MpEngine::previewItem(int) - ??1MpSongScanner@@UAE@XZ @ 55 NONAME ; MpSongScanner::~MpSongScanner(void) - ?loudness@MpEngine@@QAE_NXZ @ 56 NONAME ; bool MpEngine::loudness(void) - ?staticMetaObject@MpEngineFactory@@2UQMetaObject@@B @ 57 NONAME ; struct QMetaObject const MpEngineFactory::staticMetaObject - ?deleteSongs@MpEngine@@QAEXAAV?$QList@H@@@Z @ 58 NONAME ; void MpEngine::deleteSongs(class QList &) - ?releaseIsolatedCollection@MpEngine@@QAEXXZ @ 59 NONAME ; void MpEngine::releaseIsolatedCollection(void) - ?deleteStarted@MpEngine@@IAEXW4TCollectionContext@@H@Z @ 60 NONAME ; void MpEngine::deleteStarted(enum TCollectionContext, int) - ?stopSeeking@MpEngine@@QAEXXZ @ 61 NONAME ; void MpEngine::stopSeeking(void) - ?playEmbedded@MpEngine@@QAEXVQString@@@Z @ 62 NONAME ; void MpEngine::playEmbedded(class QString) - ?initialize@MpEngine@@AAEXVTUid@@W4EngineMode@1@@Z @ 63 NONAME ; void MpEngine::initialize(class TUid, enum MpEngine::EngineMode) - ?tr@MpEngine@@SA?AVQString@@PBD0@Z @ 64 NONAME ; class QString MpEngine::tr(char const *, char const *) - ?disableEqualizer@MpEngine@@QAEXXZ @ 65 NONAME ; void MpEngine::disableEqualizer(void) - ?getStaticMetaObject@MpEngine@@SAABUQMetaObject@@XZ @ 66 NONAME ; struct QMetaObject const & MpEngine::getStaticMetaObject(void) - ?shuffleAll@MpEngine@@QAEXXZ @ 67 NONAME ; void MpEngine::shuffleAll(void) - ?qt_metacast@MpEngineFactory@@UAEPAXPBD@Z @ 68 NONAME ; void * MpEngineFactory::qt_metacast(char const *) - ?renamePlaylist@MpEngine@@QAEXAAVQString@@@Z @ 69 NONAME ; void MpEngine::renamePlaylist(class QString &) - ?libraryUpdated@MpEngine@@IAEXXZ @ 70 NONAME ; void MpEngine::libraryUpdated(void) - ?metaObject@MpSongScanner@@UBEPBUQMetaObject@@XZ @ 71 NONAME ; struct QMetaObject const * MpSongScanner::metaObject(void) const - ?setRepeat@MpEngine@@QAEX_N@Z @ 72 NONAME ; void MpEngine::setRepeat(bool) - ?trUtf8@MpEngineFactory@@SA?AVQString@@PBD0@Z @ 73 NONAME ; class QString MpEngineFactory::trUtf8(char const *, char const *) - ??0MpSongScanner@@QAE@PAVMpMpxHarvesterFrameworkWrapper@@PAVQObject@@@Z @ 74 NONAME ; MpSongScanner::MpSongScanner(class MpMpxHarvesterFrameworkWrapper *, class QObject *) - ?cancelCollectionRequest@MpEngine@@QAEXXZ @ 75 NONAME ; void MpEngine::cancelCollectionRequest(void) - ?containerContentsChanged@MpEngine@@IAEXXZ @ 76 NONAME ; void MpEngine::containerContentsChanged(void) - ?startSeekBackward@MpEngine@@QAEXXZ @ 77 NONAME ; void MpEngine::startSeekBackward(void) - ?playlistsRenamed@MpEngine@@IAEX_N@Z @ 78 NONAME ; void MpEngine::playlistsRenamed(bool) - ?playPause@MpEngine@@QAEXXZ @ 79 NONAME ; void MpEngine::playPause(void) - ?checkForSystemEvents@MpEngine@@QAEXXZ @ 80 NONAME ; void MpEngine::checkForSystemEvents(void) - ?tr@MpEngineFactory@@SA?AVQString@@PBD0@Z @ 81 NONAME ; class QString MpEngineFactory::tr(char const *, char const *) - ?applyPreset@MpEngine@@QAEXH@Z @ 82 NONAME ; void MpEngine::applyPreset(int) - ?playEmbedded@MpEngine@@QAEXABVXQSharableFile@@@Z @ 83 NONAME ; void MpEngine::playEmbedded(class XQSharableFile const &) - ?trUtf8@MpEngineFactory@@SA?AVQString@@PBD0H@Z @ 84 NONAME ; class QString MpEngineFactory::trUtf8(char const *, char const *, int) - ?staticMetaObject@MpEngine@@2UQMetaObject@@B @ 85 NONAME ; struct QMetaObject const MpEngine::staticMetaObject - ?scanStarted@MpSongScanner@@IAEXXZ @ 86 NONAME ; void MpSongScanner::scanStarted(void) - ?retrieveSongDetails@MpEngine@@QAEXH@Z @ 87 NONAME ; void MpEngine::retrieveSongDetails(int) - ?unableToCotinueDueUSB@MpEngine@@IAEXXZ @ 88 NONAME ; void MpEngine::unableToCotinueDueUSB(void) - ?handleUsbMtpStartEvent@MpEngine@@AAEXXZ @ 89 NONAME ; void MpEngine::handleUsbMtpStartEvent(void) - ?openCollectionItem@MpEngine@@QAEXH@Z @ 90 NONAME ; void MpEngine::openCollectionItem(int) - ?cancelScan@MpSongScanner@@QAEXXZ @ 91 NONAME ; void MpSongScanner::cancelScan(void) - ?trUtf8@MpSongScanner@@SA?AVQString@@PBD0@Z @ 92 NONAME ; class QString MpSongScanner::trUtf8(char const *, char const *) - ?handleScanStarted@MpEngine@@QAEXXZ @ 93 NONAME ; void MpEngine::handleScanStarted(void) - ?back@MpEngine@@QAEXXZ @ 94 NONAME ; void MpEngine::back(void) - ?activePreset@MpEngine@@QAEHXZ @ 95 NONAME ; int MpEngine::activePreset(void) - ?tr@MpSongScanner@@SA?AVQString@@PBD0H@Z @ 96 NONAME ; class QString MpSongScanner::tr(char const *, char const *, int) - ?handleUsbEvent@MpEngine@@QAEXW4MpxUsbEvents@@@Z @ 97 NONAME ; void MpEngine::handleUsbEvent(enum MpxUsbEvents) - ?loadActivityData@MpEngine@@QAEXABVQByteArray@@@Z @ 98 NONAME ; void MpEngine::loadActivityData(class QByteArray const &) - ?songScanner@MpEngine@@QAEPAVMpSongScanner@@XZ @ 99 NONAME ; class MpSongScanner * MpEngine::songScanner(void) - ?sharedEngine@MpEngineFactory@@SAPAVMpEngine@@XZ @ 100 NONAME ; class MpEngine * MpEngineFactory::sharedEngine(void) - ?handleUsbMassStorageStartEvent@MpEngine@@AAEXXZ @ 101 NONAME ; void MpEngine::handleUsbMassStorageStartEvent(void) - ?saveActivityData@MpEngine@@QAEXAAVQByteArray@@@Z @ 102 NONAME ; void MpEngine::saveActivityData(class QByteArray &) - ?balance@MpEngine@@QAEHXZ @ 103 NONAME ; int MpEngine::balance(void) - ?handleDeleteEnded@MpEngine@@QAEX_N@Z @ 104 NONAME ; void MpEngine::handleDeleteEnded(bool) - ?handleDiskEvent@MpEngine@@QAEXW4MpxDiskEvents@@@Z @ 105 NONAME ; void MpEngine::handleDiskEvent(enum MpxDiskEvents) - ?verifyUsbBlocking@MpEngine@@QAE_N_N@Z @ 106 NONAME ; bool MpEngine::verifyUsbBlocking(bool) - ?usbSynchronizationStarted@MpEngine@@IAEXXZ @ 107 NONAME ; void MpEngine::usbSynchronizationStarted(void) - ?handleUsbMassStorageEndEvent@MpEngine@@AAEXXZ @ 108 NONAME ; void MpEngine::handleUsbMassStorageEndEvent(void) - ?createSharedEngine@MpEngineFactory@@SAPAVMpEngine@@VTUid@@W4EngineMode@2@@Z @ 109 NONAME ; class MpEngine * MpEngineFactory::createSharedEngine(class TUid, enum MpEngine::EngineMode) - ?usbBlocked@MpEngine@@IAEX_N@Z @ 110 NONAME ; void MpEngine::usbBlocked(bool) - ?restorePathFailed@MpEngine@@IAEXXZ @ 111 NONAME ; void MpEngine::restorePathFailed(void) - ?getStaticMetaObject@MpSongScanner@@SAABUQMetaObject@@XZ @ 112 NONAME ; struct QMetaObject const & MpSongScanner::getStaticMetaObject(void) - ?getStaticMetaObject@MpEngineFactory@@SAABUQMetaObject@@XZ @ 113 NONAME ; struct QMetaObject const & MpEngineFactory::getStaticMetaObject(void) - ??0MpEngine@@AAE@XZ @ 114 NONAME ; MpEngine::MpEngine(void) - ?handleUsbMtpNotActive@MpEngine@@AAEXXZ @ 115 NONAME ; void MpEngine::handleUsbMtpNotActive(void) - ?staticMetaObject@MpSongScanner@@2UQMetaObject@@B @ 116 NONAME ; struct QMetaObject const MpSongScanner::staticMetaObject - ?handleScanEnded@MpSongScanner@@QAEXHH@Z @ 117 NONAME ; void MpSongScanner::handleScanEnded(int, int) - ?isolatedCollectionOpened@MpEngine@@IAEXPAVMpMpxCollectionData@@@Z @ 118 NONAME ; void MpEngine::isolatedCollectionOpened(class MpMpxCollectionData *) - ?handleScanEnded@MpEngine@@QAEXHH@Z @ 119 NONAME ; void MpEngine::handleScanEnded(int, int) - ?aboutToAddSongs@MpEngine@@IAEXH@Z @ 120 NONAME ; void MpEngine::aboutToAddSongs(int) - ?skipBackward@MpEngine@@QAEXXZ @ 121 NONAME ; void MpEngine::skipBackward(void) - ??_EMpEngine@@UAE@I@Z @ 122 NONAME ; MpEngine::~MpEngine(unsigned int) - ??1MpEngine@@UAE@XZ @ 123 NONAME ; MpEngine::~MpEngine(void) - ?changeUsbBlockingState@MpEngine@@AAEXW4UsbBlockingState@1@@Z @ 124 NONAME ; void MpEngine::changeUsbBlockingState(enum MpEngine::UsbBlockingState) - ?setLoudness@MpEngine@@QAEX_N@Z @ 125 NONAME ; void MpEngine::setLoudness(bool) - ?scanFinished@MpSongScanner@@IAEXHH@Z @ 126 NONAME ; void MpSongScanner::scanFinished(int, int) - ?reorderPlaylist@MpEngine@@QAEXHHHH@Z @ 127 NONAME ; void MpEngine::reorderPlaylist(int, int, int, int) - ?qt_metacast@MpSongScanner@@UAEPAXPBD@Z @ 128 NONAME ; void * MpSongScanner::qt_metacast(char const *) + ?instance@MpEngineFactory@@SAPAV1@XZ @ 1 NONAME ; class MpEngineFactory * MpEngineFactory::instance(void) + ?saveToCurrentPlaylist@MpEngine@@QAEXAAV?$QList@H@@PAVMpMpxCollectionData@@@Z @ 2 NONAME ; void MpEngine::saveToCurrentPlaylist(class QList &, class MpMpxCollectionData *) + ?handleDeleteStarted@MpEngine@@QAEXW4TCollectionContext@@H@Z @ 3 NONAME ; void MpEngine::handleDeleteStarted(enum TCollectionContext, int) + ?getMuteState@MpEngine@@QAEXXZ @ 4 NONAME ; void MpEngine::getMuteState(void) + ?collectionData@MpEngine@@QAEPAVMpMpxCollectionData@@XZ @ 5 NONAME ; class MpMpxCollectionData * MpEngine::collectionData(void) + ?createPlaylist@MpEngine@@QAEXAAVQString@@AAV?$QList@H@@PAVMpMpxCollectionData@@@Z @ 6 NONAME ; void MpEngine::createPlaylist(class QString &, class QList &, class MpMpxCollectionData *) + ?collectionPlaylistOpened@MpEngine@@IAEXXZ @ 7 NONAME ; void MpEngine::collectionPlaylistOpened(void) + ?renamePlaylist@MpEngine@@QAEXAAVQString@@H@Z @ 8 NONAME ; void MpEngine::renamePlaylist(class QString &, int) + ?mute@MpEngine@@QAEXXZ @ 9 NONAME ; void MpEngine::mute(void) + ?scanCountChanged@MpSongScanner@@IAEXH@Z @ 10 NONAME ; void MpSongScanner::scanCountChanged(int) + ?handleUsbMtpEndEvent@MpEngine@@AAEXXZ @ 11 NONAME ; void MpEngine::handleUsbMtpEndEvent(void) + ?setBalance@MpEngine@@QAEXH@Z @ 12 NONAME ; void MpEngine::setBalance(int) + ?playAlbumSongs@MpEngine@@QAEXHHPAVMpMpxCollectionData@@@Z @ 13 NONAME ; void MpEngine::playAlbumSongs(int, int, class MpMpxCollectionData *) + ?getVolume@MpEngine@@QAEXXZ @ 14 NONAME ; void MpEngine::getVolume(void) + ?setShuffle@MpEngine@@QAEX_N@Z @ 15 NONAME ; void MpEngine::setShuffle(bool) + ?openIsolatedCollection@MpEngine@@QAEXW4TCollectionContext@@@Z @ 16 NONAME ; void MpEngine::openIsolatedCollection(enum TCollectionContext) + ?usbSynchronizationFinished@MpEngine@@IAEXXZ @ 17 NONAME ; void MpEngine::usbSynchronizationFinished(void) + ?qt_metacall@MpEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 18 NONAME ; int MpEngine::qt_metacall(enum QMetaObject::Call, int, void * *) + ?playlistSaved@MpEngine@@IAEX_N@Z @ 19 NONAME ; void MpEngine::playlistSaved(bool) + ?playbackData@MpEngine@@QAEPAVMpPlaybackData@@XZ @ 20 NONAME ; class MpPlaybackData * MpEngine::playbackData(void) + ?stop@MpEngine@@QAEXXZ @ 21 NONAME ; void MpEngine::stop(void) + ?scan@MpSongScanner@@QAEX_N@Z @ 22 NONAME ; void MpSongScanner::scan(bool) + ?openCollection@MpEngine@@QAEXW4TCollectionContext@@@Z @ 23 NONAME ; void MpEngine::openCollection(enum TCollectionContext) + ?decreaseVolume@MpEngine@@QAEXXZ @ 24 NONAME ; void MpEngine::decreaseVolume(void) + ??0MpEngineFactory@@AAE@XZ @ 25 NONAME ; MpEngineFactory::MpEngineFactory(void) + ?handleDiskEvent@MpSongScanner@@QAEXW4MpxDiskEvents@@@Z @ 26 NONAME ; void MpSongScanner::handleDiskEvent(enum MpxDiskEvents) + ?tr@MpEngine@@SA?AVQString@@PBD0H@Z @ 27 NONAME ; class QString MpEngine::tr(char const *, char const *, int) + ?trUtf8@MpEngine@@SA?AVQString@@PBD0@Z @ 28 NONAME ; class QString MpEngine::trUtf8(char const *, char const *) + ?presetNames@MpEngine@@QAE?AVQStringList@@XZ @ 29 NONAME ; class QStringList MpEngine::presetNames(void) + ?previewItem@MpEngine@@QAEXH@Z @ 30 NONAME ; void MpEngine::previewItem(int) + ??1MpSongScanner@@UAE@XZ @ 31 NONAME ; MpSongScanner::~MpSongScanner(void) + ?loudness@MpEngine@@QAE_NXZ @ 32 NONAME ; bool MpEngine::loudness(void) + ?deleteSongs@MpEngine@@QAEXAAV?$QList@H@@@Z @ 33 NONAME ; void MpEngine::deleteSongs(class QList &) + ?releaseIsolatedCollection@MpEngine@@QAEXXZ @ 34 NONAME ; void MpEngine::releaseIsolatedCollection(void) + ?deleteStarted@MpEngine@@IAEXW4TCollectionContext@@H@Z @ 35 NONAME ; void MpEngine::deleteStarted(enum TCollectionContext, int) + ?stopSeeking@MpEngine@@QAEXXZ @ 36 NONAME ; void MpEngine::stopSeeking(void) + ?initialize@MpEngine@@AAEXVTUid@@W4EngineMode@1@@Z @ 37 NONAME ; void MpEngine::initialize(class TUid, enum MpEngine::EngineMode) + ?tr@MpEngine@@SA?AVQString@@PBD0@Z @ 38 NONAME ; class QString MpEngine::tr(char const *, char const *) + ?disableEqualizer@MpEngine@@QAEXXZ @ 39 NONAME ; void MpEngine::disableEqualizer(void) + ?getStaticMetaObject@MpEngine@@SAABUQMetaObject@@XZ @ 40 NONAME ; struct QMetaObject const & MpEngine::getStaticMetaObject(void) + ?qt_metacast@MpEngineFactory@@UAEPAXPBD@Z @ 41 NONAME ; void * MpEngineFactory::qt_metacast(char const *) + ?libraryUpdated@MpEngine@@IAEXXZ @ 42 NONAME ; void MpEngine::libraryUpdated(void) + ?unmute@MpEngine@@QAEXXZ @ 43 NONAME ; void MpEngine::unmute(void) + ??0MpSongScanner@@QAE@PAVMpMpxHarvesterFrameworkWrapper@@PAVQObject@@@Z @ 44 NONAME ; MpSongScanner::MpSongScanner(class MpMpxHarvesterFrameworkWrapper *, class QObject *) + ?checkForSystemEvents@MpEngine@@QAEXXZ @ 45 NONAME ; void MpEngine::checkForSystemEvents(void) + ?applyPreset@MpEngine@@QAEXH@Z @ 46 NONAME ; void MpEngine::applyPreset(int) + ?volumePropertyChanged@MpEngine@@IAEXW4MpVolumeProperty@MpCommon@@H@Z @ 47 NONAME ; void MpEngine::volumePropertyChanged(enum MpCommon::MpVolumeProperty, int) + ?trUtf8@MpEngineFactory@@SA?AVQString@@PBD0H@Z @ 48 NONAME ; class QString MpEngineFactory::trUtf8(char const *, char const *, int) + ?staticMetaObject@MpEngine@@2UQMetaObject@@B @ 49 NONAME ; struct QMetaObject const MpEngine::staticMetaObject + ?scanStarted@MpSongScanner@@IAEXXZ @ 50 NONAME ; void MpSongScanner::scanStarted(void) + ?unableToCotinueDueUSB@MpEngine@@IAEXXZ @ 51 NONAME ; void MpEngine::unableToCotinueDueUSB(void) + ?openCollectionItem@MpEngine@@QAEXH@Z @ 52 NONAME ; void MpEngine::openCollectionItem(int) + ?handleScanStarted@MpEngine@@QAEXXZ @ 53 NONAME ; void MpEngine::handleScanStarted(void) + ?back@MpEngine@@QAEXXZ @ 54 NONAME ; void MpEngine::back(void) + ?tr@MpSongScanner@@SA?AVQString@@PBD0H@Z @ 55 NONAME ; class QString MpSongScanner::tr(char const *, char const *, int) + ?songScanner@MpEngine@@QAEPAVMpSongScanner@@XZ @ 56 NONAME ; class MpSongScanner * MpEngine::songScanner(void) + ?handleUsbMassStorageStartEvent@MpEngine@@AAEXXZ @ 57 NONAME ; void MpEngine::handleUsbMassStorageStartEvent(void) + ?saveActivityData@MpEngine@@QAEXAAVQByteArray@@@Z @ 58 NONAME ; void MpEngine::saveActivityData(class QByteArray &) + ?getMaxVolume@MpEngine@@QAEXXZ @ 59 NONAME ; void MpEngine::getMaxVolume(void) + ?handleDeleteEnded@MpEngine@@QAEX_N@Z @ 60 NONAME ; void MpEngine::handleDeleteEnded(bool) + ?handleDiskEvent@MpEngine@@QAEXW4MpxDiskEvents@@@Z @ 61 NONAME ; void MpEngine::handleDiskEvent(enum MpxDiskEvents) + ?verifyUsbBlocking@MpEngine@@QAE_N_N@Z @ 62 NONAME ; bool MpEngine::verifyUsbBlocking(bool) + ?usbSynchronizationStarted@MpEngine@@IAEXXZ @ 63 NONAME ; void MpEngine::usbSynchronizationStarted(void) + ?handleUsbMassStorageEndEvent@MpEngine@@AAEXXZ @ 64 NONAME ; void MpEngine::handleUsbMassStorageEndEvent(void) + ??0MpEngine@@AAE@XZ @ 65 NONAME ; MpEngine::MpEngine(void) + ?getStaticMetaObject@MpEngineFactory@@SAABUQMetaObject@@XZ @ 66 NONAME ; struct QMetaObject const & MpEngineFactory::getStaticMetaObject(void) + ?getStaticMetaObject@MpSongScanner@@SAABUQMetaObject@@XZ @ 67 NONAME ; struct QMetaObject const & MpSongScanner::getStaticMetaObject(void) + ?isolatedCollectionOpened@MpEngine@@IAEXPAVMpMpxCollectionData@@@Z @ 68 NONAME ; void MpEngine::isolatedCollectionOpened(class MpMpxCollectionData *) + ?aboutToAddSongs@MpEngine@@IAEXH@Z @ 69 NONAME ; void MpEngine::aboutToAddSongs(int) + ??1MpEngine@@UAE@XZ @ 70 NONAME ; MpEngine::~MpEngine(void) + ?changeUsbBlockingState@MpEngine@@AAEXW4UsbBlockingState@1@@Z @ 71 NONAME ; void MpEngine::changeUsbBlockingState(enum MpEngine::UsbBlockingState) + ?setVolume@MpEngine@@QAEXH@Z @ 72 NONAME ; void MpEngine::setVolume(int) + ?metaObject@MpEngine@@UBEPBUQMetaObject@@XZ @ 73 NONAME ; struct QMetaObject const * MpEngine::metaObject(void) const + ??_EMpSongScanner@@UAE@I@Z @ 74 NONAME ; MpSongScanner::~MpSongScanner(unsigned int) + ?createIsolatedEngine@MpEngineFactory@@SAPAVMpEngine@@W4EngineMode@2@@Z @ 75 NONAME ; class MpEngine * MpEngineFactory::createIsolatedEngine(enum MpEngine::EngineMode) + ?equalizerReady@MpEngine@@IAEXXZ @ 76 NONAME ; void MpEngine::equalizerReady(void) + ?findAlbumSongs@MpEngine@@QAEXH@Z @ 77 NONAME ; void MpEngine::findAlbumSongs(int) + ?setPosition@MpEngine@@QAEXH@Z @ 78 NONAME ; void MpEngine::setPosition(int) + ?metaObject@MpEngineFactory@@UBEPBUQMetaObject@@XZ @ 79 NONAME ; struct QMetaObject const * MpEngineFactory::metaObject(void) const + ?handleEqualizerReady@MpEngine@@QAEXXZ @ 80 NONAME ; void MpEngine::handleEqualizerReady(void) + ?tr@MpSongScanner@@SA?AVQString@@PBD0@Z @ 81 NONAME ; class QString MpSongScanner::tr(char const *, char const *) + ??_EMpEngineFactory@@UAE@I@Z @ 82 NONAME ; MpEngineFactory::~MpEngineFactory(unsigned int) + ?skipForward@MpEngine@@QAEXXZ @ 83 NONAME ; void MpEngine::skipForward(void) + ?songData@MpEngine@@QAEPAVMpSongData@@XZ @ 84 NONAME ; class MpSongData * MpEngine::songData(void) + ?trUtf8@MpSongScanner@@SA?AVQString@@PBD0H@Z @ 85 NONAME ; class QString MpSongScanner::trUtf8(char const *, char const *, int) + ?close@MpEngineFactory@@SAXXZ @ 86 NONAME ; void MpEngineFactory::close(void) + ?libraryAboutToUpdate@MpEngine@@IAEXXZ @ 87 NONAME ; void MpEngine::libraryAboutToUpdate(void) + ?reopenCollection@MpEngine@@QAEXXZ @ 88 NONAME ; void MpEngine::reopenCollection(void) + ?trUtf8@MpEngine@@SA?AVQString@@PBD0H@Z @ 89 NONAME ; class QString MpEngine::trUtf8(char const *, char const *, int) + ?songsDeleted@MpEngine@@IAEX_N@Z @ 90 NONAME ; void MpEngine::songsDeleted(bool) + ?refreshLibrary@MpEngine@@QAEX_N@Z @ 91 NONAME ; void MpEngine::refreshLibrary(bool) + ?qt_metacast@MpEngine@@UAEPAXPBD@Z @ 92 NONAME ; void * MpEngine::qt_metacast(char const *) + ?startSeekForward@MpEngine@@QAEXXZ @ 93 NONAME ; void MpEngine::startSeekForward(void) + ?saveToPlaylist@MpEngine@@QAEXHAAV?$QList@H@@@Z @ 94 NONAME ; void MpEngine::saveToPlaylist(int, class QList &) + ?qt_metacall@MpEngineFactory@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 95 NONAME ; int MpEngineFactory::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacall@MpSongScanner@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 96 NONAME ; int MpSongScanner::qt_metacall(enum QMetaObject::Call, int, void * *) + ?tr@MpEngineFactory@@SA?AVQString@@PBD0H@Z @ 97 NONAME ; class QString MpEngineFactory::tr(char const *, char const *, int) + ?findPlaylists@MpEngine@@QAEXAAVQStringList@@@Z @ 98 NONAME ; void MpEngine::findPlaylists(class QStringList &) + ?isAutomaticScan@MpSongScanner@@QAE_NXZ @ 99 NONAME ; bool MpSongScanner::isAutomaticScan(void) + ??1MpEngineFactory@@UAE@XZ @ 100 NONAME ; MpEngineFactory::~MpEngineFactory(void) + ?staticMetaObject@MpEngineFactory@@2UQMetaObject@@B @ 101 NONAME ; struct QMetaObject const MpEngineFactory::staticMetaObject + ?pause@MpEngine@@QAEXXZ @ 102 NONAME ; void MpEngine::pause(void) + ?playEmbedded@MpEngine@@QAEXVQString@@@Z @ 103 NONAME ; void MpEngine::playEmbedded(class QString) + ?shuffleAll@MpEngine@@QAEXXZ @ 104 NONAME ; void MpEngine::shuffleAll(void) + ?metaObject@MpSongScanner@@UBEPBUQMetaObject@@XZ @ 105 NONAME ; struct QMetaObject const * MpSongScanner::metaObject(void) const + ?renamePlaylist@MpEngine@@QAEXAAVQString@@@Z @ 106 NONAME ; void MpEngine::renamePlaylist(class QString &) + ?setRepeat@MpEngine@@QAEX_N@Z @ 107 NONAME ; void MpEngine::setRepeat(bool) + ?cancelCollectionRequest@MpEngine@@QAEXXZ @ 108 NONAME ; void MpEngine::cancelCollectionRequest(void) + ?trUtf8@MpEngineFactory@@SA?AVQString@@PBD0@Z @ 109 NONAME ; class QString MpEngineFactory::trUtf8(char const *, char const *) + ?increaseVolume@MpEngine@@QAEXXZ @ 110 NONAME ; void MpEngine::increaseVolume(void) + ?containerContentsChanged@MpEngine@@IAEXXZ @ 111 NONAME ; void MpEngine::containerContentsChanged(void) + ?playPause@MpEngine@@QAEXXZ @ 112 NONAME ; void MpEngine::playPause(void) + ?playlistsRenamed@MpEngine@@IAEX_N@Z @ 113 NONAME ; void MpEngine::playlistsRenamed(bool) + ?startSeekBackward@MpEngine@@QAEXXZ @ 114 NONAME ; void MpEngine::startSeekBackward(void) + ?tr@MpEngineFactory@@SA?AVQString@@PBD0@Z @ 115 NONAME ; class QString MpEngineFactory::tr(char const *, char const *) + ?playEmbedded@MpEngine@@QAEXABVXQSharableFile@@@Z @ 116 NONAME ; void MpEngine::playEmbedded(class XQSharableFile const &) + ?retrieveSongDetails@MpEngine@@QAEXH@Z @ 117 NONAME ; void MpEngine::retrieveSongDetails(int) + ?handleUsbMtpStartEvent@MpEngine@@AAEXXZ @ 118 NONAME ; void MpEngine::handleUsbMtpStartEvent(void) + ?cancelScan@MpSongScanner@@QAEXXZ @ 119 NONAME ; void MpSongScanner::cancelScan(void) + ?trUtf8@MpSongScanner@@SA?AVQString@@PBD0@Z @ 120 NONAME ; class QString MpSongScanner::trUtf8(char const *, char const *) + ?activePreset@MpEngine@@QAEHXZ @ 121 NONAME ; int MpEngine::activePreset(void) + ?handleUsbEvent@MpEngine@@QAEXW4MpxUsbEvents@@@Z @ 122 NONAME ; void MpEngine::handleUsbEvent(enum MpxUsbEvents) + ?loadActivityData@MpEngine@@QAEXABVQByteArray@@@Z @ 123 NONAME ; void MpEngine::loadActivityData(class QByteArray const &) + ?sharedEngine@MpEngineFactory@@SAPAVMpEngine@@XZ @ 124 NONAME ; class MpEngine * MpEngineFactory::sharedEngine(void) + ?balance@MpEngine@@QAEHXZ @ 125 NONAME ; int MpEngine::balance(void) + ?createSharedEngine@MpEngineFactory@@SAPAVMpEngine@@VTUid@@W4EngineMode@2@@Z @ 126 NONAME ; class MpEngine * MpEngineFactory::createSharedEngine(class TUid, enum MpEngine::EngineMode) + ?usbBlocked@MpEngine@@IAEX_N@Z @ 127 NONAME ; void MpEngine::usbBlocked(bool) + ?handleUsbMtpNotActive@MpEngine@@AAEXXZ @ 128 NONAME ; void MpEngine::handleUsbMtpNotActive(void) + ?restorePathFailed@MpEngine@@IAEXXZ @ 129 NONAME ; void MpEngine::restorePathFailed(void) + ?handleScanEnded@MpSongScanner@@QAEXHH@Z @ 130 NONAME ; void MpSongScanner::handleScanEnded(int, int) + ?staticMetaObject@MpSongScanner@@2UQMetaObject@@B @ 131 NONAME ; struct QMetaObject const MpSongScanner::staticMetaObject + ?handleScanEnded@MpEngine@@QAEXHH@Z @ 132 NONAME ; void MpEngine::handleScanEnded(int, int) + ??_EMpEngine@@UAE@I@Z @ 133 NONAME ; MpEngine::~MpEngine(unsigned int) + ?play@MpEngine@@QAEXXZ @ 134 NONAME ; void MpEngine::play(void) + ?skipBackward@MpEngine@@QAEXXZ @ 135 NONAME ; void MpEngine::skipBackward(void) + ?qt_metacast@MpSongScanner@@UAEPAXPBD@Z @ 136 NONAME ; void * MpSongScanner::qt_metacast(char const *) + ?reorderPlaylist@MpEngine@@QAEXHHHH@Z @ 137 NONAME ; void MpEngine::reorderPlaylist(int, int, int, int) + ?scanFinished@MpSongScanner@@IAEXHH@Z @ 138 NONAME ; void MpSongScanner::scanFinished(int, int) + ?setLoudness@MpEngine@@QAEX_N@Z @ 139 NONAME ; void MpEngine::setLoudness(bool) diff -r 612c4815aebe -r 4cc1412daed0 mpengine/eabi/mpengineu.def --- a/mpengine/eabi/mpengineu.def Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/eabi/mpengineu.def Fri Aug 06 16:51:36 2010 -0500 @@ -47,84 +47,95 @@ _ZN8MpEngine11songScannerEv @ 46 NONAME _ZN8MpEngine11stopSeekingEv @ 47 NONAME _ZN8MpEngine12activePresetEv @ 48 NONAME - _ZN8MpEngine12playEmbeddedE7QString @ 49 NONAME - _ZN8MpEngine12playEmbeddedERK14XQSharableFile @ 50 NONAME - _ZN8MpEngine12playbackDataEv @ 51 NONAME - _ZN8MpEngine12skipBackwardEv @ 52 NONAME - _ZN8MpEngine12songsDeletedEb @ 53 NONAME - _ZN8MpEngine13deleteStartedE18TCollectionContexti @ 54 NONAME - _ZN8MpEngine13findPlaylistsER11QStringList @ 55 NONAME - _ZN8MpEngine13playlistSavedEb @ 56 NONAME - _ZN8MpEngine14collectionDataEv @ 57 NONAME - _ZN8MpEngine14createPlaylistER7QStringR5QListIiEP19MpMpxCollectionData @ 58 NONAME - _ZN8MpEngine14equalizerReadyEv @ 59 NONAME - _ZN8MpEngine14findAlbumSongsEi @ 60 NONAME - _ZN8MpEngine14handleUsbEventE12MpxUsbEvents @ 61 NONAME - _ZN8MpEngine14libraryUpdatedEv @ 62 NONAME - _ZN8MpEngine14openCollectionE18TCollectionContext @ 63 NONAME - _ZN8MpEngine14playAlbumSongsEiiP19MpMpxCollectionData @ 64 NONAME - _ZN8MpEngine14refreshLibraryEb @ 65 NONAME - _ZN8MpEngine14renamePlaylistER7QString @ 66 NONAME - _ZN8MpEngine14renamePlaylistER7QStringi @ 67 NONAME - _ZN8MpEngine14saveToPlaylistEiR5QListIiE @ 68 NONAME - _ZN8MpEngine15aboutToAddSongsEi @ 69 NONAME - _ZN8MpEngine15handleDiskEventE13MpxDiskEvents @ 70 NONAME - _ZN8MpEngine15handleScanEndedEii @ 71 NONAME - _ZN8MpEngine15reorderPlaylistEiiii @ 72 NONAME - _ZN8MpEngine16disableEqualizerEv @ 73 NONAME - _ZN8MpEngine16loadActivityDataERK10QByteArray @ 74 NONAME - _ZN8MpEngine16playlistsRenamedEb @ 75 NONAME - _ZN8MpEngine16reopenCollectionEv @ 76 NONAME - _ZN8MpEngine16saveActivityDataER10QByteArray @ 77 NONAME - _ZN8MpEngine16startSeekForwardEv @ 78 NONAME - _ZN8MpEngine16staticMetaObjectE @ 79 NONAME DATA 16 - _ZN8MpEngine17handleDeleteEndedEb @ 80 NONAME - _ZN8MpEngine17handleScanStartedEv @ 81 NONAME - _ZN8MpEngine17restorePathFailedEv @ 82 NONAME - _ZN8MpEngine17startSeekBackwardEv @ 83 NONAME - _ZN8MpEngine17verifyUsbBlockingEb @ 84 NONAME - _ZN8MpEngine18openCollectionItemEi @ 85 NONAME - _ZN8MpEngine19getStaticMetaObjectEv @ 86 NONAME - _ZN8MpEngine19handleDeleteStartedE18TCollectionContexti @ 87 NONAME - _ZN8MpEngine19retrieveSongDetailsEi @ 88 NONAME - _ZN8MpEngine20checkForSystemEventsEv @ 89 NONAME - _ZN8MpEngine20handleEqualizerReadyEv @ 90 NONAME - _ZN8MpEngine20handleUsbMtpEndEventEv @ 91 NONAME - _ZN8MpEngine20libraryAboutToUpdateEv @ 92 NONAME - _ZN8MpEngine21handleUsbMtpNotActiveEv @ 93 NONAME - _ZN8MpEngine21saveToCurrentPlaylistER5QListIiEP19MpMpxCollectionData @ 94 NONAME - _ZN8MpEngine21unableToCotinueDueUSBEv @ 95 NONAME - _ZN8MpEngine22changeUsbBlockingStateENS_16UsbBlockingStateE @ 96 NONAME - _ZN8MpEngine22handleUsbMtpStartEventEv @ 97 NONAME - _ZN8MpEngine22openIsolatedCollectionE18TCollectionContext @ 98 NONAME - _ZN8MpEngine23cancelCollectionRequestEv @ 99 NONAME - _ZN8MpEngine24collectionPlaylistOpenedEv @ 100 NONAME - _ZN8MpEngine24containerContentsChangedEv @ 101 NONAME - _ZN8MpEngine24isolatedCollectionOpenedEP19MpMpxCollectionData @ 102 NONAME - _ZN8MpEngine25releaseIsolatedCollectionEv @ 103 NONAME - _ZN8MpEngine25usbSynchronizationStartedEv @ 104 NONAME - _ZN8MpEngine26usbSynchronizationFinishedEv @ 105 NONAME - _ZN8MpEngine28handleUsbMassStorageEndEventEv @ 106 NONAME - _ZN8MpEngine30handleUsbMassStorageStartEventEv @ 107 NONAME - _ZN8MpEngine4backEv @ 108 NONAME - _ZN8MpEngine4stopEv @ 109 NONAME - _ZN8MpEngine7balanceEv @ 110 NONAME - _ZN8MpEngine8loudnessEv @ 111 NONAME - _ZN8MpEngine8songDataEv @ 112 NONAME - _ZN8MpEngine9playPauseEv @ 113 NONAME - _ZN8MpEngine9setRepeatEb @ 114 NONAME - _ZN8MpEngineC1Ev @ 115 NONAME - _ZN8MpEngineC2Ev @ 116 NONAME - _ZN8MpEngineD0Ev @ 117 NONAME - _ZN8MpEngineD1Ev @ 118 NONAME - _ZN8MpEngineD2Ev @ 119 NONAME - _ZNK13MpSongScanner10metaObjectEv @ 120 NONAME - _ZNK15MpEngineFactory10metaObjectEv @ 121 NONAME - _ZNK8MpEngine10metaObjectEv @ 122 NONAME - _ZTI13MpSongScanner @ 123 NONAME - _ZTI15MpEngineFactory @ 124 NONAME - _ZTI8MpEngine @ 125 NONAME - _ZTV13MpSongScanner @ 126 NONAME - _ZTV15MpEngineFactory @ 127 NONAME - _ZTV8MpEngine @ 128 NONAME + _ZN8MpEngine12getMaxVolumeEv @ 49 NONAME + _ZN8MpEngine12getMuteStateEv @ 50 NONAME + _ZN8MpEngine12playEmbeddedE7QString @ 51 NONAME + _ZN8MpEngine12playEmbeddedERK14XQSharableFile @ 52 NONAME + _ZN8MpEngine12playbackDataEv @ 53 NONAME + _ZN8MpEngine12skipBackwardEv @ 54 NONAME + _ZN8MpEngine12songsDeletedEb @ 55 NONAME + _ZN8MpEngine13deleteStartedE18TCollectionContexti @ 56 NONAME + _ZN8MpEngine13findPlaylistsER11QStringList @ 57 NONAME + _ZN8MpEngine13playlistSavedEb @ 58 NONAME + _ZN8MpEngine14collectionDataEv @ 59 NONAME + _ZN8MpEngine14createPlaylistER7QStringR5QListIiEP19MpMpxCollectionData @ 60 NONAME + _ZN8MpEngine14decreaseVolumeEv @ 61 NONAME + _ZN8MpEngine14equalizerReadyEv @ 62 NONAME + _ZN8MpEngine14findAlbumSongsEi @ 63 NONAME + _ZN8MpEngine14handleUsbEventE12MpxUsbEvents @ 64 NONAME + _ZN8MpEngine14increaseVolumeEv @ 65 NONAME + _ZN8MpEngine14libraryUpdatedEv @ 66 NONAME + _ZN8MpEngine14openCollectionE18TCollectionContext @ 67 NONAME + _ZN8MpEngine14playAlbumSongsEiiP19MpMpxCollectionData @ 68 NONAME + _ZN8MpEngine14refreshLibraryEb @ 69 NONAME + _ZN8MpEngine14renamePlaylistER7QString @ 70 NONAME + _ZN8MpEngine14renamePlaylistER7QStringi @ 71 NONAME + _ZN8MpEngine14saveToPlaylistEiR5QListIiE @ 72 NONAME + _ZN8MpEngine15aboutToAddSongsEi @ 73 NONAME + _ZN8MpEngine15handleDiskEventE13MpxDiskEvents @ 74 NONAME + _ZN8MpEngine15handleScanEndedEii @ 75 NONAME + _ZN8MpEngine15reorderPlaylistEiiii @ 76 NONAME + _ZN8MpEngine16disableEqualizerEv @ 77 NONAME + _ZN8MpEngine16loadActivityDataERK10QByteArray @ 78 NONAME + _ZN8MpEngine16playlistsRenamedEb @ 79 NONAME + _ZN8MpEngine16reopenCollectionEv @ 80 NONAME + _ZN8MpEngine16saveActivityDataER10QByteArray @ 81 NONAME + _ZN8MpEngine16startSeekForwardEv @ 82 NONAME + _ZN8MpEngine16staticMetaObjectE @ 83 NONAME DATA 16 + _ZN8MpEngine17handleDeleteEndedEb @ 84 NONAME + _ZN8MpEngine17handleScanStartedEv @ 85 NONAME + _ZN8MpEngine17restorePathFailedEv @ 86 NONAME + _ZN8MpEngine17startSeekBackwardEv @ 87 NONAME + _ZN8MpEngine17verifyUsbBlockingEb @ 88 NONAME + _ZN8MpEngine18openCollectionItemEi @ 89 NONAME + _ZN8MpEngine19getStaticMetaObjectEv @ 90 NONAME + _ZN8MpEngine19handleDeleteStartedE18TCollectionContexti @ 91 NONAME + _ZN8MpEngine19retrieveSongDetailsEi @ 92 NONAME + _ZN8MpEngine20checkForSystemEventsEv @ 93 NONAME + _ZN8MpEngine20handleEqualizerReadyEv @ 94 NONAME + _ZN8MpEngine20handleUsbMtpEndEventEv @ 95 NONAME + _ZN8MpEngine20libraryAboutToUpdateEv @ 96 NONAME + _ZN8MpEngine21handleUsbMtpNotActiveEv @ 97 NONAME + _ZN8MpEngine21saveToCurrentPlaylistER5QListIiEP19MpMpxCollectionData @ 98 NONAME + _ZN8MpEngine21unableToCotinueDueUSBEv @ 99 NONAME + _ZN8MpEngine21volumePropertyChangedEN8MpCommon16MpVolumePropertyEi @ 100 NONAME + _ZN8MpEngine22changeUsbBlockingStateENS_16UsbBlockingStateE @ 101 NONAME + _ZN8MpEngine22handleUsbMtpStartEventEv @ 102 NONAME + _ZN8MpEngine22openIsolatedCollectionE18TCollectionContext @ 103 NONAME + _ZN8MpEngine23cancelCollectionRequestEv @ 104 NONAME + _ZN8MpEngine24collectionPlaylistOpenedEv @ 105 NONAME + _ZN8MpEngine24containerContentsChangedEv @ 106 NONAME + _ZN8MpEngine24isolatedCollectionOpenedEP19MpMpxCollectionData @ 107 NONAME + _ZN8MpEngine25releaseIsolatedCollectionEv @ 108 NONAME + _ZN8MpEngine25usbSynchronizationStartedEv @ 109 NONAME + _ZN8MpEngine26usbSynchronizationFinishedEv @ 110 NONAME + _ZN8MpEngine28handleUsbMassStorageEndEventEv @ 111 NONAME + _ZN8MpEngine30handleUsbMassStorageStartEventEv @ 112 NONAME + _ZN8MpEngine4backEv @ 113 NONAME + _ZN8MpEngine4muteEv @ 114 NONAME + _ZN8MpEngine4playEv @ 115 NONAME + _ZN8MpEngine4stopEv @ 116 NONAME + _ZN8MpEngine5pauseEv @ 117 NONAME + _ZN8MpEngine6unmuteEv @ 118 NONAME + _ZN8MpEngine7balanceEv @ 119 NONAME + _ZN8MpEngine8loudnessEv @ 120 NONAME + _ZN8MpEngine8songDataEv @ 121 NONAME + _ZN8MpEngine9getVolumeEv @ 122 NONAME + _ZN8MpEngine9playPauseEv @ 123 NONAME + _ZN8MpEngine9setRepeatEb @ 124 NONAME + _ZN8MpEngine9setVolumeEi @ 125 NONAME + _ZN8MpEngineC1Ev @ 126 NONAME + _ZN8MpEngineC2Ev @ 127 NONAME + _ZN8MpEngineD0Ev @ 128 NONAME + _ZN8MpEngineD1Ev @ 129 NONAME + _ZN8MpEngineD2Ev @ 130 NONAME + _ZNK13MpSongScanner10metaObjectEv @ 131 NONAME + _ZNK15MpEngineFactory10metaObjectEv @ 132 NONAME + _ZNK8MpEngine10metaObjectEv @ 133 NONAME + _ZTI13MpSongScanner @ 134 NONAME + _ZTI15MpEngineFactory @ 135 NONAME + _ZTI8MpEngine @ 136 NONAME + _ZTV13MpSongScanner @ 137 NONAME + _ZTV15MpEngineFactory @ 138 NONAME + _ZTV8MpEngine @ 139 NONAME diff -r 612c4815aebe -r 4cc1412daed0 mpengine/inc/mpmediakeyhandler.h --- a/mpengine/inc/mpmediakeyhandler.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Music Player media key handler. -* -*/ - -#ifndef MPMEDIAKEYHANDLER_H -#define MPMEDIAKEYHANDLER_H - -#include - -class MpMediaKeyHandlerPrivate; - -class MpMediaKeyHandler : public QObject -{ - Q_OBJECT - - friend class MpMediaKeyHandlerPrivate; - -public: - - explicit MpMediaKeyHandler( QObject *parent = 0 ); - virtual ~MpMediaKeyHandler(); - - void setEnabled( bool enable ); - -signals: - - void volumeChanged( int volume ); - void errorOccured( int error ); - -public slots: - - - -private: - - Q_DISABLE_COPY(MpMediaKeyHandler) - MpMediaKeyHandlerPrivate *d_ptr; - -}; - -#endif // MPMEDIAKEYHANDLER_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/inc/mpmediakeyhandler_p.h --- a/mpengine/inc/mpmediakeyhandler_p.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Music Player media key handler - private implementation. -* -*/ - -#ifndef MPMEDIAKEYHANDLER_P_H -#define MPMEDIAKEYHANDLER_P_H - - -#include -#include -#include - -class CRemConInterfaceSelector; -class MMPXPlaybackUtility; -class MpMediaKeyHandler; -class MpMediaKeyRemConResponse; - -class MpMediaKeyHandlerPrivate : public MRemConCoreApiTargetObserver, - public MMPXPlaybackCallback -{ -public: - - MpMediaKeyHandlerPrivate( MpMediaKeyHandler *wrapper ); - virtual ~MpMediaKeyHandlerPrivate(); - - void init(); - void setEnabled( bool enable ); - -// From MRemConCoreApiTargetObserver - - /** - * From MRemConCoreApiTargetObserver - * A command has been received. - * - * @param aOperationId The operation ID of the command. - * @param aButtonAct The button action associated with the command. - */ - void MrccatoCommand( - TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ); - - /** - * From MRemConCoreApiTargetObserver - * A 'play' command has been received. - * - * @param aSpeed The playback speed. - * @param aButtonAct The button action associated with the command. - */ - void MrccatoPlay( - TRemConCoreApiPlaybackSpeed aSpeed, - TRemConCoreApiButtonAction aButtonAct ); - - /** - * From MRemConCoreApiTargetObserver - * A 'tune function' command has been received. - * - * @param aTwoPart Determine which channel to be used. - * @param aMajorChannel The major channel number. - * @param aMinorChannel The minor channel number. - * @param aButtonAct The button action associated with the command. - */ - void MrccatoTuneFunction( - TBool aTwoPart, - TUint aMajorChannel, - TUint aMinorChannel, - TRemConCoreApiButtonAction aButtonAct ); - - /** - * From MRemConCoreApiTargetObserver - * A 'select disk function' has been received. - * - * @param aDisk The disk. - * @param aButtonAct The button action associated with the command. - */ - void MrccatoSelectDiskFunction( - TUint aDisk, - TRemConCoreApiButtonAction aButtonAct ); - - /** - * From MRemConCoreApiTargetObserver - * A 'select AV input function' has been received. - * - * @param aAvInputSignalNumber The AV input. - * @param aButtonAct The button action associated with the command. - */ - void MrccatoSelectAvInputFunction( - TUint8 aAvInputSignalNumber, - TRemConCoreApiButtonAction aButtonAct ); - - /** - * From MRemConCoreApiTargetObserver - * A 'select audio input function' has been received. - * - * @param aAudioInputSignalNumber The audio input. - * @param aButtonAct The button action associated with the command. - */ - void MrccatoSelectAudioInputFunction( - TUint8 aAudioInputSignalNumber, - TRemConCoreApiButtonAction aButtonAct ); - -// from base class MMPXPlaybackCallback - - /** - * From MMPXPlaybackCallback - * Handle playback property - * - * @param aProperty the property - * @param aValue the value of the property - * @param aError error code - */ - void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ); - - /** - * From MMPXPlaybackCallback - * Method is called continously until aComplete=ETrue, signifying that - * it is done and there will be no more callbacks - * Only new items are passed each time - * - * @param aPlayer UID of the subplayer - * @param aSubPlayers a list of sub players - * @param aComplete ETrue no more sub players. EFalse more subplayer - * expected - * @param aError error code - */ - void HandleSubPlayerNamesL( - TUid aPlayer, - const MDesCArray* aSubPlayers, - TBool aComplete, - TInt aError ); - - /** - * From MMPXPlaybackCallback - * Handle media properties - * - * @param aMedia media - * @param aError error code - */ - void HandleMediaL( const CMPXMedia& aMedia, TInt aError ); - -private: - - void DoInitL(); - void SendCommand( TMPXPlaybackCommand aCommandId ); - void DoSendCommandL( TMPXPlaybackCommand aCommandId ); - - /** - * Callback for timer - * - * @param aPtr Pointer pass to this callback function. - * @return Zero if callback function doesn't need to be called again. - * Otherwise, non-zero. - */ - static TInt TimerCallback( TAny* aPtr ); - - /** - * Handle repeat event - */ - void HandleRepeatEvent(); - -private: - - MpMediaKeyHandler *q_ptr; - - CRemConInterfaceSelector *iInterfaceSelector; // owned - MpMediaKeyRemConResponse *iResponseHandler; // owned - CPeriodic *iTimer; // owned - - MMPXPlaybackUtility *iPlaybackUtility; - - TBool iIncreaseVol; - TBool iEnabled; - -}; - -#endif // MPMEDIAKEYHANDLER_P_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/inc/mpmediakeyremconresponse.h --- a/mpengine/inc/mpmediakeyremconresponse.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Music Player media key handler. -* Helper class for sending response back to Remote Controller Framework. -* -*/ - -#ifndef MPMEDIAKEYREMCONKEYRESPONSE_H -#define MPMEDIAKEYREMCONKEYRESPONSE_H - -#include - - -NONSHARABLE_CLASS( MpMediaKeyRemConResponse ) : public CActive -{ -public: - - /** - * Two-phased constructor. - * - * @since 3.0 - * @param aRemConCoreApiTarget RemCon core target object. - * @return Pointer to newly created object. - */ - static MpMediaKeyRemConResponse* NewL( CRemConCoreApiTarget& aRemConCoreApiTarget ); - - /** - * Destructor. - */ - virtual ~MpMediaKeyRemConResponse(); - - /** - * Send the any key response back to Remcon server - * - * @since 3.0 - * @param aOperationId RemCon operation Id. - */ - void CompleteAnyKey( TRemConCoreApiOperationId aOperationId ); - -private: - - /** - * C++ default constructor. - */ - MpMediaKeyRemConResponse( CRemConCoreApiTarget& aRemConCoreApiTarget ); - -// from base class CActive - - /** - * From CActive - * Handles an active object's request completion event. - */ - void RunL(); - - /** - * From CActive - * Implements cancellation of an outstanding request. - */ - void DoCancel(); - -private: // Data - - // Response array. - RArray iResponseArray; // Own - CRemConCoreApiTarget& iRemConCoreApiTarget; // Not own -}; - -#endif // MPMEDIAKEYREMCONKEYRESPONSE_H - -// End of File diff -r 612c4815aebe -r 4cc1412daed0 mpengine/inc/mpmpxplaybackframeworkwrapper.h --- a/mpengine/inc/mpmpxplaybackframeworkwrapper.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/inc/mpmpxplaybackframeworkwrapper.h Fri Aug 06 16:51:36 2010 -0500 @@ -48,10 +48,16 @@ void retrieveSongDetails(); +signals: + + void volumePropertyChanged( MpCommon::MpVolumeProperty property, int value ); + public slots: void play( QString aFilename ); void play( const XQSharableFile& file ); + void play(); + void pause(); void playPause(); void stop(); void skipForward(); @@ -62,6 +68,14 @@ void setPosition( int position ); void setShuffle( bool mode ); void setRepeat( bool mode ); + void getMaxVolume(); + void getVolume(); + void increaseVolume(); + void decreaseVolume(); + void setVolume( int value ); + void getMuteState(); + void mute(); + void unmute(); void closeCurrentPlayback(); private: diff -r 612c4815aebe -r 4cc1412daed0 mpengine/inc/mpmpxplaybackframeworkwrapper_p.h --- a/mpengine/inc/mpmpxplaybackframeworkwrapper_p.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/inc/mpmpxplaybackframeworkwrapper_p.h Fri Aug 06 16:51:36 2010 -0500 @@ -43,6 +43,8 @@ void play( QString aFilename ); void play( const XQSharableFile& file ); + void play(); + void pause(); void playPause(); void stop(); void skipForward(); @@ -56,6 +58,14 @@ void setBalance( int balance ); void applyAudioEffects(); void applyEqualizer(); + void getMaxVolume(); + void getVolume(); + void increaseVolume(); + void decreaseVolume(); + void setVolume( int value ); + void getMuteState(); + void mute(); + void unmute(); void closeCurrentPlayback(); MpPlaybackData *playbackData(); diff -r 612c4815aebe -r 4cc1412daed0 mpengine/mpengine.pro --- a/mpengine/mpengine.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/mpengine.pro Fri Aug 06 16:51:36 2010 -0500 @@ -40,8 +40,6 @@ -lmpxharvesterutility \ -lmpxcommon \ -lmpxcollectionhelper \ - -lremconcoreapi \ - -lremconinterfacebase \ -lmpsettingsmanager \ -lmpdata \ -lxqserviceutil \ @@ -57,9 +55,6 @@ inc/mpmpxharvesterframeworkwrapper_p.h \ inc/mpmpxplaybackframeworkwrapper.h \ inc/mpmpxplaybackframeworkwrapper_p.h \ - inc/mpmediakeyhandler.h \ - inc/mpmediakeyhandler_p.h\ - inc/mpmediakeyremconresponse.h \ inc/mpmpxcollectionframeworkwrapper.h \ inc/mpmpxisolatedcollectionhelper.h \ inc/mpmpxcollectionframeworkwrapper_p.h \ @@ -75,9 +70,6 @@ src/mpmpxharvesterframeworkwrapper_p.cpp \ src/mpmpxplaybackframeworkwrapper.cpp \ src/mpmpxplaybackframeworkwrapper_p.cpp \ - src/mpmediakeyhandler.cpp \ - src/mpmediakeyhandler_p.cpp \ - src/mpmediakeyremconresponse.cpp \ src/mpmpxcollectionframeworkwrapper.cpp \ src/mpmpxisolatedcollectionhelper.cpp \ src/mpmpxcollectionframeworkwrapper_p.cpp \ diff -r 612c4815aebe -r 4cc1412daed0 mpengine/src/mpengine.cpp --- a/mpengine/src/mpengine.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/src/mpengine.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -24,7 +24,6 @@ #include "mpmpxplaybackframeworkwrapper.h" #include "mpaudioeffectsframeworkwrapper.h" #include "mpequalizerframeworkwrapper.h" -#include "mpmediakeyhandler.h" #include "mptrace.h" #include "mpsettingsmanager.h" #include "mpsongscanner.h" @@ -177,12 +176,25 @@ */ /*! +------------------------------------------------------------------------------- + Playback related signals +------------------------------------------------------------------------------- +*/ + +/*! + \fn void volumePropertyChanged( MpCommon::MpVolumeProperty, int value ); + + This signal is emitted when framework receives a volume related property notification, + such as EPbPropertyVolume, EPbPropertyMaxVolume, EPbPropertyMute. + */ + + +/*! Constructs music player engine. */ MpEngine::MpEngine() : mMpxHarvesterWrapper(0), mSongScanner(0), - mMediaKeyHandler(0), mMpxCollectionWrapper(0), mMpxPlaybackWrapper(0), mAudioEffectsWrapper(0), @@ -190,7 +202,8 @@ mCurrentPresetIndex(KEqualizerPresetNone), mSongData(0), mUsbBlockingState(USB_NotConnected), - mPreviousUsbState(USB_NotConnected) + mPreviousUsbState(USB_NotConnected), + mHandleMediaCommands(true) { TX_LOG } @@ -201,7 +214,6 @@ MpEngine::~MpEngine() { TX_ENTRY - delete mMediaKeyHandler; delete mMpxPlaybackWrapper; delete mMpxHarvesterWrapper; delete mMpxCollectionWrapper; @@ -219,7 +231,6 @@ { TX_ENTRY_ARGS("hostUid=" << hostUid.iUid << ", mode=" << mode); mHostUid = hostUid; - mMediaKeyHandler = new MpMediaKeyHandler(); if ( StandAlone == mode ) { mSongData = new MpSongData(); @@ -276,8 +287,10 @@ // Playback Wrapper mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); - connect( this, SIGNAL( libraryAboutToUpdate() ), + connect( this, SIGNAL( libraryUpdated() ), mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); + connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), + this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); // AudioEffects wrapper mAudioEffectsWrapper = new MpAudioEffectsFrameworkWrapper(); @@ -311,8 +324,11 @@ // Playback Wrapper mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, 0 ); - connect( this, SIGNAL( libraryAboutToUpdate() ), + connect( this, SIGNAL( libraryUpdated() ), mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); + connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), + this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); + } else if ( MediaBrowsing == mode ) { // Collection Wrapper @@ -328,6 +344,9 @@ mSongData = new MpSongData(); // Playback Wrapper mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); + connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), + this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); + } TX_EXIT } @@ -398,7 +417,7 @@ */ void MpEngine::handleScanStarted() { TX_ENTRY - mMediaKeyHandler->setEnabled(false); + mHandleMediaCommands = false; TX_EXIT } @@ -409,7 +428,7 @@ TX_ENTRY Q_UNUSED( count ); Q_UNUSED( error ); - mMediaKeyHandler->setEnabled(true); + mHandleMediaCommands = true; emit libraryUpdated(); TX_EXIT } @@ -422,10 +441,10 @@ TX_ENTRY_ARGS("event=" << event); switch ( event ) { case DiskFormatStarted: - mMediaKeyHandler->setEnabled(false); + mHandleMediaCommands = false; break; case DiskFormatEnded: - mMediaKeyHandler->setEnabled(true); + mHandleMediaCommands = true; break; case DiskRemoved: if ( mUsbBlockingState != USB_Synchronizing ) { @@ -479,7 +498,7 @@ void MpEngine::handleUsbMassStorageStartEvent() { TX_ENTRY - mMediaKeyHandler->setEnabled(false); + mHandleMediaCommands = false; changeUsbBlockingState( USB_Synchronizing ); emit usbBlocked(true); @@ -494,7 +513,7 @@ void MpEngine::handleUsbMassStorageEndEvent() { TX_ENTRY - mMediaKeyHandler->setEnabled(true); + mHandleMediaCommands = true; changeUsbBlockingState( USB_NotConnected ); emit usbBlocked(false); @@ -510,7 +529,7 @@ void MpEngine::handleUsbMtpStartEvent() { TX_ENTRY - mMediaKeyHandler->setEnabled(false); + mHandleMediaCommands = false; changeUsbBlockingState( USB_Synchronizing ); emit usbBlocked(true); @@ -529,7 +548,7 @@ void MpEngine::handleUsbMtpEndEvent() { TX_ENTRY - mMediaKeyHandler->setEnabled(true); + mHandleMediaCommands = true; changeUsbBlockingState( USB_NotConnected ); emit usbBlocked(false); @@ -749,7 +768,7 @@ void MpEngine::handleDeleteStarted( TCollectionContext context, int count ) { TX_ENTRY - mMediaKeyHandler->setEnabled( false ); + mHandleMediaCommands = false; emit deleteStarted( context, count ); TX_EXIT } @@ -760,7 +779,7 @@ void MpEngine::handleDeleteEnded( bool success ) { TX_ENTRY - mMediaKeyHandler->setEnabled(true); + mHandleMediaCommands = true; emit songsDeleted( success ); TX_EXIT } @@ -808,12 +827,36 @@ { mMpxPlaybackWrapper->play( file ); } + +/*! + Slot to handle a play command + */ + +void MpEngine::play() +{ + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->play(); + } +} + +/*! + Slot to handle a pause command. + */ +void MpEngine::pause() +{ + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->pause(); + } +} + /*! Slot to handle a play pause. */ void MpEngine::playPause() { - mMpxPlaybackWrapper->playPause(); + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->playPause(); + } } /*! @@ -821,7 +864,9 @@ */ void MpEngine::stop() { - mMpxPlaybackWrapper->stop(); + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->stop(); + } } /*! @@ -829,7 +874,9 @@ */ void MpEngine::skipForward() { - mMpxPlaybackWrapper->skipForward(); + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->skipForward(); + } } /*! @@ -837,7 +884,9 @@ */ void MpEngine::startSeekForward() { - mMpxPlaybackWrapper->startSeekForward(); + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->startSeekForward(); + } } /*! @@ -845,7 +894,9 @@ */ void MpEngine::stopSeeking() { - mMpxPlaybackWrapper->stopSeeking(); + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->stopSeeking(); + } } /*! @@ -853,7 +904,9 @@ */ void MpEngine::skipBackward() { - mMpxPlaybackWrapper->skipBackward(); + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->skipBackward(); + } } /*! @@ -861,7 +914,9 @@ */ void MpEngine::startSeekBackward() { - mMpxPlaybackWrapper->startSeekBackward(); + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->startSeekBackward(); + } } /*! Slot to handle a request to change \a position. @@ -888,6 +943,83 @@ } /*! + Slot to handle a request to get the volume level Max. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpEngine::getMaxVolume( ) +{ + mMpxPlaybackWrapper->getMaxVolume(); +} + +/*! + Slot to handle a request to get the current volume level. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpEngine::getVolume( ) +{ + mMpxPlaybackWrapper->getVolume(); +} + +/*! + Slot to handle a request to increase volume. + */ +void MpEngine::increaseVolume() +{ + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->increaseVolume(); + } +} + +/*! + Slot to handle a request to decrease volume. + */ +void MpEngine::decreaseVolume() +{ + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->decreaseVolume(); + } +} + +/*! + Slot to handle a request to set the volume level. + */ +void MpEngine::setVolume( int value ) +{ + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->setVolume( value ); + } +} + +/*! + Slot to handle a request to get the current mute state. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpEngine::getMuteState( ) +{ + mMpxPlaybackWrapper->getMuteState(); +} + +/*! + Slot to handle a request to mute. + */ +void MpEngine::mute() +{ + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->mute(); + } +} + +/*! + Slot to handle a request to unmute. + */ +void MpEngine::unmute() +{ + if ( mHandleMediaCommands ) { + mMpxPlaybackWrapper->unmute(); + } +} + +/*! Returns pointer to MpSongData, which is the song data for Details View. */ MpSongData *MpEngine::songData() diff -r 612c4815aebe -r 4cc1412daed0 mpengine/src/mpmediakeyhandler.cpp --- a/mpengine/src/mpmediakeyhandler.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Music Player media key handler. -* -*/ - -#include "mpmediakeyhandler.h" -#include "mpmediakeyhandler_p.h" -#include "mpengine.h" -#include "mptrace.h" - -// --------------------------------------------------------------------------- -// MpMediaKeyHandler() -// --------------------------------------------------------------------------- -// -MpMediaKeyHandler::MpMediaKeyHandler( QObject *parent ) - : QObject(parent) -{ - TX_ENTRY - d_ptr = new MpMediaKeyHandlerPrivate(this); - d_ptr->init(); - TX_EXIT -} - -// --------------------------------------------------------------------------- -// ~MpMediaKeyHandler() -// --------------------------------------------------------------------------- -// -MpMediaKeyHandler::~MpMediaKeyHandler() -{ - TX_ENTRY - delete d_ptr; - TX_EXIT -} - -// --------------------------------------------------------------------------- -// setEnabled() -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandler::setEnabled( bool enable ) -{ - d_ptr->setEnabled( enable ); -} - diff -r 612c4815aebe -r 4cc1412daed0 mpengine/src/mpmediakeyhandler_p.cpp --- a/mpengine/src/mpmediakeyhandler_p.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,501 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Music Player media key handler - private implementation. -* -*/ - -#include "mpmediakeyhandler_p.h" -#include "mpmediakeyhandler.h" -#include "mpmediakeyremconresponse.h" -#include "mpcommondefs.h" - -//symbian header files -#include -#include - -//mpx header files -#include -#include -#include -#include - -const TInt KFirstTimerExpiryInterval( 1 ); // Expire immediately -const TInt KTimerExpiryInterval( 1000000/6 ); - -// --------------------------------------------------------------------------- -// MpMediaKeyHandlerPrivate() -// --------------------------------------------------------------------------- -// -MpMediaKeyHandlerPrivate::MpMediaKeyHandlerPrivate( MpMediaKeyHandler *wrapper ) - : q_ptr( wrapper ), - iInterfaceSelector(NULL), - iResponseHandler(NULL), - iTimer(NULL), - iPlaybackUtility(NULL), - iEnabled(ETrue) -{ -} - -// --------------------------------------------------------------------------- -// ~MpMediaKeyHandlerPrivate() -// --------------------------------------------------------------------------- -// -MpMediaKeyHandlerPrivate::~MpMediaKeyHandlerPrivate() -{ - if ( iPlaybackUtility ) { - //TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); - iPlaybackUtility->Close(); - } - - delete iResponseHandler; - delete iInterfaceSelector; - - if ( iTimer ) { - iTimer->Cancel(); - delete iTimer; - } - -} - -// --------------------------------------------------------------------------- -// init -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::init() -{ - TRAPD(err, DoInitL()); - if ( err != KErrNone ) { - emit q_ptr->errorOccured(err); - } - -} - -// --------------------------------------------------------------------------- -// setEnabled -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::setEnabled( bool enable ) -{ - iEnabled = enable; -} - -// --------------------------------------------------------------------------- -// From MRemConCoreApiTargetObserver -// A command has been received. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::MrccatoCommand( - TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ) -{ - MPX_DEBUG3( "MpMediaKeyHandlerPrivate::MrccatoCommand(aOperationId=%d, aButtonAct=%d)", - aOperationId, aButtonAct ); - - switch ( aOperationId ) { - case ERemConCoreApiPausePlayFunction: - if ( aButtonAct == ERemConCoreApiButtonClick ) { - SendCommand( EPbCmdPlayPause ); - } - break; - case ERemConCoreApiPlay: - if ( aButtonAct == ERemConCoreApiButtonClick - || aButtonAct == ERemConCoreApiButtonPress ) { - SendCommand( EPbCmdPlay ); - } - break; - case ERemConCoreApiStop: - if ( aButtonAct == ERemConCoreApiButtonClick - || aButtonAct == ERemConCoreApiButtonPress ) { - SendCommand( EPbCmdStop ); - } - break; - case ERemConCoreApiPause: - if ( aButtonAct == ERemConCoreApiButtonClick - || aButtonAct == ERemConCoreApiButtonPress ) { - SendCommand( EPbCmdPause ); - } - break; - case ERemConCoreApiRewind: - switch ( aButtonAct ) { - case ERemConCoreApiButtonPress: - SendCommand( EPbCmdStartSeekBackward ); - break; - case ERemConCoreApiButtonRelease: - SendCommand( EPbCmdStopSeeking ); - break; - default: - break; - } - break; - case ERemConCoreApiFastForward: - switch ( aButtonAct ) { - case ERemConCoreApiButtonPress: - SendCommand( EPbCmdStartSeekForward ); - break; - case ERemConCoreApiButtonRelease: - SendCommand( EPbCmdStopSeeking ); - break; - default: - break; - } - break; - case ERemConCoreApiBackward: - if ( aButtonAct == ERemConCoreApiButtonClick ) { - SendCommand( EPbCmdPrevious ); - } - break; - case ERemConCoreApiForward: - if ( aButtonAct == ERemConCoreApiButtonClick ) { - SendCommand( EPbCmdNext ); - } - break; - case ERemConCoreApiVolumeUp: - iTimer->Cancel(); - iIncreaseVol = ETrue; - switch ( aButtonAct ) { - case ERemConCoreApiButtonPress: - //Start Timer - iTimer->Start( - KFirstTimerExpiryInterval, - KTimerExpiryInterval, - TCallBack( TimerCallback, this ) ); - break; - case ERemConCoreApiButtonClick: - SendCommand( EPbCmdIncreaseVolume ); - break; - case ERemConCoreApiButtonRelease: - default: - break; - } - break; - case ERemConCoreApiVolumeDown: - iTimer->Cancel(); - iIncreaseVol = EFalse; - switch ( aButtonAct ) { - case ERemConCoreApiButtonPress: - //Start Timer - iTimer->Start( - KFirstTimerExpiryInterval, - KTimerExpiryInterval, - TCallBack( TimerCallback, this ) ); - break; - case ERemConCoreApiButtonClick: - SendCommand( EPbCmdDecreaseVolume ); - break; - case ERemConCoreApiButtonRelease: - default: - break; - } - break; - default: - break; - } - iResponseHandler->CompleteAnyKey( aOperationId ); - -} - -// --------------------------------------------------------------------------- -// From MRemConCoreApiTargetObserver -// A 'play' command has been received. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::MrccatoPlay( - TRemConCoreApiPlaybackSpeed aSpeed, - TRemConCoreApiButtonAction aButtonAct ) -{ - MPX_DEBUG2( "MpMediaKeyHandlerPrivate::MrccatoPlay(aButtonAct=%d)", aButtonAct ); - Q_UNUSED(aSpeed); - - if ( ( aButtonAct == ERemConCoreApiButtonClick ) || - ( aButtonAct == ERemConCoreApiButtonPress ) ) - { - SendCommand( EPbCmdPlay ); - } - iResponseHandler->CompleteAnyKey( ERemConCoreApiPlay ); - -} - -// --------------------------------------------------------------------------- -// From MRemConCoreApiTargetObserver -// A 'tune function' command has been received. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::MrccatoTuneFunction( - TBool aTwoPart, - TUint aMajorChannel, - TUint aMinorChannel, - TRemConCoreApiButtonAction aButtonAct ) -{ - Q_UNUSED(aTwoPart); - Q_UNUSED(aMajorChannel); - Q_UNUSED(aMinorChannel); - Q_UNUSED(aButtonAct); - - iResponseHandler->CompleteAnyKey( ERemConCoreApiTuneFunction ); - -} - -// --------------------------------------------------------------------------- -// From MRemConCoreApiTargetObserver -// A 'select disk function' has been received. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::MrccatoSelectDiskFunction( - TUint aDisk, - TRemConCoreApiButtonAction aButtonAct ) -{ - Q_UNUSED(aDisk); - Q_UNUSED(aButtonAct); - - iResponseHandler->CompleteAnyKey( ERemConCoreApiSelectDiskFunction ); - -} - -// --------------------------------------------------------------------------- -// From MRemConCoreApiTargetObserver -// A 'select AV input function' has been received. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::MrccatoSelectAvInputFunction( - TUint8 aAvInputSignalNumber, - TRemConCoreApiButtonAction aButtonAct ) -{ - Q_UNUSED(aAvInputSignalNumber); - Q_UNUSED(aButtonAct); - - iResponseHandler->CompleteAnyKey( ERemConCoreApiSelectAvInputFunction ); - -} - -// --------------------------------------------------------------------------- -// From MRemConCoreApiTargetObserver -// A 'select audio input function' has been received. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::MrccatoSelectAudioInputFunction( - TUint8 aAudioInputSignalNumber, - TRemConCoreApiButtonAction aButtonAct ) -{ - Q_UNUSED(aAudioInputSignalNumber); - Q_UNUSED(aButtonAct); - - iResponseHandler->CompleteAnyKey( ERemConCoreApiSelectAudioInputFunction ); - -} - -// --------------------------------------------------------------------------- -// From MMPXPlaybackCallback -// Handle playback property. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::HandlePropertyL( - TMPXPlaybackProperty aProperty, - TInt aValue, - TInt aError ) -{ - MPX_FUNC( "MpMediaKeyHandlerPrivate::DoHandlePropertyL" ); - MPX_DEBUG4( "MpMediaKeyHandlerPrivate::HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError ); - - if ( KErrNone == aError ) { - switch ( aProperty ) { - case EPbPropertyVolume: - q_ptr->emit volumeChanged(aValue); - break; - case EPbPropertyPosition: - case EPbPropertyMaxVolume: - case EPbPropertyMute: - default: - break; - } - } - -} - -// --------------------------------------------------------------------------- -// From MMPXPlaybackCallback -// HandleSubPlayerNamesL -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::HandleSubPlayerNamesL( - TUid aPlayer, - const MDesCArray* aSubPlayers, - TBool aComplete, - TInt aError ) -{ - MPX_FUNC( "MpMediaKeyHandlerPrivate::HandleSubPlayerNamesL" ); - Q_UNUSED(aPlayer); - Q_UNUSED(aSubPlayers); - Q_UNUSED(aComplete); - Q_UNUSED(aError); - -} - -// --------------------------------------------------------------------------- -// From MMPXPlaybackCallback -// Handle media properties. -// Notes: The client is responsible for delete the object of aMedia. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::HandleMediaL( - const CMPXMedia& aMedia, - TInt aError ) -{ - MPX_FUNC( "MpMediaKeyHandlerPrivate::DoHandleMediaL" ); - Q_UNUSED(aMedia); - Q_UNUSED(aError); - -} - -// --------------------------------------------------------------------------- -// DoInitL() -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::DoInitL() -{ - // Register to remote control framework - iInterfaceSelector = CRemConInterfaceSelector::NewL(); - CRemConCoreApiTarget *coreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); - CleanupStack::PushL( coreTarget ); - iInterfaceSelector->OpenTargetL(); - iResponseHandler = MpMediaKeyRemConResponse::NewL( *coreTarget ); - CleanupStack::Pop(coreTarget); - - // Timer for implementing repeat - iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); - - // Get the playback utility instance from engine. - iPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid(MpCommon::KMusicPlayerUid) ); - //iPlaybackUtility->AddObserverL( *this ); - - iEnabled = ETrue; -} - -// --------------------------------------------------------------------------- -// Send command to playback utility. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::SendCommand( TMPXPlaybackCommand aCommandId ) -{ - MPX_FUNC( "MpMediaKeyHandlerPrivate::SendCommand" ); - TRAP_IGNORE( DoSendCommandL( aCommandId ) ); - -} - -// --------------------------------------------------------------------------- -// Send command to playback utility. -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::DoSendCommandL( TMPXPlaybackCommand aCommandId ) -{ - MPX_FUNC( "MpMediaKeyHandlerPrivate::DoFilterAndSendCommandL" ); - - if ( iEnabled ) - { - TMPXPlaybackState playerState( iPlaybackUtility->StateL() ); - - switch ( aCommandId ) { - case EPbCmdPlayPause: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused - || playerState == EPbStateStopped ) { - iPlaybackUtility->CommandL( EPbCmdPlayPause ); - } - break; - case EPbCmdPlay: - if ( playerState == EPbStateStopped || playerState == EPbStatePaused ) { - iPlaybackUtility->CommandL( EPbCmdPlay ); - } - break; - case EPbCmdStop: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused ) { - iPlaybackUtility->CommandL( EPbCmdStop ); - } - break; - case EPbCmdPause: - if ( playerState == EPbStatePlaying ) { - iPlaybackUtility->CommandL( EPbCmdPause ); - } - break; - case EPbCmdStartSeekBackward: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused ) { - iPlaybackUtility->CommandL( EPbCmdStartSeekBackward ); - } - break; - case EPbCmdStartSeekForward: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused ) { - iPlaybackUtility->CommandL( EPbCmdStartSeekForward ); - } - break; - case EPbCmdStopSeeking: - if ( playerState == EPbStateSeekingBackward || playerState == EPbStateSeekingForward ) { - iPlaybackUtility->CommandL( EPbCmdStopSeeking ); - } - break; - case EPbCmdPrevious: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused - || playerState == EPbStateStopped ) { - iPlaybackUtility->CommandL( EPbCmdPrevious ); - } - break; - case EPbCmdNext: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused - || playerState == EPbStateStopped ) { - iPlaybackUtility->CommandL( EPbCmdNext ); - } - break; - case EPbCmdIncreaseVolume: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused - || playerState == EPbStateStopped ) { - iPlaybackUtility->CommandL( EPbCmdIncreaseVolume ); - } - break; - case EPbCmdDecreaseVolume: - if ( playerState == EPbStatePlaying || playerState == EPbStatePaused - || playerState == EPbStateStopped ) { - iPlaybackUtility->CommandL( EPbCmdDecreaseVolume ); - } - break; - default: - break; - } - } -} - -// --------------------------------------------------------------------------- -// Callback for timer -// --------------------------------------------------------------------------- -// -TInt MpMediaKeyHandlerPrivate::TimerCallback( TAny* aPtr ) -{ - - static_cast( aPtr )->HandleRepeatEvent(); - - return KErrNone; -} - -// --------------------------------------------------------------------------- -// Handle repeat event -// --------------------------------------------------------------------------- -// -void MpMediaKeyHandlerPrivate::HandleRepeatEvent() -{ - - if ( iIncreaseVol ) { - SendCommand( EPbCmdIncreaseVolume ); - } - else { - SendCommand( EPbCmdDecreaseVolume ); - } - -} - diff -r 612c4815aebe -r 4cc1412daed0 mpengine/src/mpmediakeyremconresponse.cpp --- a/mpengine/src/mpmediakeyremconresponse.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Music Player media key handler. -* Helper class for sending response back to Remote Controller Framework. -* -*/ - -// INCLUDE FILES -#include "mpmediakeyremconresponse.h" -#include "mpxlog.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -MpMediaKeyRemConResponse::MpMediaKeyRemConResponse( - CRemConCoreApiTarget& aRemConCoreApiTarget ) - : CActive( CActive::EPriorityStandard ), - iRemConCoreApiTarget( aRemConCoreApiTarget ) - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// Two-phased constructor. -// --------------------------------------------------------------------------- -// -MpMediaKeyRemConResponse* MpMediaKeyRemConResponse::NewL( - CRemConCoreApiTarget& aRemConCoreApiTarget ) - { - MpMediaKeyRemConResponse* self = - new (ELeave) MpMediaKeyRemConResponse( aRemConCoreApiTarget ); - - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -MpMediaKeyRemConResponse::~MpMediaKeyRemConResponse() - { - Cancel(); - iResponseArray.Close(); - } - -// --------------------------------------------------------------------------- -// Send the any key response back to Remcon server -// --------------------------------------------------------------------------- -// -void MpMediaKeyRemConResponse::CompleteAnyKey( - TRemConCoreApiOperationId aOperationId ) - { - if ( !IsActive() ) - { - switch ( aOperationId ) - { - case ERemConCoreApiPausePlayFunction: - { - iRemConCoreApiTarget.PausePlayFunctionResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiPlay: - { - iRemConCoreApiTarget.PlayResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiStop: - { - iRemConCoreApiTarget.StopResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiPause: - { - iRemConCoreApiTarget.PauseResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiRewind: - { - iRemConCoreApiTarget.RewindResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiFastForward: - { - iRemConCoreApiTarget.FastForwardResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiBackward: - { - iRemConCoreApiTarget.BackwardResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiForward: - { - iRemConCoreApiTarget.ForwardResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiVolumeUp: - { - iRemConCoreApiTarget.VolumeUpResponse( iStatus, KErrNone ); - SetActive(); - break; - } - case ERemConCoreApiVolumeDown: - { - iRemConCoreApiTarget.VolumeDownResponse( iStatus, KErrNone ); - SetActive(); - break; - } - default: - { - TInt error = KErrNone; - iRemConCoreApiTarget.SendResponse( - iStatus, aOperationId, error ); - SetActive(); - break; - } - } - } - // already active. Append to array and complete later. - else - { - iResponseArray.Append( aOperationId ); - } - } - -// --------------------------------------------------------------------------- -// Implements cancellation of an outstanding request. -// --------------------------------------------------------------------------- -// -void MpMediaKeyRemConResponse::DoCancel() - { - } - -// --------------------------------------------------------------------------- -// Handles an active object's request completion event. -// --------------------------------------------------------------------------- -// -void MpMediaKeyRemConResponse::RunL() - { - MPX_DEBUG2( "MpMediaKeyRemConResponse.RunL() -- iStatus=%d", iStatus.Int() ); - - // if any existing -> Send response - if ( iResponseArray.Count() ) - { - CompleteAnyKey( iResponseArray[0] ); - // Remove already completed key - iResponseArray.Remove( 0 ); - iResponseArray.Compress(); - } - } - -// End of File diff -r 612c4815aebe -r 4cc1412daed0 mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp --- a/mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -60,8 +60,8 @@ #include "mpsongdata.h" const TInt KIncrementalDelayNone = 0; -const TInt KIncrementalDelayHalfSecond = 1000000; -const TInt KIncrementalFetchBlockSize = 40; +const TInt KIncrementalDelayHalfSecond = 500000; +const TInt KIncrementalFetchBlockSize = 400; const TInt KMPXChunkSize = 100; // number of songs added in each chunk, IncAddL _LIT( KPlaylistPath, "C:\\Data\\Playlists\\" ); // Todo @@ -751,7 +751,7 @@ TArray ary = attrs.Array(); iIncrementalOpenUtil->SetDelay( KIncrementalDelayNone ); iIncrementalOpenUtil->StartL( ary, KIncrementalFetchBlockSize, - KErrNotFound, CMPXCollectionOpenUtility::EFetchNormal ); + KErrNotFound, CMPXCollectionOpenUtility::EFetchDown ); iIncrementalOpenUtil->SetDelay( KIncrementalDelayHalfSecond ); CleanupStack::PopAndDestroy( &attrs ); TX_EXIT diff -r 612c4815aebe -r 4cc1412daed0 mpengine/src/mpmpxplaybackframeworkwrapper.cpp --- a/mpengine/src/mpmpxplaybackframeworkwrapper.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/src/mpmpxplaybackframeworkwrapper.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -29,6 +29,13 @@ */ /*! + \fn void volumePropertyChanged( MpCommon::MpVolumeProperty, int value ); + + This signal is emitted when MPXPlaybackUtility sends a volume related property notification, + such as EPbPropertyVolume, EPbPropertyMaxVolume, EPbPropertyMute. + */ + +/*! Constructs the utility wrapper. */ MpMpxPlaybackFrameworkWrapper::MpMpxPlaybackFrameworkWrapper( TUid hostUid, MpSongData *songData, QObject *parent ) @@ -71,6 +78,22 @@ } /*! + Slot to handle play command + */ +void MpMpxPlaybackFrameworkWrapper::play() +{ + d_ptr->play(); +} + +/*! + Slot to handle pause command + */ +void MpMpxPlaybackFrameworkWrapper::pause() +{ + d_ptr->pause(); +} + +/*! Slot to handle a play pause. */ void MpMpxPlaybackFrameworkWrapper::playPause() @@ -152,6 +175,73 @@ } /*! + Slot to handle a request to get the volume level Max. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpMpxPlaybackFrameworkWrapper::getMaxVolume() +{ + d_ptr->getMaxVolume(); +} + +/*! + Slot to handle a request to get the current volume level. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpMpxPlaybackFrameworkWrapper::getVolume() +{ + d_ptr->getVolume(); +} + +/*! + Slot to handle a request to increase volume. + */ +void MpMpxPlaybackFrameworkWrapper::increaseVolume() +{ + d_ptr->increaseVolume(); +} + +/*! + Slot to handle a request to decrease volume. + */ +void MpMpxPlaybackFrameworkWrapper::decreaseVolume() +{ + d_ptr->decreaseVolume(); +} + +/*! + Slot to handle a request to set the volume level. + */ +void MpMpxPlaybackFrameworkWrapper::setVolume( int value ) +{ + d_ptr->setVolume( value ); +} + +/*! + Slot to handle a request to get the current mute state. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpMpxPlaybackFrameworkWrapper::getMuteState() +{ + d_ptr->getMuteState(); +} + +/*! + Slot to handle a request to mute. + */ +void MpMpxPlaybackFrameworkWrapper::mute() +{ + d_ptr->mute(); +} + +/*! + Slot to handle a request to unmute. + */ +void MpMpxPlaybackFrameworkWrapper::unmute() +{ + d_ptr->unmute(); +} + +/*! Slot to close current playback. */ void MpMpxPlaybackFrameworkWrapper::closeCurrentPlayback() diff -r 612c4815aebe -r 4cc1412daed0 mpengine/src/mpmpxplaybackframeworkwrapper_p.cpp --- a/mpengine/src/mpmpxplaybackframeworkwrapper_p.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/src/mpmpxplaybackframeworkwrapper_p.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -110,6 +110,33 @@ TX_LOG_ARGS( "Error: " << err << "; should never get here." ); } } + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::play() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->CommandL(EPbCmdPlay) ); + if ( err != KErrNone ) { + TX_LOG_ARGS( "Error: " << err << "; should never get here." ); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::pause() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->CommandL(EPbCmdPause) ); + if ( err != KErrNone ) { + TX_LOG_ARGS( "Error: " << err << "; should never get here." ); + } + TX_EXIT +} + /*! \internal */ @@ -280,6 +307,110 @@ } /*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::getMaxVolume() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->PropertyL( *this, EPbPropertyMaxVolume ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::getVolume() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->PropertyL( *this, EPbPropertyVolume ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::increaseVolume() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->CommandL( EPbCmdIncreaseVolume ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::decreaseVolume() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->CommandL( EPbCmdDecreaseVolume ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::setVolume( int value ) +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->CommandL( EPbCmdSetVolume, value ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::getMuteState() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->PropertyL( *this, EPbPropertyMute ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::mute() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->CommandL( EPbCmdMuteVolume ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! + \internal + */ +void MpMpxPlaybackFrameworkWrapperPrivate::unmute() +{ + TX_ENTRY + TRAPD( err, iPlaybackUtility->CommandL( EPbCmdUnMuteVolume ) ); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT +} + +/*! \ Closes current playback source. */ void MpMpxPlaybackFrameworkWrapperPrivate::closeCurrentPlayback() @@ -347,6 +478,18 @@ TX_LOG_ARGS("EPbPropertyDuration") iPlaybackData->setDuration(aValue); break; + case EPbPropertyVolume: + TX_LOG_ARGS("EPbPropertyVolume") + q_ptr->emit volumePropertyChanged( MpCommon::Volume, aValue ); + break; + case EPbPropertyMaxVolume: + TX_LOG_ARGS("EPbPropertyMaxVolume") + q_ptr->emit volumePropertyChanged( MpCommon::MaxVolume, aValue ); + break; + case EPbPropertyMute: + TX_LOG_ARGS("EPbPropertyMute") + q_ptr->emit volumePropertyChanged( MpCommon::MuteState, aValue ); + break; default: break; } @@ -567,6 +710,7 @@ break; case TMPXPlaybackMessage::EPlaylistUpdated: TX_LOG_ARGS( "EPlaylistUpdated" ) + // coverity[fallthrough] case TMPXPlaybackMessage::EActivePlayerChanged: TX_LOG_ARGS( "EActivePlayerChanged or fall through from EPlaylistUpdated" ) UpdateStateL(); diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/tsrc.pro --- a/mpengine/tsrc/tsrc.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -18,7 +18,6 @@ SUBDIRS += unittest_mpaudioeffectsframeworkwrapper \ unittest_mpequalizerframeworkwrapper \ - # unittest_mpmediakeyhandler \ unittest_mpmpxcollectionframeworkwrapper \ unittest_mpmpxharvesterframeworkwrapper \ unittest_mpmpxisolatedcollectionhelper \ diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/inc/unittest_mpengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/inc/unittest_mpengine.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpengine +* +*/ + +#ifndef TESTMPENGINE_H +#define TESTMPENGINE_H + +#include + +class MpEngine; + +class TestMpEngine : public QObject +{ + Q_OBJECT + +public: + + TestMpEngine(); + ~TestMpEngine(); + +public slots: + + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void testInitialize(); + void testVerifyUsbBlocking(); + void testSongScanner(); + void testRefreshLibrary(); + void testHandleScanStarted(); + void testHandleScanEnded(); + void testHandleDiskEvent(); + void testHandleUsbEvent(); + void testHandleUsbMassStorageStartEvent(); + void testHandleUsbMassStorageEndEvent(); + void testHandleUsbMtpStartEvent(); + void testHandleUsbMtpEndEvent(); + void testHandleUsbMtpNotActive(); + void testChangeUsbBlockingState(); + void testHandleDeleteStarted(); + void testHandleDeleteEnded(); + void testPlaybackData(); + void testSongData(); + void testBalance(); + void testLoudness(); + void testSetBalance(); + void testSetLoudness(); + void testApplyPreset(); + void testDisableEqualizer(); + void testActivePreset(); + void testPresetNames(); + void testHandleEqualizerReady(); + +private: + MpEngine *mTest; +}; + + +// to test private functions +#include +#include "mpcommondefs.h" +// Do this so we can access all member variables. +#define private public +#include "../../inc/mpengine.h" +#undef private + +class MpEngineFactory : QObject +{ + Q_OBJECT +private: + explicit MpEngineFactory(){ + } + +public: + virtual ~MpEngineFactory(){ + + } + static MpEngineFactory * instance() { + static MpEngineFactory instance; + return &instance; + } + static MpEngine *createIsolatedEngine( MpEngine::EngineMode mode ) { + instance()->mEngines.append( new MpEngine() ); + instance()->mEngines.last()->initialize( TUid::Uid( MpCommon::KMusicPlayerUid + instance()->mEngines.count() ), mode ); + return instance()->mEngines.last(); + } + static void close() { + MpEngine *ptr; + foreach ( ptr, instance()->mEngines ) { + delete ptr; + ptr = 0; + } + } + +private: + QList mEngines; +}; + + +#endif // TESTMPENGINE_H + + + + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/src/unittest_mpengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/src/unittest_mpengine.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,565 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpengine +* +*/ + +#include +#include + +#include "unittest_mpengine.h" +#include "mpmediakeyhandler.h" +#include "mpmpxcollectionviewdefs.h" + +#define private public +#include "mpengine.h" +#undef private + +// help to test private function +#include "../../src/mpengine.cpp" + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + TestMpEngine tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpengine.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpEngine::TestMpEngine() + : mTest(0) +{ +} + +TestMpEngine::~TestMpEngine() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpEngine::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpEngine::cleanupTestCase() +{ + MpEngineFactory::close(); +} + +/*! + Called before each testfunction is executed. + */ +void TestMpEngine::init() +{ + +} + +/*! + Called after every testfunction. + */ +void TestMpEngine::cleanup() +{ + +} + +/*! + test initialize + */ +void TestMpEngine::testInitialize() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QVERIFY( mTest->mSongData != 0 ); + QVERIFY( mTest->mMpxHarvesterWrapper != 0 ); + QVERIFY( mTest->mMpxCollectionWrapper != 0 ); + QVERIFY( mTest->mEqualizerWrapper != 0 ); + QVERIFY( mTest->mMpxPlaybackWrapper != 0 ); + QVERIFY( mTest->mAudioEffectsWrapper != 0 ); + + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::Fetch ); + QVERIFY( mTest->mMpxHarvesterWrapper != 0 ); + QVERIFY( mTest->mMpxCollectionWrapper != 0 ); + QVERIFY( mTest->mMpxPlaybackWrapper != 0 ); + QVERIFY( mTest->mEqualizerWrapper == 0 ); + QVERIFY( mTest->mAudioEffectsWrapper == 0 ); + + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::MediaBrowsing ); + QVERIFY( mTest->mMpxCollectionWrapper != 0 ); + QVERIFY( mTest->mMpxHarvesterWrapper == 0 ); + QVERIFY( mTest->mMpxPlaybackWrapper == 0 ); + QVERIFY( mTest->mEqualizerWrapper == 0 ); + QVERIFY( mTest->mAudioEffectsWrapper == 0 ); + + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::Embedded ); + QVERIFY( mTest->mMpxPlaybackWrapper != 0 ); + QVERIFY( mTest->mSongData != 0 ); +} + +/*! + test verifyUsbBlocking + */ +void TestMpEngine::testVerifyUsbBlocking() +{ + bool result; + QSignalSpy spy( mTest, SIGNAL( unableToCotinueDueUSB() ) ); + + mTest->mUsbBlockingState = MpEngine::USB_Connected; + result = mTest->verifyUsbBlocking( true ); + QVERIFY( result == true ); + QVERIFY( spy.count() == 1 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_Connected; + result = mTest->verifyUsbBlocking( false ); + QVERIFY( result == true ); + QVERIFY( spy.count() == 0 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_NotConnected; + result = mTest->verifyUsbBlocking( true ); + QVERIFY( result == false ); + QVERIFY( spy.count() == 0 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_NotConnected; + result = mTest->verifyUsbBlocking( false ); + QVERIFY( result == false ); + QVERIFY( spy.count() == 0 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_Synchronizing; + result = mTest->verifyUsbBlocking( true ); + QVERIFY( result == false ); + QVERIFY( spy.count() == 0 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_Synchronizing; + result = mTest->verifyUsbBlocking( false ); + QVERIFY( result == false ); + QVERIFY( spy.count() == 0 ); + spy.clear(); +} + +/*! + test songScanner + */ +void TestMpEngine::testSongScanner() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QCOMPARE( mTest->mSongScanner, mTest->songScanner() ); +} + +/*! + test refreshLibrary + */ +void TestMpEngine::testRefreshLibrary() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( libraryAboutToUpdate() ) ); + + mTest->mUsbBlockingState = MpEngine::USB_Connected; + QVERIFY( mTest->verifyUsbBlocking() == true ); + mTest->refreshLibrary( true ); + QVERIFY( mTest->mSongScanner == 0 ); + QVERIFY( spy.count() == 0 ); + + mTest->mUsbBlockingState = MpEngine::USB_NotConnected; + QVERIFY( mTest->verifyUsbBlocking() == false ); + mTest->refreshLibrary( true ); + QVERIFY( mTest->mSongScanner != 0 ); + QVERIFY( spy.count() == 1 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_Synchronizing; + QVERIFY( mTest->verifyUsbBlocking() == false ); + mTest->refreshLibrary( true ); + QVERIFY( mTest->mSongScanner != 0 ); + QVERIFY( spy.count() == 1 ); + spy.clear(); +} + +/*! + test handleScanStarted + */ +void TestMpEngine::testHandleScanStarted() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + mTest->handleScanStarted(); + QVERIFY( mTest->mHandleMediaCommands == false ); +} + +/*! + test handleScanEnded + */ +void TestMpEngine::testHandleScanEnded() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( libraryUpdated() ) ); + + mTest->handleScanEnded( 0, 0 ); + QVERIFY( mTest->mHandleMediaCommands == true ); + + QVERIFY( spy.count() == 1 ); + spy.clear(); +} + +/*! + test handleDiskEvent + */ +void TestMpEngine::testHandleDiskEvent() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( libraryUpdated() ) ); + QSignalSpy spyTwo( mTest, SIGNAL( libraryAboutToUpdate() ) ); + + mTest->handleDiskEvent( DiskFormatStarted ); + QVERIFY( mTest->mHandleMediaCommands == false ); + + mTest->handleDiskEvent( DiskFormatEnded ); + QVERIFY( mTest->mHandleMediaCommands == true ); + + mTest->mUsbBlockingState = MpEngine::USB_Synchronizing; + mTest->handleDiskEvent( DiskRemoved ); + QVERIFY( spy.count() == 0 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_NotConnected; + mTest->handleDiskEvent( DiskRemoved ); + QVERIFY( spy.count() == 1 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_Connected; + mTest->handleDiskEvent( DiskRemoved ); + QVERIFY( spy.count() == 1 ); + spy.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_NotConnected; + mTest->handleDiskEvent( DiskInserted ); + QVERIFY( mTest->verifyUsbBlocking() == false ); + QVERIFY( spyTwo.count() == 1 ); + spyTwo.clear(); + + mTest->mUsbBlockingState = MpEngine::USB_Connected; + mTest->handleDiskEvent( DiskInserted ); + QVERIFY( spy.count() == 1 ); + spy.clear(); +} + +/*! + test HandleUsbEvent + */ +void TestMpEngine::testHandleUsbEvent() +{ + // no need to test here +} + +/*! + test handleUsbMassStorageStartEvent + */ +void TestMpEngine::testHandleUsbMassStorageStartEvent() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( usbBlocked( bool ) ) ); + QSignalSpy spyTwo( mTest, SIGNAL( usbSynchronizationStarted() ) ); + + mTest->handleUsbMassStorageStartEvent(); + QVERIFY( mTest->mHandleMediaCommands == false ); + QVERIFY( spy.count() == 1 ); + QList arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == true ); + + QVERIFY( spyTwo.count() == 1 ); +} + +/*! + test handleUsbMassStorageEndEvent + */ +void TestMpEngine::testHandleUsbMassStorageEndEvent() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( usbBlocked( bool ) ) ); + QSignalSpy spyTwo( mTest, SIGNAL( usbSynchronizationFinished() ) ); + + mTest->handleUsbMassStorageEndEvent(); + QVERIFY( mTest->mHandleMediaCommands == true ); + QVERIFY( spy.count() == 1 ); + QList arguments = spy.takeFirst(); + QVERIFY(arguments.at(0).toBool() == false ); + + QVERIFY( spyTwo.count() == 1 ); +} + +/*! + test handleUsbMtpStartEvent + */ +void TestMpEngine::testHandleUsbMtpStartEvent() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( usbBlocked( bool ) ) ); + QSignalSpy spyTwo( mTest, SIGNAL( libraryAboutToUpdate() ) ); + QSignalSpy spyThree( mTest, SIGNAL( usbSynchronizationStarted() ) ); + + mTest->handleUsbMtpStartEvent(); + QVERIFY( mTest->mHandleMediaCommands == false ); + QVERIFY( spy.count() == 1 ); + QList arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == true ); + QVERIFY( spyTwo.count() == 1 ); + QVERIFY( spyThree.count() == 1 ); +} + +/*! + test handleUsbMtpEndEvent + */ +void TestMpEngine::testHandleUsbMtpEndEvent() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( usbBlocked( bool ) ) ); + QSignalSpy spyTwo( mTest, SIGNAL( usbSynchronizationFinished() ) ); + QSignalSpy spyThree( mTest, SIGNAL( libraryUpdated() ) ); + QList arguments; + + mTest->mUsbBlockingState = MpEngine::USB_Synchronizing; + mTest->handleUsbMtpEndEvent(); + QVERIFY( mTest->mHandleMediaCommands == true ); + QVERIFY( spy.count() == 1 ); + arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == false ); + QVERIFY( spyTwo.count() == 1 ); + QVERIFY( spyThree.count() == 1 ); + spyTwo.clear(); + spyThree.clear(); + arguments.clear(); + + mTest->mPreviousUsbState = MpEngine::USB_NotConnected; + mTest->handleUsbMtpEndEvent(); + QVERIFY( mTest->mHandleMediaCommands == true ); + QVERIFY( spy.count() == 1 ); + arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == false ); + QVERIFY( spyTwo.count() == 0 ); + QVERIFY( spyThree.count() == 0 ); + spyTwo.clear(); + spyThree.clear(); + arguments.clear(); + + mTest->mPreviousUsbState = MpEngine::USB_Connected; + mTest->handleUsbMtpEndEvent(); + QVERIFY( mTest->mHandleMediaCommands == true ); + QVERIFY( spy.count() == 1 ); + arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == false ); + QVERIFY( spyTwo.count() == 0 ); + QVERIFY( spyThree.count() == 0 ); + spyTwo.clear(); + spyThree.clear(); + arguments.clear(); +} + +/*! + test handleUsbMtpNotActive + */ +void TestMpEngine::testHandleUsbMtpNotActive() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( usbBlocked( bool ) ) ); + + mTest->handleUsbMtpNotActive(); + QVERIFY( spy.count() == 1 ); + QList arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == true ); +} + +/*! + test changeUsbBlockingState + */ +void TestMpEngine::testChangeUsbBlockingState() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + + MpEngine::UsbBlockingState cState = mTest->mUsbBlockingState; + mTest->changeUsbBlockingState( MpEngine::USB_Connected ); + QCOMPARE( mTest->mPreviousUsbState, cState ); + QCOMPARE( mTest->mUsbBlockingState, MpEngine::USB_Connected ); +} + +/*! + test handleDeleteStarted + */ +void TestMpEngine::testHandleDeleteStarted() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + qRegisterMetaType("TCollectionContext"); + QSignalSpy spy( mTest, SIGNAL( deleteStarted( TCollectionContext, int ) ) ); + + TCollectionContext context( ECollectionContextAllSongs ); + mTest->handleDeleteStarted( context, 0 ); + QVERIFY( mTest->mHandleMediaCommands == false ); + QVERIFY( spy.count() == 1 ); +} + +/*! + test handleDeleteEnded + */ +void TestMpEngine::testHandleDeleteEnded() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( songsDeleted( bool ) ) ); + QList arguments; + + mTest->handleDeleteEnded( true ); + QVERIFY( mTest->mHandleMediaCommands == true ); + QVERIFY( spy.count() == 1 ); + arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == true ); + spy.clear(); + arguments.clear(); + + mTest->handleDeleteEnded( false ); + QVERIFY( mTest->mHandleMediaCommands == true ); + QVERIFY( spy.count() == 1 ); + arguments = spy.takeFirst(); + QVERIFY( arguments.at(0).toBool() == false ); + spy.clear(); + arguments.clear(); +} + +/*! + test playbackData + */ +void TestMpEngine::testPlaybackData() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QVERIFY( mTest->mMpxPlaybackWrapper->mPlaybackData == mTest->playbackData() ); +} + +/*! + test songData + */ +void TestMpEngine::testSongData() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QVERIFY( mTest->mSongData == mTest->songData() ); +} + +/*! + test balance + */ +void TestMpEngine::testBalance() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QVERIFY( mTest->mAudioEffectsWrapper->mBalance == mTest->balance() ); +} + +/*! + test loudness + */ +void TestMpEngine::testLoudness() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QVERIFY( mTest->mAudioEffectsWrapper->mLoudness == mTest->loudness() ); +} + +/*! + test setBalance + */ +void TestMpEngine::testSetBalance() +{ + // nothing to test here +} + +/*! + test setLoudness + */ +void TestMpEngine::testSetLoudness() +{ + // nothing to test here +} + +/*! + test applyPreset + */ +void TestMpEngine::testApplyPreset() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + mTest->mCurrentPresetIndex = 2; + + mTest->applyPreset( 4 ); + QCOMPARE( mTest->mCurrentPresetIndex, 4 ); +} + +/*! + test disableEqualizer + */ +void TestMpEngine::testDisableEqualizer() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + mTest->disableEqualizer(); + + QCOMPARE( mTest->mCurrentPresetIndex, KEqualizerPresetNone ); +} + +/*! + test activePreset + */ +void TestMpEngine::testActivePreset() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + + QCOMPARE( mTest->mCurrentPresetIndex, mTest->activePreset() ); +} + +/*! + test presetNames + */ +void TestMpEngine::testPresetNames() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + + QCOMPARE( mTest->mEqualizerWrapper->mList, mTest->presetNames() ); +} + +/*! + test handleEqualizerReady + */ +void TestMpEngine::testHandleEqualizerReady() +{ + mTest = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QSignalSpy spy( mTest, SIGNAL( equalizerReady() ) ); + + mTest->handleEqualizerReady(); + QCOMPARE( mTest->mCurrentPresetIndex, 1 ); + QVERIFY( spy.count() == 1 ); +} + + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpaudioeffectsframeworkwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpaudioeffectsframeworkwrapper.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for MpAudioEffectsFrameworkWrapper +* +*/ + +#ifndef MPAUDIOEFFECTSFRAMEWORKWRAPPER_H +#define MPAUDIOEFFECTSFRAMEWORKWRAPPER_H + +#include + + +class MpAudioEffectsFrameworkWrapper : public QObject +{ + Q_OBJECT + +public: + + explicit MpAudioEffectsFrameworkWrapper(); + virtual ~MpAudioEffectsFrameworkWrapper(); + + int balance(); + bool loudness(); + void setBalance( int balance ); + void setLoudness( bool mode ); + +public: + int mBalance; + bool mLoudness; +}; + +#endif /*MPAUDIOEFFECTSFRAMEWORKWRAPPER_H*/ diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpequalizerframeworkwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpequalizerframeworkwrapper.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for equalizer framework +* +*/ + +#ifndef MPEQUALIZERFRAMEWORKWRAPPER_H +#define MPEQUALIZERFRAMEWORKWRAPPER_H + +// System includes +#include +#include + + +/** + * Wrapper for equalizer framework + */ +class MpEqualizerFrameworkWrapper : public QObject + { + Q_OBJECT + Q_PROPERTY(QStringList presetNames READ presetNames) + +public: + + explicit MpEqualizerFrameworkWrapper( QObject *parent = 0 ); + virtual ~MpEqualizerFrameworkWrapper(); + + int getPresetNameKey( int presetIndex ); + int getPresetIndex( int presetNameKey ); + QStringList presetNames(); + +signals: + void equalizerReady(); + + +public: + QStringList mList; + +}; +#endif // MPEQUALIZERFRAMEWORKWRAPPER_H + +//End of File diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpmediakeyhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpmediakeyhandler.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for media key handler. +* +*/ + +#ifndef MPMEDIAKEYHANDLER_H +#define MPMEDIAKEYHANDLER_H + +#include + +class MpMediaKeyHandler : public QObject +{ + Q_OBJECT +public: + + explicit MpMediaKeyHandler( QObject *parent = 0 ); + virtual ~MpMediaKeyHandler(); + + void setEnabled( bool enable ); + +public: + bool mEnable; +}; + +#endif // MPMEDIAKEYHANDLER_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxcollectiondata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxcollectiondata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpMpxCollectionData stub for testing MpCollectionDataModel +* +*/ + +#ifndef MPMPXCOLLECTIONDATA_H +#define MPMPXCOLLECTIONDATA_H + +#include + +#include "mpmpxcollectionviewdefs.h" + + +class MpMpxCollectionData : public QObject +{ + Q_OBJECT + +public: + + enum DataType { + Title, + Artist, + Count, + AlbumArtUri + }; + + // Stub functions + explicit MpMpxCollectionData( QObject *parent=0 ); + virtual ~MpMpxCollectionData(); + + TCollectionContext context() const; + int count() const; + QString itemData( int index, MpMpxCollectionData::DataType type ) const; + +signals: + + void contextChanged( TCollectionContext context ); + +public: + + TCollectionContext mContext; + int mCount; + bool mItemDataReturn; + +}; + +#endif // MPMPXCOLLECTIONDATA_H + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxcollectionframeworkwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxcollectionframeworkwrapper.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper for mpx collection framework utilities. +* +*/ + +#ifndef MPMPXCOLLECTIONFRAMEWORKWRAPPER_H +#define MPMPXCOLLECTIONFRAMEWORKWRAPPER_H + +#include +#include "mpmpxcollectionviewdefs.h" +#include "mpcommondefs.h" + +class MpMpxCollectionData; +class MpSongData; +class QStringList; + + +class MpMpxCollectionFrameworkWrapper : public QObject +{ + Q_OBJECT + +public: + + explicit MpMpxCollectionFrameworkWrapper( TUid hostUid=TUid::Uid(MpCommon::KMusicPlayerUid), + MpSongData *songData=0, QObject *parent=0 ); + virtual ~MpMpxCollectionFrameworkWrapper(); + + void openCollection( TCollectionContext context ); + void openCollectionItem( int index ); + void back(); + void findPlaylists( QStringList &playlists ); + void createPlaylist( QString &playlistName, QList &selection, MpMpxCollectionData* collectionData ); + void saveToPlaylist( int playlistIndex, QList &selection ); + void saveToCurrentPlaylist( QList &selection, MpMpxCollectionData *collectionData ); + void renamePlaylist( QString &newName, int index ); + void renamePlaylist( QString &newName ); + void deleteSongs( QList &selection ); + void setShuffle( bool active ); + void cancelRequest(); + + void previewItem( int index ); + void openIsolatedCollection( TCollectionContext context ); + void releaseIsolatedCollection(); + + void findAlbumSongs( int index ); + void playAlbumSongs( int albumIndex, int songIndex, MpMpxCollectionData* collectionData ); + + MpMpxCollectionData *collectionData(); + + void reopenCollection(); + void reorderPlaylist( int playlistId, int songId, int originalOrdinal, int newOrdinal ); + void setRepeatFeatureEnabled( bool enable ); + void setShuffleFeatureEnabled( bool enable ); + + void openShuffleAllSongsPath(); + + void retrieveSongDetails( int index ); + + void savePath( QByteArray &data ); + void restorePath( const QByteArray &data ); + +signals: + + void collectionPlaylistOpened(); + void playlistSaved( bool success ); + void deleteStarted(TCollectionContext context, int Count); + void songsDeleted( bool success ); + void playlistsRenamed( bool success ); + void aboutToAddSongs( int count ); + + void isolatedCollectionOpened( MpMpxCollectionData* collectionData ); + + void containerContentsChanged(); + void restorePathFailed(); +}; + +#endif // MPMPXCOLLECTIONFRAMEWORKWRAPPER_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxharvesterframeworkwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxharvesterframeworkwrapper.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub class for mpsongscanner unittest. +* +*/ + +#ifndef MPMPXHARVESTERFRAMEWORKWRAPPER_H +#define MPMPXHARVESTERFRAMEWORKWRAPPER_H + +#include + +#include "mpmpxcommondefs.h" +#include "mpcommondefs.h" + +class MpMpxHarvesterFrameworkWrapper : public QObject +{ + Q_OBJECT + +public: + explicit MpMpxHarvesterFrameworkWrapper( TUid hostUid = TUid::Uid( MpCommon::KMusicPlayerUid ), QObject *parent=0 ); + virtual ~MpMpxHarvesterFrameworkWrapper(); + + // mock functions + void scan(); + void cancelScan(); + void checkForSystemEvents(); + + // unittest specific functions + void emitScanStarted(); + void emitScanEnded( int count, int error ); + void emitScanCountChanged( int count ); + void emitDiskEvent(); + +signals: + void scanStarted(); + void scanEnded( int count, int error ); + void scanCountChanged( int count ); + + void diskEvent( MpxDiskEvents event ); + void usbEvent( MpxUsbEvents event ); + +public: + bool mScanRequested; + bool mScanning; + int mScanCount; + bool mCheckSystemEventsRequested; + +}; + +#endif // MPMPXHARVESTERFRAMEWORKWRAPPER_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxplaybackframeworkwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpmpxplaybackframeworkwrapper.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for MpMpxPlaybackFrameworkWrapper +* +*/ + +#ifndef MPMPXPLAYBACKFRAMEWORKWRAPPER_H +#define MPMPXPLAYBACKFRAMEWORKWRAPPER_H + +#include +#include "mpmpxcommondefs.h" +#include "mpcommondefs.h" +#include + +class MpPlaybackData; +class MpSongData; +class QStringList; + + +class MpMpxPlaybackFrameworkWrapper : public QObject +{ + Q_OBJECT + + friend class MpMpxPlaybackFrameworkWrapperPrivate; + +public: + + explicit MpMpxPlaybackFrameworkWrapper( TUid hostUid=TUid::Uid(MpCommon::KMusicPlayerUid), + MpSongData *songData=0, QObject *parent=0 ); + virtual ~MpMpxPlaybackFrameworkWrapper(); + + MpPlaybackData *playbackData(); + void setBalance( int balance ); + void applyAudioEffects(); + void applyEqualizer(); + + void retrieveSongDetails(); + +public slots: + + void play( QString aFilename ); + void play( const XQSharableFile& file ); + void play(); + void playPause(); + void stop(); + void skipForward(); + void startSeekForward(); + void stopSeeking(); + void skipBackward(); + void startSeekBackward(); + void setPosition( int position ); + void setShuffle( bool mode ); + void setRepeat( bool mode ); + void getMaxVolume(); + void pause(); + void getVolume(); + void increaseVolume(); + void decreaseVolume(); + void setVolume( int value ); + void getMuteState(); + void mute(); + void unmute(); + +public: + MpPlaybackData* mPlaybackData; +}; + +#endif // MPMPXPLAYBACKFRAMEWORKWRAPPER_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpplaybackdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpplaybackdata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpplaybackdata stub for testing MpNowPlayingWidget +* +*/ + +#ifndef MPPLAYBACKDATA_H +#define MPPLAYBACKDATA_H + +//includes +#include +#include + + +class MpPlaybackData : public QObject +{ + Q_OBJECT + +public: + + enum SimplifiedState { + NotPlaying, + Playing, + Paused, + Stopped + }; + // Test utility functions + static int getUpdateCounter(); + static void resetUpdateCounter(); + void triggerStateUpdate(SimplifiedState state); + void triggerLabelsChanged(const QString &title, const QString &artist); + + // Stub functions + explicit MpPlaybackData(); + virtual ~MpPlaybackData(); + +signals: + void playbackStateChanged(); + void playbackInfoChanged(); + +public: + const QString& title() const; + const QString& artist() const; + MpPlaybackData::SimplifiedState playbackState() const; + +private: + QString mArtist; + QString mTitle; + SimplifiedState mPlaybackState; + +}; + +#endif // MPPLAYBACKDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpsettingsmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpsettingsmanager.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpSettingsManager stub for testing MpMtpInfoLink. +* +*/ + +#ifndef MPSETTINGSMANAGER_H +#define MPSETTINGSMANAGER_H + +#include +#include + +class MpSettingsManager: public QObject +{ + +Q_OBJECT + +private: + explicit MpSettingsManager(); + +public: + virtual ~MpSettingsManager(); + static MpSettingsManager *instance(); + static void SetUrl( QString url ); + static QString mtpInfoUrl(); + static int preset(); + +public slots: + static void setPreset(int preset); + +public: + QString mMtpInfoUrl; + +private: + Q_DISABLE_COPY(MpSettingsManager) +}; + +#endif // MPSETTINGSMANAGER_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpsongdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpsongdata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpsongdata stub for testing mpmpxframeworkwrapper. +* +*/ + +#ifndef MPSONGDATA_H +#define MPSONGDATA_H + +#include + +class CMPXMedia; + +class MpSongData : public QObject +{ + Q_OBJECT + +public: + explicit MpSongData( QObject *parent=0 ); + virtual ~MpSongData(); + + void setMpxMedia( const CMPXMedia& aMedia ); + +signals: + void albumArtReady(); + void playbackInfoChanged(); + void songDetailInfoChanged(); + +public: + + bool iSetMedia; + +}; + +#endif // MPSONGDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/inc/mpsongscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/inc/mpsongscanner.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for song scanner. +* +*/ + + +#ifndef MPSONGSCANNER_H +#define MPSONGSCANNER_H + +class MpMpxHarvesterFrameworkWrapper; + +#include + +class MpSongScanner : public QObject +{ + Q_OBJECT + +public: + explicit MpSongScanner( MpMpxHarvesterFrameworkWrapper *wrapper, QObject *parent = 0 ); + virtual ~MpSongScanner(); + + void scan( bool automaticScan ); + +private: +}; + +#endif // MPSONGSCANNER_H + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpaudioeffectsframeworkwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpaudioeffectsframeworkwrapper.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,66 @@ +/* +* Copyright ( c ) 2009 Nokia Corporation and/or its subsidiary( -ies ). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for MpAudioEffectsFrameworkWrapper +* +*/ + +#include "mpaudioeffectsframeworkwrapper.h" + +/*! + Constructor. + */ +MpAudioEffectsFrameworkWrapper::MpAudioEffectsFrameworkWrapper() +{ +} + +/*! + Destructor. + */ +MpAudioEffectsFrameworkWrapper::~MpAudioEffectsFrameworkWrapper() +{ + +} + +/*! + Returns the current persistent balance. + */ +int MpAudioEffectsFrameworkWrapper::balance() +{ + return mBalance; +} + +/*! + Returns the current persistent loudness. + */ +bool MpAudioEffectsFrameworkWrapper::loudness() +{ + return mLoudness; +} + +/*! + Set the \a balance. + */ +void MpAudioEffectsFrameworkWrapper::setBalance( int balance ) +{ + Q_UNUSED(balance); +} + +/*! + Set the loudness \a mode. + */ +void MpAudioEffectsFrameworkWrapper::setLoudness( bool mode ) +{ + Q_UNUSED(mode); +} + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpequalizerframeworkwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpequalizerframeworkwrapper.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for equalizer framework. +* +*/ + +// System includes +#include +#include + +// User includes +#include "mpequalizerframeworkwrapper.h" + +/*! + \class MpEqualizerFrameworkWrapper + \ingroup musicplayer + \brief Wrapper for equalizer framework. + \since 10.1 + + Equalizer wrapper provides Qt style interface to the audio equalizer + utilities. Its implementation is hidden using private class data pattern. + + This class defines several APIs that are needed from \a MpPlaybackView + and other components in \a mpplaybackviewplugin. + + \sa MpEqualizerFrameworkWrapperPrivate +*/ + +/*! + \fn MpEqualizerFrameworkWrapper::equalizerReady() + + This signal will be emitted when Audio Eqalizer is initialized. This is + when all APIs, like \a applyPreset, are ready to be used. + + \sa MpEqualizerFrameworkWrapperPrivate::MapcInitComplete +*/ + +/*! + Constructs a new MpEqualizerFrameworkWrapper with \a parent and initializes + private imaplementation. + +*/ +MpEqualizerFrameworkWrapper::MpEqualizerFrameworkWrapper( QObject *parent ) + : QObject(parent) +{ + +} + +/*! + Destructs the class and its private imaplementation. + + */ +MpEqualizerFrameworkWrapper::~MpEqualizerFrameworkWrapper() +{ + +} + +/*! + Get the preset name key by giving \a presetIndex. The command then + relays to its private implementation. + + */ +int MpEqualizerFrameworkWrapper::getPresetNameKey( int presetIndex ) +{ + Q_UNUSED(presetIndex); + return 0; +} + +/*! + Get the preset index by giving \a presetNameKey. The command then + relays to its private implementation. + + */ +int MpEqualizerFrameworkWrapper::getPresetIndex( int presetNameKey ) +{ + Q_UNUSED(presetNameKey); + return 0; +} + +/*! + Returning the list of availale preset names. The command then relays to its + private implementation. + + */ + QStringList MpEqualizerFrameworkWrapper::presetNames() +{ + return mList; +} + + //End of File diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpmediakeyhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpmediakeyhandler.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for media key handler. +* +*/ + +#include "mpmediakeyhandler.h" + +// --------------------------------------------------------------------------- +// MpMediaKeyHandler() +// --------------------------------------------------------------------------- +// +MpMediaKeyHandler::MpMediaKeyHandler( QObject *parent ) + : QObject(parent) +{ + +} + +// --------------------------------------------------------------------------- +// ~MpMediaKeyHandler() +// --------------------------------------------------------------------------- +// +MpMediaKeyHandler::~MpMediaKeyHandler() +{ + +} + +// --------------------------------------------------------------------------- +// setEnabled() +// --------------------------------------------------------------------------- +// +void MpMediaKeyHandler::setEnabled( bool enable ) +{ + mEnable = enable; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpmpxcollectiondata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpmpxcollectiondata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpMpxCollectionData stub for testing MpCollectionDataModel +* +*/ + +#include "mptrace.h" +#include "stub/inc/mpmpxcollectiondata.h" + +/*! + Stub function. + */ +MpMpxCollectionData::MpMpxCollectionData( QObject *parent ) + : QObject(parent), + mContext(ECollectionContextUnknown), + mCount(0), + mItemDataReturn(true) +{ +} + +/*! + Stub function. + */ +MpMpxCollectionData::~MpMpxCollectionData() +{ +} + +/*! + Stub function. + */ +TCollectionContext MpMpxCollectionData::context() const +{ + return mContext; +} + +/*! + Stub function. + */ +int MpMpxCollectionData::count() const +{ + return mCount; +} + +/*! + Stub function. + */ +QString MpMpxCollectionData::itemData( int index, MpMpxCollectionData::DataType type ) const +{ + if ( index < 0 || index > mCount ) { + TX_LOG_ARGS("index=" << index); + qFatal("MpMpxCollectionData::itemData called with index out of range"); + } + QString data; + if ( !mItemDataReturn && (type != MpMpxCollectionData::Count) ) { + return data; + } + switch ( type ) { + case MpMpxCollectionData::Title: + data = QString("Title"); + break; + case MpMpxCollectionData::Artist: + data = QString("Artist"); + break; + case MpMpxCollectionData::Count: + data = QString("Count"); + break; + case MpMpxCollectionData::AlbumArtUri: + data = QString("AlbumArtUri"); + break; + default: + qFatal("MpMpxCollectionData::itemData called with unknown type"); + break; + } + return data; +} diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpmpxcollectionframeworkwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpmpxcollectionframeworkwrapper.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper for mpx collection framework utilities. +* +*/ + +#include "mpmpxcollectionframeworkwrapper.h" +#include "mpmpxcollectiondata.h" + +/*! + Constructs the utility wrapper. + */ +MpMpxCollectionFrameworkWrapper::MpMpxCollectionFrameworkWrapper( TUid hostUid, MpSongData *songData, QObject *parent ) + : QObject( parent ) +{ + Q_UNUSED(hostUid); + Q_UNUSED(songData); +} + +/*! + Destructs the utility wrapper. + */ +MpMpxCollectionFrameworkWrapper::~MpMpxCollectionFrameworkWrapper() +{ + +} + +/*! + Opens the collection for the given \a context. + + \sa collectionOpened() + */ +void MpMpxCollectionFrameworkWrapper::openCollection( TCollectionContext context ) +{ + Q_UNUSED(context); +} + +/*! + Opens the collection at a specific \a index. + + \sa collectionOpened(), playlistOpened() + */ +void MpMpxCollectionFrameworkWrapper::openCollectionItem( int index ) +{ + Q_UNUSED(index); +} + +/*! + Navigates back to the container of the current items. + + \sa collectionOpened() + */ +void MpMpxCollectionFrameworkWrapper::back() +{ + +} + +/*! + Loads the user created \a playLists. + + */ +void MpMpxCollectionFrameworkWrapper::findPlaylists( QStringList &playlists ) +{ + Q_UNUSED(playlists); +} + +/*! + Creates a new playlist with name \a playlistName and adds \a selection and optionally uses \a collectionData. + */ +void MpMpxCollectionFrameworkWrapper::createPlaylist( QString &playlistName, QList &selection, MpMpxCollectionData* collectionData ) +{ + Q_UNUSED(playlistName); + Q_UNUSED(selection); + Q_UNUSED(collectionData); +} + +/*! + Adds \a selection to the playlist specified in \a playlistIndex. + */ +void MpMpxCollectionFrameworkWrapper::saveToPlaylist( int playlistIndex, QList &selection ) +{ + Q_UNUSED(playlistIndex); + Q_UNUSED(selection); +} + +/*! + Rename a playlist by \a index with \a name. + */ +void MpMpxCollectionFrameworkWrapper::renamePlaylist( QString &newName, int index ) +{ + Q_UNUSED(newName); + Q_UNUSED(index); +} + +/*! + Adds \a selection to the current playlist from the specified \a collectionData. + */ +void MpMpxCollectionFrameworkWrapper::saveToCurrentPlaylist( QList &selection, MpMpxCollectionData *collectionData ) +{ + Q_UNUSED(selection); + Q_UNUSED(collectionData); +} + +/*! + Rename a playlist with \a name. + */ +void MpMpxCollectionFrameworkWrapper::renamePlaylist( QString &newName ) +{ + Q_UNUSED(newName); +} + +/*! + Deletes \a selection from the collection. + */ +void MpMpxCollectionFrameworkWrapper::deleteSongs( QList &selection ) +{ + Q_UNUSED(selection); +} + +/*! + Sets the suffle according to \a active. + */ +void MpMpxCollectionFrameworkWrapper::setShuffle( bool active ) +{ + Q_UNUSED(active); +} + +/*! + Initiate a playback preview for the selected item. + */ +void MpMpxCollectionFrameworkWrapper::previewItem( int index ) +{ + Q_UNUSED(index); +} + + +/*! + Opens the an isolated collection with \a context. + \sa isolatedCollectionOpened() + */ +void MpMpxCollectionFrameworkWrapper::openIsolatedCollection( TCollectionContext context ) +{ + Q_UNUSED(context); +} + +/*! + Releases the resources used for the isolated collection. + */ +void MpMpxCollectionFrameworkWrapper::releaseIsolatedCollection() +{ + +} + +/*! + Finds all songs beloging to the album specified by the \a index. + */ +void MpMpxCollectionFrameworkWrapper::findAlbumSongs( int index ) +{ + Q_UNUSED(index); +} + +/*! + Plays album with \a albumIndex starting with the songs with \a songIndex. +*/ +void MpMpxCollectionFrameworkWrapper::playAlbumSongs( int albumIndex, int songIndex, MpMpxCollectionData* collectionData ) +{ + Q_UNUSED(albumIndex); + Q_UNUSED(songIndex); + Q_UNUSED(collectionData); +} + +/*! + Returns pointer to MpMpxCollectionData, which is the collection data. + */ +MpMpxCollectionData *MpMpxCollectionFrameworkWrapper::collectionData() +{ + MpMpxCollectionData *data = new MpMpxCollectionData(); + return data; +} + +/*! + Called from an engine slot to reopen the collection in its current state. + + \sa collectionOpened() + */ +void MpMpxCollectionFrameworkWrapper::reopenCollection() +{ + +} + +/*! + Called from an engine slot to request a reorder operation , indicates that + the item with \a playlistId , \a songId is to be moved from + \a originalOrdinal to \a newOrdinal. + */ +void MpMpxCollectionFrameworkWrapper::reorderPlaylist( int playlistId, int songId, int originalOrdinal, int newOrdinal ) +{ + Q_UNUSED(playlistId); + Q_UNUSED(songId); + Q_UNUSED(originalOrdinal); + Q_UNUSED(newOrdinal); +} + +/*! + Called to set the repeat feature to \a enable + */ +void MpMpxCollectionFrameworkWrapper::setRepeatFeatureEnabled( bool enable ) +{ + Q_UNUSED(enable); +} + +/*! + Called to set the shuffle feature to \a enable + */ +void MpMpxCollectionFrameworkWrapper::setShuffleFeatureEnabled( bool enable ) +{ + Q_UNUSED(enable); +} + +/*! + Called to open all songs path and trigger shuffle all songs play + */ +void MpMpxCollectionFrameworkWrapper::openShuffleAllSongsPath() +{ + +} + +/*! + Retrieves song details for the specified \a index. + */ +void MpMpxCollectionFrameworkWrapper::retrieveSongDetails( int index ) +{ + Q_UNUSED(index); +} + +/*! + Called to save playback data used for publishing activity (i.e. restore path) + */ +void MpMpxCollectionFrameworkWrapper::savePath( QByteArray &data ) +{ + Q_UNUSED(data); +} + +/*! + Called to load playback data used from returning activity (i.e. restore path) + */ +void MpMpxCollectionFrameworkWrapper::restorePath( const QByteArray &data ) +{ + Q_UNUSED(data); +} +/*! + Cancels CollectionUiHelper request. + */ +void MpMpxCollectionFrameworkWrapper::cancelRequest() +{ +} + +//EOF diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpmpxharvesterframeworkwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpmpxharvesterframeworkwrapper.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub class for mpsongscanner unittest. +* +*/ + +#include "stub/inc/mpmpxharvesterframeworkwrapper.h" + +/*! + Stub function. + */ +MpMpxHarvesterFrameworkWrapper::MpMpxHarvesterFrameworkWrapper( TUid hostUid, QObject *parent ) + : QObject( parent ), + mScanRequested( false ), + mScanning( false ), + mScanCount( -1 ), + mCheckSystemEventsRequested( false ) +{ + Q_UNUSED( hostUid ); +} + + +/*! + Stub function. + */ +MpMpxHarvesterFrameworkWrapper::~MpMpxHarvesterFrameworkWrapper() +{ +} + +/*! + Stub function. + */ +void MpMpxHarvesterFrameworkWrapper::scan() +{ + mScanRequested = true; +} + +/*! + Stub function. + */ +void MpMpxHarvesterFrameworkWrapper::cancelScan() +{ + mScanRequested = false; +} + +/*! + Stub function. + */ +void MpMpxHarvesterFrameworkWrapper::checkForSystemEvents() +{ + mCheckSystemEventsRequested = true; +} + +/*! + Stub function. + */ +void MpMpxHarvesterFrameworkWrapper::emitScanStarted() +{ + mScanning = true; + emit scanStarted(); +} + +/*! + Stub function. + */ +void MpMpxHarvesterFrameworkWrapper::emitScanEnded( int count, int error ) +{ + mScanning = false; + emit scanEnded( count, error ); +} + +/*! + Stub function. + */ +void MpMpxHarvesterFrameworkWrapper::emitScanCountChanged( int count ) +{ + emit scanCountChanged( count ); +} + +/*! + Stub function. + */ +void MpMpxHarvesterFrameworkWrapper::emitDiskEvent() +{ + emit diskEvent( DiskInserted ); +} diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpmpxplaybackframeworkwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpmpxplaybackframeworkwrapper.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for MpMpxPlaybackFrameworkWrapper +* +*/ + + +#include "mpmpxplaybackframeworkwrapper.h" +#include "mpplaybackdata.h" + +/*! + \class MpMpxPlaybackFrameworkWrapper + \brief Wrapper for mpx framework utilities. + + MPX framework wrapper provides Qt style interface to the MPX framework + utilities. Its implementation is hidden using private class data pattern. +*/ + +/*! + Constructs the utility wrapper. + */ +MpMpxPlaybackFrameworkWrapper::MpMpxPlaybackFrameworkWrapper( TUid hostUid, MpSongData *songData, QObject *parent ) + : QObject(parent) +{ + Q_UNUSED(hostUid); + Q_UNUSED(songData); +} + +/*! + Destructs the utility wrapper. + */ +MpMpxPlaybackFrameworkWrapper::~MpMpxPlaybackFrameworkWrapper() +{ + +} + +/*! + Returns pointer to MpPlaybackData, which is the playback data. + */ +MpPlaybackData *MpMpxPlaybackFrameworkWrapper::playbackData() +{ + return mPlaybackData; +} + +/*! + Slot to handle play from Uri aFilename + */ +void MpMpxPlaybackFrameworkWrapper::play( QString aFilename ) +{ + Q_UNUSED(aFilename); +} + +/*! + Slot to handle play from file handle + */ +void MpMpxPlaybackFrameworkWrapper::play( const XQSharableFile& file) +{ + Q_UNUSED(file); +} + +/*! + Slot to handle play command + */ +void MpMpxPlaybackFrameworkWrapper::play() +{ + +} + +/*! + Slot to handle a play pause. + */ +void MpMpxPlaybackFrameworkWrapper::playPause() +{ +} + +/*! + Slot to handle a stop. + */ +void MpMpxPlaybackFrameworkWrapper::stop() +{ +} + +/*! + Slot to handle a skip forward. + */ +void MpMpxPlaybackFrameworkWrapper::skipForward() +{ +} + +/*! + Slot to handle seek forward. + */ +void MpMpxPlaybackFrameworkWrapper::startSeekForward() +{ +} + +/*! + Slot to handle stop seeking. + */ +void MpMpxPlaybackFrameworkWrapper::stopSeeking() +{ +} + +/*! + Slot to handle a skip backwards. + */ +void MpMpxPlaybackFrameworkWrapper::skipBackward() +{ +} + +/*! + Slot to handle seek backwards. + */ + +void MpMpxPlaybackFrameworkWrapper::startSeekBackward() +{ +} + +/*! + Slot to handle a request to change \a position. + */ +void MpMpxPlaybackFrameworkWrapper::setPosition( int position ) +{ + Q_UNUSED(position); +} + +/*! + Slot to handle a request to change shuffle \a mode. + */ +void MpMpxPlaybackFrameworkWrapper::setShuffle( bool mode ) +{ + Q_UNUSED(mode); +} + +/*! + Slot to handle a request to change repeat \a mode. + */ +void MpMpxPlaybackFrameworkWrapper::setRepeat( bool mode ) +{ + Q_UNUSED(mode); +} + +/*! + Change \a balance. + */ +void MpMpxPlaybackFrameworkWrapper::setBalance( int balance ) +{ + Q_UNUSED(balance); +} + +/*! + Send command to apply audio effects. + */ +void MpMpxPlaybackFrameworkWrapper::applyAudioEffects() +{ + +} + +/*! + Send command to apply equalizer. + */ +void MpMpxPlaybackFrameworkWrapper::applyEqualizer() +{ + +} + +/*! + Retrieves song details for the currently playing song. + */ +void MpMpxPlaybackFrameworkWrapper::retrieveSongDetails() +{ + +} + +/*! + Slot to handle a request to get the volume level Max. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpMpxPlaybackFrameworkWrapper::getMaxVolume() +{ +} + +/*! + Slot to handle pause command + */ +void MpMpxPlaybackFrameworkWrapper::pause() +{ + +} + +/*! + Slot to handle a request to get the current volume level. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpMpxPlaybackFrameworkWrapper::getVolume() +{ + +} + +/*! + Slot to handle a request to increase volume. + */ +void MpMpxPlaybackFrameworkWrapper::increaseVolume() +{ + +} + +/*! + Slot to handle a request to decrease volume. + */ +void MpMpxPlaybackFrameworkWrapper::decreaseVolume() +{ + +} + +/*! + Slot to handle a request to set the volume level. + */ +void MpMpxPlaybackFrameworkWrapper::setVolume( int value ) +{ + Q_UNUSED( value ); +} + +/*! + Slot to handle a request to get the current mute state. + Response will be asynchronously sent through volumePropertyChanged() signal. + */ +void MpMpxPlaybackFrameworkWrapper::getMuteState() +{ + +} + +/*! + Slot to handle a request to mute. + */ +void MpMpxPlaybackFrameworkWrapper::mute() +{ + +} + +/*! + Slot to handle a request to unmute. + */ +void MpMpxPlaybackFrameworkWrapper::unmute() +{ + +} + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpplaybackdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpplaybackdata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpPlaybackData stub for testing mpnowplayingwidget +* +*/ + +#include "stub/inc/mpplaybackdata.h" + + +int gUpdateCounter = 0; + + +/*! + Returns gUpdateCounter. + gUpdateCounter counts the number of MpNowPlayingBackEnd::update calls. + */ +int MpPlaybackData::getUpdateCounter() +{ + return gUpdateCounter; +} + +/*! + Resets gUpdateCounter to zero. + */ +void MpPlaybackData::resetUpdateCounter() +{ + gUpdateCounter = 0; +} + +/*! + Causes signal stateUpdate to be emitted. + */ +void MpPlaybackData::triggerStateUpdate(SimplifiedState state) +{ + mPlaybackState = state; + emit playbackStateChanged(); + +} + +/*! + Causes signal titleChanged to be emitted. + */ +void MpPlaybackData::triggerLabelsChanged(const QString &title, const QString &artist ) +{ + mArtist = artist; + mTitle = title; + emit playbackInfoChanged();; +} + +/*! + Stub function. + */ +MpPlaybackData::MpPlaybackData() + : mPlaybackState(NotPlaying) +{ + gUpdateCounter++; +} + +/*! + Stub function. + */ +MpPlaybackData::~MpPlaybackData() +{ +} + +/*! + Stub function. + */ +const QString& MpPlaybackData::title() const +{ + return mTitle; +} + +/*! + Stub function. + */ +const QString& MpPlaybackData::artist() const +{ + return mArtist; +} + +/*! + Stub function. + */ +MpPlaybackData::SimplifiedState MpPlaybackData::playbackState() const +{ + return mPlaybackState; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpsettingsmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpsettingsmanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpSettingsManager stub for testing MpMtpInfoLink. +* +*/ + +#include "stub/inc/mpsettingsmanager.h" + + +/*! + Constructs the MP Settings Manager. + */ +MpSettingsManager::MpSettingsManager() +{ + mMtpInfoUrl = QString( "http://nokia.com/" ); +} + +/*! + Destructs the settings manager. + */ +MpSettingsManager::~MpSettingsManager() +{ +} + +/*! + Returns the singleton instance to the settings manager. + */ +MpSettingsManager * MpSettingsManager::instance() +{ + static MpSettingsManager instance; + return &instance; +} + +void MpSettingsManager::SetUrl( QString url ) +{ + instance()->mMtpInfoUrl = url; +} + +/*! + Returns mtp info url. + */ +QString MpSettingsManager::mtpInfoUrl() +{ + return instance()->mMtpInfoUrl; +} + +/*! + Returns the preset setting. + */ +int MpSettingsManager::preset() +{ + return 0; +} + +/*! + Slot to be called to request an update on the \a preset setting. + */ +void MpSettingsManager::setPreset(int preset) +{ + Q_UNUSED( preset ); +} diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpsongdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpsongdata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpsongdata stub for testing mpmpxframeworkwrapper. +* +*/ + +#include +#include "stub/inc/mpsongdata.h" +#include "mptrace.h" + +/*! + Stub function. +*/ +MpSongData::MpSongData( QObject *parent ) + : QObject( parent ), + iSetMedia( false ) +{ + TX_LOG_ARGS("Stub") +} + +/*! + Stub function. +*/ +MpSongData::~MpSongData() +{ + TX_LOG_ARGS("Stub") +} + +void MpSongData::setMpxMedia( const CMPXMedia& aMedia ) +{ + TX_LOG_ARGS("Stub") + Q_UNUSED( aMedia ); + iSetMedia = true; +} diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/stub/src/mpsongscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/stub/src/mpsongscanner.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for song scanner. +* +*/ + +#include "mpsongscanner.h" +#include "mpmpxharvesterframeworkwrapper.h" + +/*! + Constructs the song scanner. + */ +MpSongScanner::MpSongScanner( MpMpxHarvesterFrameworkWrapper */*wrapper*/, QObject *parent ) + : QObject( parent ) +{ + +} + +/*! + Destructs the song scanner. + */ +MpSongScanner::~MpSongScanner() +{ +} + +/*! + Initiates song scanning. + */ +void MpSongScanner::scan( bool /*automaticScan*/ ) +{ + +} diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpengine/unittest_mpengine.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpengine/unittest_mpengine.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,60 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpengine unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpengine +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + stub/inc \ + ../../inc \ + ../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lestor.dll \ + -lfbscli.dll \ + +HEADERS += inc/unittest_mpengine.h \ + ../../../inc/mpengine.h \ + stub/inc/mpmpxharvesterframeworkwrapper.h \ + stub/inc/mpsongdata.h \ + stub/inc/mpsongscanner.h \ + stub/inc/mpmediakeyhandler.h \ + stub/inc/mpmpxcollectionframeworkwrapper.h \ + stub/inc/mpmpxcollectiondata.h \ + stub/inc/mpmpxplaybackframeworkwrapper.h \ + stub/inc/mpplaybackdata.h \ + stub/inc/mpaudioeffectsframeworkwrapper.h \ + stub/inc/mpequalizerframeworkwrapper.h \ + stub/inc/mpsettingsmanager.h \ + +SOURCES += src/unittest_mpengine.cpp \ + stub/src/mpmpxharvesterframeworkwrapper.cpp \ + stub/src/mpsongdata.cpp \ + stub/src/mpsongscanner.cpp \ + stub/src/mpmediakeyhandler.cpp \ + stub/src/mpmpxcollectionframeworkwrapper.cpp \ + stub/src/mpmpxcollectiondata.cpp \ + stub/src/mpmpxplaybackframeworkwrapper.cpp \ + stub/src/mpplaybackdata.cpp \ + stub/src/mpaudioeffectsframeworkwrapper.cpp \ + stub/src/mpequalizerframeworkwrapper.cpp \ + stub/src/mpsettingsmanager.cpp \ + +DEFINES += BUILD_MPENGINE_LIB + \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpenginefactory/inc/unittest_mpenginefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpenginefactory/inc/unittest_mpenginefactory.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpenginefactory +* +*/ + +#ifndef TESTMPENGINEFACTORY_H +#define TESTMPENGINEFACTORY_H + +#include + +class MpEngineFactory; + +class TestMpEngineFactory : public QObject +{ + Q_OBJECT + +public: + + TestMpEngineFactory(); + ~TestMpEngineFactory(); + +public slots: + + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void testInstance(); + void testCreateSharedEngine(); + void testCreateIsolatedEngine(); + void testSharedEngine(); + void testClose(); + +private: + + MpEngineFactory *mTest; +}; + +#endif // TESTMPENGINEFACTORY_H + + + + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpenginefactory/src/unittest_mpenginefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpenginefactory/src/unittest_mpenginefactory.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpenginefactory +* +*/ + +#include + +#include "unittest_mpenginefactory.h" + +// Do this so we can access all member variables. +#define private public +#include "mpenginefactory.h" +#undef private + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + TestMpEngineFactory tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpenginefactory.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpEngineFactory::TestMpEngineFactory() + : mTest(0) +{ +} + +TestMpEngineFactory::~TestMpEngineFactory() +{ +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpEngineFactory::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpEngineFactory::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpEngineFactory::init() +{ + +} + +/*! + Called after every testfunction. + */ +void TestMpEngineFactory::cleanup() +{ + +} + + +void TestMpEngineFactory::testInstance() +{ + mTest = MpEngineFactory::instance(); + QVERIFY( mTest != 0 ); + MpEngineFactory *factory = MpEngineFactory::instance(); + QVERIFY( mTest == factory ); +} + + +void TestMpEngineFactory::testCreateSharedEngine() +{ + MpEngine *sharedEngine = MpEngineFactory::createSharedEngine(); + QVERIFY( sharedEngine != 0 ); + MpEngine *engine = MpEngineFactory::createSharedEngine(); + QVERIFY( sharedEngine == engine ); + + delete MpEngineFactory::instance()->mSharedEngine; + MpEngineFactory::instance()->mSharedEngine = 0; +} + +void TestMpEngineFactory::testCreateIsolatedEngine() +{ + MpEngine *engineOne = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QVERIFY( engineOne != 0 ); + MpEngine *engineTwo = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + QVERIFY( engineTwo != 0 ); + QVERIFY( engineOne != engineTwo ); + QVERIFY( MpEngineFactory::instance()->mEngines.count() == 2 ); + + MpEngine *ptr; + foreach ( ptr, MpEngineFactory::instance()->mEngines ) { + delete ptr; + ptr = 0; + } + // This might be a potential bug in MpEngineFactory, need to call clear in close() function + MpEngineFactory::instance()->mEngines.clear(); +} + +void TestMpEngineFactory::testSharedEngine() +{ + MpEngine *sharedEngine = MpEngineFactory::createSharedEngine(); + QVERIFY( sharedEngine != 0 ); + MpEngine *engine = MpEngineFactory::sharedEngine(); + QVERIFY( sharedEngine == engine ); +} + +void TestMpEngineFactory::testClose() +{ + MpEngine *sharedEngine = MpEngineFactory::createSharedEngine(); + MpEngine *engineOne = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + MpEngine *engineTwo = MpEngineFactory::createIsolatedEngine( MpEngine::StandAlone ); + + MpEngineFactory::close(); + MpEngineFactory::instance()->mEngines.clear(); + QVERIFY( MpEngineFactory::instance()->mSharedEngine == 0 ); +} + + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpenginefactory/stub/inc/mpengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpenginefactory/stub/inc/mpengine.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpengine stub +* +*/ + +#ifndef MPENGINE_H +#define MPENGINE_H + +#include + +class MpEngine : public QObject +{ + Q_OBJECT + +public: + enum EngineMode{ + StandAlone, + Fetch, + Embedded, + MediaBrowsing + }; + friend class MpEngineFactory; + +private: + explicit MpEngine(); + void initialize( TUid hostUid, EngineMode mode); + +public: + virtual ~MpEngine(); +}; + +#endif // MPENGINE_H diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpenginefactory/stub/src/mpengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpenginefactory/stub/src/mpengine.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper for mpengine. +* +*/ + +#include "mpengine.h" + +MpEngine::MpEngine() +{ + +} + +/*! + Destructs music player engine. + */ +MpEngine::~MpEngine() +{ + +} + +/*! + Initialize engine + */ +void MpEngine::initialize( TUid hostUid, EngineMode mode ) +{ + Q_UNUSED( hostUid ); + Q_UNUSED( mode ); +} diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpenginefactory/unittest_mpenginefactory.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpengine/tsrc/unittest_mpenginefactory/unittest_mpenginefactory.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,41 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpenginefactory unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpenginefactory +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + stub/inc \ + ../../inc \ + ../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lestor.dll \ + -lfbscli.dll \ + -lmpengine + +HEADERS += inc/unittest_mpenginefactory.h \ + stub/inc/mpengine.h + +SOURCES += src/unittest_mpenginefactory.cpp \ + ../../src/mpenginefactory.cpp \ + stub/src/mpengine.cpp + + + diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmediakeyhandler/inc/unittest_mpmediakeyhandler.h --- a/mpengine/tsrc/unittest_mpmediakeyhandler/inc/unittest_mpmediakeyhandler.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/** -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for mpmediakeyhandler -* -*/ - -#ifndef TESTMPMEDIAKEYHANDLER_H -#define TESTMPMEDIAKEYHANDLER_H - -#include - -class MpMediaKeyHandler; -class MpMediaKeyHandlerPrivate; - -class TestMpMediaKeyHandler : public QObject -{ - Q_OBJECT - -public: - - TestMpMediaKeyHandler(); - virtual ~TestMpMediaKeyHandler(); - -// from QtTest -public slots: - - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -// internal -private slots: - - void testConstructor(); - void testDestructor(); - void testConstructorFail(); - void testDestructorFail(); - void testCommandVolumeUpKey(); - void testCommandVolumeDownKey(); - void testCommandPlayKey(); - void testCommandPauseKey(); - void testCommandPlayPauseKey(); - void testCommandStopKey(); - void testCommandFastForwardKeyPress(); - void testCommandFastForwardKeyRelease(); - void testCommandRewindKeyPress(); - void testCommandRewindKeyRelease(); - void testCommandForwardKey(); - void testCommandBackwardKey(); - - void testPlay(); - void testAudioInputFunction(); - void testSelectAvInputFunction(); - void testSelectDiskFunction(); - void testTuneFunction(); - -private: - - MpMediaKeyHandler *mTest; - MpMediaKeyHandlerPrivate *mTestPrivate; - -}; - -#endif // TESTMPMEDIAKEYHANDLER_H - - - - diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmediakeyhandler/src/unittest_mpmediakeyhandler.cpp --- a/mpengine/tsrc/unittest_mpmediakeyhandler/src/unittest_mpmediakeyhandler.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,396 +0,0 @@ -/** -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for mpmediakeyhandler -* -*/ - -#include -#include -#include -#include -#include - -#include "unittest_mpmediakeyhandler.h" -#include "mpcommondefs.h" -#include "stub/inc/mpxplaybackutility.h" -#include "stub/inc/remconcoreapitarget.h" -#include "stub/inc/remconinterfaceselector.h" - - -// Do this so we can access all member variables. -#define private public -#include "mpmediakeyhandler.h" -#include "mpmediakeyhandler_p.h" -#undef private - - -/*! - Make our test case a stand-alone executable that runs all the test functions. - */ -int main(int argc, char *argv[]) -{ - HbApplication app(argc, argv); - HbMainWindow window; - - TestMpMediaKeyHandler tv; - - char *pass[3]; - pass[0] = argv[0]; - pass[1] = "-o"; - pass[2] = "c:\\data\\unittest_mpmediakeyhandler.txt"; - - int res = QTest::qExec(&tv, 3, pass); - - return res; -} - -TestMpMediaKeyHandler::TestMpMediaKeyHandler() - : mTest(0) -{ -} - -TestMpMediaKeyHandler::~TestMpMediaKeyHandler() -{ - delete mTest; -} - -/*! - Called before the first testfunction is executed. - */ -void TestMpMediaKeyHandler::initTestCase() -{ - RDebug::Print(_L("initTestCase()")); -} - -/*! - Called after the last testfunction was executed. - */ -void TestMpMediaKeyHandler::cleanupTestCase() -{ - RDebug::Print(_L("cleanupTestCase()")); -} - -/*! - Called before each testfunction is executed. - */ -void TestMpMediaKeyHandler::init() -{ - RDebug::Print(_L(">>init()")); - mTest = new MpMediaKeyHandler(); - mTestPrivate = mTest->d_ptr; - RDebug::Print(_L("<>testConstructor()")); - - QVERIFY(mTest != 0); - QVERIFY(mTestPrivate != 0); - QVERIFY(mTestPrivate->iInterfaceSelector != 0); - QVERIFY(mTestPrivate->iResponseHandler != 0); - QVERIFY(mTestPrivate->iPlaybackUtility != 0); - - RDebug::Print(_L("<>testDestructor()")); - - // it is been observed that CRemConCoreApiTarget is not being deleted by anyone - // the creator claim it does not own it, while others never claim the ownership neither - cleanup(); - QVERIFY(mTest == 0); - QCOMPARE(MMPXPlaybackUtility::getCount(), 0); - QCOMPARE(CRemConCoreApiTarget::getCount(), 0); - QCOMPARE(CRemConInterfaceSelector::getCount(), 0); - - RDebug::Print(_L("<>testConstructorFail()")); - - // errorOccured signal cannot be connected until mediakeyhandler is created, - // and error during construction cannot be feedback. - // solution should be to seperate construction/init - cleanup(); - CRemConInterfaceSelector::setNewLLeave(); - init(); - QSignalSpy spy1(mTest, SIGNAL(errorOccured(int))); - QVERIFY(mTest != 0); - //QCOMPARE(spy1.count(), 1); // failed if comment in - - cleanup(); - CRemConInterfaceSelector::setOpenTargetLLeave(); - init(); - QSignalSpy spy2(mTest, SIGNAL(errorOccured(int))); - QVERIFY(mTest != 0); - //QCOMPARE(spy2.count(), 1); // failed if comment in - - cleanup(); - CRemConCoreApiTarget::setNewLLeave(); - init(); - QSignalSpy spy3(mTest, SIGNAL(errorOccured(int))); - QVERIFY(mTest != 0); - //QCOMPARE(spy3.count(), 1); // failed if comment in - - cleanup(); - MMPXPlaybackUtility::setNewLLeave(); - init(); - QSignalSpy spy4(mTest, SIGNAL(errorOccured(int))); - QVERIFY(mTest != 0); - //QCOMPARE(spy4.count(), 1); // failed if comment in - - cleanup(); - MMPXPlaybackUtility::setAddObserverLLeave(); - init(); - QSignalSpy spy5(mTest, SIGNAL(errorOccured(int))); - QVERIFY(mTest != 0); - //QCOMPARE(spy5.count(), 1); // failed if comment in - - RDebug::Print(_L("<>testDestructorFail()")); - - MMPXPlaybackUtility::setRemoveObserverLLeave(); - cleanup(); - QVERIFY(mTest == 0); - QCOMPARE(MMPXPlaybackUtility::getCount(), 0); - QCOMPARE(CRemConCoreApiTarget::getCount(), 0); - QCOMPARE(CRemConInterfaceSelector::getCount(), 0); - - RDebug::Print(_L("<>testCommandVolumeUpKey()")); - - // volumeChanged signal would not emit until mediakeyhandler is not added as an observer to MMPXPlaybackUtility - QSignalSpy spy(mTest, SIGNAL(volumeChanged(int))); - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - MMPXPlaybackUtility::setPlaying(); - mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeUp, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - QCOMPARE(spy.count(), 1); - - // impossible to stub out the CPeriodic class which is part of the Press/Release handling - // hence, those logic could not be tested - - RDebug::Print(_L("<>testCommandVolumeDownKey()")); - - // volumeChanged signal would not emit until mediakeyhandler is not added as an observer to MMPXPlaybackUtility - QSignalSpy spy(mTest, SIGNAL(volumeChanged(int))); - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - MMPXPlaybackUtility::setPlaying(); - mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeDown, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - QCOMPARE(spy.count(), 1); - - // impossible to stub out the CPeriodic class which is part of the Press/Release handling - // hence, those logic could not be tested - - RDebug::Print(_L("<>testCommandPlayKey()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiPlay, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandPauseKey()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiPause, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandPlayPauseKey()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiPausePlayFunction, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandStopKey()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiStop, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandFastForwardKeyPress()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiFastForward, ERemConCoreApiButtonPress); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandFastForwardKeyRelease()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiFastForward, ERemConCoreApiButtonRelease); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandRewindKey()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiRewind, ERemConCoreApiButtonPress); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandRewindKeyRelease()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiRewind, ERemConCoreApiButtonRelease); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandForwardKey()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiForward, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testCommandBackwardKey()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoCommand(ERemConCoreApiBackward, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testPlay()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoPlay(ERemConCoreApiPlaybackSpeedX1, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testAudioInputFunction()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoSelectAudioInputFunction(0, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testSelectAvInputFunction()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoSelectAvInputFunction(0, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testSelectDiskFunction()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoSelectDiskFunction(0, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("<>testTuneFunction()")); - - int oldCount = CRemConCoreApiTarget::getSendResponseCount(); - mTestPrivate->MrccatoTuneFunction(ETrue, 0, 1, ERemConCoreApiButtonClick); - QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); - - RDebug::Print(_L("< // KPbModeDefault, TMPXPlaybackCommand -#include // CBase - - -class MpMediaKeyHandlerPrivate; - -class MMPXPlaybackUtility : public CActive - { - -public: - - static int getCount(); - static void setNewLLeave(); - static void NewLLeaveIfDesiredL(); - static void setAddObserverLLeave(); - static void AddObserverLLeaveIfDesiredL(); - static void setRemoveObserverLLeave(); - static void RemoveObserverLLeaveIfDesiredL(); - static void setCommandLLeave(); - static void CommandLLeaveIfDesiredL(); - static void setStateLLeave(); - static void StateLLeaveIfDesiredL(); - static void setPlaying(); - -public: - - static MMPXPlaybackUtility* UtilityL(const TUid& aModeId = KPbModeDefault); - virtual ~MMPXPlaybackUtility(); - - void Close(); - void AddObserverL(MpMediaKeyHandlerPrivate& aObs); - void RemoveObserverL(MpMediaKeyHandlerPrivate& aObs); - void CommandL(TMPXPlaybackCommand aCmd, TInt aData = 0); - - TMPXPlaybackState StateL() const; - -protected: - - // from CActive - virtual void DoCancel(); - virtual void RunL(); - -private: - - MMPXPlaybackUtility(); - -private: - - MpMediaKeyHandlerPrivate* iObserver; - TInt iVolume; - TBool iVolumeUp; - - }; - -#endif // MMPXPLAYBACKUTILITY_H - -// End of File diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmediakeyhandler/stub/inc/remconcoreapitarget.h --- a/mpengine/tsrc/unittest_mpmediakeyhandler/stub/inc/remconcoreapitarget.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: remconcoreapitarget stub for testing mpmediakeyhandler -* -*/ - - -#ifndef REMCONCOREAPITARGET_H -#define REMCONCOREAPITARGET_H - - -#include // TRemConCoreApiOperationId - - -class CRemConInterfaceSelector; -class MRemConCoreApiTargetObserver; - -class CRemConCoreApiTarget : public CActive - { - -public: - - static int getCount(); - static void setNewLLeave(); - static void NewLLeaveIfDesiredL(); - static int getSendResponseCount(); - -public: - - static CRemConCoreApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, MRemConCoreApiTargetObserver& aObserver); - virtual ~CRemConCoreApiTarget(); - - void VolumeUpResponse(TRequestStatus& aStatus, TInt aError); - void VolumeDownResponse(TRequestStatus& aStatus, TInt aError); - void SendResponse(TRequestStatus& aStatus, TRemConCoreApiOperationId aOperationId, TInt aError); - -protected: - - // from CActive - virtual void DoCancel(); - virtual void RunL(); - -private: - - CRemConCoreApiTarget(); - -private: - - TRequestStatus* iClientStatus; - - }; - -#endif // REMCONCOREAPITARGET_H - -// End of File diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmediakeyhandler/stub/inc/remconinterfaceselector.h --- a/mpengine/tsrc/unittest_mpmediakeyhandler/stub/inc/remconinterfaceselector.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: remconinterfaceselector stub for testing mpmediakeyhandler -* -*/ - - -#ifndef REMCONINTERFACESELECTOR_H -#define REMCONINTERFACESELECTOR_H - - -#include - - -class CRemConInterfaceSelector : public CBase - { - -public: - - static int getCount(); - static void setNewLLeave(); - static void NewLLeaveIfDesiredL(); - static void setOpenTargetLLeave(); - static void OpenTargetLLeaveIfDesiredL(); - -public: - - static CRemConInterfaceSelector* NewL(); - virtual ~CRemConInterfaceSelector(); - - void OpenTargetL(); - -private: - - CRemConInterfaceSelector(); - - }; - -#endif // REMCONINTERFACESELECTOR_H - -// End of File diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmediakeyhandler/stub/src/mpxplaybackutility.cpp --- a/mpengine/tsrc/unittest_mpmediakeyhandler/stub/src/mpxplaybackutility.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: mpxplaybackutility stub for testing MpNowPlayingBackEnd -* -*/ - - -#include -#include - -#include "stub/inc/mpxplaybackutility.h" -#include "mpmediakeyhandler_p.h" - - -int gMMPXPlaybackUtilityCount = 0; -bool gMMPXPlaybackUtilityNewLLeave = false; -bool gMMPXPlaybackUtilityAddObserverLLeave = false; -bool gMMPXPlaybackUtilityRemoveObserverLLeave = false; -bool gMMPXPlaybackUtilityCommandLLeave = false; -bool gMMPXPlaybackUtilityStateLLeave = false; -TMPXPlaybackState gMMPXPlaybackUtilityState = EPbStateNotInitialised; - - -//static functions start - -int MMPXPlaybackUtility::getCount() -{ - return gMMPXPlaybackUtilityCount; -} - -void MMPXPlaybackUtility::setNewLLeave() -{ - gMMPXPlaybackUtilityNewLLeave = true; -} - -void MMPXPlaybackUtility::NewLLeaveIfDesiredL() -{ - if (gMMPXPlaybackUtilityNewLLeave) - { - RDebug::Print(_L("MMPXPlaybackUtility::NewLLeaveIfDesiredL Leave")); - gMMPXPlaybackUtilityNewLLeave = false; - User::Leave(KErrGeneral); - } -} - -void MMPXPlaybackUtility::setAddObserverLLeave() -{ - gMMPXPlaybackUtilityAddObserverLLeave = true; -} - -void MMPXPlaybackUtility::AddObserverLLeaveIfDesiredL() -{ - if (gMMPXPlaybackUtilityAddObserverLLeave) - { - RDebug::Print(_L("MMPXPlaybackUtility::AddObserverLLeaveIfDesiredL Leave")); - gMMPXPlaybackUtilityAddObserverLLeave = false; - User::Leave(KErrGeneral); - } -} - -void MMPXPlaybackUtility::setRemoveObserverLLeave() -{ - gMMPXPlaybackUtilityRemoveObserverLLeave = true; -} - -void MMPXPlaybackUtility::RemoveObserverLLeaveIfDesiredL() -{ - if (gMMPXPlaybackUtilityRemoveObserverLLeave) - { - RDebug::Print(_L("MMPXPlaybackUtility::RemoveObserverLLeaveIfDesiredL Leave")); - gMMPXPlaybackUtilityRemoveObserverLLeave = false; - User::Leave(KErrGeneral); - } -} - -void MMPXPlaybackUtility::setCommandLLeave() -{ - gMMPXPlaybackUtilityCommandLLeave = true; -} - -void MMPXPlaybackUtility::CommandLLeaveIfDesiredL() -{ - if (gMMPXPlaybackUtilityCommandLLeave) - { - RDebug::Print(_L("MMPXPlaybackUtility::CommandLLeaveIfDesiredL Leave")); - gMMPXPlaybackUtilityCommandLLeave = false; - User::Leave(KErrGeneral); - } -} - -void MMPXPlaybackUtility::setStateLLeave() -{ - gMMPXPlaybackUtilityStateLLeave = true; -} - -void MMPXPlaybackUtility::StateLLeaveIfDesiredL() -{ - if (gMMPXPlaybackUtilityStateLLeave) - { - RDebug::Print(_L("MMPXPlaybackUtility::StateLLeaveIfDesiredL Leave")); - gMMPXPlaybackUtilityStateLLeave = false; - User::Leave(KErrGeneral); - } -} - -void MMPXPlaybackUtility::setPlaying() -{ - gMMPXPlaybackUtilityState = EPbStatePlaying; -} - -//static functions end - -MMPXPlaybackUtility::MMPXPlaybackUtility() - : CActive(EPriorityStandard), - iObserver(NULL), - iVolume(5), - iVolumeUp(ETrue) -{ - gMMPXPlaybackUtilityState = EPbStateNotInitialised; -} - -MMPXPlaybackUtility::~MMPXPlaybackUtility() -{ -} - -MMPXPlaybackUtility* MMPXPlaybackUtility::UtilityL(const TUid& /*aModeId*/) -{ - RDebug::Print(_L("stub MMPXPlaybackUtility::UtilityL")); - MMPXPlaybackUtility::NewLLeaveIfDesiredL(); - gMMPXPlaybackUtilityCount++; - static MMPXPlaybackUtility playbackUtilility; - return &playbackUtilility; -} - -void MMPXPlaybackUtility::Close() -{ - iObserver = NULL; - gMMPXPlaybackUtilityCount--; -} - -void MMPXPlaybackUtility::AddObserverL(MpMediaKeyHandlerPrivate& aObs) -{ - MMPXPlaybackUtility::AddObserverLLeaveIfDesiredL(); - iObserver = &aObs; -} - -void MMPXPlaybackUtility::RemoveObserverL(MpMediaKeyHandlerPrivate& /*aObs*/) -{ - MMPXPlaybackUtility::RemoveObserverLLeaveIfDesiredL(); - iObserver = NULL; -} - -void MMPXPlaybackUtility::CommandL(TMPXPlaybackCommand aCmd, TInt /*aData*/) -{ - RDebug::Print(_L(">>MMPXPlaybackUtility::CommandL")); - - MMPXPlaybackUtility::CommandLLeaveIfDesiredL(); - - if (IsActive()) - User::Leave(KErrNotReady); - else - { - if ((aCmd == EPbCmdIncreaseVolume) || (aCmd == EPbCmdDecreaseVolume)) - { - if (aCmd == EPbCmdIncreaseVolume) - iVolumeUp = ETrue; - else - iVolumeUp = EFalse; - - // stub should not be async - /*TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive();*/ - - RunL(); - } - } - - RDebug::Print(_L("<>MMPXPlaybackUtility::RunL")); - - TInt err = KErrNone; - - if (iVolumeUp) - { - if (iVolume < 10) - iVolume++; - else - err = KErrArgument; - } - else - { - if (iVolume > 0) - iVolume--; - else - err = KErrArgument; - } - - if (iObserver) - iObserver->HandlePropertyL(EPbPropertyVolume, iVolume, err); - - RDebug::Print(_L("< - -#include "stub/inc/remconcoreapitarget.h" - - -int gCRemConCoreApiTargetCount = 0; -bool gCRemConCoreApiTargetNewLLeave = false; -int gCRemConCoreApiTargetSendResponseCount = 0; - - -//static functions start - -int CRemConCoreApiTarget::getCount() -{ - return gCRemConCoreApiTargetCount; -} - -void CRemConCoreApiTarget::setNewLLeave() -{ - gCRemConCoreApiTargetNewLLeave = true; -} - -void CRemConCoreApiTarget::NewLLeaveIfDesiredL() -{ - if (gCRemConCoreApiTargetNewLLeave) - { - RDebug::Print(_L("CRemConCoreApiTarget::NewLLeaveIfDesiredL Leave")); - gCRemConCoreApiTargetNewLLeave = false; - User::Leave(KErrGeneral); - } -} - -int CRemConCoreApiTarget::getSendResponseCount() -{ - return gCRemConCoreApiTargetSendResponseCount; -} - -//static functions end - - -CRemConCoreApiTarget::CRemConCoreApiTarget() - : CActive(EPriorityStandard), - iClientStatus(NULL) -{ - gCRemConCoreApiTargetCount++; -} - -CRemConCoreApiTarget::~CRemConCoreApiTarget() -{ - gCRemConCoreApiTargetCount--; - gCRemConCoreApiTargetSendResponseCount = 0; -} - -CRemConCoreApiTarget* CRemConCoreApiTarget::NewL(CRemConInterfaceSelector& /*aInterfaceSelector*/, MRemConCoreApiTargetObserver& /*aObserver*/) -{ - RDebug::Print(_L("stub CRemConCoreApiTarget::NewL")); - CRemConCoreApiTarget::NewLLeaveIfDesiredL(); - CRemConCoreApiTarget* self = new(ELeave) CRemConCoreApiTarget(); - return self; -} - - -void CRemConCoreApiTarget::VolumeUpResponse(TRequestStatus& aStatus, TInt /*aError*/) -{ - RDebug::Print(_L(">>CRemConCoreApiTarget::VolumeUpResponse")); - - iClientStatus = &aStatus; - gCRemConCoreApiTargetSendResponseCount++; - - // stub should not be async - /*TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive();*/ - - RunL(); - - RDebug::Print(_L("<>CRemConCoreApiTarget::VolumeDownResponse")); - - iClientStatus = &aStatus; - gCRemConCoreApiTargetSendResponseCount++; - - // stub should not be async - /*TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive();*/ - - RunL(); - - RDebug::Print(_L("<>CRemConCoreApiTarget::SendResponse")); - - iClientStatus = &aStatus; - gCRemConCoreApiTargetSendResponseCount++; - - // stub should not be async - /*TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive();*/ - - RunL(); - - RDebug::Print(_L("<>CRemConCoreApiTarget::RunL")); - User::RequestComplete(iClientStatus, KErrNone); - RDebug::Print(_L("< - -#include "stub/inc/remconinterfaceselector.h" - - -int gCRemConInterfaceSelectorCount = 0; -bool gCRemConInterfaceSelectorNewLLeave = false; -bool gCRemConInterfaceSelectorOpenTargetLLeave = false; - - -//static functions start - -int CRemConInterfaceSelector::getCount() -{ - return gCRemConInterfaceSelectorCount; -} - -void CRemConInterfaceSelector::setNewLLeave() -{ - gCRemConInterfaceSelectorNewLLeave = true; -} - -void CRemConInterfaceSelector::NewLLeaveIfDesiredL() -{ - if (gCRemConInterfaceSelectorNewLLeave) - { - RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave")); - gCRemConInterfaceSelectorNewLLeave = false; - User::Leave(KErrGeneral); - } -} - -void CRemConInterfaceSelector::setOpenTargetLLeave() -{ - gCRemConInterfaceSelectorOpenTargetLLeave = true; -} - -void CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL() -{ - if (gCRemConInterfaceSelectorOpenTargetLLeave) - { - RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave")); - gCRemConInterfaceSelectorOpenTargetLLeave = false; - User::Leave(KErrGeneral); - } -} - -//static functions end - -CRemConInterfaceSelector::CRemConInterfaceSelector() -{ - gCRemConInterfaceSelectorCount++; -} - -CRemConInterfaceSelector::~CRemConInterfaceSelector() -{ - gCRemConInterfaceSelectorCount--; -} - -CRemConInterfaceSelector* CRemConInterfaceSelector::NewL() -{ - RDebug::Print(_L("stub CRemConInterfaceSelector::NewL")); - CRemConInterfaceSelector::NewLLeaveIfDesiredL(); - CRemConInterfaceSelector* self = new(ELeave) CRemConInterfaceSelector(); - return self; -} - -void CRemConInterfaceSelector::OpenTargetL() -{ - CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL(); -} - -//end of file diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmediakeyhandler/unittest_mpmediakeyhandler.pro --- a/mpengine/tsrc/unittest_mpmediakeyhandler/unittest_mpmediakeyhandler.pro Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: mpmediakeyhandler unit test project file. -# - -TEMPLATE = app -CONFIG += qtestlib hb symbian_test -TARGET = unittest_mpmediakeyhandler -TARGET.CAPABILITY = CAP_APPLICATION - -symbian: { - MMP_RULES += SMPSAFE -} - -DEPENDPATH += . -INCLUDEPATH += . \ - stub/inc \ - ../../../inc \ -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - -LIBS += -lestor.dll \ - -lfbscli.dll \ - -lmpxcommon.dll \ - -lremconcoreapi.dll - -HEADERS += inc/unittest_mpmediakeyhandler.h \ - ../../inc/mpmediakeyhandler.h \ - ../../inc/mpmediakeyhandler_p.h \ - ../../inc/mpmediakeyremconresponse.h \ - stub/inc/mpxplaybackutility.h \ - stub/inc/remconcoreapitarget.h \ - stub/inc/remconinterfaceselector.h - -SOURCES += src/unittest_mpmediakeyhandler.cpp \ - ../../src/mpmediakeyhandler.cpp \ - ../../src/mpmediakeyhandler_p.cpp \ - ../../src/mpmediakeyremconresponse.cpp \ - stub/src/mpxplaybackutility.cpp \ - stub/src/remconcoreapitarget.cpp \ - stub/src/remconinterfaceselector.cpp - diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/inc/unittest_mpmpxplaybackframeworkwrapper.h --- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/inc/unittest_mpmpxplaybackframeworkwrapper.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/inc/unittest_mpmpxplaybackframeworkwrapper.h Fri Aug 06 16:51:36 2010 -0500 @@ -71,6 +71,15 @@ void testStartSeekBackward(); void testHandleSubPlayerNamesL(); void testCloseCurrentPlayback(); + void testPause(); + void testGetMaxVolume(); + void testGetVolume(); + void testIncreaseVolume(); + void testDecreaseVolume(); + void testSetVolume(); + void testGetMuteState(); + void testMute(); + void testUnmute(); private: diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/src/unittest_mpmpxplaybackframeworkwrapper.cpp --- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/src/unittest_mpmpxplaybackframeworkwrapper.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/src/unittest_mpmpxplaybackframeworkwrapper.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -495,6 +495,12 @@ else { QWARN("Not able to create RF Session"); } + + //Play command + cleanup(); + init(); + mTest->play(); + QCOMPARE( mTestPrivate->iPlaybackUtility->iCmd, EPbCmdPlay); } /*! @@ -556,6 +562,89 @@ } /*! + Tests pause. + */ +void TestMpMpxPlaybackFrameworkWrapper::testPause() +{ + mTest->pause(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iCmd, EPbCmdPause); +} + +/*! + Tests getMaxVolume. + */ +void TestMpMpxPlaybackFrameworkWrapper::testGetMaxVolume() +{ + mTest->getMaxVolume(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iProperty, EPbPropertyMaxVolume); +} + +/*! + Tests getVolume. + */ +void TestMpMpxPlaybackFrameworkWrapper::testGetVolume() +{ + mTest->getVolume(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iProperty, EPbPropertyVolume); +} + +/*! + Tests increaseVolume. + */ +void TestMpMpxPlaybackFrameworkWrapper::testIncreaseVolume() +{ + mTest->increaseVolume(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iCmd, EPbCmdIncreaseVolume); +} + +/*! + Tests decreaseVolume. + */ +void TestMpMpxPlaybackFrameworkWrapper::testDecreaseVolume() +{ + mTest->decreaseVolume(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iCmd, EPbCmdDecreaseVolume); +} + +/*! + Tests setVolume. + */ +void TestMpMpxPlaybackFrameworkWrapper::testSetVolume() +{ + int value = 30; + mTest->setVolume( value ); + QCOMPARE(mTestPrivate->iPlaybackUtility->iCmd, EPbCmdSetVolume); + QCOMPARE(mTestPrivate->iPlaybackUtility->iComandData, value); +} + +/*! + Tests getMuteState. + */ +void TestMpMpxPlaybackFrameworkWrapper::testGetMuteState() +{ + mTest->getMuteState(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iProperty, EPbPropertyMute); +} + +/*! + Tests mute. + */ +void TestMpMpxPlaybackFrameworkWrapper::testMute() +{ + mTest->mute(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iCmd, EPbCmdMuteVolume); +} + +/*! + Tests unmute. + */ +void TestMpMpxPlaybackFrameworkWrapper::testUnmute() +{ + mTest->unmute(); + QCOMPARE(mTestPrivate->iPlaybackUtility->iCmd, EPbCmdUnMuteVolume); +} + +/*! Used to load test data */ void TestMpMpxPlaybackFrameworkWrapper::loadTestData(TInt aPos) diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpxplaybackutility.h --- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpxplaybackutility.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpxplaybackutility.h Fri Aug 06 16:51:36 2010 -0500 @@ -54,6 +54,7 @@ void Close(); void CommandL(TMPXPlaybackCommand aCmd,TInt aData=0); void CommandL(CMPXCommand& aCmd, MMPXPlaybackCallback* aCallback=NULL); + void PropertyL(MMPXPlaybackCallback& aCallback, TMPXPlaybackProperty aProperty); MMPXSource* Source(); void SetL(TMPXPlaybackProperty aProperty, TInt aValue); TMPXPlaybackState StateL() const; diff -r 612c4815aebe -r 4cc1412daed0 mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpxplaybackutility.cpp --- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpxplaybackutility.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpxplaybackutility.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -103,6 +103,15 @@ /*! Stub function. */ +void MMPXPlaybackUtility::PropertyL(MMPXPlaybackCallback& aCallback, TMPXPlaybackProperty aProperty) +{ + Q_UNUSED(aCallback); + iProperty = aProperty; +} + +/*! + Stub function. +*/ MMPXSource* MMPXPlaybackUtility::Source() { if (iReturnSource) { diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistexporter.cpp --- a/mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistexporter.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistexporter.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -318,6 +318,8 @@ // Convert line from Unicode to UTF-8 // UTF-8 encoded character may consume several bytes => // multiply the descriptor length in order to prevent overflow. + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC8* line = HBufC8::NewLC(iLine->Length() * KMPXM3UUtf8ConvMultiplier); TPtr8 ptr = line->Des(); @@ -488,7 +490,7 @@ CleanupClosePushL(file); // Calculate the increase in the playlist file size - TInt oldSize; + TInt oldSize = 0; User::LeaveIfError(file.Size(oldSize)); TInt sizeIncr = iPlaylistBuf->Size() - oldSize; diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp --- a/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -603,6 +603,8 @@ MPX_FUNC("MPXDbCommonUtil::ProcessSingleQuotesLC"); // reserve space for all single quotes (double the size) + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value = HBufC::NewLC(aString.Length() * 2); TPtr valuePtr(value->Des()); @@ -629,6 +631,8 @@ // reserve space for all percentage signs (triple the size because % should // be replaced by %%) TInt srcLen(aString.Length()); + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* targetString = HBufC::NewLC(aString.Length() * 3); TPtr targetStringPtr(targetString->Des()); diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp --- a/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -505,7 +505,7 @@ CleanupClosePushL( dstFile ); // resize destination file - TInt remainingBytes; + TInt remainingBytes = 0; User::LeaveIfError( srcFile.Size(remainingBytes) ); User::LeaveIfError( dstFile.SetSize(remainingBytes) ); @@ -1854,6 +1854,8 @@ { delete database.iAliasname; database.iAliasname = HBufC::NewL(KAliasName().Length()); + // coverity[size_error] + // coverity[buffer_alloc] HBufC* temp = HBufC::NewLC(2); // form of DE, DF, DX,... temp->Des().Append(iRAMDrive); // length == 2 TDriveUnit pdrive( database.iDrive ); @@ -2208,6 +2210,8 @@ { TInt columnCount(GetColumnCountL(aStatement)); TInt err(KErrNone); + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* tableRow = HBufC::NewLC(255 * columnCount); TPtr tableRowPtr = tableRow->Des(); diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/mpxsqlitedbcommon/src/mpxdbtable.cpp --- a/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbtable.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbtable.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -419,10 +419,10 @@ User::Leave(KErrNotFound); } - TUint32 value(recordset.ColumnInt64(KMPXTableDefaultIndex)); + TInt64 value( recordset.ColumnInt64( KMPXTableDefaultIndex ) ); CleanupStack::PopAndDestroy(&recordset); - return value; + return value < 0 ? 0: I64LOW( value ); } // ---------------------------------------------------------------------------- @@ -456,6 +456,8 @@ // replace single quotes // reserve double the value length for single quote duplicates + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2); TPtr value1Ptr(value1->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr); @@ -484,6 +486,8 @@ MPX_FUNC("CMPXDbTable::ExecuteIntQueryL"); // replace single quotes + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value = HBufC::NewLC(aValue.Length() * 2); TPtr valuePtr(value->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr); @@ -640,6 +644,8 @@ // replace single quotes // reserve double the value length for single quote duplicates + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2); TPtr value1Ptr(value1->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr); @@ -670,10 +676,14 @@ // replace single quotes // reserve double the value length for single quote duplicates + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2); TPtr value1Ptr(value1->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr); + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value2 = HBufC::NewLC(aValue2.Length() * 2); TPtr value2Ptr(value2->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue2, value2Ptr); @@ -704,6 +714,8 @@ // replace single quotes // reserve double the value length for single quote duplicates + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value = HBufC::NewLC(aValue.Length() * 2); TPtr valuePtr(value->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr); @@ -736,12 +748,16 @@ // replace single quotes // reserve double the value length for single quote duplicates + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2); TPtr value1Ptr(value1->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr); // replace single quotes // reserve double the value length for single quote duplicates + // coverity[incorrect_multiplication] + // coverity[buffer_alloc] HBufC* value3 = HBufC::NewLC(aValue3.Length() * 2); TPtr value3Ptr(value3->Des()); MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue3, value3Ptr); diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbdef.h --- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbdef.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbdef.h Fri Aug 06 16:51:36 2010 -0500 @@ -28,11 +28,11 @@ // Db filename #ifdef ABSTRACTAUDIOALBUM_INCLUDED -_LIT(KMCDbFile, "mpxv3_0.db"); -_LIT(KMCDbFileEMMC, "mpxv3_0i.db"); -#else -_LIT(KMCDbFile, "mpxv3_0n.db"); -_LIT(KMCDbFileEMMC, "mpxv3_0in.db"); +_LIT(KMCDbFile, "mpxv3_1.db"); +_LIT(KMCDbFileEMMC, "mpxv3_1i.db"); +#else +_LIT(KMCDbFile, "mpxv3_1n.db"); +_LIT(KMCDbFileEMMC, "mpxv3_1in.db"); #endif // ABSTRACTAUDIOALBUM_INCLUDED // Collection Db resource file _LIT(KMPXCollectionDbResourceFile, "mpxcollectiondbhgres.rsc"); diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h --- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h Fri Aug 06 16:51:36 2010 -0500 @@ -144,6 +144,13 @@ _LIT(KQueryMusicGetMostPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.PlayCount<>0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u"); _LIT(KQueryMusicGetRecentlyAdded, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND (julianday(Music.TimeAdded)>julianday('now','-7 days')) AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.TimeAdded DESC"); */ + +#ifdef ABSTRACTAUDIOALBUM_INCLUDED +_LIT(KQueryMusicGetAllSongsMinimum, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,0,Music.Art,Music.Deleted,Music.Location,0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,'',0,0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY MUSIC.Title"); +#else +_LIT(KQueryMusicGetAllSongsMinimum, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,0,Music.Art,Music.Deleted,Music.Location,0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY MUSIC.Title"); +#endif + _LIT(KQueryMusicGetAllSongs, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4"); _LIT(KQueryMusicGetSongsForArtist, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4"); _LIT(KQueryMusicGetSongsForAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 9, 4"); @@ -270,9 +277,9 @@ _LIT(KAuxiliaryDropTable,"DROP TABLE Auxiliary"); _LIT(KAuxiliaryCheckTable, "SELECT Id,Version,TimeRefreshed,TimeSynced,Corrupt,SaveDeletedRecordCount FROM AUXILIARY"); #ifdef ABSTRACTAUDIOALBUM_INCLUDED -_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.6.0',%u)"); +_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.7.0',%u)"); #else -_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.6.1',%u)"); +_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.7.1',%u)"); #endif // ABSTRACTAUDIOALBUM_INCLUDED _LIT(KQueryAuxiliarySetTime, "UPDATE :dbname.Auxiliary SET TimeRefreshed='%S', Corrupt=0"); _LIT(KQueryAuxiliaryGetTime, "SELECT TimeRefreshed FROM :dbname.Auxiliary"); diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp --- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -712,7 +712,7 @@ // Run query and add result media objects to the cache array. MPX_FUNC("CMPXDbMusic::ExecuteQueryAllSongsL"); - RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetAllSongs)); + RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetAllSongsMinimum)); CleanupClosePushL(recordset); TInt err(KErrNone); @@ -2436,6 +2436,7 @@ // Do not create any other indexes than the one on UniqueId // as they only slow down the database overall + User::LeaveIfError(aDatabase.Exec(KMusicDeletedTitleIndex)); } // ---------------------------------------------------------------------------- diff -r 612c4815aebe -r 4cc1412daed0 mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp --- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -4078,14 +4078,6 @@ TInt offset = aCmd.ValueTObjectL( KMPXCollectionCommandIdIncOpenLOffset ); TInt numItems = aCmd.ValueTObjectL( KMPXCollectionCommandIdIncOpenLNumItems ); - TReadDirection direction(EReadUnknown); -/* Ascending and Decending reads are currently not used. We optimized for offset reads. - if( aCmd.IsSupported(KMPXCollectionCommandIdIncOpenLAscDsc) && - aCmd.IsSupported(KMPXCollectionCommandIdIncOpenLKeyItem) ) - { - direction = aCmd.ValueTObjectL(KMPXCollectionCommandIdIncOpenLAscDsc); - } -*/ CMPXCollectionPath* path = aCmd.ValueCObjectL(KMPXCollectionCommandIdIncOpenLPath); CleanupStack::PushL( path ); MPX_DEBUG_PATH( *path ); @@ -4120,21 +4112,7 @@ // Array to read data from CMPXMediaArray* array = CMPXMediaArray::NewL(); CleanupStack::PushL( array ); - - // Do we have to use offset or can we use asc/dsc - // - if( direction == EReadUnknown ) - { - iDbHandler->GetSongsAtOffsetL( array, attrs.Array(), offset, numItems ); - } - else - { - iDbHandler->GetSongsInBlockL( array, attrs.Array(), - aCmd.ValueText( KMPXCollectionCommandIdIncOpenLKeyItem ), - numItems, - direction ); - } - + iDbHandler->GetSongsAtOffsetL( array, attrs.Array(), offset, numItems ); TInt max( path->Count() ); TInt count(0); TInt aryCount( array->Count() ); diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/mpcollectionviewplugin.pro --- a/mpviewplugins/mpcollectionviewplugin/mpcollectionviewplugin.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/mpcollectionviewplugin.pro Fri Aug 06 16:51:36 2010 -0500 @@ -71,3 +71,4 @@ RESOURCES += resources/mpcollectionviewresources.qrc +DOCML += resources/musiccollection.docml \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/resources/mpcollectionviewresources.qrc --- a/mpviewplugins/mpcollectionviewplugin/resources/mpcollectionviewresources.qrc Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/resources/mpcollectionviewresources.qrc Fri Aug 06 16:51:36 2010 -0500 @@ -1,7 +1,7 @@ - musiccollection.docml + musiccollection.docml.bin diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerallsongs.cpp --- a/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerallsongs.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerallsongs.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -71,7 +71,7 @@ MpCollectionListContainer::dataReloaded(); if ( mViewMode != MpCommon::FetchView ) { int count = mCollectionData->count(); - QString details = hbTrId("txt_mus_subhead_ln_songs", count); + QString details = hbTrId("txt_mus_subhead_songs_l1").arg( count ); mInfoBar->setHeading(details); } if ( mCollectionData->count() > 1 ) { @@ -113,7 +113,7 @@ } else { int count = mCollectionData->count(); - details = hbTrId("txt_mus_subhead_ln_songs", count); + details = hbTrId("txt_mus_subhead_songs_l1").arg( count ); } mInfoBar->setHeading(details); } diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/src/unittest_mpcollectioncontainers.cpp --- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/src/unittest_mpcollectioncontainers.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/src/unittest_mpcollectioncontainers.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -245,7 +245,7 @@ QVERIFY(allSongs->mIndexFeedback->itemView() == allSongs->mList); // Normal mode. Should see count. - QCOMPARE(allSongs->mInfoBar->heading(), hbTrId("txt_mus_subhead_ln_songs", 5)); + QCOMPARE(allSongs->mInfoBar->heading(), hbTrId("txt_mus_subhead_songs_l1").arg( 5 ) ); } /*! @@ -802,7 +802,7 @@ mCollectionData->mCurrentAlbumAvailable = false; artists->mAlbumIndexOffset = 0; artists->mCurrentAlbumIndex = 0; - artists->albumCentered(); + artists->albumCentered( QModelIndex() ); QCOMPARE(artists->mCurrentAlbumIndex, -1); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), -1); @@ -810,14 +810,14 @@ mCollectionData->mCurrentAlbumAvailable = true; artists->mAlbumIndexOffset = 0; artists->mCurrentAlbumIndex = 0; - artists->albumCentered(); + artists->albumCentered( QModelIndex() ); QCOMPARE(artists->mCurrentAlbumIndex, -1); QCOMPARE(spy.count(), 1); // Re-centered on same item artists->mAlbumIndexOffset = 1; artists->mCurrentAlbumIndex = 0; - artists->albumCentered(); + artists->albumCentered( QModelIndex() ); QCOMPARE(spy.count(), 1); } @@ -833,20 +833,20 @@ mCollectionData->mCurrentAlbumAvailable = false; albums->mCurrentAlbumIndex = 0; - albums->albumCentered(); + albums->albumCentered( QModelIndex() ); QCOMPARE(albums->mCurrentAlbumIndex, -1); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), -1); mCollectionData->mCurrentAlbumAvailable = true; albums->mCurrentAlbumIndex = 0; - albums->albumCentered(); + albums->albumCentered( QModelIndex() ); QCOMPARE(albums->mCurrentAlbumIndex, -1); QCOMPARE(spy.count(), 1); // Re-centered on same item albums->mCurrentAlbumIndex = -1; - albums->albumCentered(); + albums->albumCentered( QModelIndex() ); QCOMPARE(spy.count(), 1); } diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/hgmediawall.h --- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/hgmediawall.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/hgmediawall.h Fri Aug 06 16:51:36 2010 -0500 @@ -43,7 +43,9 @@ virtual void setModel(QAbstractItemModel *model); void scrollTo(const QModelIndex &index); QModelIndex currentIndex() const; - + QSizeF itemSize() const; + void setDefaultImage(QImage defaultImage); + signals: void scrollingEnded(); diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/mpmpxcollectiondata.h --- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/mpmpxcollectiondata.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/mpmpxcollectiondata.h Fri Aug 06 16:51:36 2010 -0500 @@ -51,6 +51,7 @@ QString itemData( int index, MpMpxCollectionData::DataType type ) const; bool setCurrentAlbum( int index ); + int albumSongsCount() const; const CMPXMedia& containerMedia(); @@ -60,6 +61,7 @@ bool mMediaSet; TCollectionContext mContext; int mCount; + int mAlbumSongsCount; int mCurrentAlbumIndex; bool mCurrentAlbumAvailable; bool mReturnCollectionTitle; diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/mpnowplayingwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/mpnowplayingwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpNowPlayingWidget stub for testing mpcollectioncontainers +* +*/ + +#ifndef MPNOWPLAYINGWIDGET_H +#define MPNOWPLAYINGWIDGET_H + +//includes +#include + +class MpNowPlayingWidget : public QObject +{ + Q_OBJECT + +public: + explicit MpNowPlayingWidget(); + virtual ~MpNowPlayingWidget(); +}; + +#endif // MPNOWPLAYINGWIDGET_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/hgmediawall.cpp --- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/hgmediawall.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/hgmediawall.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -65,6 +65,22 @@ return QModelIndex(); } +/*! + Stub function + */ +QSizeF HgWidget::itemSize() const +{ + return QSizeF(); +} + +/*! + Stub function + */ +void HgWidget::setDefaultImage(QImage defaultImage) +{ + Q_UNUSED(defaultImage); +} + //=========================================================================== //=========================================================================== diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/mpmpxcollectiondata.cpp --- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/mpmpxcollectiondata.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/mpmpxcollectiondata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -29,9 +29,11 @@ mMediaSet(false), mContext(ECollectionContextUnknown), mCount(0), + mAlbumSongsCount(0), mCurrentAlbumIndex(-1), mCurrentAlbumAvailable(false), mReturnCollectionTitle(true) + { } @@ -102,3 +104,11 @@ return *mContainerMedia; } +/*! + Stub function. +*/ +int MpMpxCollectionData::albumSongsCount() const +{ + return 0; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/mpnowplayingwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/src/mpnowplayingwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpNowPlayingWidget stub for testing collecitoncontainers +* +*/ + +#include "mpnowplayingwidget.h" + + +/*! + Constructs the now playing widget stub + */ +MpNowPlayingWidget::MpNowPlayingWidget( ) +{ +} + +/*! + Destructs the now playing widget stub. + */ +MpNowPlayingWidget::~MpNowPlayingWidget() +{ +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/unittest_mpcollectioncontainers.pro --- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/unittest_mpcollectioncontainers.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/unittest_mpcollectioncontainers.pro Fri Aug 06 16:51:36 2010 -0500 @@ -43,7 +43,8 @@ stub/inc/mpcollectiontbonelistdatamodel.h \ stub/inc/mpmpxcollectiondata.h \ stub/inc/mpcollectionview.h \ - stub/inc/hgmediawall.h + stub/inc/hgmediawall.h \ + stub/inc/mpnowplayingwidget.h SOURCES += src/unittest_mpcollectioncontainers.cpp \ ../../src/mpcollectioncontainerfactory.cpp \ @@ -58,7 +59,8 @@ stub/src/mpcollectiontbonelistdatamodel.cpp \ stub/src/mpmpxcollectiondata.cpp \ stub/src/mpcollectionview.cpp \ - stub/src/hgmediawall.cpp + stub/src/hgmediawall.cpp \ + stub/src/mpnowplayingwidget.cpp RESOURCES += ../../resources/mpcollectionviewresources.qrc diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/inc/mpdetailssharedialog.h --- a/mpviewplugins/mpdetailsviewplugin/inc/mpdetailssharedialog.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header file for share player. -* -*/ - -#ifdef SHARE_FUNC_ENABLED -#ifndef MPDETAILSSHAREDIALOG_H -#define MPDETAILSSHAREDIALOG_H - -#include -#include -#include -#include "mpsharedata.h" - -class QGraphicsWebView; -class QNetworkAccessManager; -class QNetworkReply; -class MpShareWebView; -class MpSongData; -class HbProgressDialog; - -/*! - Implements Share Player dialog for music player details view. - First, construct an instance of the class, then call initialize method. -*/ -class MpDetailsShareDialog : public HbDialog -{ - Q_OBJECT - -public: - MpDetailsShareDialog(); - - /*! - Initializes an instance of the class with given MpSongData. - Translation for "unknown" string is passed so that the share - dialog can display "unknown" if artist or title are not set. - MpSongData object ownership is not transferred, - Music Player Engine retains the ownership. - */ - void initialize( MpSongData* aSongData, const QString& aUnknownTr ); - virtual ~MpDetailsShareDialog(); - void cachePublishingPlayerFiles(); - void logoutPlayer(); - bool isInitialized() const; - -public slots: - void addContext(); - void updateSharedData(); - void onIndexLoad( bool ok ); - void debugJs( QString s ); - void errorHandler( QString aError, QString aMessage ); - void clearCache(); - void showWindow(); - void showProgressDialog(); - void handleRequestSSLErrors( QNetworkReply* aReply, const QList< QSslError >& aErrors ); - void handleRequestFinished( QNetworkReply* aReply ); - -signals: - void closeShareDialog(); - -private: - void initShareData( MpSongData* aSongData, const QString& aUnknownTr ); - void initLanguage(); - void initNetworkAccessManager(); - void initWebView(); - void initSignalSlots(); - bool initUser(); - -private: - MpShareData mShareData; - MpShareWebView* mShareWebView; // Owned by HbDialog - QNetworkAccessManager* mShareNetAccMan; // Owned - HbProgressDialog* mProgressbar; // Owned - bool mIsInitialized; -}; - -#endif // MPDETAILSSHAREDIALOG_H -#endif // SHARE_FUNC_ENABLED diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/inc/mpdetailsview.h --- a/mpviewplugins/mpdetailsviewplugin/inc/mpdetailsview.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/inc/mpdetailsview.h Fri Aug 06 16:51:36 2010 -0500 @@ -36,6 +36,7 @@ class HbPushButton; class HbDocumentLoader; class HbListWidget; +class HbListWidgetItem; class QGraphicsLinearLayout; class HbProgressBar; @@ -44,18 +45,11 @@ class MpSongData; class MpQueryManager; -#ifdef SHARE_FUNC_ENABLED -#include -QTM_USE_NAMESPACE -class MpDetailsShareDialog; -#endif - //class declaration /*! Details view is the "flipside view" of Music Player. In addition to displaying song details, details view - also provides user the possibility to comment a - track (by initiating sharedialog), and to get + also provides user the possibility to get recommendations based on his playlist (by displaying a list of favourites, fetched from OVI music server). @@ -83,33 +77,26 @@ void albumArtChanged(); private slots: + void queryInspireMe(bool storeUpdated = true); + void queryLocalMusicStore(); void handlePlaybackInfoChanged(); void songDetailInfoChanged(); + void handleListItemSelected( HbListWidgetItem *item); void handleDetailsGroupBoxToggled( bool state ); void handleInspireMeGroupBoxToggled( bool state ); - void RenderInspireMeGroupBox(); - void handleNetworkError(); - void updateSharedData(const QString& url); - -#ifdef SHARE_FUNC_ENABLED - void share(); - void closeShareDialog(); -#endif + void renderInspireMeMetadata(); + void renderInspireMeAlbumArts(); + void abortInspireMeProcess(); private: - bool canQueryRecommendations() const; - bool canQuerySharePlayerLink() const; + void startInspireMe(); + bool isMetadata() const; void setupMenu(); - void clearInspireMe(); - -#ifdef SHARE_FUNC_ENABLED - void createShareDialog(); - void preloadShareDialog(); -#endif + void saveGroupBoxStates(); private: - MpEngine *mMpEngine; // Own + MpEngine *mMpEngine; // Owned by the factory MpSongData *mSongData; @@ -122,7 +109,6 @@ HbLabel *mAlbumArt; //owned HbGroupBox *mSongDetailsGroupBox; //owned HbGroupBox *mInspireMeGroupBox; //owned - HbPushButton *mShareButton; //owned HbDocumentLoader *mDocumentLoader;//owned HbListWidget *mDetailList; // owned by mSongDetailsGroupBox HbListWidget *mInspireList; // owned by mInspireMeGroupBox @@ -133,13 +119,7 @@ bool mInspireMeQueryOngoing; bool mInspireMeQueryRendered; - bool mInspireMeOpen; - bool mSongDetailsGbOpen; -#ifdef SHARE_FUNC_ENABLED - MpDetailsShareDialog* mSharePopup; // Own -#endif - Q_DISABLE_COPY(MpDetailsView) }; diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/inc/mpquerymanager.h --- a/mpviewplugins/mpdetailsviewplugin/inc/mpquerymanager.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/inc/mpquerymanager.h Fri Aug 06 16:51:36 2010 -0500 @@ -17,11 +17,11 @@ #ifndef MPQUERYMANAGER_H_ #define MPQUERYMANAGER_H_ -#include #include #include #include #include +#include #include "mpviewbase.h" @@ -45,66 +45,76 @@ ~MpQueryManager(); public: - void clearNetworkReplies(); + void reset(); void queryLocalMusicStore( QString mArtist,QString mAlbum,QString mTitle ); void queryInspireMeItems( QString mArtist,QString mAlbum,QString mTitle ); - void clearRecommendations(); + void queryLocalMusicStore(); + bool isLocalMusicStore() const; - QStringList recommendationSongs(); - QStringList recommendationArtists(); - QStringList recommendationAlbumArtsLink(); - QMap recommendationAlbumArtsMap(); - void insertMapItem( const QString &uri, const QPixmap &pixmap ); + int recommendationsCount() const; + QString recommendedSong(int index) const; + QString recommendedArtist(int index) const; + HbIcon recommendedAlbumArt(int index) const; private slots: void retrieveInformationFinished( QNetworkReply* reply ); void retrieveInformationNetworkError( QNetworkReply::NetworkError error ); void retrieveInformationSslErrors( const QList &error ); - void DownloadFinished( QNetworkReply* reply ); + void albumArtDownloaded( QNetworkReply* reply ); void setAlbumArtUri( const QString &albumArtUri, const QString &albumArtName ); - void thumbnailReady( const QPixmap& pixmap, void *data, int id, int error ); + void thumbnailReady( const QPixmap pixmap, void *data, int id, int error ); private: + void clearThumbnails(); + void clearRecommendations(); + void clearNetworkReplies(); + void signalError(); void constructRequest( QString &uri ); // retrieve URI from Ovi music server void retrieveInformation( const QString &urlEncoded ); - void composeAlbumCover( QPixmap albumart ); QString keyValues( QStringList keys, QStringList values ) const; void handleParsedXML(); bool writeImageToFile( const QByteArray &aImageData, const QString &aImageFileName ); signals: - void networkError(); - void searchUrlRetrieved( const QString& url ); - void recommendationAlbumArtsReady(); - + void inspireMeItemAlbumArtReady(); + void localMusicStoreRetrieved(bool storeUpdated); + void localMusicStoreRetrievalError(); + void inspireMeItemsRetrievalError(); + void inspireMeItemsMetadataRetrieved(); + private: - QNetworkAccessManager *mManager; - QNetworkAccessManager *mDownloadManager; + QNetworkAccessManager *mManager; + QNetworkAccessManager *mAlbumArtDownloader; - int mDownloadedAlbumArts; + int mDownloadedAlbumArts; - QList mReplys; + QList mReplys; + QList mThumbnailRequests; - QDomDocument mDomDocument; - ThumbnailManager *mThumbnailManager; //owned + QDomDocument mDomDocument; + ThumbnailManager *mThumbnailManager; //owned - QString mArtist; - QString mAlbum; - QString mTitle; - - QStringList mRecommendationAlbumArtsName; + QString mArtist; + QString mAlbum; + QString mTitle; + QString mMusicStore; + QStringList mRecommendationAlbumArtsName; - QStringList mRecommendationSongs; - QStringList mRecommendationArtists; - QStringList mRecommendationAlbumArtsLink; - QMap mRecommendationAlbumArtsMap; - int mAlbumArtsReadyCount; - QPixmap mDefaultRecommendationAlbumArt; + QStringList mRecommendationSongs; + QStringList mRecommendationArtists; + QStringList mRecommendationAlbumArtsLink; + QMap mRecommendationAlbumArtsMap; + int mAlbumArtsReadyCount; + HbIcon mDefaultRecommendationAlbumArt; + enum RequestType { NoRequest, InspireMeItemsMetadataRequest, InspireMeItemsAlbumArtRequest, LocalStoreRequest }; + RequestType mRequestType; + int mRecommendationCount; }; #endif /* MPQUERYMANAGER_H_ */ + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/inc/mpsharedata.h --- a/mpviewplugins/mpdetailsviewplugin/inc/mpsharedata.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: meta data used by publish player. -* -*/ - -#ifdef SHARE_FUNC_ENABLED - -#ifndef MPSHAREDATA_H -#define MPSHAREDATA_H - -#include -#include -#include - -class MpSongData; -class HbIcon; - -/*! - MpShareData represents the information that is - used for sharing purposes. This information includes - e.g. song information and user information. -*/ -class MpShareData : public QObject -{ - Q_OBJECT - -public: - MpShareData(); - virtual ~MpShareData(); - - void setOwner( QObject* aOwner ); - void setSongData( MpSongData* aSongData ); - void setErrorMessage( const QString& s ); - void setLanguage( const QString& s ); - void setUnknownTr( const QString& s ); - -public slots: - QObject* owner() const; - MpSongData* songData() const; - QString errorMessage() const; - void setUsername( const QString& s ); - QString username() const; - void setPassword( const QString& s ); - QString password() const; - QString objectType() const; - QString objectContent() const; - int objectReservedLength() const; - QString language() const; - QString title() const; - QString artist() const; - QString albumArtBase64() const; - -private: - QObject* mOwner; // NOT owned. - MpSongData* mSongData; // NOT owned. - QString mErrorMessage; - QString mUsername; - QString mPassword; - QString mLanguage; - QString mUnknownTr; -}; - -#endif // MPSHAREDATA_H -#endif // SHARE_FUNC_ENABLED diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/mpdetailsviewplugin.pro --- a/mpviewplugins/mpdetailsviewplugin/mpdetailsviewplugin.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/mpdetailsviewplugin.pro Fri Aug 06 16:51:36 2010 -0500 @@ -15,12 +15,12 @@ # TEMPLATE = lib -CONFIG += hb qt ecomplugin mobility SHARE_FUNC_ENABLED +CONFIG += hb qt ecomplugin QT += webkit \ network \ xml TARGET = mpdetailsviewplugin -MOBILITY += bearer systeminfo +MOBILITY += systeminfo symbian: { TARGET.UID3 = 0x2002D0AA TARGET.CAPABILITY = All -TCB @@ -42,7 +42,8 @@ -lthumbnailmanagerqt \ -lmpsettingsmanager \ -lmpengine \ - -lmpdata + -lmpdata \ + -lxqsysinfo # Input HEADERS += ../../inc/mpviewbase.h \ @@ -54,15 +55,6 @@ src/mpdetailsview.cpp \ src/mpquerymanager.cpp -# Sharing functionality -CONFIG(SHARE_FUNC_ENABLED) { - SOURCES += src/mpdetailssharedialog.cpp src/mpsharedata.cpp - HEADERS += inc/mpdetailssharedialog.h inc/mpsharedata.h - DEFINES += SHARE_FUNC_ENABLED - debug { - DEFINES += SHARE_PLAYER_RND - } -} - RESOURCES += resources/mpdetailsviewresources.qrc +DOCML += resources/mpdetailsview.docml \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/resources/index.html --- a/mpviewplugins/mpdetailsviewplugin/resources/index.html Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ - - - - - Publish - - - - - - - - - - - - - - - - -
- - diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/resources/mpdetailsview.docml --- a/mpviewplugins/mpdetailsviewplugin/resources/mpdetailsview.docml Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/resources/mpdetailsview.docml Fri Aug 06 16:51:36 2010 -0500 @@ -25,6 +25,7 @@ + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/resources/mpdetailsviewresources.qrc --- a/mpviewplugins/mpdetailsviewplugin/resources/mpdetailsviewresources.qrc Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/resources/mpdetailsviewresources.qrc Fri Aug 06 16:51:36 2010 -0500 @@ -1,13 +1,5 @@ - mpdetailsview.docml - - - qtg_large_music_album.svg - - - index.html - musiccontext.js - musiccontext.css + mpdetailsview.docml.bin diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/resources/musiccontext.css --- a/mpviewplugins/mpdetailsviewplugin/resources/musiccontext.css Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* Info */ -table.info-list { - padding-top:10px; -} - -table.info-list td { - padding: 2px 0; -} - -.info-list .description .artist { - padding-top:10px; - color:#ccc; -} - -.info-list .description .title { - -} - -.info-list .description { - display:inline-block; - padding-left:20px; - vertical-align:top; -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/resources/musiccontext.js --- a/mpviewplugins/mpdetailsviewplugin/resources/musiccontext.js Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -//Logging for QT - -// Override the default alert function. -// TODO remove this when alert in platform is working? -alert = function(str) { - console.log(str); - window.context.owner().errorHandler("Alert", str); -} - -function logme(str){ - console.log(str); - if(window['context'] && context['owner']){ - context.owner().debugJs('debugJs: ' + str); - } -} - -function traceme(){ - var cf = arguments.callee.caller; - logme('-------------- Start traceme ' + new Date().toLocaleTimeString() + ' --------------'); - var arr = new Array(); - while (cf) { - var fn = cf.toString(); - fn = fn.substr(0,fn.indexOf('{')); - arr.push(fn); - cf = cf.caller; - } - //arr.reverse(); - for(i=0;i<=arr.length -1;i++){ - logme(arr[i]); - } - logme('-------------- End traceme --------------'); -} - - -window["music"] = window["music"] || -{}; - -(function(){ - var musicContext = null; - var publishingPlayer = null; - - music.getPostContent = function(){ - traceme(); - return { - reservedLength : window.context.objectReservedLength(), - type : window.context.objectType(), - content : window.context.objectContent() - }; - } - - /** - * Call this for player to show UI and initialize connection to SNC - */ - music.initPlayer = function() - { - traceme(); - // Initialize player - publishingPlayer = new ovi.player.publish.Player({ - locale : window.context.language(), - credentials : { - type : "", - sso_base_url : "", - token : _getNoa() - } - }); - - // Show UI - publishingPlayer.create(null, function(status, data){ - traceme(); - if (status != publishingPlayer.status.updateservices_ok && status != publishingPlayer.status.show_ok) { - // Delegate errors to native side - window.context.owner().errorHandler(status, data.message); - } - }); - - } - - /** - * Call this for player to update context area (the song UI). - */ - music.updateContextArea = function() { - // Update artist and title metadata. - traceme(); - publishingPlayer.setContextObject(_getMusicContext()); - if(window['context'] && context['owner']){ - context.owner().showWindow(); - } -} - - /** - * Call this function to update metadata (called when music player has retrieved the link) - */ - music.updateMetadata = function() { - // Update url at bottom of comment field. - traceme(); - musicContext.updateObject(music.getPostContent()); - } - - /** - * Call this function to release all resources from player. - */ - music.teardown = function() { - traceme(); - publishingPlayer.cancel(); - } - - // Private functions, read data from native side.. - function _playerReady() { - traceme(); - return typeof ovi != "undefined" && - typeof ovi.player != "undefined" && - typeof ovi.player.publish != "undefinded"; - } - - - function _getMusicContext() { - traceme(); - musicContext = new ovi.player.contextobject.Player(); - - var attachment = music.getPostContent(); - - logme('music._getMusicContext() | attachment'); - - logme('music._getMusicContext() | musicContext.create'); - - var sharePlayerArtImage = ""; - var sharePlayerArtBase64 = window.context.albumArtBase64(); - if ( sharePlayerArtBase64.length > 0 ) { - // TODO: this is temporary solution until base64 defect in QT is fixed. - sharePlayerArtImage = ""; -// sharePlayerArtImage = ""; - } - // Create context object - musicContext.create({ - view: "none", - data: { - miniview: "" - /* - // TODO REMOVE, for testing only - + "" - */ - + sharePlayerArtImage - + "
" - + "" - + "
" + window.context.title() + "
" - + "
" + window.context.artist() + "
" - + "
" - + "
", - object: attachment - } - }); - return musicContext; - } - - function _getNoa() { - traceme(); - // temporary solution until SSO token get from QT SSO DE (now we fetch username, password and re-authenticate using api.ovi.com) - var token = (window.context.username)? [window.context.username(),window.context.password()] : window.context.token.split(":"); - logme(token[0] + "/" + token[1]); - return { - username: token[0], - password: token[1] - } - } -})(); diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/resources/ovicredentials.txt --- a/mpviewplugins/mpdetailsviewplugin/resources/ovicredentials.txt Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -hipsu:hipsupass diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/resources/qtg_large_music_album.svg --- a/mpviewplugins/mpdetailsviewplugin/resources/qtg_large_music_album.svg Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/src/mpdetailssharedialog.cpp --- a/mpviewplugins/mpdetailsviewplugin/src/mpdetailssharedialog.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,569 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation for share player. -* -*/ - -#ifdef SHARE_FUNC_ENABLED - -#include "mpdetailssharedialog.h" -#include "mpsharedata.h" -#include "mpsongdata.h" -#include "mptrace.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QTM_USE_NAMESPACE - -// SHARE_INDEX_FILE defines where the index.html file is loaded from. -#define SHARE_INDEX_URL "qrc:///shareview/index.html" - -#ifdef Q_OS_SYMBIAN -// Symbian target. -#ifdef SHARE_PLAYER_RND -// For R&D testing, index.html may be loaded from E: drive. -// User must manually place index.html in the correct location. -// If the RND file does not exist, then SHARE_INDEX_URL will be used. -#define RND_SHARE_INDEX_URL "file:///f:/index.html" -#define RND_SHARE_INDEX_FILE "f:\\index.html" -#define RND_OVI_LOGIN_FILE "f:\\ovicredentials.txt" -#endif -#else -// Assume Windows target. -#define RND_SHARE_INDEX_URL "file:///c:/temp/index.html" -#define RND_SHARE_INDEX_FILE "c:\\temp\\index.html" -#define RND_OVI_LOGIN_FILE "c:\\temp\\ovicredentials.txt" - -#endif - -// Default language in case QSystemInfo does not work. -#define DEFAULT_LANGUAGE "en-US" - -// Default error message. -#define ERROR_MESSAGE "An error occured. Sharing is not currently available" - - -/*! - MpNetworkAccessManager allows local caching of publishing player files - in order to minimize network traffic. - The files will be cached to the private directory of the application, - i.e. in the music player's case, this is C:\Private\10207C62\Cache. - */ -class MpNetworkAccessManager : public QNetworkAccessManager -{ -public: - MpNetworkAccessManager( QObject* parent = 0 ) - : QNetworkAccessManager( parent ) - { - proxyFactory()->setUseSystemConfiguration( true ); - QNetworkDiskCache* diskCache = new QNetworkDiskCache( this ); - QString location = QDesktopServices::storageLocation( QDesktopServices::CacheLocation ); - diskCache->setCacheDirectory( location ); - setCache( diskCache ); - } - -private: - QNetworkReply* createRequest( Operation op, - const QNetworkRequest &request, - QIODevice* outgoingData = 0 ) - { - TX_ENTRY - TX_LOG_ARGS( "share: createRequest URL=" << request.url().toString() ) - - QVariant val = request.attribute( QNetworkRequest::CacheLoadControlAttribute ); - - // Change the cache load control attrbute! - QNetworkRequest req = request; - req.setAttribute( QNetworkRequest::CacheLoadControlAttribute, - QVariant( QNetworkRequest::PreferCache ) ); - QNetworkReply* result = QNetworkAccessManager::createRequest( op, req, outgoingData ); - TX_EXIT - return result; - } -}; - -/*! - MpShareWebView derives from QGraphicsWebView in order to override it's - contextMenuEvent method to prevent the background context menu from - being displayed when user makes long click in the web view. - */ -class MpShareWebView : public QGraphicsWebView -{ -public: - MpShareWebView( QGraphicsItem * parent = 0 ) - : QGraphicsWebView( parent ) - { - settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls, true ); - settings()->setAttribute( QWebSettings::LocalStorageDatabaseEnabled, true ); - settings()->enablePersistentStorage(); - } - -protected: - void contextMenuEvent( QGraphicsSceneContextMenuEvent* /*ev*/ ) // Override QGraphicsWebView::contextMenuEvent - { - // Fix to prevent "Stop" and "Reload" buttons in page background. - // Do not respond to the contextMenuEvent. - } -}; - - -/*! - Constructor. - */ -MpDetailsShareDialog::MpDetailsShareDialog() - : mShareWebView( 0 ), - mShareNetAccMan( 0 ), - mProgressbar ( 0 ), - mIsInitialized( false ) -{ - // DeleteOnClose attribute prevents crash when user presses Cancel - // before publishing player is fully loaded. - setAttribute( Qt::WA_DeleteOnClose, true ); -} - -/*! - Initialize the share dialog. - When fully initialized we set our mIsInitialized flag to true. - Our isInitialized() method can be called to determine whether - initialization was successful. - */ -void MpDetailsShareDialog::initialize( MpSongData* aSongData, const QString& aUnknownTr ) -{ - TX_ENTRY - if ( !initUser() ) - { - emit closeShareDialog(); - return; - } - initShareData( aSongData, aUnknownTr ); - initLanguage(); - initNetworkAccessManager(); - initWebView(); - initSignalSlots(); - - setDismissPolicy( HbDialog::NoDismiss ); - - // No timeout needed for the dialog. - setTimeout( HbPopup::NoTimeout ); - -#ifdef SHARE_PLAYER_RND - // Test whether the RND file exists. - QFile file( RND_SHARE_INDEX_FILE ); - if ( file.exists() ) - { - // Load the RND URL from the specified location to the web view. - TX_LOG_ARGS( "share: Use RND index.html file " << RND_SHARE_INDEX_FILE ) - mShareWebView->load( QUrl( RND_SHARE_INDEX_URL ) ); - } - else -#endif - { - // Load the production URL from the application resources to the web view. - TX_LOG_ARGS( "share: Use QRC index.html file " << SHARE_INDEX_URL ) - mShareWebView->load( QUrl( SHARE_INDEX_URL ) ); - } - - // Flag that the dialog is now fully initialized. - mIsInitialized = true; - - // Show progress dialog in .3 second if loading not finished. - QTimer::singleShot(300, this, SLOT(showProgressDialog())); - - TX_EXIT -} - -/*! - Destructor. - */ -MpDetailsShareDialog::~MpDetailsShareDialog() -{ - TX_ENTRY - if ( mShareData.songData() ) - { - // Ensure that we remove the temporary album art file when we close the dialog. - // TODO this should be removed when base64 issue is solved. - TX_LOG_ARGS( "share: remove album art file" ) - mShareData.songData()->removeAlbumArtFile(); - } - logoutPlayer(); - // Probably mShareNetAccMan should not be deleted but qt documentation - // does not indicate whether QWebPage takes ownership of the object or not. - // See http://doc.qt.nokia.com/4.6/qwebpage.html - //delete mShareNetAccMan; - TX_EXIT -} - -/*! - Initialize share data. - */ -void MpDetailsShareDialog::initShareData( MpSongData* aSongData, const QString& aUnknownTr ) -{ - TX_ENTRY - // Set information for the share data. - mShareData.setOwner( this ); - mShareData.setSongData( aSongData ); - mShareData.setErrorMessage( tr( ERROR_MESSAGE ) ); - mShareData.setUnknownTr( aUnknownTr ); - TX_EXIT -} - -/*! - Initialize language. - Language string is formatted like "en-US", where "en" is the ISO-639-1 language code, - and "US" is the ISO-3166-1 country code. - We use the QT Mobility API (systeminfo) to obtain the settings from the device. - In the event that we cannot construct the QSystemInfo variable then we will fallback - to some DEFAULT_LANGUAGE setting. - */ -void MpDetailsShareDialog::initLanguage() -{ - TX_ENTRY - // Set language string, example "en-US". - QString language; - QSystemInfo* sysInfo = new QSystemInfo( this ); - if ( sysInfo ) - { - language += sysInfo->currentLanguage(); // ISO-639-1 language code. - language += "-"; - language += sysInfo->currentCountryCode(); // ISO-3166-1 country code. - delete sysInfo; - } - else - { - // Fallback to the default language. - language = DEFAULT_LANGUAGE; - } - TX_LOG_ARGS( "share: language '" << language << "'" ) - mShareData.setLanguage( language ); - TX_EXIT -} - -/*! - Initialize network access manager. - */ -void MpDetailsShareDialog::initNetworkAccessManager() -{ - TX_ENTRY - // Make our own network access manager to allow file retrieval from local cache, - // since configuration for the default network access manager seems to be - // to always redownload from network. - if ( !mShareNetAccMan ) - { - TX_LOG_ARGS( "share: construct network access manager" ) - mShareNetAccMan = new MpNetworkAccessManager( this ); - } - TX_EXIT -} - -/*! - Initialize the web view. - */ -void MpDetailsShareDialog::initWebView() -{ - TX_ENTRY - if ( !mShareWebView ) - { - TX_LOG_ARGS( "share: construct share web view" ) - mShareWebView = new MpShareWebView( this ); - mShareWebView->page()->setNetworkAccessManager( mShareNetAccMan ); - mShareWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); - mShareWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); - setContentWidget( mShareWebView ); - addContext(); - mProgressbar = new HbProgressDialog(HbProgressDialog::WaitDialog); - mProgressbar->setText(tr("Loading")); - } - TX_EXIT -} - -/*! - Initialize signals and slots. - */ -void MpDetailsShareDialog::initSignalSlots() -{ - TX_ENTRY - // Connect various signals to slots for networking. - connect( mShareNetAccMan, SIGNAL( sslErrors( QNetworkReply*, const QList< QSslError >& ) ), - this, SLOT( handleRequestSSLErrors( QNetworkReply*, const QList< QSslError >& ) ) ); - connect( mShareNetAccMan, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( handleRequestFinished( QNetworkReply* ) ) ); - - // Connect various signals to slots for interface to webview. - connect( mShareWebView, SIGNAL( loadFinished( bool ) ), SLOT( onIndexLoad( bool ) ) ); - connect( mShareWebView->page()->mainFrame(), SIGNAL( javaScriptWindowObjectCleared() ), this, SLOT( addContext() ) ); - connect( mShareWebView->page(), SIGNAL( windowCloseRequested() ), this, SIGNAL( closeShareDialog() ) ); - connect( mProgressbar, SIGNAL(cancelled()), this, SIGNAL( closeShareDialog() ) ); - TX_EXIT -} - -/*! - initUser is used as temporary solution until Single Sign On is implemented in platform. - */ -bool MpDetailsShareDialog::initUser() -{ - TX_ENTRY - bool result = false; -#ifdef SHARE_PLAYER_RND - // ovicredentials.txt is used as temporary solution until Single Sign On is implemented in platform. - QFile file( RND_OVI_LOGIN_FILE ); - if ( !file.open( QFile::ReadOnly ) ) - { - // There must be e:ovicredentials.txt in the filesystem but don't show error dialog - // otherwise it will appear as soon as detailsview is created. - result = false; - } - else - { - QTextStream stream ( &file ); - QString strCred = stream.readLine( 0 ); - file.close(); - QStringList slCred = strCred.split( ":" ); - if ( slCred.length() > 1 ) - { - mShareData.setUsername( slCred[ 0 ] ); - mShareData.setPassword( slCred[ 1 ] ); - result = true; - } - else - { - errorHandler( "share", QString( RND_OVI_LOGIN_FILE ) + " username:password expected" ); - } - } - TX_LOG_ARGS( "share: credentials " << mShareData.username() << " / " << mShareData.password() ) -#else - // TODO: Single Sign On stuff. -#endif // SHARE_PLAYER_RND - TX_EXIT - return result; -} - -/*! - Returns true if the dialog has been fully initialized. - */ -bool MpDetailsShareDialog::isInitialized() const -{ - return mIsInitialized; -} - -/*! - Attempt to cache the publishing player files from internet - to improve user experience for first-time use. - If the files are already in the cache and have not expired, - then this should not do anything. - */ -void MpDetailsShareDialog::cachePublishingPlayerFiles() -{ - TX_ENTRY - // We need the network access manager, so make sure it is initialized. - if ( !mShareNetAccMan ) - { - initNetworkAccessManager(); - } - // Attempt to get the required publishing player files from the net in advance. - // We don't listen to any signal that the download succeeded or failed - // since we will let it silently fail at this stage. - // These URLs are also included in index.html resource, and the two must - // be kept the same. - mShareNetAccMan->get( QNetworkRequest( QUrl( - "http://hf.ci.wipsl.com/PleiXXPTsup/noheva-be/css/ovi.player.share.ui.css" ) ) ); - mShareNetAccMan->get( QNetworkRequest( QUrl( - "http://hf.ci.wipsl.com/PleiXXPTsup/noheva-be/js/publishplayer.js" ) ) ); - TX_EXIT -} - -/*! - Release resources from share player. - */ -void MpDetailsShareDialog::logoutPlayer() -{ - TX_ENTRY - if ( mShareWebView ) - { - mShareWebView->page()->mainFrame()->evaluateJavaScript( "music.teardown();" ); - } - TX_EXIT -} - -/*! - Adds the shared data context to the javascript of the loaded page. - */ -void MpDetailsShareDialog::addContext() -{ - TX_ENTRY - if ( mShareWebView ) - { - mShareWebView->page()->mainFrame()->addToJavaScriptWindowObject( "context", &mShareData ); - } - TX_EXIT -} - -/*! - Updates the shared data context in the javascript of the loaded page. - */ -void MpDetailsShareDialog::updateSharedData() -{ - TX_ENTRY - if ( mShareWebView ) - { - // We don't need to call updateContextArea when the track URL has been updated. - //mShareWebView->page()->mainFrame()->evaluateJavaScript( "music.updateContextArea();" ); - mShareWebView->page()->mainFrame()->evaluateJavaScript( "music.updateMetadata();" ); - } - TX_EXIT -} - -/*! - Slot to call when index.html loading completes. - */ -void MpDetailsShareDialog::onIndexLoad( bool aOk ) -{ - TX_ENTRY - if ( !aOk ) - { - // Close the popup window, failed to load index.html. - // This is pretty serious and most likely unrecoverable error. - // Only thing we can do really is to close the share player - // dialog - TODO do we need to show any error message to user? - TX_LOG_ARGS( "share: failed to load index.html" ) - emit closeShareDialog(); - } - TX_EXIT -} - -/*! - Slot to call for debug output. - */ -void MpDetailsShareDialog::debugJs( QString s ) -{ - TX_ENTRY - Q_UNUSED(s); - - TX_EXIT -} - -/*! - Slot to call for displaying an error message to the user. - */ -void MpDetailsShareDialog::errorHandler( QString aError, QString aMessage ) -{ - TX_ENTRY - // If error argument ends with "_SUCCESS", then this should be an info message. - // If error argument ends with "_FAILED" or something else, then this should be a warning message. - TX_LOG_ARGS( "share: errorHandler: " << aError << ": " << aMessage ) - if ( aError.endsWith( "_SUCCESS" ) ) - { - // TODO this method seems to be deprecated? - HbMessageBox::information( tr( "%1" ).arg( aError ) + ": " + tr( "%1" ).arg( aMessage ) ); // For week16 hbwidgets - } - else - { - // TODO this method seems to be deprecated? - HbMessageBox::warning( tr( "%1" ).arg( aError ) + ": " + tr( "%1" ).arg( aMessage ) ); // For week16 hbwidgets - // HbMessageBox::launchWarningMessageBox( tr( "%1" ).arg( aError ) + ": " + tr( "%1" ).arg( message ) ); // For week12 hbwidgets - } - TX_EXIT -} - -/*! - Slot to call to clear the web view cache. - */ -void MpDetailsShareDialog::clearCache() -{ - TX_ENTRY - QAbstractNetworkCache* cache = mShareNetAccMan ? mShareNetAccMan->cache() : NULL; - if ( cache ) - { - TX_LOG_ARGS( "share: clearCache: clearing cache" ) - cache->clear(); -#ifdef SHARE_PLAYER_RND - errorHandler( "Cache", "Cleared cache!" ); -#endif - } - else - { - TX_LOG_ARGS( "share: clearCache: unable to clear cache" ) -#ifdef SHARE_PLAYER_RND - errorHandler( "Cache", "Could not clear cache!" ); -#endif - } - TX_EXIT -} - -/*! - Slot to show the publishing window after html elements are created in javascript. - */ -void MpDetailsShareDialog::showWindow() -{ - TX_ENTRY - if (mProgressbar) - mProgressbar->close(); - show(); - TX_EXIT -} - -/*! - Slot to show progress dialog if the publishing window is not loaded in .3 sec. - */ -void MpDetailsShareDialog::showProgressDialog() -{ - TX_ENTRY - if (!isVisible()) - mProgressbar->show(); - TX_EXIT -} - -/*! - Slot to SSL errors in network request. We will ignore any errors. - */ -void MpDetailsShareDialog::handleRequestSSLErrors( QNetworkReply* aReply, const QList< QSslError >& aErrors ) -{ - TX_ENTRY - aReply->ignoreSslErrors(); - for( int i = 0; i < aErrors.count(); i++ ) - { - TX_LOG_ARGS( "SSL error " << aErrors.at( i ).errorString() ); - } - TX_EXIT -} - -/*! - Slot to handle network request completion. - */ -void MpDetailsShareDialog::handleRequestFinished( QNetworkReply* aReply ) -{ - TX_ENTRY - if ( aReply->error() != QNetworkReply::NoError ) - { - TX_LOG_ARGS( "Network request error " << aReply->error() << aReply->errorString() ); - // TODO what to do now? - } - TX_EXIT -} - -#endif // SHARE_FUNC_ENABLED diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp --- a/mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -23,7 +23,7 @@ #include #include #include - +#include #include @@ -49,12 +49,7 @@ #include "mpquerymanager.h" #include "mptrace.h" -#ifdef SHARE_FUNC_ENABLED -#include "mpdetailssharedialog.h" -#endif - -const int KRecommendationCount = 2; const int KOneKiloByteInBytes = 1024; const int KOneMegabyteInBytes = 1048576; const int KOneGigaByteInBytes = 134217728; @@ -73,19 +68,13 @@ mAlbumArt( 0 ), mSongDetailsGroupBox(0), mInspireMeGroupBox(0), - mShareButton(0), mDocumentLoader( 0 ), mDetailList(0), mInspireList(0), mInspireMeProgressBar(0), mMpQueryManager( 0 ), mInspireMeQueryOngoing( false ), - mInspireMeQueryRendered( false ), - mInspireMeOpen(true), - mSongDetailsGbOpen(false) -#ifdef SHARE_FUNC_ENABLED - , mSharePopup( 0 ) -#endif + mInspireMeQueryRendered( false ) { TX_ENTRY bool widgetsOk = false; @@ -112,10 +101,6 @@ TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for : " << (int)(widget) ); setWidget( qobject_cast(widget) ); - widget = mDocumentLoader->findWidget( QString("shareButton") ); - mShareButton = qobject_cast(widget); - TX_LOG_ARGS("MpDetailsView() widget found mShareButton: " << (int)(mShareButton) ); - widget = mDocumentLoader->findWidget( QString("trackTitle") ); mSongText = qobject_cast(widget); TX_LOG_ARGS("MpDetailsView() widget found mSongText: " << (int)(mSongText) ); @@ -157,7 +142,8 @@ mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), QString( "ShowInspireMe" ), &loadingSectionOk ); if( loadingSectionOk ) { TX_LOG_ARGS( "Loading ShowInspireMe section is successful." ); - } else { + } + else { TX_LOG_ARGS( "Loading ShowInspireMe section fails." ); } @@ -170,13 +156,11 @@ MpDetailsView::~MpDetailsView() { TX_ENTRY + saveGroupBoxStates(); delete mSoftKeyBack; delete mDocumentLoader; delete mMpQueryManager; -#ifdef SHARE_FUNC_ENABLED - closeShareDialog(); -#endif TX_EXIT } @@ -201,19 +185,24 @@ connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) ); connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) ); connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) ); + connect( mDetailList, SIGNAL( pressed( HbListWidgetItem * ) ), this, SLOT( handleListItemSelected( HbListWidgetItem * ) ) ); connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) ); connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) ); - connect( mMpQueryManager, SIGNAL( networkError() ), this ,SLOT( handleNetworkError() ) ); - connect( mMpQueryManager, SIGNAL(searchUrlRetrieved(const QString&)), this, SLOT(updateSharedData(const QString&))); - connect( mMpQueryManager, SIGNAL(recommendationAlbumArtsReady()), this, SLOT(RenderInspireMeGroupBox())); + connect( mMpQueryManager, SIGNAL(inspireMeItemsMetadataRetrieved()), this, SLOT(renderInspireMeMetadata())); + connect( mMpQueryManager, SIGNAL(inspireMeItemAlbumArtReady()), this, SLOT(renderInspireMeAlbumArts())); + connect( mMpQueryManager, SIGNAL(localMusicStoreRetrieved(bool)), this, SLOT(queryInspireMe(bool)), Qt::QueuedConnection); + connect( mMpQueryManager, SIGNAL(localMusicStoreRetrievalError()), this, SLOT(abortInspireMeProcess())); + connect( mMpQueryManager, SIGNAL(inspireMeItemsRetrievalError()), this, SLOT(queryLocalMusicStore()), Qt::QueuedConnection); -#ifdef SHARE_FUNC_ENABLED - connect( mShareButton, SIGNAL( clicked() ), this, SLOT( share() ) ); + TX_EXIT +} - // Preload the share popup - preloadShareDialog(); -#endif - TX_EXIT +void MpDetailsView::queryLocalMusicStore() +{ + TX_ENTRY + mMpQueryManager->reset(); + mMpQueryManager->queryLocalMusicStore(); + TX_EXIT } /*! @@ -225,12 +214,10 @@ setNavigationAction( mSoftKeyBack ); mActivated = true; - mInspireMeOpen = MpSettingsManager::inspireMe(); - mSongDetailsGbOpen = MpSettingsManager::songDetailsGb(); - TX_LOG_ARGS( "InspireMeVal: " << mInspireMeOpen ); - TX_LOG_ARGS( "SongDetailsGbVal: " << mSongDetailsGbOpen ); - mInspireMeGroupBox->setCollapsed(!mInspireMeOpen); - mSongDetailsGroupBox->setCollapsed(!mSongDetailsGbOpen); + TX_LOG_ARGS( "InspireMeVal: " << MpSettingsManager::inspireMe() ); + TX_LOG_ARGS( "SongDetailsGbVal: " << MpSettingsManager::songDetailsGb() ); + mInspireMeGroupBox->setCollapsed(!MpSettingsManager::inspireMe()); + mSongDetailsGroupBox->setCollapsed(!MpSettingsManager::songDetailsGb()); TX_EXIT } @@ -240,23 +227,31 @@ void MpDetailsView::deactivateView() { TX_ENTRY - if (mInspireMeGroupBox->isCollapsed() ) { - MpSettingsManager::setInspireMe(false); - } else { - MpSettingsManager::setInspireMe(true); - } - - if (mSongDetailsGroupBox->isCollapsed() ) { - MpSettingsManager::setSongDetailsGb(false); - } else { - MpSettingsManager::setSongDetailsGb(true); - } - + saveGroupBoxStates(); setNavigationAction( 0 ); mActivated = false; TX_EXIT } +void MpDetailsView::saveGroupBoxStates() +{ + TX_ENTRY + if (mInspireMeGroupBox->isCollapsed() ) { + MpSettingsManager::setInspireMe(false); + } + else { + MpSettingsManager::setInspireMe(true); + } + + if (mSongDetailsGroupBox->isCollapsed() ) { + MpSettingsManager::setSongDetailsGb(false); + } + else { + MpSettingsManager::setSongDetailsGb(true); + } + TX_EXIT +} + /*! Setup the menu. */ @@ -292,29 +287,33 @@ /*! Slot to handle network error. */ -void MpDetailsView::handleNetworkError() +void MpDetailsView::abortInspireMeProcess() { TX_ENTRY + mInspireMeProgressBar->hide(); + mInspireMeGroupBox->setCollapsed( true ); mInspireMeQueryOngoing = false; mInspireMeQueryRendered = false; - clearInspireMe(); - mInspireMeGroupBox->setCollapsed( true ); + // ensure that we dont get callbacks from previous queries. Especially true, + // if details view is actived with a quick song change again + mMpQueryManager->reset(); + mInspireList->clear(); TX_EXIT } /*! Render inspireme groupbox after album arts downloaded */ -void MpDetailsView::RenderInspireMeGroupBox() +void MpDetailsView::renderInspireMeMetadata() { TX_ENTRY mInspireMeQueryOngoing = false; mInspireMeQueryRendered = true; mInspireMeProgressBar->hide(); - if( mMpQueryManager->recommendationAlbumArtsMap().count() ) { + if( mMpQueryManager->recommendationsCount() ) { TX_LOG_ARGS( "There are recommendations." ) // we have recommendations - for ( int i = 0; i < KRecommendationCount; i++ ) { + for ( int i = 0; i < mMpQueryManager->recommendationsCount(); ++i ) { // configure the layout properties if(!mInspireList->count()) { // we havent configured the prototype before @@ -323,15 +322,14 @@ } // create the item HbListWidgetItem *inspireMeItem = new HbListWidgetItem(); - HbIcon icon( QIcon( mMpQueryManager->recommendationAlbumArtsMap().value(mMpQueryManager->recommendationAlbumArtsLink().at( i ) ) ) ); - inspireMeItem->setIcon( icon ); - inspireMeItem->setText( mMpQueryManager->recommendationSongs().at( i ) ); - inspireMeItem->setSecondaryText( mMpQueryManager->recommendationArtists().at( i ) ); + inspireMeItem->setIcon( mMpQueryManager->recommendedAlbumArt( i )); + inspireMeItem->setText( mMpQueryManager->recommendedSong( i ) ); + inspireMeItem->setSecondaryText( mMpQueryManager->recommendedArtist( i ) ); mInspireList->addItem( inspireMeItem ); } } else { - TX_LOG_ARGS( "There is NO recommendation." ) + TX_LOG_ARGS( "There are NO recommendations" ) // we dont have recommendations // we havent configured the prototype before HbListViewItem *prototype = mInspireList->listItemPrototype(); @@ -347,31 +345,33 @@ TX_EXIT } -bool MpDetailsView::canQueryRecommendations() const +void MpDetailsView::renderInspireMeAlbumArts() +{ + TX_ENTRY + for( int i = 0; i < mInspireList->count(); ++i) { + mInspireList->item(i)->setIcon( mMpQueryManager->recommendedAlbumArt( i ) ); + } + TX_EXIT +} + +bool MpDetailsView::isMetadata() const { bool result = ( ( !mSongData->album().isEmpty() ) || - ( !mSongData->artist().isEmpty() ) ) && - !( mInspireMeGroupBox->isCollapsed() ); - TX_LOG_ARGS( "Can query recommendations:" << result ); + ( !mSongData->artist().isEmpty() ) ); + TX_LOG_ARGS( "Inspire Me Query metadata available:" << result ); return result; } -bool MpDetailsView::canQuerySharePlayerLink() const -{ - bool result = ( !mSongData->title().isEmpty() ) && - ( !mSongData->artist().isEmpty() ) ; - TX_LOG_ARGS( "Can query share player link:" << result ); - return result; -} - /*! Slot to handle basic song information */ void MpDetailsView::handlePlaybackInfoChanged() { TX_ENTRY - mMpQueryManager->clearNetworkReplies(); - clearInspireMe(); + // ensure that we dont get callbacks from previous queries. Especially true, + // if details view is actived with a quick song change again + mMpQueryManager->reset(); + mInspireList->clear(); mInspireMeQueryRendered = false; // Clear the song data link until new query has been made. @@ -379,50 +379,53 @@ if ( !mSongData->title().isEmpty () ) { mSongText->setPlainText( mSongData->title() ); - } else { + } + else { mSongText->setPlainText( mSongData->fileName() ); } if ( !mSongData->album().isEmpty () ) { mAlbumText->setPlainText( mSongData->album() ); - } else { + } + else { mAlbumText->setPlainText( hbTrId( "txt_mus_other_unknown7") ); } if ( !mSongData->artist().isEmpty() ) { mArtistText->setPlainText( mSongData->artist() ); - } else { + } + else { mArtistText->setPlainText( hbTrId( "txt_mus_other_unknown6") ); } - if (canQuerySharePlayerLink() ) { - mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title()); - } - - if (canQueryRecommendations()) { - // start inspire me area progress bar - // TODO: currently, till we get to this callback from MPX the bar not shown - // TODO: check if inspireMe is ON, if not, dont show - mInspireMeProgressBar->show(); - mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); - mInspireMeQueryOngoing = true; - } - else { - // metadata to query for inspire me items not available - // show information note - if (!mInspireMeGroupBox->isCollapsed()) - RenderInspireMeGroupBox(); + if(!mInspireMeGroupBox->isCollapsed()) { + startInspireMe(); } TX_EXIT } -void MpDetailsView::clearInspireMe() +void MpDetailsView::startInspireMe() { - TX_ENTRY - mInspireList->clear(); - mMpQueryManager->clearRecommendations(); - TX_EXIT + TX_ENTRY + if(isMetadata()) { + // show progress bar, start store query or inspire me query process + mInspireMeProgressBar->show(); + mInspireMeQueryOngoing = true; + if( mMpQueryManager->isLocalMusicStore() ) { + mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); + } + else { + // no local store information present + mMpQueryManager->queryLocalMusicStore(); + } + } + else { + // no metadata. show no recommendations + renderInspireMeMetadata(); + } + TX_EXIT } + /*! Slot to handle detail song information */ @@ -495,7 +498,7 @@ TX_LOG_ARGS("Warning: If zero, bitrate is not read correctly. It wont show up in details" << ok); if(ok) { item->setSecondaryText( hbTrId("txt_mus_dblist_bitrate_val_ln_kbps", bitRate) ); - } + } item->setEnabled( false ); mDetailList->addItem( item ); } @@ -508,7 +511,7 @@ TX_LOG_ARGS("Warning: If zero, sampling rate is not read correctly. It wont show up in details" << ok); if(ok) { item->setSecondaryText( hbTrId("txt_mus_dblist_sampling_rate_val_ln_hz", samplingRate) ); - } + } item->setEnabled( false ); mDetailList->addItem( item ); } @@ -522,15 +525,18 @@ if( size < KOneKiloByteInBytes) { // under 1 KB item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_b", size) ); - } else if( size < KOneMegabyteInBytes ) { + } + else if( size < KOneMegabyteInBytes ) { // under 1 MB size /= KOneKiloByteInBytes; // turn size into KB item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_kb", size) ); - } else if( size < KOneGigaByteInBytes ) { + } + else if( size < KOneGigaByteInBytes ) { // under 1 GB size /= KOneMegabyteInBytes; // turn size to MB item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_mb", size) ); - } else { + } + else { // 1 GB or higher size /= KOneGigaByteInBytes; // turn size to GB item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_gb", size) ); @@ -592,108 +598,52 @@ if ( mInspireMeQueryOngoing ) { TX_LOG_ARGS( "Query is ongoing " ) mInspireMeProgressBar->show(); - } else { + } + else { TX_LOG_ARGS( "Query is NOT ongoing " ) if ( mInspireMeQueryRendered ) { TX_LOG_ARGS( "InspireMe is rendered already. " ) mInspireMeProgressBar->hide(); - } else { - if ( canQueryRecommendations() ) { - TX_LOG_ARGS( "InspireMe is NOT rendered yet but can query for recommendations. " ) - mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); - mInspireMeProgressBar->show(); - mInspireMeQueryOngoing = true; - } else { - TX_LOG_ARGS( "InspireMe is NOT rendered yet and CANNOT query for recommendations either. " ) - RenderInspireMeGroupBox(); - } + } + else { + startInspireMe(); } } - } else { + } + else { TX_LOG_ARGS( "InspireMe is collapsed." ) mInspireMeProgressBar->hide(); } TX_EXIT } -#ifdef SHARE_FUNC_ENABLED /*! - Slot to be called when share button is clicked - */ -void MpDetailsView::share() + Slot to call when URL item in song details is pressed +*/ +void MpDetailsView::handleListItemSelected( HbListWidgetItem *item) { - TX_ENTRY - createShareDialog(); - if (canQuerySharePlayerLink() ) - { - mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title() ); - } - TX_EXIT -} - -/*! - Method to create the share dialog on demand. - This will cause the share web view to be created and start loading. - */ -void MpDetailsView::createShareDialog() -{ - TX_ENTRY - if ( !mSharePopup ) - { - mSharePopup = new MpDetailsShareDialog(); - } - if ( !mSharePopup->isInitialized() ) - { - connect( mSharePopup, SIGNAL( closeShareDialog() ), this, SLOT( closeShareDialog() ) ); - // TODO: Ask for a localization string for this, there is none in text map - mSharePopup->initialize( mSongData, tr( "Unknown" ) ); - } + TX_ENTRY_ARGS( "URL: " << item->secondaryText() ); + QDesktopServices::openUrl( item->secondaryText() ); TX_EXIT } /*! - Method to create the share dialog on demand and preload publishing player files. - This will construct the share dialog but it will still be in "uninitialized" state. - */ -void MpDetailsView::preloadShareDialog() + Slot to call when MusicStore Info is Received +*/ +void MpDetailsView::queryInspireMe(bool storeUpdated) { TX_ENTRY - if ( !mSharePopup ) - { - mSharePopup = new MpDetailsShareDialog(); + // we asked query manager to update its local store information + // if that store info didnt change (i.e. from empty string to "fi" or + // from "bad old store" to "good new store") then we dont need to pursue a query + if( storeUpdated ) { + mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); + mInspireMeQueryOngoing = true; } - mSharePopup->cachePublishingPlayerFiles(); + else { + mInspireMeQueryOngoing = false; + mInspireMeProgressBar->hide(); + } TX_EXIT } -/*! - Slot to be called when ok/close button in share dialog is pressed. - */ -void MpDetailsView::closeShareDialog() -{ - TX_ENTRY - if ( mSharePopup ) - { - // Dialog uses WA_DeleteOnClose so no need to delete it explicitely here, just close it. - mSharePopup->close(); - mSharePopup = NULL; - } - TX_EXIT -} -#endif - -/*! - Slot to handle the music store URL retrieval from the query manager. -*/ -void MpDetailsView::updateSharedData(const QString& url) -{ - TX_ENTRY - mSongData->setLink( url ); -#ifdef SHARE_FUNC_ENABLED - if ( mSharePopup ) - { - mSharePopup->updateSharedData(); - } -#endif - TX_EXIT -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/src/mpquerymanager.cpp --- a/mpviewplugins/mpdetailsviewplugin/src/mpquerymanager.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/src/mpquerymanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -30,12 +30,12 @@ #include #include #include +#include #include #include #include -#include "mpdetailssharedialog.h" #include "mptrace.h" const int KUndefined = -1; @@ -43,8 +43,11 @@ MpQueryManager::MpQueryManager() : mManager(0), - mDownloadManager(0), - mThumbnailManager(0) + mAlbumArtDownloader(0), + mThumbnailManager(0), + mDefaultRecommendationAlbumArt("qtg_large_album_art"), + mRequestType(NoRequest), + mRecommendationCount(0) { TX_ENTRY @@ -56,56 +59,57 @@ bool res = dir.mkdir( newDir ); TX_LOG_ARGS( "New dir creation result: " << res); - // We're not handling a negative result for directory creation here, - // instead it will be escalated in DownloadFinished() method. + // TODO: Instead of writing the album art to a file, + // then using Thumbnail Manager to convert it, etc. + // have you considered just loading it directly into QPixmap? + // QPixmap provides a loadFromData() that can load from QByteArray. + // This would not only make the availability of the album art immediate, + // but also save a lot of cleanup in file system, thumbnail manager, etc. privatePathQt = privatePathQt + "/detailsview"; QString albumArt1( privatePathQt + "/albumOne.png" ); QString albumArt2( privatePathQt + "/albumTwo.png" ); mRecommendationAlbumArtsName << albumArt1 << albumArt2; TX_LOG_ARGS( "recommendation album art names: " << mRecommendationAlbumArtsName ); - mManager = new QNetworkAccessManager( this ); - - mDownloadManager = new QNetworkAccessManager( this ); - connect( mDownloadManager, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( DownloadFinished( QNetworkReply * ) ) ); - + mManager = new QNetworkAccessManager( this ); + mAlbumArtDownloader = new QNetworkAccessManager( this ); // TODO: check if we can only use mManager mThumbnailManager = new ThumbnailManager( this ); mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality ); mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailSmall ); - QObject::connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), - this, SLOT( thumbnailReady( QPixmap , void * , int , int ) ) ); - // TODO: Use the album art in provided by 10.1 wk16 platform. Current one is in the binary - mDefaultRecommendationAlbumArt = QPixmap( ":/mpdetailsviewicons/qtg_large_music_album.svg" ); - + TX_EXIT } MpQueryManager::~MpQueryManager() { TX_ENTRY + reset(); if ( mManager ) { mManager->deleteLater(); - } - if ( mDownloadManager ) { - mDownloadManager->deleteLater(); + } + if ( mAlbumArtDownloader ) { + mAlbumArtDownloader->deleteLater(); } - delete mThumbnailManager; + if( mThumbnailManager ) { + mThumbnailManager->deleteLater(); + } TX_EXIT } void MpQueryManager::clearNetworkReplies() { + mRequestType = NoRequest; disconnect( mManager, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( retrieveInformationFinished( QNetworkReply * ) ) ); TX_ENTRY_ARGS( "Reply count = " << mReplys.count() ); - for ( int i = 0; i < mReplys.count(); i++ ) { + for ( int i = 0; i < mReplys.count(); ++i ) { QNetworkReply *reply = mReplys.at( i ); disconnect( reply, SIGNAL( error( QNetworkReply::NetworkError ) ), this, SLOT( retrieveInformationNetworkError( QNetworkReply::NetworkError ) ) ); if ( reply != NULL ) { reply->close(); reply->deleteLater(); reply = NULL; - } + } } mReplys.clear(); TX_EXIT @@ -123,6 +127,7 @@ constructRequest( queryURI ); TX_LOG_ARGS( "queryURI : " << queryURI ); retrieveInformation( queryURI ); + mRequestType = LocalStoreRequest; TX_EXIT } @@ -133,82 +138,89 @@ mAlbum=album; mTitle=title; // start querying inspire me items - QString queryRecommendation("http://api.music.ovi.com/1.0/gb/releases/recommend/?"); + QString queryRecommendation("http://api.music.ovi.com/1.0/" + mMusicStore + "/releases/recommend/?"); constructRequest( queryRecommendation ); - TX_LOG_ARGS( "queryRecommendation : " << queryRecommendation ); + // TODO: Store the token to a cenrep key + // TODO: Tokens change per new ovi api release. + // Need to figure out a way to get them updated on the fly + queryRecommendation.append("&Token=03574704-e3d1-4466-9691-e0b34c7abfff"); + + TX_LOG_ARGS( queryRecommendation ); retrieveInformation( queryRecommendation ); + mRequestType = InspireMeItemsMetadataRequest; TX_EXIT } void MpQueryManager::clearRecommendations() { - TX_ENTRY + TX_ENTRY + mRecommendationCount = 0; mDownloadedAlbumArts = 0; mAlbumArtsReadyCount = 0; - for ( int i = 0; i < KRecommendationCount; i++ ) { - mRecommendationSongs.clear(); - mRecommendationArtists.clear(); - mRecommendationAlbumArtsLink.clear(); - mRecommendationAlbumArtsMap.clear(); - QFile file( mRecommendationAlbumArtsName.at( i ) ); - if ( file.exists() ) { - if ( file.remove() ) { - TX_LOG_ARGS( "File removed - " << file.fileName() ); - } - else { - TX_LOG_ARGS( "Cannot remove file - " << file.fileName() ); - } - } else { - TX_LOG_ARGS( "File doesn't exist - " << file.fileName() ); + mRecommendationSongs.clear(); + mRecommendationArtists.clear(); + mRecommendationAlbumArtsLink.clear(); + mRecommendationAlbumArtsMap.clear(); + for ( int i = 0; i < mRecommendationAlbumArtsName.count(); ++i ) { + QFile file( mRecommendationAlbumArtsName.at( i ) ); + TX_LOG_ARGS( "File " << file.fileName() << " exists: " << file.exists() ); + if ( file.exists() && file.remove() ) { + TX_LOG_ARGS( "File " << file.fileName() << " removed"); } } TX_EXIT } + + /*! - Return recommendation songs + Returns the Local Music Store(if available) to be used while querying "Inspire Me" Items */ -QStringList MpQueryManager::recommendationSongs() +void MpQueryManager::queryLocalMusicStore() { - TX_LOG - return mRecommendationSongs; + TX_ENTRY + QString imsi,mcc; + + XQSysInfo sysInfo( this ); + imsi = sysInfo.imsi(); + mcc= imsi.left(3); + TX_LOG_ARGS( "mcc : " << mcc ); + + QString queryLocalMusicStore("http://api.music.cq1.brislabs.com/1.0/?mcc=" + mcc + "&token=06543e34-0261-40a4-a03a-9e09fe110c1f"); + TX_LOG_ARGS( "queryLocalMusicStore : " << queryLocalMusicStore ); + retrieveInformation( queryLocalMusicStore ); + mRequestType = LocalStoreRequest; + TX_EXIT +} + + +int MpQueryManager::recommendationsCount() const +{ + TX_LOG_ARGS ("count: " << mRecommendationSongs.count()); + return mRecommendationSongs.count(); +} + +QString MpQueryManager::recommendedSong(int index) const +{ + QString result; + if( (0 <= index) && (index < mRecommendationSongs.count())) { + result = mRecommendationSongs.at(index); + } + TX_LOG_ARGS ("recommendedSong: " << result); + return result; } /*! Return recommendation artists */ -QStringList MpQueryManager::recommendationArtists() -{ - TX_LOG - return mRecommendationArtists; -} - -/*! - Return recommendation album arts links - */ -QStringList MpQueryManager::recommendationAlbumArtsLink() +QString MpQueryManager::recommendedArtist(int index) const { - TX_LOG - return mRecommendationAlbumArtsLink; -} - -/*! - Return map of name and pixmap - */ -QMap MpQueryManager::recommendationAlbumArtsMap() -{ - TX_LOG - return mRecommendationAlbumArtsMap; -} - -/*! - Insert one uri & pixmap item into map - */ -void MpQueryManager::insertMapItem( const QString &uri, const QPixmap &pixmap ) -{ - TX_ENTRY_ARGS( "Map Item URI: " << uri ); - mRecommendationAlbumArtsMap.insert( uri, pixmap ); - TX_EXIT + QString result; + if( (0 <= index) && (index < mRecommendationArtists.count())) { + result = mRecommendationArtists.at(index); + } + TX_LOG_ARGS ("recommendedArtist: " << result); + return result; } /*! @@ -221,24 +233,49 @@ int errorLine; int errorColumn; bool parsingSuccess; + + if ( reply->error() != QNetworkReply::NoError ) { + TX_LOG_ARGS("reply->error(): " << reply->error()); + signalError(); + return; + } + + parsingSuccess = mDomDocument.setContent( reply, true, &errorStr, &errorLine, &errorColumn ); + if ( !parsingSuccess ) { + TX_LOG_ARGS("Parsing Received Content Failed"); + signalError(); + return; + } + + handleParsedXML(); //CodeScanner throws a warning mis-interpreting the trailing 'L' to be a leaving function. - if ( reply->error() == QNetworkReply::NoError ) - { - parsingSuccess = mDomDocument.setContent( reply, true, &errorStr, &errorLine, &errorColumn ); - if ( parsingSuccess ) { - handleParsedXML(); //CodeScanner throws a warning mis-interpreting the trailing 'L' to be a leaving function. - } else { - // TODO: agree on error handling - TX_LOG_ARGS( "XML parsing error" ); - } + mReplys.removeAll(reply); // remove it so that we wont process it again + reply->deleteLater(); // make sure reply is deleted, as we longer care about it + + TX_EXIT +} + +void MpQueryManager::signalError() +{ + TX_ENTRY; + switch(mRequestType) { + case InspireMeItemsMetadataRequest: + TX_LOG_ARGS("emit inspireMeItemsRetrievalError"); + emit inspireMeItemsRetrievalError(); + break; + case InspireMeItemsAlbumArtRequest: + TX_LOG_ARGS("Warning: InspireMeItemsAlbumArtRequestError, will keep using the default AA icon"); + break; + case LocalStoreRequest: + TX_LOG_ARGS("emit localMusicStoreRetrievalError"); + emit localMusicStoreRetrievalError(); + break; + case NoRequest: + default: + TX_LOG_ARGS("Warning!! Possible uninitialized mRequestType"); + break; } - else - { - // TODO: agree on error handling - TX_LOG_ARGS( "Network error in retrieving Information" ); - emit networkError(); - } - TX_EXIT + TX_EXIT } /*! @@ -246,9 +283,13 @@ */ void MpQueryManager::retrieveInformationNetworkError( QNetworkReply::NetworkError error ) { + TX_ENTRY_ARGS( "Network error for retrieving Information" << error); // TODO: agree on error handling + Q_UNUSED(error) - TX_ENTRY_ARGS( "Network error for retrieving Information" << error); + + disconnect( mManager, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( retrieveInformationFinished( QNetworkReply * ) ) ); + signalError(); TX_EXIT } @@ -256,43 +297,59 @@ Slot to call when there is ssl error */ void MpQueryManager::retrieveInformationSslErrors( const QList &/*error*/ ) -{ +{ // TODO: agree on error handling TX_ENTRY_ARGS( "SSL error for retrieving Information" ); + disconnect( mManager, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( retrieveInformationFinished( QNetworkReply * ) ) ); + signalError(); TX_EXIT } /*! Slot to call when downloading finished */ -void MpQueryManager::DownloadFinished( QNetworkReply* reply ) +void MpQueryManager::albumArtDownloaded( QNetworkReply* reply ) { TX_ENTRY_ARGS( "mDownloadedAlbumArts = " << mDownloadedAlbumArts ); - if ( reply->error() == QNetworkReply::NoError ) - { + TX_ENTRY_ARGS( "QNetworkReply obj " << reply); + + // It seems we get several finished signals for the same reply obj + // do nothing if we get a second signal + if( mReplys.indexOf(reply) == -1 ) { + TX_LOG_ARGS("Warning: QNetworkReply AA request may have been processed in previous call: " << reply ); + return; + } + + if ( reply->error() == QNetworkReply::NoError ) { + QString fileName = mRecommendationAlbumArtsName.at( mDownloadedAlbumArts ); QByteArray imageData = reply->readAll(); bool ret = writeImageToFile( imageData, fileName ); // If file writing went OK, emit a signal with the real filename // If it failed, use empty filename (since file was removed in any case) - if ( ret ) - { + if ( ret ) { + // TODO: If album album arts come in different order than they have been asked, + // then inspire me items will use swapped album arts. Correct setAlbumArtUri( mRecommendationAlbumArtsLink.at( mDownloadedAlbumArts), mRecommendationAlbumArtsName.at( mDownloadedAlbumArts ) ); - } - else - { + } + else { setAlbumArtUri(mRecommendationAlbumArtsLink.at( mDownloadedAlbumArts), ""); - } } - else - { - TX_LOG_ARGS( "Downloading album art failed!" ); - emit networkError(); + ++mDownloadedAlbumArts; + mReplys.removeAll(reply); // remove it so that we wont process it again + reply->deleteLater(); // make sure reply is deleted, as we longer care about it + } + else { + TX_LOG_ARGS( "Error: Downloading album art failed! Will keep using the default AA" ); } - mDownloadedAlbumArts++; + if( mDownloadedAlbumArts == mRecommendationCount) { + // no need to be informed anymore + mAlbumArtDownloader->disconnect(this); + } + TX_EXIT } @@ -302,48 +359,40 @@ returns false, otherwise true. */ bool MpQueryManager::writeImageToFile(const QByteArray &aImageData, const QString &aImageFileName ) - { +{ bool ret( false ); TX_ENTRY_ARGS( "imagefile: " << aImageFileName ); - if ( aImageFileName.isEmpty() ) - { + if ( aImageFileName.isEmpty() ) { TX_LOG_ARGS( "Only store two album arts" ); - } - else - { + } + else { QFile file( aImageFileName ); - - if ( !file.open( QIODevice::ReadWrite ) ) - { + if ( !file.open( QIODevice::ReadWrite ) ) { TX_LOG_ARGS( "Unable to open file" ); - } - else - { + } + else { qint64 writtenBytes = file.write( aImageData ); - // Verify file write status - if ( writtenBytes < aImageData.size() ) - { + if ( writtenBytes < aImageData.size() ) { // If write succeeded only partially, or completely failed, // remove the file from filesystem to remove risk of corruption TX_LOG_ARGS( "Wrote only " << writtenBytes << " bytes, aborting operation!" ); file.close(); QFile::remove( mRecommendationAlbumArtsName.at( mDownloadedAlbumArts ) ); - } - else - { + } + else { // If write fully succeeded, flush contents TX_LOG_ARGS( "Wrote all the bytes (" << writtenBytes << "), flushing and closing!"); file.flush(); file.close(); ret = true; - } } } + } TX_LOG_ARGS( "Returning with value: " << ret ); TX_EXIT return ret; - } +} /*! Get Atom response from Ovi server based on query @@ -351,7 +400,7 @@ void MpQueryManager::retrieveInformation( const QString &urlEncoded ) { TX_ENTRY_ARGS( "urlEconded = " << urlEncoded) - connect( mManager, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( retrieveInformationFinished( QNetworkReply * ) ) ); + connect( mManager, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( retrieveInformationFinished( QNetworkReply * ) ), Qt::UniqueConnection ); QNetworkReply *reply = mManager->get( QNetworkRequest( QUrl( urlEncoded ) ) ); mReplys.append( reply ); @@ -369,71 +418,99 @@ TX_ENTRY QDomElement rootElement = mDomDocument.documentElement(); - if ( rootElement.attribute( "type" ) == "search" ) { - TX_LOG_ARGS( "URI response" ) - QString result; + if ( rootElement.attribute( "type" ) == "recommendedTracks" ) { + TX_LOG_ARGS( "Recommendation response" ) QDomElement entry = rootElement.firstChildElement( "entry" ); - while ( !entry.isNull() ) - { + mRecommendationCount = 0; + while ( !entry.isNull() && mRecommendationCount < KRecommendationCount ) { if ( entry.attribute( "type" ) == "musictrack" ) { QDomElement link = entry.firstChildElement( "link" ); - while ( !link.isNull() ) - { - if ( link.attribute( "rel" ) == "alternate" - && link.attribute( "type" ) == "text/html" ) { - result = link.attribute( "href" ); - } - link = link.nextSiblingElement( "link" ); - } - } - entry = entry.nextSiblingElement( "entry" ); - } - // Signal that the url was received. Might be empty string. - emit searchUrlRetrieved( result ); - } else if ( rootElement.attribute( "type" ) == "recommendedTracks" ) { - TX_LOG_ARGS( "Recommendation response" ) - QDomElement entry = rootElement.firstChildElement( "entry" ); - QNetworkReply *reply; - int count = 0; - while ( !entry.isNull() && count < KRecommendationCount ) - { - if ( entry.attribute( "type" ) == "musictrack" ) { - QDomElement link = entry.firstChildElement( "link" ); - while ( !link.isNull() ) - { + while ( !link.isNull() ) { if ( link.attribute( "title" ) == "albumart100" ) { mRecommendationAlbumArtsLink.append( link.attribute( "href" ) ); + // TODO: This may get called twice for one inspire me item. Investigate why + mRecommendationAlbumArtsMap.insert( link.attribute( "href" ), mDefaultRecommendationAlbumArt ); break; - } else { + } + else { link = link.nextSiblingElement( "link" ); - } + } } QDomElement metadata = entry.firstChildElement( "metadata" ); mRecommendationSongs.append( metadata.firstChildElement( "name" ).text() ); mRecommendationArtists.append( metadata.firstChildElement( "primaryartist" ).text() ); - count++; + ++mRecommendationCount; } entry = entry.nextSiblingElement( "entry" ); - } - - for (int i = 0; i < KRecommendationCount; i++ ) { + } + + emit inspireMeItemsMetadataRetrieved(); + + QNetworkReply *reply = 0; + // we need to channel the retrieved album arts to albumArtDownloaded slot only + disconnect( mManager, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( retrieveInformationFinished( QNetworkReply * ) ) ); + for (int i = 0; i < mRecommendationCount; i++ ) { TX_LOG_ARGS( "song name: " << mRecommendationSongs.at(i) ); TX_LOG_ARGS( "Artist name: " << mRecommendationArtists.at(i) ); TX_LOG_ARGS( "Album art link: " << mRecommendationAlbumArtsLink.at(i) ); - + mRequestType = InspireMeItemsAlbumArtRequest; if ( mRecommendationAlbumArtsLink.at( i ).contains( "http", Qt::CaseInsensitive ) ) { - reply = mDownloadManager->get( QNetworkRequest( QUrl( mRecommendationAlbumArtsLink.at(i) ) ) ); + reply = mAlbumArtDownloader->get( QNetworkRequest( QUrl( mRecommendationAlbumArtsLink.at(i) ) ) ); mReplys.append( reply ); connect( reply, SIGNAL( error( QNetworkReply::NetworkError ) ), this, SLOT( retrieveInformationNetworkError( QNetworkReply::NetworkError ) ) ); connect( reply, SIGNAL( sslErrors( QList ) ), this, SLOT( retrieveInformationSslErrors( QList ) ) ); - } + } } - } else { + // we have queried for album arts for inspire me items. Now, time to wait for a response + connect( mAlbumArtDownloader, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( albumArtDownloaded( QNetworkReply * ) ) ); + + } + else if ( rootElement.attribute( "type" ) == "storeList" ) { + TX_LOG_ARGS( "Music Store List" ) + QDomElement entry = rootElement.firstChildElement( "workspace" ); + QString previousMusicStore = mMusicStore; + mMusicStore = entry.attribute( "countryCode" ); + if(!mMusicStore.isEmpty()) { + bool musicStoreUpdated = (previousMusicStore != mMusicStore); + TX_LOG_ARGS("Music Store" << mMusicStore ); + emit localMusicStoreRetrieved(musicStoreUpdated); + } + else { + emit localMusicStoreRetrievalError(); + } + } + else { TX_LOG_ARGS( "Not supported response" ) } TX_EXIT } +void MpQueryManager::clearThumbnails() +{ + TX_ENTRY + for(int i = 0; i < mThumbnailRequests.count(); ++i ) { + mThumbnailManager->cancelRequest(mThumbnailRequests.at(i)); + } + mThumbnailRequests.clear(); + for(int i = 0; i < mRecommendationAlbumArtsName.count(); ++i) { + mThumbnailManager->deleteThumbnails(mRecommendationAlbumArtsName.at(i)); // async, returns immidiately + } + TX_EXIT +} + +void MpQueryManager::reset() +{ + TX_ENTRY + mManager->disconnect(this); + mAlbumArtDownloader->disconnect(this); + mThumbnailManager->disconnect(this); + clearNetworkReplies(); + clearRecommendations(); + clearThumbnails(); + mRecommendationAlbumArtsMap.clear(); + TX_EXIT +} + /*! Construct the query for fetching URI & recommendations */ @@ -468,11 +545,11 @@ QString str; if ( keys.length() != values.length() ) { TX_LOG_ARGS( "Error: keys length is not equal to values length" ); - } else { + } + else { for ( int i = 0; i < keys.length(); i++ ) { QString tValue = values.at( i ); - if ( 0 != tValue.length() ) - { + if ( 0 != tValue.length() ) { str += keys.at( i ) + "=" + values.at( i ) + "&"; } } @@ -486,18 +563,28 @@ */ void MpQueryManager::setAlbumArtUri( const QString &albumArtUri, const QString &albumArtName ) { + // TODO: rename this function. Doing too many things TX_ENTRY_ARGS( "albumArtUri = " << albumArtUri ) TX_LOG_ARGS( "albumArtName = " << albumArtName ) if ( !albumArtUri.isEmpty() && !albumArtName.isEmpty() ) { + // TODO: this is no good to pass the address of the albumArtUri. It is an item in the list, which can cleaned int id = mThumbnailManager->getThumbnail( albumArtName, reinterpret_cast( const_cast( &albumArtUri ) ) ); if ( id == KUndefined ) { - // Request failed. Set default album art. - insertMapItem( albumArtUri, mDefaultRecommendationAlbumArt ); + // Request failed. Set default album art + mRecommendationAlbumArtsMap.insert( albumArtUri, mDefaultRecommendationAlbumArt ); + } + else { + // Async request went throu + TX_LOG_ARGS("Request to thumbnail manager made. Id: " << id) + mThumbnailRequests.append(id); + mThumbnailManager->disconnect( this ); // to prevent multiple same connections with thumbnailmanager + QObject::connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), + this, SLOT( thumbnailReady( QPixmap , void * , int , int ) ) ); } } else { // No album art uri. Set default album art. - insertMapItem( albumArtUri, mDefaultRecommendationAlbumArt ); + mRecommendationAlbumArtsMap.insert( albumArtUri, mDefaultRecommendationAlbumArt ); } TX_EXIT } @@ -506,24 +593,42 @@ Slot to handle the recommendation album art */ void MpQueryManager::thumbnailReady( - const QPixmap& pixmap, + const QPixmap pixmap, void *data, - int /*id*/, + int id, int error ) { TX_ENTRY - // TODO: Hkn: use qobject_cast + + if( mThumbnailRequests.indexOf(id) == -1 ) { + TX_LOG_ARGS("Warning: some old thumbnail request from previous song. Ignoring") + return; + } + + // TODO: Using data from array, which can be reset. There must be a safer way QString uri = *( reinterpret_cast( data ) ); TX_LOG_ARGS( "Uri: " << uri ); if ( error == 0 ) { TX_LOG_ARGS( "album art link: " << uri ); - insertMapItem( uri, pixmap ); - } else { - insertMapItem( uri, mDefaultRecommendationAlbumArt ); + mRecommendationAlbumArtsMap.insert( uri, HbIcon(QIcon(pixmap)) ); } - if(++mAlbumArtsReadyCount == KRecommendationCount) { - emit recommendationAlbumArtsReady(); - } + else { + mRecommendationAlbumArtsMap.insert( uri, mDefaultRecommendationAlbumArt ); + } + + emit inspireMeItemAlbumArtReady(); TX_EXIT } + +bool MpQueryManager::isLocalMusicStore() const +{ + TX_LOG_ARGS( "isLocalMusicStore = " << !mMusicStore.isEmpty() ) + return !mMusicStore.isEmpty(); +} + +HbIcon MpQueryManager::recommendedAlbumArt(int index) const +{ + TX_LOG_ARGS( "index = " << index ) + return mRecommendationAlbumArtsMap.value( mRecommendationAlbumArtsLink.at( index ) ); +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/src/mpsharedata.cpp --- a/mpviewplugins/mpdetailsviewplugin/src/mpsharedata.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifdef SHARE_FUNC_ENABLED - -#include "mpsharedata.h" -#include "mpsongdata.h" - - -// TODO OVI_URL needs to come from cenrep -const QString OVI_URL = "http://music.ovi.com"; - -// The music note symbol that we post if we do not have music store URL. -const QString MUSIC_NOTE_SYMBOL = "♫"; - - -MpShareData::MpShareData() - : mOwner( 0 ), - mSongData( 0 ) -{ -} - -MpShareData::~MpShareData() -{ - // Intentionally empty. -} - -void MpShareData::setOwner( QObject* aOwner ) -{ - mOwner = aOwner; -} - -QObject* MpShareData::owner() const -{ - return mOwner; -} - -void MpShareData::setSongData( MpSongData* aSongData ) -{ - mSongData = aSongData; -} - -MpSongData* MpShareData::songData() const -{ - return mSongData; -} - -void MpShareData::setErrorMessage( const QString& s ) -{ - mErrorMessage = s; -} - -QString MpShareData::errorMessage() const -{ - return mErrorMessage; -} - -void MpShareData::setUsername( const QString& s ) -{ - mUsername = s; -} - -QString MpShareData::username() const -{ - return mUsername; -} - -void MpShareData::setPassword( const QString& s ) -{ - mPassword = s; -} - -QString MpShareData::password() const -{ - return mPassword; -} - -void MpShareData::setLanguage( const QString& s ) -{ - mLanguage = s; -} - -QString MpShareData::language() const -{ - return mLanguage; -} - -void MpShareData::setUnknownTr( const QString& s ) -{ - mUnknownTr = s; -} - -QString MpShareData::objectType() const -{ - if ( !mSongData || mSongData->link().isEmpty() ) - { - return "NOTE-APPEND"; - } - // No link, append artist-song - return "URI"; -} - -int MpShareData::objectReservedLength() const -{ - return objectContent().length(); -} - -QString MpShareData::objectContent() const -{ - if ( mSongData && !mSongData->link().isEmpty() ) - { - return mSongData->link(); - } - // TODO: do we need to have right-to-left text direction here, - // i.e. putting the title before the artist in such a case? - return MUSIC_NOTE_SYMBOL + " " + artist() + ": " + title() + " " + OVI_URL; -} - -QString MpShareData::title() const -{ - if ( mSongData && !mSongData->title().isEmpty() ) - { - return mSongData->title(); - } - return mUnknownTr; -} - -QString MpShareData::artist() const -{ - if ( mSongData && !mSongData->artist().isEmpty() ) - { - return mSongData->artist(); - } - return mUnknownTr; -} - -QString MpShareData::albumArtBase64() const -{ - return mSongData ? mSongData->albumArtBase64() : ""; -} - -#endif // SHARE_FUNC_ENABLED diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/UT_ALL_mpdetailsviewplugin.pkg --- a/mpviewplugins/mpdetailsviewplugin/tsrc/UT_ALL_mpdetailsviewplugin.pkg Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/UT_ALL_mpdetailsviewplugin.pkg Fri Aug 06 16:51:36 2010 -0500 @@ -27,21 +27,11 @@ ; Executable and default resource files -"/epoc32/release/armv5/udeb/unittest_mpdetailssharedialog.exe" - "!:\sys\bin\unittest_mpdetailssharedialog.exe" -"/epoc32/data/z/private/10003a3f/import/apps/unittest_mpdetailssharedialog_reg.rsc" - "!:\private\10003a3f\import\apps\unittest_mpdetailssharedialog_reg.rsc" - "/epoc32/release/armv5/udeb/unittest_mpdetailsview.exe" - "!:\sys\bin\unittest_mpdetailsview.exe" "/epoc32/data/z/private/10003a3f/import/apps/unittest_mpdetailsview_reg.rsc" - "!:\private\10003a3f\import\apps\unittest_mpdetailsview_reg.rsc" - "/epoc32/release/armv5/udeb/unittest_mpdetailsviewplugin.exe" - "!:\sys\bin\unittest_mpdetailsviewplugin.exe" "/epoc32/data/z/private/10003a3f/import/apps/unittest_mpdetailsviewplugin_reg.rsc" - "!:\private\10003a3f\import\apps\unittest_mpdetailsviewplugin_reg.rsc" "/epoc32/release/armv5/udeb/unittest_mpquerymanager.exe" - "!:\sys\bin\unittest_mpquerymanager.exe" "/epoc32/data/z/private/10003a3f/import/apps/unittest_mpquerymanager_reg.rsc" - "!:\private\10003a3f\import\apps\unittest_mpquerymanager_reg.rsc" - -"/epoc32/release/armv5/udeb/unittest_mpsharedata.exe" - "!:\sys\bin\unittest_mpsharedata.exe" -"/epoc32/data/z/private/10003a3f/import/apps/unittest_mpsharedata_reg.rsc" - "!:\private\10003a3f\import\apps\unittest_mpsharedata_reg.rsc" - - - diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/UT_ALL_mpdetailsviewplugin.sisx Binary file mpviewplugins/mpdetailsviewplugin/tsrc/UT_ALL_mpdetailsviewplugin.sisx has changed diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/megapak.pkg --- a/mpviewplugins/mpdetailsviewplugin/tsrc/megapak.pkg Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Metapackage for all unit tests -; -; Language -&EN - -; SIS header: name, uid, version -#{"megapak"},(0xEEEECAFE),1,0,0 - -; Localised Vendor name -%{"Vendor"} - -; Unique Vendor name -:"Vendor" - - -; Manual PKG pre-rules from PRO files -; Default HW/platform dependencies -;[0x101F7961],0,0,0,{"S60ProductID"} -;[0x102032BE],0,0,0,{"S60ProductID"} -;[0x102752AE],0,0,0,{"S60ProductID"} -;[0x1028315F],0,0,0,{"S60ProductID"} - -; Default dependency to Qt libraries -;(0x2001E61C), 4, 6, 3, {"Qt"} -; Dependency to Qt Webkit -;(0x200267C2), 4, 6, 3, {"QtWebKit"} - -; Embedded SIS files -@"./unittest_mpdetailssharedialog/unittest_mpdetailssharedialog.sisx", (0xE3fe6204) -@"./unittest_mpdetailsview/UT_detailsview.sisx", (0xE003e880) -@"./unittest_mpdetailsviewplugin/UT_mpdetailsviewplugin.sisx", (0xE003e881) -@"./unittest_mpquerymanager/UT_mpquerymanager.sisx", (0xE003e882) -@"./unittest_mpsharedata/unittest_mpsharedata.sisx", (0xE5d27be8) diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/tsrc.pro --- a/mpviewplugins/mpdetailsviewplugin/tsrc/tsrc.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -16,11 +16,9 @@ TEMPLATE = subdirs -SUBDIRS += unittest_mpdetailssharedialog \ - unittest_mpdetailsview \ - unittest_mpdetailsviewplugin \ - unittest_mpquerymanager \ - unittest_mpsharedata +SUBDIRS += unittest_mpdetailsview \ + unittest_mpdetailsviewplugin +# unittest_mpquerymanager CONFIG += ordered diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/UT_mpdetailssharedialog.pkg --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/UT_mpdetailssharedialog.pkg Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -; Language -&EN - -; SIS header: name, uid, version -#{"unittest_mpdetailssharedialog"},(0xE3fe6204),1,0,0 - -; Localised Vendor name -%{"Vendor"} - -; Unique Vendor name -:"Vendor" - - -; Manual PKG pre-rules from PRO files -; Default HW/platform dependencies -;[0x101F7961],0,0,0,{"S60ProductID"} -;[0x102032BE],0,0,0,{"S60ProductID"} -;[0x102752AE],0,0,0,{"S60ProductID"} -;[0x1028315F],0,0,0,{"S60ProductID"} - -; Default dependency to Qt libraries -;(0x2001E61C), 4, 6, 3, {"Qt"} -; Dependency to Qt Webkit -;(0x200267C2), 4, 6, 3, {"QtWebKit"} - -; Executable and default resource files -"/epoc32/release/armv5/udeb/unittest_mpdetailssharedialog.exe" - "!:\sys\bin\unittest_mpdetailssharedialog.exe" -"/epoc32/data/z/resource/apps/unittest_mpdetailssharedialog.rsc" - "!:\resource\apps\unittest_mpdetailssharedialog.rsc" -"/epoc32/data/z/private/10003a3f/import/apps/unittest_mpdetailssharedialog_reg.rsc" - "!:\private\10003a3f\import\apps\unittest_mpdetailssharedialog_reg.rsc" - -; Manual PKG post-rules from PRO files diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/inc/unittest_mpdetailssharedialog.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/inc/unittest_mpdetailssharedialog.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for mpdetailssharedialog -* -*/ - -#ifndef UNITTEST_MPDETAILSSHAREDIALOG_H_ -#define UNITTEST_MPDETAILSSHAREDIALOG_H_ - -#include - -class MpDetailsShareDialog; -class MpSongData; - -class TestMpDetailsShareDialog : public QObject -{ - Q_OBJECT - -public: - - TestMpDetailsShareDialog(); - virtual ~TestMpDetailsShareDialog(); - -signals: - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void testIndexLoadOk(); - void testConstruction(); - -private: - MpDetailsShareDialog *mTest; - MpSongData* mSongData; - -}; - - -#endif /* UNITTEST_MPDETAILSSHAREDIALOG_H_ */ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/sis.bat --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/sis.bat Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -@echo off -del *.sisx -makesis UT_mpdetailssharedialog.pkg -signsis UT_mpdetailssharedialog.sis UT_mpdetailssharedialog.sisx %RNDCERTS_PATH%\Nokia_RnDCert_02.der %RNDCERTS_PATH%\Nokia_RnDCert_02.key -del UT_mpdetailssharedialog.sis \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/src/unittest_mpdetailssharedialog.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/src/unittest_mpdetailssharedialog.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for MpDetailsShareDialog -* -*/ -#include -#ifdef Q_OS_SYMBIAN -#include -#include -#include -#endif -#include"unittest_mpdetailssharedialog.h" -#include "hbmessagebox.h" - -// Do this so we can access all member variables. -#define private public -#include "mpdetailssharedialog.h" -#undef private -#include "mpsharedata.h" -#include "mpsongdata.h" - -/*! - Make our test case a stand-alone executable that runs all the test functions. - */ -#ifdef Q_OS_SYMBIAN -int main(int argc, char *argv[]) -{ - - HbApplication app(argc, argv); - HbMainWindow window; - - TestMpDetailsShareDialog tv; - - if ( argc > 1 ) { - return QTest::qExec( &tv, argc, argv); - } - else { - char *pass[3]; - pass[0] = argv[0]; - pass[1] = "-o"; - pass[2] = "c:\\data\\unittest_testmpdetailssharedialog.txt"; - - return QTest::qExec(&tv, 3, pass); - } -} -#endif - -#ifdef Q_OS_WIN32 -QTEST_MAIN(TestMpDetailsShareDialog) -#endif -//Constructor -TestMpDetailsShareDialog::TestMpDetailsShareDialog() - : mTest(0) -{ - -} - -//Destructor -TestMpDetailsShareDialog::~TestMpDetailsShareDialog() -{ - if (mTest) delete mTest; -} - -/*! - Called before the first testfunction is executed. - */ -void TestMpDetailsShareDialog::initTestCase() -{ - qDebug() << "unit test for mpdetailssharedialog begin."; -} - -/*! - Called after the last testfunction was executed. - */ -void TestMpDetailsShareDialog::cleanupTestCase() -{ - qDebug() << "unit test for mpdetailssharedialog end."; - QCoreApplication::processEvents(); -} - -/*! - Called before each testfunction is executed. - */ -void TestMpDetailsShareDialog::init() -{ - mSongData = new MpSongData(); - mTest = new MpDetailsShareDialog(); - mTest->initialize(mSongData, "unknown"); -} - -/*! - Called after every testfunction. - */ -void TestMpDetailsShareDialog::cleanup() -{ - delete mTest; - delete mSongData; - mTest = 0; - mSongData = 0; -} - -void TestMpDetailsShareDialog::testConstruction() -{ - mTest->updateSharedData(); - mTest->debugJs("Test"); - mTest->errorHandler("Test error", "Test message"); - mTest->clearCache(); - mTest->addContext(); - - mTest->mShareNetAccMan = NULL; - mTest->mShareWebView = NULL; - mTest->updateSharedData(); - mTest->debugJs("Test"); - mTest->errorHandler("Test error", "Test message"); - mTest->clearCache(); - mTest->addContext(); - //nothing to verify - QCOMPARE(true, true); -} - -void TestMpDetailsShareDialog::testIndexLoadOk() -{ - mTest->onIndexLoad(true); - mTest->onIndexLoad(false); - //nothing to verify - QCOMPARE(true, true); -} - diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/inc/hbmessagebox.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/inc/hbmessagebox.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: stub file for hbmessagebox class. -* -*/ -#ifndef HBMESSAGEBOX_H -#define HBMESSAGEBOX_H - -#include - -class HbMessageBox : public QObject -{ - Q_OBJECT -public: - explicit HbMessageBox(); - virtual ~HbMessageBox(); - -public: - static void information(const QString &warningText); - static void warning(const QString &warningText); -}; - -#endif // HB_MESSAGEBOX_H - diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/inc/mpsongdata.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/inc/mpsongdata.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stub of Metadata of song -* -*/ - -#ifndef MPSONGDATA_H -#define MPSONGDATA_H - -#include -#include -#include - - -//forward declartions -class QIcon; - -//class declaration -class MpSongData : public QObject -{ - Q_OBJECT - -public: - explicit MpSongData( QObject *parent=0 ); - virtual ~MpSongData(); - - bool setTitle( const QString &title ); - bool setAlbum( const QString &album ); - bool setArtist( const QString &artist ); - bool setComment( const QString &comment ); - void setAlbumArtUri( const QString &albumArtUri ); - bool setYear( int date ); - bool setGenre( const QString &genre ); - bool setComposer( const QString &compoer ); - bool setAlbumTrack( const QString &albumtrack ); - void setLink( const QString &link ); - - // inform details view when basic information is ready to accelerate UI update - void commitPlaybackInfo(); - // inform details view when details information is ready - void commitSongDetailInfo(); - void removeAlbumArtFile() const; //TODO: Remove when base64 starts to work - -public slots: - void thumbnailReady( const QPixmap& pixmap, void *data, int id, int error ); - - int reservedLength() const { return mLink.length() + mTitle.length() + mArtist.length(); } - - QString title() const; - QString album() const; - QString artist() const; - QString comment() const; - void albumArt( QPixmap& pixmap ); - QString year() const; - QString genre() const; - QString composer() const; - QString albumTrack() const; - QString link() const; - QString albumArtBase64() const; - -signals: - void albumArtReady(); - void playbackInfoChanged(); - void songDetailInfoChanged(); - -private: - QString mTitle; - QString mAlbum; - QString mArtist; - QString mComment; - QString mComposer; - QString mGenre; - QString mYear; - QString mAlbumTrack; - QPixmap mAlbumArt; - int mReqId; - QString currentAAUri; - QPixmap mDefaultAlbumArt; - QString mLink; - - Q_DISABLE_COPY(MpSongData) -}; - -#endif // MPSONGDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/inc/qsysteminfo.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/inc/qsysteminfo.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stub of QSystemInfo -* -*/ - -#ifndef QSYSTEMINFO_H -#define QSYSTEMINFO_H - -#include -#include - - -//class declaration -class QSystemInfo : public QObject -{ - Q_OBJECT - -public: - QSystemInfo( QObject *parent = 0 ); - ~QSystemInfo(); - - QString currentLanguage(); - QString currentCountryCode(); -}; - -#define QTM_USE_NAMESPACE ; - -#endif // QSYSTEMINFO_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/hbmessagebox.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/hbmessagebox.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stub -* -*/ - -#include "hbmessagebox.h" - -HbMessageBox::HbMessageBox() -{ - -} - -HbMessageBox::~HbMessageBox() -{ - -} - -void HbMessageBox::information(const QString &warningText) -{ - Q_UNUSED(warningText); -} - -void HbMessageBox::warning(const QString &warningText) -{ - Q_UNUSED(warningText); -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/mpsongdata.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/mpsongdata.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,337 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Playback Data provider for playback view. -* -*/ - - -#include -#include - -#include "mpsongdata.h" -#include "mptrace.h" - - -const int KUndefined = -1; - -/*! - \class MpSongData - \brief Music Player song metadata. - - Song data provide acces to current playing song metadata -*/ - -/*! - \fn void albumArtReady() - - This signal is albuma alrt is ready. - */ - -/*! - \fn void playbackInfoChanged() - - This signal is emitted when basic information is available - */ - -/*! - \fn void songDetailInfoChanged() - - This signal is emitted when detail information is available - */ - - - -/*! - Constructs a new MpSongData. - */ -MpSongData::MpSongData( QObject *parent ) - : QObject( parent ), - mTitle( NULL ), - mAlbum( NULL ), - mArtist( NULL ), - mComposer( NULL), - mGenre( NULL ), - mYear( NULL ), - mAlbumTrack( NULL ), - mAlbumArt(), - mReqId( KUndefined ) -{ - TX_ENTRY_ARGS("Stub") -} - -/*! - Constructs a new MpSongData. - */ -MpSongData::~MpSongData() -{ - TX_ENTRY_ARGS("Stub") -} - -/*! - Returns the song album art on \a pixmap. -*/ -void MpSongData::albumArt( QPixmap& pixmap ) -{ - if ( !mAlbumArt.isNull() ) { - pixmap = mAlbumArt; - } - else { - pixmap = QPixmap(); - } -} - - -/*! - Returns the song title. -*/ -QString MpSongData::title() const -{ - return mTitle; -} - -/*! - Returns the song album. -*/ -QString MpSongData::album() const -{ - return mAlbum; -} - -/*! - Returns the song artist. -*/ -QString MpSongData::artist() const -{ - return mArtist; -} - -/*! - Returns comment -*/ -QString MpSongData::comment() const -{ - return mComment; -} - -/*! - Returns the song composer. -*/ -QString MpSongData::composer() const -{ - return mComposer; -} - - -/*! - Returns the song genre. -*/ -QString MpSongData::genre() const -{ - return mGenre; -} - - -/*! - Returns the album track. -*/ -QString MpSongData::albumTrack() const -{ - return mAlbumTrack; -} - -/*! - Returns link -*/ -QString MpSongData::link() const -{ - return mLink; -} - -/*! - Returns the release date. -*/ -QString MpSongData::year() const -{ - return mYear; -} - - -/*! - Sets the song \a title, returns true if the value is new. -*/ -bool MpSongData::setTitle( const QString &title ) -{ - bool change = false; - if ( title != mTitle ) { - change = true; - mTitle = title; - } - return change; -} - -/*! - Sets the song \a album, returns true if the value is new. -*/ -bool MpSongData::setAlbum( const QString &album ) -{ - bool change = false; - if ( album != mAlbum ) { - change = true; - mAlbum = album; - } - return change; -} - -/*! - Sets the song \a artist, returns true if the value is new. -*/ -bool MpSongData::setArtist( const QString &artist ) -{ - bool change = false; - if ( artist != mArtist ) { - change = true; - mArtist = artist; - } - return change; -} - -/*! - Sets the song \a comment, returns true if the value is new. -*/ -bool MpSongData::setComment( const QString &comment) -{ - bool change = false; - if ( comment != mComment ) { - change = true; - mComment = comment; - } - return change; -} - - -/*! - Sets the song \a composer, returns true if the value is new. -*/ -bool MpSongData::setComposer( const QString &composer ) -{ - bool change = false; - if ( composer != mComposer ) { - change = true; - mComposer = composer; - } - return change; -} - -/*! - Sets the song \a genre, returns true if the value is new. -*/ -bool MpSongData::setGenre( const QString &genre ) -{ - bool change = false; - if ( genre != mGenre ) { - change = true; - mGenre = genre; - } - return change; -} - - -/*! - Sets the song \a date, returns true if the value is new. -*/ -bool MpSongData::setYear( int year ) -{ - bool change = false; - if ( QString::number(year) != mYear ) { - change = true; - if ( year >= 0 && year < 9999 ) { - mYear = QString::number(year); - } - } - return change; -} - -/*! - Sets the \a album track, returns true if the value is new. -*/ -bool MpSongData::setAlbumTrack( const QString &track ) -{ - bool change = false; - if ( track != mAlbumTrack ) { - change = true; - mAlbumTrack = track; - } - return change; -} - -/*! - Sets the \a link -*/ -void MpSongData::setLink( const QString &link ) -{ - mLink = link; -} - -/*! - Sets the song \a albumArtUri. -*/ -void MpSongData::setAlbumArtUri( const QString &albumArtUri) -{ - Q_UNUSED(albumArtUri); - mAlbumArt = mDefaultAlbumArt; - emit albumArtReady(); -} - - -/*! - Slot to handle the album art thumb. -*/ -void MpSongData::thumbnailReady( - const QPixmap& pixmap, - void *data, - int id, - int error ) -{ - Q_UNUSED( pixmap ); - Q_UNUSED( data ); - Q_UNUSED( id ); - Q_UNUSED( error ); -} - -/*! - Emit signal when playback information changed, such as artist, track name -*/ -void MpSongData::commitPlaybackInfo() -{ - emit playbackInfoChanged(); -} - -/*! - Emit signal when song detail information changed -*/ -void MpSongData::commitSongDetailInfo() -{ - emit songDetailInfoChanged(); -} - -QString MpSongData::albumArtBase64() const -{ - - return QString(""); -} - -void MpSongData::removeAlbumArtFile() const -{ - -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/qsysteminfo.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/qsysteminfo.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stub of QSystemInfo -* -*/ - - -#include "qsysteminfo.h" - -QSystemInfo::QSystemInfo( QObject *parent ) - : QObject( parent ) -{ - //TX_ENTRY - //TX_EXIT -} - -QSystemInfo::~QSystemInfo() -{ - //TX_ENTRY - //TX_EXIT -} - -QString QSystemInfo::currentLanguage() { return "fi"; }; -QString QSystemInfo::currentCountryCode() { return "Fi"; }; diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/unittest_mpdetailssharedialog.pro --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/unittest_mpdetailssharedialog.pro Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -TEMPLATE = app -CONFIG += qtestlib \ - symbian_test \ - hb \ - mobility - -QT += webkit \ - network \ - xml - -MOBILITY += bearer systeminfo - -TARGET = unittest_mpdetailssharedialog - -TARGET.CAPABILITY = All -TCB - -DEPENDPATH += . -INCLUDEPATH += ./inc \ - ./stub/inc \ - ../../inc \ - ../../../../inc -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - -DEFINES += SHARE_FUNC_ENABLED SHARE_PLAYER_RND - -# Input -HEADERS += inc/unittest_mpdetailssharedialog.h \ - ../../inc/mpdetailssharedialog.h \ - ../../inc/mpsharedata.h \ - stub/inc/mpsongdata.h \ - stub/inc/hbmessagebox.h -win32:{ -HEADERS += stub/inc/qsysteminfo.h -} -SOURCES += src/unittest_mpdetailssharedialog.cpp \ - ../../src/mpdetailssharedialog.cpp \ - ../../src/mpsharedata.cpp \ - stub/src/mpsongdata.cpp \ - stub/src/hbmessagebox.cpp - -win32:{ -SOURCES += stub/src/qsysteminfo.cpp -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/inc/unittest_mpdetailsview.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/inc/unittest_mpdetailsview.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/inc/unittest_mpdetailsview.h Fri Aug 06 16:51:36 2010 -0500 @@ -53,11 +53,7 @@ void testdeactivateView(); void testbackSlot(); void testAlbumArtChanged(); - void testHandleNetworkError(); - void testCanQueryRecommendations(); - void testCanQuerySharePlayerLink(); void testHandlePlaybackInfoChanged(); - void testClearInspireMe(); void testHandleDetailsGroupBoxToggled(); void testHandleInspireMeGroupBoxToggled(); diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/src/unittest_mpdetailsview.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/src/unittest_mpdetailsview.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/src/unittest_mpdetailsview.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -134,9 +134,6 @@ { mTest->activateView(); QCOMPARE( mTest->mActivated, true ); - - QCOMPARE( mTest->mInspireMeOpen, MpSettingsManager::inspireMe() ); - QCOMPARE( mTest->mSongDetailsGbOpen, MpSettingsManager::songDetailsGb() ); } void TestMpDetailsView::testdeactivateView() @@ -164,77 +161,6 @@ QVERIFY( mTest->mAlbumArt->icon().isNull() == false ); } -void TestMpDetailsView::testHandleNetworkError() -{ - mTest->handleNetworkError(); - QVERIFY( mTest->mInspireMeQueryOngoing == false ); - QVERIFY( mTest->mInspireMeQueryRendered == false ); -} - -void TestMpDetailsView::testCanQueryRecommendations() -{ - mTest->mSongData = new MpSongData(); - mTest->mSongData->mAlbum = QString( "album" ); - mTest->mSongData->mArtist = QString( "artist" ); - mTest->mInspireMeGroupBox->setCollapsed( true ); - QVERIFY( mTest->canQueryRecommendations() == false ); - - mTest->mSongData->mAlbum = QString( "album" ); - mTest->mSongData->mArtist = QString(); - mTest->mInspireMeGroupBox->setCollapsed( true ); - QVERIFY( mTest->canQueryRecommendations() == false ); - - mTest->mSongData->mAlbum = QString(); - mTest->mSongData->mArtist = QString( "artist" ); - mTest->mInspireMeGroupBox->setCollapsed( true ); - QVERIFY( mTest->canQueryRecommendations() == false ); - - mTest->mSongData->mAlbum = QString(); - mTest->mSongData->mArtist = QString(); - mTest->mInspireMeGroupBox->setCollapsed( true ); - QVERIFY( mTest->canQueryRecommendations() == false ); - - mTest->mSongData->mAlbum = QString( "album" ); - mTest->mSongData->mArtist = QString( "artist" ); - mTest->mInspireMeGroupBox->setCollapsed( false ); - QVERIFY( mTest->canQueryRecommendations() == true ); - - mTest->mSongData->mAlbum = QString( "album" ); - mTest->mSongData->mArtist = QString(); - mTest->mInspireMeGroupBox->setCollapsed( false ); - QVERIFY( mTest->canQueryRecommendations() == true ); - - mTest->mSongData->mAlbum = QString(); - mTest->mSongData->mArtist = QString( "artist" ); - mTest->mInspireMeGroupBox->setCollapsed( false ); - QVERIFY( mTest->canQueryRecommendations() == true ); - - mTest->mSongData->mAlbum = QString(); - mTest->mSongData->mArtist = QString(); - mTest->mInspireMeGroupBox->setCollapsed( false ); - QVERIFY( mTest->canQueryRecommendations() == false ); -} - -void TestMpDetailsView::testCanQuerySharePlayerLink() -{ - mTest->mSongData = new MpSongData(); - mTest->mSongData->mTitle = QString( "title" ); - mTest->mSongData->mArtist = QString( "artist" ); - QVERIFY( mTest->canQuerySharePlayerLink() == true ); - - mTest->mSongData->mTitle = QString(); - mTest->mSongData->mArtist = QString( "artist" ); - QVERIFY( mTest->canQuerySharePlayerLink() == false ); - - mTest->mSongData->mTitle = QString( "title" ); - mTest->mSongData->mArtist = QString(); - QVERIFY( mTest->canQuerySharePlayerLink() == false ); - - mTest->mSongData->mTitle = QString(); - mTest->mSongData->mArtist = QString(); - QVERIFY( mTest->canQuerySharePlayerLink() == false ); -} - void TestMpDetailsView::testHandlePlaybackInfoChanged() { mTest->mSongData = new MpSongData(); @@ -257,12 +183,6 @@ QCOMPARE( mTest->mArtistText->plainText(), QString( "txt_mus_other_unknown6" ) ); } -void TestMpDetailsView::testClearInspireMe() -{ - mTest->clearInspireMe(); - QVERIFY( mTest->mInspireList->count() == 0 ); -} - void TestMpDetailsView::testHandleDetailsGroupBoxToggled() { mTest->handleDetailsGroupBoxToggled( false ); diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/inc/mpdetailssharedialog.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/inc/mpdetailssharedialog.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MPDETAILSSHAREDIALOG_H -#define MPDETAILSSHAREDIALOG_H - -#include - -class QGraphicsWebView; -class QNetworkAccessManager; -class MpSongData; - -class MpDetailsShareDialog : public HbDialog -{ - Q_OBJECT - -public: - MpDetailsShareDialog(); - void initialize( MpSongData* aSongData ); - virtual ~MpDetailsShareDialog(); - void reload(); - -public slots: - void updateSharedData(); - void onIndexLoad( bool ok ); - -private: - QObject* mSharedData; // NOT owned. - QGraphicsWebView* mShareWebView; // Owned by HbDialog - QNetworkAccessManager* mShareNetAccMan; // Owned -}; - -#endif // MPDETAILSSHAREDIALOG_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/inc/mpquerymanager.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/inc/mpquerymanager.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/inc/mpquerymanager.h Fri Aug 06 16:51:36 2010 -0500 @@ -19,12 +19,11 @@ #include #include -#include +#include #include #include "mpviewbase.h" class MpSongData; -class MpDetailsShareDialog; class MpEngine; @@ -37,18 +36,21 @@ ~MpQueryManager(); public: + void reset(); + bool isLocalMusicStore() const; void clearNetworkReplies(); void queryLocalMusicStore( QString mArtist,QString mAlbum,QString mTitle ); + void queryLocalMusicStore(); void queryInspireMeItems( QString mArtist,QString mAlbum,QString mTitle ); void clearRecommendations(); - QStringList recommendationSongs(); - QStringList recommendationArtists(); + int recommendationsCount() const; + QString recommendedSong(int index) const; + QString recommendedArtist(int index) const; QStringList recommendationAlbumArtsLink(); - QMap recommendationAlbumArtsMap(); + HbIcon recommendedAlbumArt(int index) const; int &albumArtsReadyCount(); - - void insertMapItem( const QString &uri, const QPixmap &pixmap ); + signals: void onlineStatusChanged( bool state ); @@ -57,7 +59,6 @@ private: int mDownloadedAlbumArts; - MpDetailsShareDialog* mSharePopup; QString mArtist; QString mAlbum; @@ -68,7 +69,7 @@ QStringList mRecommendationSongs; QStringList mRecommendationArtists; QStringList mRecommendationAlbumArtsLink; - QMap mRecommendationAlbumArtsMap; + QMap mRecommendationAlbumArtsMap; int mAlbumArtsReadyCount; }; diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/src/mpdetailssharedialog.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/src/mpdetailssharedialog.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "mpdetailssharedialog.h" -#include "mptrace.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// For allowing local caching of javascript files loaded by popup -class MpNetworkAccessManager : public QNetworkAccessManager -{ -public: - MpNetworkAccessManager() { }; - -private: - QNetworkReply *createRequest( Operation /*op*/, - const QNetworkRequest &/*request*/, - QIODevice */*outgoingData = 0*/ ) { return 0; } -}; - - -MpDetailsShareDialog::MpDetailsShareDialog( ) - : mSharedData( ), - mShareWebView( 0 ), - mShareNetAccMan( 0 ) -{ - TX_ENTRY_ARGS("STUB") - TX_EXIT_ARGS("STUB") -} - -MpDetailsShareDialog::~MpDetailsShareDialog() -{ - TX_ENTRY_ARGS("STUB") - TX_EXIT_ARGS("STUB") -} - -void MpDetailsShareDialog::initialize( MpSongData* aSongData ) -{ - Q_UNUSED(aSongData) - TX_ENTRY_ARGS("STUB") - TX_EXIT_ARGS("STUB") -} - -void MpDetailsShareDialog::updateSharedData() -{ - TX_ENTRY_ARGS("STUB") - TX_EXIT_ARGS("STUB") -} - -void MpDetailsShareDialog::reload() -{ - TX_ENTRY_ARGS("STUB") - TX_EXIT_ARGS("STUB") -} - -void MpDetailsShareDialog::onIndexLoad( bool aOk ) -{ - Q_UNUSED(aOk) - TX_ENTRY_ARGS("STUB") - TX_EXIT_ARGS("STUB") -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/src/mpquerymanager.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/src/mpquerymanager.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/stub/src/mpquerymanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -21,7 +21,6 @@ #include #include -#include "mpdetailssharedialog.h" #include "mptrace.h" const int KRecommendationNum = 2; @@ -56,6 +55,26 @@ mTitle=title; TX_EXIT_ARGS("STUB") } + +void MpQueryManager::queryLocalMusicStore() +{ + TX_ENTRY_ARGS("STUB") + TX_EXIT_ARGS("STUB") +} + +void MpQueryManager::reset() +{ + TX_ENTRY_ARGS("STUB") + TX_EXIT_ARGS("STUB") +} + +bool MpQueryManager::isLocalMusicStore() const +{ + TX_ENTRY_ARGS("STUB - will always return TRUE") + TX_EXIT_ARGS("STUB") + return true; +} + void MpQueryManager::queryInspireMeItems(QString artist,QString album,QString title) { @@ -91,40 +110,18 @@ TX_EXIT_ARGS("STUB") } -/*! - Return recommendation songs - */ -QStringList MpQueryManager::recommendationSongs() -{ - TX_LOG - return mRecommendationSongs; -} /*! Return recommendation artists */ -QStringList MpQueryManager::recommendationArtists() -{ - TX_LOG - return mRecommendationArtists; -} - -/*! - Return recommendation album arts links - */ -QStringList MpQueryManager::recommendationAlbumArtsLink() +QString MpQueryManager::recommendedArtist(int index) const { - TX_LOG - return mRecommendationAlbumArtsLink; -} - -/*! - Return map of name and pixmap - */ -QMap MpQueryManager::recommendationAlbumArtsMap() -{ - TX_LOG - return mRecommendationAlbumArtsMap; + QString result; + if( (0 <= index) && (index < mRecommendationArtists.count())) { + result = mRecommendationArtists.at(index); + } + TX_LOG_ARGS ("recommendedArtist: " << result); + return result; } /*! @@ -136,13 +133,23 @@ return mAlbumArtsReadyCount; } -/*! - Insert one uri & pixmap item into map - */ -void MpQueryManager::insertMapItem( const QString &uri, const QPixmap &pixmap ) +int MpQueryManager::recommendationsCount() const { - TX_ENTRY_ARGS("STUB Map Item URI: " << uri ); - mRecommendationAlbumArtsMap.insert( uri, pixmap ); - TX_EXIT_ARGS("STUB") + TX_LOG_ARGS ("count: " << mRecommendationSongs.count()); + return mRecommendationSongs.count(); } +QString MpQueryManager::recommendedSong(int index) const +{ + QString result; + if( (0 <= index) && (index < mRecommendationSongs.count())) { + result = mRecommendationSongs.at(index); + } + return result; +} + +HbIcon MpQueryManager::recommendedAlbumArt(int index) const +{ + TX_LOG_ARGS( "index = " << index ) + return mRecommendationAlbumArtsMap.value( mRecommendationAlbumArtsLink.at( index ) ); +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/unittest_mpdetailsview.pro --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/unittest_mpdetailsview.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/unittest_mpdetailsview.pro Fri Aug 06 16:51:36 2010 -0500 @@ -45,7 +45,6 @@ stub/inc/mpenginefactory.h \ stub/inc/mpsongdata.h \ stub/inc/thumbnailmanager_qt.h \ - stub/inc/mpdetailssharedialog.h \ ../../../../inc/mpviewbase.h @@ -56,6 +55,5 @@ stub/src/mpenginefactory.cpp \ stub/src/mpsongdata.cpp \ stub/src/thumbnailmanager_qt.cpp \ - stub/src/mpdetailssharedialog.cpp RESOURCES += ../../resources/mpdetailsviewresources.qrc diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/src/unittest_mpquerymanager.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/src/unittest_mpquerymanager.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/src/unittest_mpquerymanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -142,17 +142,26 @@ void TestMpQueryManager::testrecommendationArtists() { QStringList recommendedArtists; + QStringList recommendedSongs; QStringList recommendedArtistsRecd; QString recommendedArtist1("Artist1"); QString recommendedArtist2("Artist2"); + QString song1("Song1"); + QString song2("Song2"); recommendedArtists.append(recommendedArtist1); recommendedArtists.append(recommendedArtist2); + + recommendedSongs.append(song1); + recommendedSongs.append(song2); mTest->mRecommendationArtists.append(recommendedArtists); - - recommendedArtistsRecd << mTest->recommendationArtists(); + mTest->mRecommendationSongs.append(recommendedSongs); + + for(int i = 0; i < mTest->recommendationsCount(); ++i) { + recommendedArtistsRecd << mTest->recommendedArtist(i); + } QCOMPARE(recommendedArtists,recommendedArtistsRecd); } diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/stub/inc/thumbnailmanager_qt.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/stub/inc/thumbnailmanager_qt.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/stub/inc/thumbnailmanager_qt.h Fri Aug 06 16:51:36 2010 -0500 @@ -112,6 +112,7 @@ int getThumbnail( const QString& fileName, void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); bool cancelRequest( int id ); + void deleteThumbnails( const QString& fileName ); signals: diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/stub/src/thumbnailmanager_qt.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/stub/src/thumbnailmanager_qt.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/stub/src/thumbnailmanager_qt.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -107,3 +107,8 @@ mCancelCounter++; return true; } + +void ThumbnailManager::deleteThumbnails( const QString& fileName ) +{ + TX_ENTRY_ARGS("Stub (NOP)") +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/unittest_mpquerymanager.pro --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/unittest_mpquerymanager.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpquerymanager/unittest_mpquerymanager.pro Fri Aug 06 16:51:36 2010 -0500 @@ -31,7 +31,8 @@ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -LIBS += -lqtbearer.dll +LIBS += -lqtbearer.dll \ + -lxqsysinfo # Input HEADERS += inc/unittest_mpquerymanager.h \ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/UT_mpsharedata.pkg --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/UT_mpsharedata.pkg Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -; Language -&EN - -; SIS header: name, uid, version -#{"unittest_mpsharedata"},(0xE5d27be8),1,0,0 - -; Localised Vendor name -%{"Vendor"} - -; Unique Vendor name -:"Vendor" - - -; Manual PKG pre-rules from PRO files -; Default HW/platform dependencies -; [0x101F7961],0,0,0,{"S60ProductID"} -; [0x102032BE],0,0,0,{"S60ProductID"} -; [0x102752AE],0,0,0,{"S60ProductID"} -; [0x1028315F],0,0,0,{"S60ProductID"} - -; Default dependency to Qt libraries -; (0x2001E61C), 4, 6, 3, {"Qt"} - -; Executable and default resource files -"/epoc32/release/armv5/udeb/unittest_mpsharedata.exe" - "!:\sys\bin\unittest_mpsharedata.exe" -"/epoc32/data/z/resource/apps/unittest_mpsharedata.rsc" - "!:\resource\apps\unittest_mpsharedata.rsc" -"/epoc32/data/z/private/10003a3f/import/apps/unittest_mpsharedata_reg.rsc" - "!:\private\10003a3f\import\apps\unittest_mpsharedata_reg.rsc" - -; Manual PKG post-rules from PRO files diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/inc/unittest_mpsharedata.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/inc/unittest_mpsharedata.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for mpsongdata -* -*/ - -#ifndef UNITTEST_MPSHAREDATA_H_ -#define UNITTEST_MPSHAREDATA_H_ - -#include - -class MpShareData; - -class TestMpShareData : public QObject -{ - Q_OBJECT - -public: - - TestMpShareData(); - virtual ~TestMpShareData(); - -signals: - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void testOwner(); - void testSongData(); - void testErrorMessage(); - void testUserName(); - void testPassword(); - void testObjectTypeWithLink(); - void testObjectTypeWithoutLink(); - void testObjectContentWithLink(); - void testObjectContentWithTitleAndArtist(); - void testObjectContentWithTitleOnly(); - void testObjectContentWithArtistOnly(); - void testObjectContentWithoutMetaInfo(); - void testSongTitle(); -// void testSongAlbum(); - void testSongArtist(); - void testAlbumArt(); - void testLanguage(); -// void testSongComment(); -// void testSongAlbumArt(); -// void testSongYear(); -// void testSongGenre(); -// void testSongComposer(); -// void testSongAlbumTrack(); -// void testSongLink(); - void testSongNoInfo(); - -private: - MpShareData *mTest; - -}; - - -#endif /* UNITTEST_MPSHAREDATA_H_ */ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/sis.bat --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/sis.bat Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -@echo off -del *.sisx -makesis UT_mpsharedata.pkg -signsis UT_mpsharedata.sis UT_mpsharedata.sisx %RNDCERTS_PATH%\Nokia_RnDCert_02.der %RNDCERTS_PATH%\Nokia_RnDCert_02.key -del UT_mpsharedata.sis \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/src/unittest_mpsharedata.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/src/unittest_mpsharedata.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for MpShareData -* -*/ -#include -#ifdef Q_OS_SYMBIAN -#include -#include -#include -#endif -#include"unittest_mpsharedata.h" - -// Do this so we can access all member variables. -#define private public -#include "mpsharedata.h" -#undef private -#include "mpsongdata.h" - -/*! - Make our test case a stand-alone executable that runs all the test functions. - */ -#ifdef Q_OS_SYMBIAN -int main(int argc, char *argv[]) -{ - - HbApplication app(argc, argv); - HbMainWindow window; - - TestMpShareData tv; - -if ( argc > 1 ) { - return QTest::qExec( &tv, argc, argv); - } - else { - char *pass[3]; - pass[0] = argv[0]; - pass[1] = "-o"; - pass[2] = "c:\\data\\unittest_mpsharedata.txt"; - - return QTest::qExec(&tv, 3, pass); - } -} -#endif - -#ifdef Q_OS_WIN32 -QTEST_MAIN(TestMpShareData) -#endif -//Constructor -TestMpShareData::TestMpShareData() - : mTest(0) -{ - -} - -//Destructor -TestMpShareData::~TestMpShareData() -{ - if (mTest) delete mTest; -} - -/*! - Called before the first testfunction is executed. - */ -void TestMpShareData::initTestCase() -{ - qDebug() << "unit test for mpsharedata begin."; -} - -/*! - Called after the last testfunction was executed. - */ -void TestMpShareData::cleanupTestCase() -{ - qDebug() << "unit test for mpsharedata end."; - QCoreApplication::processEvents(); -} - -/*! - Called before each testfunction is executed. - */ -void TestMpShareData::init() -{ - mTest = new MpShareData(); - mTest->setUnknownTr("Unknown"); -} - -/*! - Called after every testfunction. - */ -void TestMpShareData::cleanup() -{ - delete mTest; - mTest = 0; -} - -void TestMpShareData::testOwner() -{ - mTest->setOwner(this); - QCOMPARE(mTest->owner(), (QObject*) this); -} - -void TestMpShareData::testSongData() -{ - MpSongData *song = new MpSongData(); - mTest->setSongData(song); - QCOMPARE(mTest->songData(), song); - delete song; -} - -void TestMpShareData::testErrorMessage() -{ - QString msg("Test error message."); - mTest->setErrorMessage(msg); - QCOMPARE(mTest->errorMessage(), msg); -} - -void TestMpShareData::testUserName() -{ - QString name("testname"); - mTest->setUsername(name); - QCOMPARE(mTest->username(), name); -} - -void TestMpShareData::testPassword() -{ - QString password("testpassword"); - mTest->setPassword(password); - QCOMPARE(mTest->password(), password); -} - -void TestMpShareData::testObjectTypeWithLink() -{ - MpSongData *song = new MpSongData(); - song->setLink("http://www.nokia.com"); - mTest->setSongData(song); - QCOMPARE(mTest->objectType(), QString("URI")); -} - -void TestMpShareData::testObjectTypeWithoutLink() -{ - MpSongData *song = new MpSongData(); - song->setLink(""); - mTest->setSongData(song); - QCOMPARE(mTest->objectType(), QString("NOTE-APPEND")); - delete song; -} - -void TestMpShareData::testObjectContentWithLink() -{ - MpSongData *song = new MpSongData(); - song->setLink("http://www.nokia.com"); - song->setTitle("TestTitle"); - song->setArtist("TestArtist"); - song->setAlbum("TestAlbum"); - song->setAlbumArtUri("http://www.nokia.com/notexist.png"); - mTest->setSongData(song); - QCOMPARE(mTest->objectContent(), QString("http://www.nokia.com")); - QCOMPARE(mTest->objectReservedLength(), QString("http://www.nokia.com").length()); - delete song; -} - -void TestMpShareData::testObjectContentWithTitleAndArtist() -{ - MpSongData *song = new MpSongData(); - song->setTitle("TestTitle"); - song->setArtist("TestArtist"); - song->setAlbum("TestAlbum"); - song->setAlbumArtUri("http://www.nokia.com/notexist.png"); - mTest->setSongData(song); - QCOMPARE(mTest->objectContent(), QString("♫ TestArtist: TestTitle http://music.ovi.com")); - QCOMPARE(mTest->objectReservedLength(), QString("♫ TestArtist: TestTitle http://music.ovi.com").length()); - delete song; -} - - -void TestMpShareData::testObjectContentWithTitleOnly() -{ - MpSongData *song = new MpSongData(); - song->setTitle("TestTitle"); - song->setAlbum("TestAlbum"); - song->setAlbumArtUri("http://www.nokia.com/notexist.png"); - mTest->setSongData(song); - QCOMPARE(mTest->objectContent(), QString("♫ Unknown: TestTitle http://music.ovi.com")); - QCOMPARE(mTest->objectReservedLength(), QString("♫ Unknown: TestTitle http://music.ovi.com").length()); - delete song; -} - - -void TestMpShareData::testObjectContentWithArtistOnly() -{ - MpSongData *song = new MpSongData(); - song->setArtist("TestArtist"); - song->setAlbum("TestAlbum"); - song->setAlbumArtUri("http://www.nokia.com/notexist.png"); - mTest->setSongData(song); - QCOMPARE(mTest->objectContent(), QString("♫ TestArtist: Unknown http://music.ovi.com")); - QCOMPARE(mTest->objectReservedLength(), QString("♫ TestArtist: Unknown http://music.ovi.com").length()); - delete song; -} - - -void TestMpShareData::testObjectContentWithoutMetaInfo() -{ - MpSongData *song = new MpSongData(); - mTest->setSongData(song); - QCOMPARE(mTest->objectContent(), QString("♫ Unknown: Unknown http://music.ovi.com")); - QCOMPARE(mTest->objectReservedLength(), QString("♫ Unknown: Unknown http://music.ovi.com").length()); - delete song; -} - -void TestMpShareData::testSongTitle() -{ - MpSongData *song = new MpSongData(); - song->setTitle("TestTitle"); - mTest->setSongData(song); - QCOMPARE(mTest->title(), QString("TestTitle")); - delete song; -} - - -void TestMpShareData::testSongArtist() -{ - MpSongData *song = new MpSongData(); - song->setArtist("TestArtist"); - mTest->setSongData(song); - QCOMPARE(mTest->artist(), QString("TestArtist")); - delete song; -} - -void TestMpShareData::testAlbumArt() -{ - MpSongData *song = new MpSongData(); - mTest->setSongData(song); - QCOMPARE(mTest->albumArtBase64(), QString("e:\\album_art.png")); - delete song; -} - -void TestMpShareData::testLanguage() -{ - MpSongData *song = new MpSongData(); - mTest->setSongData(song); - mTest->setLanguage("fi"); - QCOMPARE(mTest->language(), QString("fi")); - delete song; -} - -void TestMpShareData::testSongNoInfo() -{ - QCOMPARE(mTest->title(), QString("Unknown")); -// QCOMPARE(mTest->album(), QString("")); - QCOMPARE(mTest->artist(), QString("Unknown")); - QCOMPARE(mTest->albumArtBase64(), QString("")); - QCOMPARE(mTest->objectContent(), QString("♫ Unknown: Unknown http://music.ovi.com")); -// QCOMPARE(mTest->comment(), QString("")); -// QCOMPARE(mTest->year(), QString("")); -// QCOMPARE(mTest->genre(), QString("")); -// QCOMPARE(mTest->composer(), QString("")); -// QCOMPARE(mTest->albumTrack(), QString("")); -// QCOMPARE(mTest->link(), QString("")); -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/stub/inc/mpsongdata.h --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/stub/inc/mpsongdata.h Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stub of Metadata of song -* -*/ - -#ifndef MPSONGDATA_H -#define MPSONGDATA_H - -#include -#include -#include - - -//forward declartions -class QIcon; - -//class declaration -class MpSongData : public QObject -{ - Q_OBJECT - -public: - explicit MpSongData( QObject *parent=0 ); - virtual ~MpSongData(); - - bool setTitle( const QString &title ); - bool setAlbum( const QString &album ); - bool setArtist( const QString &artist ); - bool setComment( const QString &comment ); - void setAlbumArtUri( const QString &albumArtUri ); - bool setYear( int date ); - bool setGenre( const QString &genre ); - bool setComposer( const QString &compoer ); - bool setAlbumTrack( const QString &albumtrack ); - void setLink( const QString &link ); - bool setMusicURL( const QString &musicURL ); - - // inform details view when basic information is ready to accelerate UI update - void commitPlaybackInfo(); - // inform details view when details information is ready - void commitSongDetailInfo(); - -public slots: - void thumbnailReady( const QPixmap& pixmap, void *data, int id, int error ); - - int reservedLength() const { return mLink.length() + mTitle.length() + mArtist.length(); } - - QString title() const; - QString album() const; - QString artist() const; - QString comment() const; - void albumArt( QPixmap& pixmap ); - QString year() const; - QString genre() const; - QString composer() const; - QString albumTrack() const; - QString musicURL() const; - QString link() const; - QString albumArtBase64() const; - -signals: - void albumArtReady(); - void playbackInfoChanged(); - void songDetailInfoChanged(); - -private: - QString mTitle; - QString mAlbum; - QString mArtist; - QString mComment; - QString mComposer; - QString mGenre; - QString mYear; - QString mAlbumTrack; - QPixmap mAlbumArt; - int mReqId; - QString currentAAUri; - QPixmap mDefaultAlbumArt; - QString mLink; - QString mMusicURL; - - Q_DISABLE_COPY(MpSongData) -}; - -#endif // MPSONGDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/stub/src/mpsongdata.cpp --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/stub/src/mpsongdata.cpp Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,402 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Playback Data provider for playback view. -* -*/ - - -#include -#include - -#include "mpsongdata.h" -#include "mptrace.h" - - -const int KUndefined = -1; - -/*! - \class MpSongData - \brief Music Player song metadata. - - Song data provide acces to current playing song metadata -*/ - -/*! - \fn void albumArtReady() - - This signal is albuma alrt is ready. - */ - -/*! - \fn void playbackInfoChanged() - - This signal is emitted when basic information is available - */ - -/*! - \fn void songDetailInfoChanged() - - This signal is emitted when detail information is available - */ - - - -/*! - Constructs a new MpSongData. - */ -MpSongData::MpSongData( QObject *parent ) - : QObject( parent ), - mTitle( NULL ), - mAlbum( NULL ), - mArtist( NULL ), - mComposer( NULL), - mGenre( NULL ), - mYear( NULL ), - mAlbumTrack( NULL ), - mAlbumArt(), - mReqId( KUndefined ) -{ - //TX_ENTRY - //TX_EXIT -} - -/*! - Constructs a new MpSongData. - */ -MpSongData::~MpSongData() -{ - //TX_ENTRY - //TX_EXIT -} - -/*! - Returns the song album art on \a pixmap. -*/ -void MpSongData::albumArt( QPixmap& pixmap ) -{ - //TX_ENTRY - if ( !mAlbumArt.isNull() ) { - pixmap = mAlbumArt; - } - else { - pixmap = QPixmap(); - } - //TX_EXIT -} - - -/*! - Returns the song title. -*/ -QString MpSongData::title() const -{ - //TX_LOG - return mTitle; -} - -/*! - Returns the song album. -*/ -QString MpSongData::album() const -{ - //TX_LOG - return mAlbum; -} - -/*! - Returns the song artist. -*/ -QString MpSongData::artist() const -{ - //TX_LOG - return mArtist; -} - -/*! - Returns comment -*/ -QString MpSongData::comment() const -{ - //TX_LOG - return mComment; -} - -/*! - Returns the song composer. -*/ -QString MpSongData::composer() const -{ - //TX_LOG - return mComposer; -} - - -/*! - Returns the song genre. -*/ -QString MpSongData::genre() const -{ - //TX_LOG - return mGenre; -} - - -/*! - Returns the album track. -*/ -QString MpSongData::albumTrack() const -{ - //TX_LOG - return mAlbumTrack; -} - -/*! - Returns link -*/ -QString MpSongData::musicURL() const -{ - //TX_LOG - return mMusicURL; -} - -/*! - Returns link -*/ -QString MpSongData::link() const -{ - //TX_LOG - return mLink; -} - -/*! - Returns the release date. -*/ -QString MpSongData::year() const -{ - //TX_LOG - return mYear; -} - - -/*! - Sets the song \a title, returns true if the value is new. -*/ -bool MpSongData::setTitle( const QString &title ) -{ - //TX_ENTRY_ARGS( "title =" << title ) - bool change = false; - if ( title != mTitle ) { - change = true; - mTitle = title; - } - //TX_EXIT - return change; -} - -/*! - Sets the song \a album, returns true if the value is new. -*/ -bool MpSongData::setAlbum( const QString &album ) -{ - //TX_ENTRY_ARGS( "album =" << album ) - bool change = false; - if ( album != mAlbum ) { - change = true; - mAlbum = album; - } - //TX_EXIT - return change; -} - -/*! - Sets the song \a artist, returns true if the value is new. -*/ -bool MpSongData::setArtist( const QString &artist ) -{ - //TX_ENTRY_ARGS( "artist =" << artist ) - bool change = false; - if ( artist != mArtist ) { - change = true; - mArtist = artist; - } - //TX_EXIT - return change; -} - -/*! - Sets the song \a comment, returns true if the value is new. -*/ -bool MpSongData::setComment( const QString &comment) -{ - //TX_ENTRY_ARGS( "comment =" << comment ) - bool change = false; - if ( comment != mComment ) { - change = true; - mComment = comment; - } - //TX_EXIT - return change; -} - - -/*! - Sets the song \a composer, returns true if the value is new. -*/ -bool MpSongData::setComposer( const QString &composer ) -{ - //TX_ENTRY_ARGS( "composer =" << composer ) - bool change = false; - if ( composer != mComposer ) { - change = true; - mComposer = composer; - } - //TX_EXIT - return change; -} - -/*! - Sets the song \a genre, returns true if the value is new. -*/ -bool MpSongData::setGenre( const QString &genre ) -{ - //TX_ENTRY_ARGS( "genre =" << genre ) - bool change = false; - if ( genre != mGenre ) { - change = true; - mGenre = genre; - } - //TX_EXIT - return change; -} - - -/*! - Sets the song \a date, returns true if the value is new. -*/ -bool MpSongData::setYear( int year ) -{ - //TX_ENTRY_ARGS( "year =" << year ) - bool change = false; - if ( QString::number(year) != mYear ) { - change = true; - if ( year >= 0 && year < 9999 ) { - mYear = QString::number(year); - } - } - //TX_EXIT - return change; -} - -/*! - Sets the \a album track, returns true if the value is new. -*/ -bool MpSongData::setAlbumTrack( const QString &track ) -{ - //TX_ENTRY_ARGS( "track =" << track ) - bool change = false; - if ( track != mAlbumTrack ) { - change = true; - mAlbumTrack = track; - } - //TX_EXIT - return change; -} - -/*! - Sets the \a link -*/ -void MpSongData::setLink( const QString &link ) -{ - //TX_ENTRY_ARGS( "Link =" << link ) - mLink = link; - //TX_EXIT -} - -/*! - Sets the \a Music URL -*/ -bool MpSongData::setMusicURL( const QString &link ) -{ - //TX_ENTRY_ARGS( "MusicURL =" << link ) - mMusicURL = link; - return true; - //TX_EXIT -} - - - -/*! - Sets the song \a albumArtUri. -*/ -void MpSongData::setAlbumArtUri( const QString &albumArtUri) -{ - //TX_ENTRY - Q_UNUSED(albumArtUri) - mAlbumArt = mDefaultAlbumArt; - emit albumArtReady(); - //TX_EXIT -} - - -/*! - Slot to handle the album art thumb. -*/ -void MpSongData::thumbnailReady( - const QPixmap& pixmap, - void *data, - int id, - int error ) -{ - //TX_ENTRY - Q_UNUSED( pixmap ); - Q_UNUSED( data ); - Q_UNUSED( id ); - Q_UNUSED( error ); - //TX_EXIT -} - -/*! - Emit signal when playback information changed, such as artist, track name -*/ -void MpSongData::commitPlaybackInfo() -{ - //TX_ENTRY - emit playbackInfoChanged(); - //TX_EXIT -} - -/*! - Emit signal when song detail information changed -*/ -void MpSongData::commitSongDetailInfo() -{ - //TX_ENTRY - emit songDetailInfoChanged(); - //TX_EXIT -} - -QString MpSongData::albumArtBase64() const -{ - // Converts the current album art pixmap to a base64 string, and return the string. -// TX_ENTRY -// QByteArray array; -// QBuffer buffer(&array); -// buffer.open(QIODevice::WriteOnly); -// mAlbumArt.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format -// buffer.close(); -// QByteArray base64 = array.toBase64(); -// TX_EXIT -// return base64.constData(); - return QString("e:\\album_art.png"); -} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/unittest_mpsharedata.pro --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsharedata/unittest_mpsharedata.pro Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -TEMPLATE = app -CONFIG += qtestlib \ - symbian_test \ - hb -TARGET = unittest_mpsharedata -DEPENDPATH += . -INCLUDEPATH += ./inc \ - ./stub/inc \ - ../../inc \ - ../../../../inc -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - -DEFINES += SHARE_FUNC_ENABLED - -# Input -HEADERS += inc/unittest_mpsharedata.h \ - ../../inc/mpsharedata.h \ - stub/inc/mpsongdata.h -SOURCES += src/unittest_mpsharedata.cpp \ - ../../src/mpsharedata.cpp \ - stub/src/mpsongdata.cpp diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/JsTestDriver-1.2.1.jar Binary file mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/JsTestDriver-1.2.1.jar has changed diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/JsTestDriver.conf --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/JsTestDriver.conf Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -server: http://localhost:12121 - -load: - - ../../resources/*.js - - test-src/oviapi.js - - test-src/publishplayer.js - - test-src/musictest.js - -exclude: diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/readme.txt --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/readme.txt Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -This is the unit test for javascript in resource folder. - -The test could only run on windows, NOT on phone! - -To execute the test, first run this command in command window to start the server: -java.exe -jar JsTestDriver-1.2.1.jar --port 12121 --browser "C:\Program Files\Mozilla Firefox\firefox.exe" - -Then run this command to run the tests: -java.exe -jar JsTestDriver-1.2.1.jar --config jsTestDriver.conf --verbose --tests all --captureConsole diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/test-src/MusicTest.js --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/test-src/MusicTest.js Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -MusicTest = TestCase('MusicTest'); - -MusicTest.prototype.testMusicContext = function() { - var context = music.privateFunctions.getMusicContext(); - assertTrue(context.object.data.miniview.indexOf("London Calling") != -1); - assertTrue(context.object.data.miniview.indexOf("The Clash") != -1); -}; - -MusicTest.prototype.testNoa = function() { - var context = music.privateFunctions.getNoa(); - assertTrue(context.username.indexOf("lcoubert10") != -1); - assertTrue(context.password.indexOf("lcoubert01") != -1); -}; - -MusicTest.prototype.testInitPlayer = function() { -// document.createElement('div').setAttribute("id", "ovi.player.share.ui"); - /*:DOC +=
*/ - music.initPlayer(); - var ui = document.getElementById("ovi.player.share.ui"); - assertTrue(ui.innerHTML.indexOf('player') >= 0); -}; - -MusicTest.prototype.setUp = function() { - window.context = { - username: function(){ - return "lcoubert10" - }, - password: function(){ - return "lcoubert01" - }, - title: function(){ - return "London Calling" - }, - album: function(){ - return "dummyuri" - }, - artist: function(){ - return "The Clash" - }, - link: function(){ - return "http://music.ovi.com/ru/ru/pc/Product/Queen/Bohemian-Rhapsody/8019069" - }, - albumArtBase64: function(){return 0;} - } -}; - -MusicTest.prototype.tearDown = function() { }; - - diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/test-src/oviapi.js --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/test-src/oviapi.js Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,408 +0,0 @@ -// The following identifier turns the IE conditional pre-compilation on. -/*@cc_on @*/ - -/** - * @namespace Parent namespace for the api.ovi.com project. - */ -if (typeof ovi == 'undefined') { - ovi = {}; -}; - -(function (ovi) { -// ovi = function() { - var that = {}; - - ovi.description = { - proxy_url: window.location.protocol + "//" + window.location.host + "/ovi-api", - sourceLocation: "/js", - urlSeperator: "/", - libFileExtension: ".js", - minified: false, - sign_method : "method-delegate-oauth", - env_path : "/alpha", - dispatch_path : "/api", - proxy_prefix : "", //useful during dev, so same consumer key can be reused for multiple instances of ovi-api - request_timeout : 30, // Network request timeout lapse (in seconds). - caller_id : "", //random id used for caller authentication - env_device : true // Do not change anything in this line, even the spacing. Else the project won't build properly for SPB. - }; - // that.description = description; - - //Ignore console calls, in case it is not imported - ovi.console = {init:function(){},log:function(){},error:function(){},debug:function(){},info:function(){}}; - - //Ignore config calls, in case config.js is not imported - ovi.config = {setenv:function(){},setServiceEndPoint:function(){}}; - - var _loaded = {}; //Mapping from script source URL to status (0 - not loaded, 1 - loaded) - var _libMappings = {}; //Mapping from script source URL to libName - var _pending_callbacks = []; //Used to delay callbacks, until all dependencies are loaded - - /** - * Method to initialize source URL using location of path from where oviapi.js was loaded - * - */ - var _initSourceURL = function() { - var scripts = document.getElementsByTagName('script'); - if (!scripts) return; // TODO Throw an exception instead. - - var srcFilePattern = new RegExp("/js/ovi/(oviapi|oviapi-min|oviapi_(.+)|oviapi_(.+)-min).js$", "gi"); - for(var index = 0; index < scripts.length; index++) { - - var ssrc = scripts.item(index).src; - if (typeof ssrc !== 'undefined') { - ssrc = ssrc.replace(/^\s*|\s*$/g,''); // To remove any white spaces. - - var startIndex = ssrc.search(srcFilePattern); - if (startIndex > 0) { - - // To determine whether the minified version of ovi libraries are used. - if (ssrc.indexOf("min") > 0) { - ovi.description.minified = true; - } - - // If only relative src can be accessed, then use window.location ro create sourceURL - if (ssrc.substr(0,6) !== 'http:/' && ssrc.substr(0,7) !== 'https:/') { - var rootdir = window.location.pathname.split('/'); - if (rootdir.length > 1) - ovi.description.proxy_url = window.location.protocol + "//" + window.location.host + "/" + rootdir[1]; - break; - } else { - ovi.description.proxy_url = ssrc.substring(0, startIndex); - break; - } - } - } - } - }; - _initSourceURL(); - - /** - * Get an array of the loaded libs - * @param {Integer} Optional param to specify the status of the loaded library. - * @return Array of libNames - */ - var _getLoadedLibNames = function(status){ - var loadedLibs = []; - if (typeof status === 'undefined') status = -1; - for (var item in _loaded){ - if ((status === -1) || (_loaded[item] === status)){ - loadedLibs.push(_libMappings[item]); - } - } - return loadedLibs; - }; - - /** - * Get an object with loaded lib name as key and load status as value (1 - loaded, 0 - not loaded) - * @param {Integer} Optional param to specify the status of the loaded library. - * @return Object with libNames as key and load status as value - */ - var _getLoadedLibNamesAsObject = function(status){ - var loadedLibs = {}; - if (typeof status === 'undefined') status = -1; - for (var item in _loaded){ - if ((status === -1) || (_loaded[item] === status)){ - loadedLibs[_libMappings[item]] = _loaded[item]; - } - } - return loadedLibs; - }; - - /** - * Test if script was already loaded - * @param {String} scriptSrcURL source URL of script - * @return {Boolean} - */ - var _isExistingScript = function(scriptSrcURL){ - for (var item in _loaded){ - if (scriptSrcURL === item){ - return true; - } - } - return false; - }; - - /** - * Method to verify if a library object has already been loaded. In case of packaged/minified - * version of ovi libraries all the libraries would reside in one single JS file. - * - * @param {String} libraryName Name of the library object to check. - * @return {Boolean} Based on whether the check is true/false. - */ - var _isExistingLib = function(libraryName) { - for (var lib in ovi.libName) { - if (libraryName == lib) { - return true; - } - } - return false; - } - - var _determineScriptSrc = function(libName, options){ - var fileName = libName; - var scriptSrcURL = ovi.description.proxy_url; - - // This helps while using this on a widget. - if (options != undefined && options.sourceURL != undefined) { - scriptSrcURL = options.sourceURL; - } - - var fileExt = ""; - // If not using slash path, then use ".js" file extension and replace dot with slash. - if(fileName.indexOf('/') == -1){ - fileExt = ovi.description.libFileExtension; - fileName = fileName.replace(/\./g,'/'); - } - - var rootDir = ""; - //If ovi package, then use source location as root dir - if (fileName.substr(0,3) === "ovi") - rootDir = ovi.description.sourceLocation; - - scriptSrcURL = scriptSrcURL + rootDir + "/" + fileName - + ((ovi.description.minified) ? "-min" : "") - + fileExt; - return scriptSrcURL; - }; - - var _loadScript = function(scriptSrcURL, srcLib, options){ - - function _loadedcallback(){ - - //console.log(new Date().getTime()+" Loaded script:"+scriptSrcURL+" "+_getLoadedLibNames(1)); - //console.log("not loaded:"+_getLoadedLibNames(0)); - - //Mark script as loaded - _loaded[scriptSrcURL] = 1; - - //If callback exists, then add to pending callbacks - if (options && options.callback != null) - _pending_callbacks.push(options.callback); - - //If 1 or more items are pending, then don't call callbacks - var done = true; - for (var item in _loaded){ - if (_loaded[item] === 0){ - done = false; - break; - } - } - - //If all libs are loaded, then call callbacks for all includes, if any - if (done == true){ - //console.log(new Date().getTime()+" DONE AT LAST\n"); - //Call all pending callbacks - for (var index = 0; index < _pending_callbacks.length; index++){ - try{ - _pending_callbacks[index].call(); - }catch(err){ - //console.log("failed to exec callback"); - } - } - _pending_callbacks = []; //Reset pending callbacks list - ovi.onReady(_getLoadedLibNamesAsObject(1)); //call onReady - } - } - - // If the library is already loaded (throug packaged/minified source file) then skip the download process. - if (!_isExistingLib(srcLib)) { - var scriptTag = document.createElement('script'); - scriptTag.type = 'text/javascript'; - scriptTag.src = scriptSrcURL; - - if(window.opera){ - scriptTag.onload = function(){ - scriptTag.onload = null; - _loadedcallback(); - }; - } - //From Nicholas C. Zakas (http://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/) - else if (scriptTag.readyState){ //IE - scriptTag.onreadystatechange = function(){ - if (scriptTag.readyState == "loaded" || scriptTag.readyState == "complete"){ - scriptTag.onreadystatechange = null; - _loadedcallback(); - } - }; - } else { //Others - scriptTag.onload = function(){ - _loadedcallback(); - }; - } - - var documentHead = document.getElementsByTagName("head")[0]; - var newScriptTag = documentHead.appendChild(scriptTag); - if (newScriptTag) return true; - } else { - _loadedcallback(); - return true; - } - return false; - }; - - /** - * ovi.include - Method to dynamically include JS libraries from "api.ovi.com".

- * The ovi.onReady(libs) function is triggered once the library and its - * dependencies are loaded. See documentation of ovi.onReady. - * - * @param {String,Array} - * libNames Names of one or more libraries to be included, specified as an - * array of strings or as a comma separated string. - * Library name can be specified in dot notation or as a relative path. e.g., "ovi.api.people", - * "ovi/api/people.1.0.js". External libraries must start - * with "lib" e.g., "lib.jquery", - * "lib/jquery.json.js". - * @param {Object} - * options Name/Value object to hold other optional parameters. - * @param {Function} - * options.callback Function to be called after a library has - * been loaded. - * - * @example - * ovi.include("ovi.api.maps"); - * ovi.include("ovi.api.people",{callback:function(){callMeBack()}}); - * ovi.include("ovi.api.people, ovi.api.share", {callback:function(){callMeBack()}}); - * - * - * - * @function - * @methodOf ovi - */ - ovi.include = function(libNames, options) { - var importStatus = true; - try { - if (libNames != undefined) { - if (typeof libNames === 'string') - libNames = libNames.split(','); - - // Determine which scripts (and also libraries) need to be loaded - var toLoadScript = []; - for (var index = 0; index < libNames.length; index++){ - var libName = libNames[index].replace(/^\s*|\s*$/g,''); // Remove any white spaces. - - // Determine script source URL from libName - var scriptSrcURL = _determineScriptSrc(libName, options); - if (!_isExistingScript(scriptSrcURL)) { - _loaded[scriptSrcURL] = 0; //Mark script as pending - _libMappings[scriptSrcURL] = libName; - toLoadScript.push(scriptSrcURL); - - } else { - if (options && options.callback) - toLoadScript.push(scriptSrcURL); - } - //console.log("o================o"); - } - - var lstatus; - //Load scripts that need to be loaded. Pass optional callback only for last script (since callback should be called only once). - for (var index = 0; index < toLoadScript.length; index ++){ - if (index == (toLoadScript.length-1)) // if last lib, then pass optional callback - lstatus = _loadScript(toLoadScript[index], _libMappings[toLoadScript[index]], options); - else - lstatus = _loadScript(toLoadScript[index], _libMappings[toLoadScript[index]]); - if (!lstatus) importStatus = false; - } - } - } catch (exception) { - importStatus = false; - } - return importStatus; - }; - // that.include = include; - - /** - * ovi.onReady - Callback function triggered after calling ovi.include, - * once the library and its dependencies are loaded. Developers can override the default - * implementation, with their own ovi.onReady function. If successive calls to ovi.include are made, - * ovi.onReady may be triggered only once. - * - * @param {Object} - * libs - library name as key and load status as value (0 - not - * loaded, 1 - loaded). Developer must check if the libraries - * they need are loaded before using them using the ovi.testIfLoaded function. - * - * @function - * @methodOf ovi - */ - ovi.onReady = function(libs) { - //default, do nothing - //console.log("onReady:"); - //console.log(libs); - }; - // that.onReady = onReady; - - /** - * ovi.testIfLoaded - Utility function to test if the specified lib names are marked as loaded in the specified loaded libs object. - * Used to test the status of libs in ovi.onReady. - * - * @param {String,Array} - * libNames Names of one or more libraries to be included, specified as an - * array of strings or as a comma separated string. - * - * @param {Object} - * loadedLibs A mapping of lib name string to load status (0 - not loaded, 1 - loaded) - * - * @return {Boolean} - * - * @function - * @methodOf ovi - */ - ovi.testIfLoaded = function(libNames, loadedLibs){ - var reqdlibs = libNames; - if (typeof libNames === 'string') - reqdlibs = libNames.split(','); - for (var index = 0; index < reqdlibs.length; index ++){ - var libName = reqdlibs[index].replace(/\s/g,''); - if ((libName in loadedLibs) && (loadedLibs[libName] == 1)) - continue; - else - return false; - } - return true; - }; - // that.testIfLoaded = testIfLoaded; - - /** - * ovi.setCallerId - Sets caller id required to authenticate API caller with Ovi API backend. - * - * @param {String} - * cid - Caller id string - * - * @function - * @methodOf ovi - */ - ovi.setCallerId = function(cid){ - ovi.description.caller_id = cid; - }; - - // return that; -// }(); -})(ovi); - - -/** - * @property {Object} services Object that holds configurable parameters of all the libraries. - * @memberOf ovi - */ -ovi.services = {}; -ovi.services["import"] = ovi.description; - -/** - * @property {Object} libName Object that holds the identified name of all the OVI API libraries. - * @memberOf ovi - */ -ovi.libName = {}; -ovi.libName["ovi.oviapi"] = ovi; - -ovi.include('ovi.config'); - -/* -@@todo: - -- if one include inside of another fails to load, then failure is silent -- file imports will fail silently if the path is wrong -- Safari reinclude doesn't work (seems that DOM removeChild doesn't really remove the script) -*/ \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/test-src/publishplayer.js --- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_resources/test-src/publishplayer.js Fri Jul 23 17:31:12 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1312 +0,0 @@ -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; -ovi.player.contextobject = ovi.player.contextobject || -{}; - -ovi.player.contextobject.getInstance = function(config) { - var player = {}; - player._create = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "CREATE_PENDING"); - } - // TODO: add context object to player store - // TODO: store options.miniview to be returned with view as HTML - // TODO: store other properties of options to be returned with view as JSON - // TODO: return uri (unique id in this player's store) in callback - }; - player._cancel = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "CANCEL_PENDING"); - } - // TODO: cancel pending tasks - // TODO: cancel Player - }; - player._delete = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "DELETE_PENDING"); - } - // TODO: delete object defined in options.uri from store - }; - player._edit = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "EDIT_PENDING"); - } - // TODO: update object defined in options.uri - }; - player._pick = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "PICK_PENDING"); - } - // TODO: return list of all objects, or object defined in options.uri, fork with options.view - }; - player._view = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "VIEW_PENDING"); - } - // TODO: return object defined in options.uri, JSON if options.view == "none", HTML if "mini" - }; - ovi.player._getInstance.call(player, config); -}; - -ovi.player.contextobject.Player = ovi.player.contextobject.getInstance; -/* - * Basic namespaces & common Player functions - */ - - - -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; - - - -/** - * A function for creating a callback chain - * @param {Object} options - * @param {Object} handler - * @param {Object} context - * @return {Function} - */ -ovi.player._notImplemented = function(functionId) { - return function() { - var status = ovi.player._status; - handler.call(context, status["NOT_IMPLEMENTED"], null); - handler.call(context, status[functionId + "_FAILURE"], null); // TODO: return description, too? - }; -}; - - - -/** - * A method for returning an instance of a singleton - * @param {Object} options A configuration object for the player - */ -ovi.player._getInstance = function(options) { - // TODO: store the configuration options - return (function() { - return (this.instance || - (function() { - this.instance = { - // Public interface - cancel: (this._cancel || ovi.player._notImplemented("CANCEL")), - create: (this._create || ovi.player._notImplemented("CREATE")), - "delete": (this._delete || ovi.player._notImplemented("DELETE")), // delete is a keyword - edit: (this._edit || ovi.player._notImplemented("EDIT")), - pick: (this._pick || ovi.player._notImplemented("PICK")), - show: (this._view || ovi.player._notImplemented("VIEW")), // show is the same function as view, included in API for compatibility - sync: (this._sync || ovi.player._notImplemented("SYNC")), - view: (this._view || ovi.player._notImplemented("VIEW")) - }; - return this.instance; - }())); - }()); -}; - - - -ovi.player._status = { - USER_CANCEL: "USER_CANCEL", - - CANCEL_PENDING: "CANCEL_PENDING", - CANCEL_FAILURE: "CANCEL_FAILURE", - CANCEL_SUCCESS: "CANCEL_SUCCESS", - - CREATE_PENDING: "CREATE_PENDING", - CREATE_FAILURE: "CREATE_FAILURE", - CREATE_SUCCESS: "CREATE_SUCCESS", - - DELETE_PENDING: "DELETE_PENDING", - DELETE_FAILURE: "DELETE_FAILURE", - DELETE_SUCCESS: "DELETE_SUCCESS", - - EDIT_PENDING: "EDIT_PENDING", - EDIT_FAILURE: "EDIT_FAILURE", - EDIT_SUCCESS: "EDIT_SUCCESS", - - PICK_PENDING: "PICK_PENDING", - PICK_FAILURE: "PICK_FAILURE", - PICK_SUCCESS: "PICK_SUCCESS", - - SYNC_PENDING: "SYNC_PENDING", - SYNC_FAILURE: "SYNC_FAILURE", - SYNC_SUCCESS: "SYNC_SUCCESS", - SYNC_CONNECT_PENDING: "SYNC_CONNECT_PENDING", - SYNC_CONNECT_FAILED: "SYNC_CONNECT_FAILED", - SYNC_CONNECT_SUCCEEDED: "SYNC_CONNECT_SUCCEEDED", - SYNC_LOGIN_PENDING: "SYNC_LOGIN_PENDING", - SYNC_LOGIN_FAILED: "SYNC_LOGIN_FAILED", - SYNC_LOGIN_SUCCEEDED: "SYNC_LOGIN_SUCCEEDED", - SYNC_UPDATE_PENDING: "SYNC_UPDATE_PENDING", - SYNC_UPDATE_FAILED: "SYNC_UPDATE_FAILED", - SYNC_UPDATE_SUCCEEDED: "SYNC_UPDATE_SUCCEEDED", - - VIEW_PENDING: "VIEW_PENDING", - VIEW_FAILURE: "VIEW_FAILURE", - VIEW_SUCCESS: "VIEW_SUCCESS", - - NOT_IMPLEMENTED: "NOT_IMPLEMENTED" -}; -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; -ovi.player.publish = ovi.player.publish || -{}; - -ovi.player.publish.getInstance = function(config) { - var player = {}; - player._create = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "CREATE_PENDING"); - } - // TODO: create UI - // TODO: get the sub-players, sync them - }; - player._cancel = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "CANCEL_PENDING"); - } - // TODO: cancel sub-players - // TODO: cancel pending tasks - // TODO: cancel Player - }; - ovi.player._getInstance.call(player, config); -}; - -ovi.player.publish.Player = ovi.player.publish.getInstance; -window["ovi"] = (window["ovi"] || {}); -ovi.player = (ovi.player || {}); -ovi.player.snc = (ovi.player.snc || {}); -ovi.player.snc.engine = (ovi.player.snc.engine || {}); - - -(function(){ - - var engine = ovi.player.snc.engine; - - - engine.status = { - SUCCESS : "SUCCESS", - FAILED : "FAILED", - } - - - var _callback = function(status, data, callback, context) { - if (typeof callback == "function") { - callback.call(context, status, data); - } - } - - // External functions - - /** - * Publish the given object to the social networks. - * @param {Object} object Published data - * @param {String} object.text Free text - * @param {String} object.context.artist Artist name - * @param {String} object.context.title Song title - * @param {Array} object.networks Array of social networks ids where to publish - * @param {Object} [callback] Called when publish is ready. - * @param {Object} [context] - */ - engine.publish = function(data, callback, context){ - - // Just concatenate some status text from received data - var status = data.text; - - // Add attached objects (temporarily just append to end of text) - // TODO : object.type == "URI" ... etc., add as attachment when supported by SNC - if (typeof data.object != "undefined") { - // Get URL to song before publishing and to status text - var link = data.object.content; - if (link.length > 0) { - status += " - " + link; - } - } - - // Update to services - ovi.activities.updateStatus(status, {networkId: data.networks }, function(response){ - - if (response.status == "success") { - _callback(engine.status.SUCCESS, null, callback, context); - } - else { - // TODO : Implement finer error handling - _callback(engine.status.FAILED, { message : "Status update failed" }, callback, context); - } - }); - } - - /** - * - * @param {Object} data - * @param {Object} callback - * @param {Object} context - */ - engine.cancelPublish = function(data, callback, context){ - _callback(engine.status.SUCCESS, null, callback, context); - } - - - /** - * Reload social networks from SNC backend to the local store. Use getServices() to retrieve the - * list of loaded services. - * @param {Object} options Object containing Noa account information. Can be user, password or already - * autheticated session token to be used. { username : "", password : "" } or { token : "" } - * @param {Object} callback - * @param {Object} context - */ - engine.sync = function(options, callback, context) { - - // TODO : Seperate init and login from sync (we need both for publish also...) - - // Do service didscovery - - // 1. Init APIs - requests.initOviApi(function(response){ - - if(response.status != engine.status.SUCCESS) { - _callback(engine.status.FAILED, response.data, callback, context); - return; - } - - // 2. Login noa - requests.noaLogin(options, function(response){ - - if(response.status != engine.status.SUCCESS) { - _callback(engine.status.FAILED, { message: response.message }, callback, context); - return; - } - - // 3. Service discover - requests.discover(function(response){ - - // Store to player store - store.clear(); - store.append(response.networks); - store.commit(); - - // Callback function - if (response.status == engine.status.SUCCESS) { - _callback(engine.status.OK, { networks: response.networks }, callback, context); - } - else { - _callback(engine.status.FAILED, { message: response.message }, callback, context); - } - }); - }); - }); - } - - /** - * Get list of services (social networks). Data is loaded from local - * player store. To synchronize data social networks from SNC call sync(). - */ - engine.getServices = function() { - // Get list of services from store - return store.getList(); - } - - /** - * Mark service as selected / unselected. Saves the selection to the persistent - * local storage to save data over sessions. - * @param {Object} id - * @param {Object} enable - */ - engine.selectService = function(id, enable) { - // Select / unselect service in player store - store.select(id, enable); - } - - // Player store - var STORE_KEY_SERVICES = "ovi.player.snc.services"; - var STORE_KEY_SELECTED = "ovi.player.snc.services.selected"; - - /** - * Player store implementation. Persists the social networks (services) and selections - * to the HTML5 local storage, which provides over sessions caching. - */ - var store = { - - _services : {}, - _selected : {}, - - /** - * Add new server or services to the store. - * @param {Object} service - */ - append : function(service) { - if (service.length) { - for(var i=0; i < service.length; i++) { - var s = service[i]; - this._services[s.id] = s; - } - } else { - this._services[service.id] = service; - } - }, - - /** - * Mark service selected or unselected in the store. Also commits changes in - * selections to the store. - * @param {Object} id - * @param {Object} enable - */ - select : function(id, enable) { - this._selected[id] = enable; - localStorage.setItem(STORE_KEY_SELECTED, JSON.stringify(this._selected)); - }, - - /** - * Clear services. - */ - clear : function() { - this._services = {}; - }, - - /** - * Get list (array) of services in the store. - */ - getList : function() { - // Convert to array - var res = []; - for(var o in this._services) { - var serv = this._services[o]; - serv.selected = typeof this._selected[o] != "undefined" ? this._selected[o] : false; - res.push(serv); - } - return res; - }, - - /** - * Commit services to the store. - */ - commit : function() { - localStorage.setItem(STORE_KEY_SERVICES, JSON.stringify(this._services)); - }, - - /** - * Retrieve services and selections in the store. - */ - load : function() { - this._services = JSON.parse(localStorage.getItem(STORE_KEY_SERVICES)); - this._selected = JSON.parse(localStorage.getItem(STORE_KEY_SELECTED)); - - if (this._services == null) this._services = {}; - if (this._selected == null) this._selected = {}; - } - } - - - // SNC Request implementation - var requests = { - - /** - * - * @param {Object} callback - */ - initOviApi: function(callback){ - var myincludes = "ovi.auth.noa_login, ovi.api.snc, ovi.api.activities, ovi.net.xss"; - ovi.onReady = function(libs){ - if (ovi.testIfLoaded(myincludes, libs)) { - - // Successful, set environment for NCIM - ovi.config.setenv("st-account", "delegate"); - - // Allow cross-domain scripting - function xssInitCallback(data){ - if (data.event === "InitializeOk") { - callback( { status : engine.status.SUCCESS }); - } - } - - ovi.net.XssInit({ - back_url: "http://spb.ci.wipsl.com/ovi-api/js/ovi/net/", - callback: xssInitCallback - }); - - } - } - - ovi.include(myincludes); - }, - - /** - * - * @param {Object} callback - */ - noaLogin: function(options, callback){ - - var noa = {}; - if (typeof options.token != "undefined") { // This propably is not supported yet.. - noa = { token : options.token }; - } - else { - noa = { username : options.username, password : options.password }; - } - - // Login - ovi.noa.login(noa, function(state){ - - // Callback - if (state.status == "success") { - callback( { - status: engine.status.SUCCESS - } ); - } - else { - callback( { - status: engine.status.FAILED, - message: "NOA login failed - " + state.statusCode + " - " + state.status - } ); - } - }); - }, - - /** - * - * @param {Object} callback - */ - discover: function(callback){ - - // Discover service available - ovi.snc.discoverSocialNetworks(function(response){ - - if (response.status != "success") { - callback( { - status: engine.status.FAILED, - message : "Service discovery failed - " + response.statusCode + " - " + response.responseText - } ); - return; - } - - var netw = response.data.network; - - // And get activated - ovi.snc.getActivatedSocialNetworks(function(response){ - - if (response.status != "success") { - callback( { - status: engine.status.FAILED, - message : "Service discovery failed - " + response.statusCode + " - " + response.responseText - } ); - - return; - } - else if (response.statusCode == 204) { // Not an error, no active networks - callback( { - status: engine.status.SUCCESS, - networks : [] - } ); - - return; - } - - var active = response.data.network; - - // Now we have finally the service discovery ready, create final response - // Remove all not-active networks from supported networks - var results = []; - for(var i=0; i < netw.length; i++) { - var id = netw[i].id; - - for(var j=0; j < active.length; j++) { - if (active[j].id == id) { - // We have a winner - results.push({ name : netw[i].name, id : netw[i].id, maxTextInput : netw[i].maxTextInput }); - break; - } - } - } - - callback( { - status: engine.status.SUCCESS, - networks : results - } ); - }); - }); - } - } - - // Restore data from store - store.load(); - -})(); -// Create needed namespace ovi.player.share.ui -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; -ovi.player.share = ovi.player.share || -{}; -ovi.player.share.ui = ovi.player.share.ui || -{}; - -/** - * TODO - * - * This API tries to imitate medos framework UI controls for future compability. - * @param {Object} params - * @param {Object} target - */ -ovi.player.share.ui.Button = function(params, target) { - - var CLICK_EVENT = "selected"; - var that = this; - - function createHtml() { - var template = ''; - - var node = document.createElement("div"); // Do we need this ?? - node.innerHTML = template; - return node; - } - - var _root = createHtml(); - var _button = _root.firstChild; - - target.appendChild(_root); - - // Interface functions - this.addEventHandler = function(event, callback) { - // selected = click (comes from medos...) - if (event == CLICK_EVENT) { - _root.addEventListener("click", function(e) { callback.call(that, e); }, that); - } - } - - this.setProperty = function(name, value) { - _button[name] = value; - } - - this.getProperty = function(name) { - return _button[name]; - } -} -// Create needed namespace ovi.player.share.ui -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; -ovi.player.share = ovi.player.share || -{}; -ovi.player.share.ui = ovi.player.share.ui || -{}; - -/** - * Checkbox UI control implementation. TODO - * - * This API tries to imitate medos framework UI controls for future compability. - * @param {Object} params - * @param {Object} target - */ -ovi.player.share.ui.CheckBox = function(params, target) { - - var that = this; - - function createHtml() { - - var template = '
' + - '' + - '' + params.label + '' + - '
'; - - var node = document.createElement("div"); // Do we need this ?? - node.innerHTML = template; - return node; - } - - var _root = createHtml(); - var _checkBox = _root.firstChild.firstChild; - - target.appendChild(_root); - - this.setProperty = function(name, value) { - - if (name == "selected") { // Use medos property name mappings - _checkBox["checked"] = value; - } - else { - _checkBox = value; - } - } - - this.getProperty = function(name) { - if (name == "selected") { - return _checkBox["checked"]; - } - return _checkBox[name]; - } - - for(var v in params) { - this.setProperty(v, params[v]); - } -} -// Create needed namespace ovi.player.share.ui -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; - - -/** - * Context object player poc implementation - */ -ovi.player.contextobject = ovi.player.contextobject || -{}; - - -ovi.player.contextobject.Player = function() { - - var targetNS = this; - targetNS.create = function(params) { - targetNS.object = params; - } -} - - - -/** - * Publish player poc implementation - */ -ovi.player.publish = ovi.player.publish || -{}; - -// Extend the namespace -ovi.player.publish.Player = function(params) { - - // TODO : MAKE THIS SINGLETON SOMEHOW ?? - var targetNS = this; - - // Utils - var _id = function(id) { - return document.getElementById(id); - }; - - var _addClass = function(target, className) { - var classes = target.className; - if (!classes.match(new RegExp("\\b" + className + "\\b"))) { - if (classes != "" && classes.substr(-1) != " ") { - target.className += " "; - } - target.className += className; - } - }; - var _removeClass = function(target, className) { - target.className = target.className.replace(new RegExp("\\b" + className + "\\b", "g"), ""); - //TODO: clean extra spaces? - - }; - var _toggleClass = function(target, className) { - if (target.className.indexOf(className) == -1) { - _addClass(target, className); - return true; - } else { - _removeClass(target, className); - return false; - } - - }; - - - - /** - * "State engine" - */ - var _state = { - visible: false, - services: {} - }; - - - - /** - * HTML templates for ui - */ - var _templates = { - // TODO: localization - "share.ui": '
\ -
Publish
\ -
\ - \ -
\ -
Write message here
\ - \ -
\ -

\ -
\ -
    \ -
    \ -
      \ -
    • OK
    • \ -
    • Cancel
    • \ -
    \ -
    \ -
    ' - }; - - - - /** - * Generic callback invoker - * - * @param {Object} notification - * @param {Object} data - * @param {Object} callback - * @param {Object} context - */ - var _callback = function(notification, data, callback, context) { - if (typeof callback == "function") { - callback.call(context, notification, data); - } - }; - - - - /** - * status messages - */ - var _status = { - - show: "SHOW", - show_ok: "SHOW_SUCCEEDED", - show_fail: "SHOW_FAILED", - - updateobject: "UPDATEOBJECT", - updateobject_ok: "UPDATEOBJECT_SUCCEEDED", - updateobject_fail: "UPDATEOBJECT_FAILED", - - updateservices: "UPDATESERVICES", - updateservices_ok: "UPDATESERVICES_SUCCEEDED", - updateservices_fail: "UPDATESERVICES_FAILED", - updateservices_nonetworks : "UPDATESERVICES_NONETWORKS" - - }; - - - - /** - * Invokes the ui for the player - * - * @param {Object} [options] - * @param {Object} [options.target] the dom node or id where the ui should be inserted - * @param {Object} [options.template] the html for the ui - * @param {Object} [callback] - * @param {Object} [context] - */ - var _show = function(options, callback, context) { - - var target = (options && options.target) || _id("ovi.player.share.ui"), template = (options && options.template) || _templates["share.ui"]; - - // Find target node if id was given - if (typeof target == "string") { - target = _id(_target); - } - if (target) { - if (template) { - if (_state.visible && target.innerHTML.indexOf('"player"') >= 0) { - // _show was already called earlier, and player is shown - _callback(_status.show, { - message: "Player is already visible" - }, callback, context); - } else { - target.innerHTML = template; - - // add handler for textarea - var message = _id("message"); - _id("message").onkeyup = _handleMessageChange; - message.style.backgroundColor = "transparent"; - - // add handlers for buttons - _id("action-ok").onclick = _handleSubmit; - _id("action-cancel").onclick = _handleSubmit; - - // Update state - _state.visible = true; - _callback(_status.show_ok, null, callback, context); - } - } else { - _callback(_status.show_fail, { - message: "Template not found", - data: { - template: template - } - }, callback, context); - } - } else { - _callback(_status.show_fail, { - message: "Target container not found", - data: { - target: target - } - }, callback, context); - } - - onResize(); // Initial resize - - // If we would like to show the services stored in local storage, uncommenting the following would do - // the job.. - /* - var services = ovi.player.share.engine.getServices(); - targetNS.updateServices(services);*/ - }; - - /** - * Removes all the handlers from the ui and the ui - * - * @param {Object} options - * @param {Object} callback - * @param {Object} context - */ - var _teardown = function(options, callback, context) { - //TODO: clear handlers - //TODO: destroy html - //TODO: update status - }; - - - var _updateServices = function(data, callback, context) { - - var target = _id("available-services"); - - if (target) { - if (data.length) { - var listToCheck = [], i; - // TODO: add loading animation? - for (i = 0; i < data.length; i++) { - var id = data[i].id, label = data[i].name; - if (id && label) { - id = "service-" + id; - listToCheck.push(id); - if (!_id(id)) { - // We don't have the network in our list yet, create one - var item = document.createElement("LI"), checkbox = document.createElement("SPAN"); - checkbox.setAttribute("class", "checkbox"); - checkbox.appendChild(document.createTextNode(label)); - item.appendChild(checkbox); - item.setAttribute("id", id); - item.onclick = _handleServiceListClick; - target.appendChild(item); - // store object to the state - if (data[i].selected) { - data[i].checked = _toggleClass(item, "checked"); - } - _state.services[id] = data[i]; - } - } else { - _callback(_status.updateservices, { - message: "Service object formatted badly", - data: data[i] - }, callback, context); - } - } - //make a searchable string - listToCheck = listToCheck.join(); - //remove obsolete networks - for (i = 0; i < target.childNodes.length; i++) { - var node = target.childNodes[i], id = node.getAttribute("id"); - if (listToCheck.indexOf(id) == -1) { - node.onclick = null; - target.removeChild(node); - } - // TODO: update _state? - } - _updateServiceLimits(); - _callback(_status.updateservices_ok, null, callback, context); - } else { - _callback(_status.updateservices_fail, { - message: "Received data was not an array", - data: data - }, callback, context); - } - } else { - _callback(_status.updateservices_fail, { - message: "Target container not found" - }, callback, context); - } - }; - - /** - * Handler for message changes - * @param {Object} e - */ - var _handleMessageChange = function(e) { - _id("comment-length").innerHTML = this.value.length; - _checkMessageLength(); - } - - - - /** - * Handler for service selection - * @param {Object} e - */ - var _handleServiceListClick = function(e) { - _state.services[this.id].checked = _toggleClass(this, "checked"); - ovi.player.snc.engine.selectService(_state.services[this.id].id, _state.services[this.id].checked); - _updateServiceLimits(); - }; - - - - /** - * Check limits and if the OK button can be clicked - */ - var _updateServiceLimits = function() { - var bigNumber = 9999999, maxTextInput = bigNumber, min = Math.min, services = _state.services, service; - for (sid in services) { - service = services[sid]; - if (service.checked && service.maxTextInput && service.maxTextInput > 0) { - maxTextInput = min(maxTextInput, service.maxTextInput); - } - } - - if (maxTextInput < bigNumber) { - // Reduce the link and context reserved size from input (data that will be allocated - // from maxTextInput for context) - var contextData = _state.contextPlayer.object.data; - maxTextInput -= contextData.object.reservedLength; - - _id("comment-maxlength").innerHTML = maxTextInput; - _removeClass(_id("comment-limit"), "hidden"); - //TODO: alter size of elements to make space for the limit? - } else { - _id("comment-maxlength").innerHTML = maxTextInput; - _addClass(_id("comment-limit"), "hidden"); - } - _checkMessageLength(); - }; - - - - var _checkMessageLength = function() { - var length = parseInt(_id("comment-length").innerHTML), maxLength = parseInt(_id("comment-maxlength").innerHTML), message = _id("message"); - if (length == 0) { - message.style.backgroundColor = "transparent"; - } else { - message.style.backgroundColor = ""; - } - if ((maxLength > 0) && (length > maxLength)) { - _addClass(_id("comment-limit"), "error"); - _addClass(message, "error"); - } else { - _removeClass(_id("comment-limit"), "error"); - _removeClass(message, "error"); - } - _updateActions(); - }; - - - - var _updateActions = function() { - if (_canSubmit()) { - _removeClass(_id("action-ok"), "disabled"); - } else { - _addClass(_id("action-ok"), "disabled"); - } - }; - var _canSubmit = function() { - var length = parseInt(_id("comment-length").innerHTML), maxLength = parseInt(_id("comment-maxlength").innerHTML), services = _state.services, service; - if ((maxLength > 0) && (length > maxLength)) { - return false; - } - for (sid in services) { - service = services[sid]; - if (service.checked && service.maxTextInput && service.maxTextInput > 0) { - return true; - } - } - return false; - } - - - var _handleSubmit = function(e) { - // don't accept clicks from elements with class "disabled" - if (/\bdisabled\b/.test(this.className)) { - return; - } - if (this.id == "action-ok") { - _addClass(this, "disabled"); - _addClass(_id("action-cancel"), "disabled"); - //TODO: disable testarea and service list? - - var services = _state.services, service, networks = []; - for (sid in services) { - service = services[sid]; - if (service.checked) { - networks.push(service.id); - } - } - - var contextData = _state.contextPlayer.object.data; - - var data = { - text: _id("message").value, - object : contextData.object, - networks: networks - }; - - ovi.player.snc.engine.publish(data, function(status, data) { - if (status == ovi.player.snc.engine.status.FAILED) { - alert(data.message); - } - _reset(); - }); - // TODO: call window.close here? teardown first? window.close in teardown? - } else { - ovi.player.snc.engine.cancelPublish(null, function(status, data) { - _reset(); - }); - } - }; - - var _reset = function() { - _id("shared-object").innerHTML = ""; - _id("message").value = ""; - _handleMessageChange.call(_id("message")); - _removeClass(_id("action-cancel"), "disabled"); - - // Request window to be closed - window.close(); - }; - - var _sync = function(contextPlayer, handler, context) { - // Sync context to UI - _state.contextPlayer = contextPlayer; // Store context object for publishing - _id("shared-object").innerHTML = _state.contextPlayer.object.data.miniview; - } - - - var _sncInit = function(credentials, handler, context) { - // Sync SNC stuff - ovi.player.snc.engine.sync(credentials.token, function(status, data) { - if (status == ovi.player.snc.engine.status.FAILED) { - _callback(_status.updateservices_fail, - { message: data.message }, - handler, context); - } - else if (data.networks.length == 0) { - _callback(_status.updateservices_nonetworks, - { message: "No networks" }, - handler, context); - } - else { - var services = ovi.player.snc.engine.getServices(); - _updateServices(services, handler, context); - } - } ); - } - - - - // Register onResize for landscape / portrait mode changes - window.addEventListener("resize", onResize, true); - - function onResize(e) { - - function isLandscape(){ - return window.innerWidth > window.innerHeight; - } - - function _setMode(mode) { - _changeMode(_id("comment-area"), mode); - - var services = _id("available-services").children; - for(var i=0; i < services.length; i++) { - _changeMode(services[i], mode); - } - } - - // Determine - landscape or portrait mode - if (isLandscape()) { - _setMode("landscape"); - } - else { - _setMode("portrait"); - } - } - - function _changeMode(id, mode) { - if (mode == "portrait") { - _removeClass(id, "landscape"); - _addClass(id, "portrait"); - } else { - _removeClass(id, "portrait"); - _addClass(id, "landscape"); - } - } - - /** - * Assign needed functions to the target namespace => defined public API. - */ - targetNS.view = _show; - targetNS.teardown = _teardown; - targetNS.reset = _reset; - - /** - * Synchronize context data from context object - */ - targetNS.sync = _sync; - - /** - * Launch UI and initialize SNC - */ - targetNS.create = function(options, handler, context) { - - // Show UI - _show(options, handler, context); - - // Start loading SNC networks - _sncInit(params.credentials, handler, context); - } - - targetNS.status = _status; -}; -// Create needed namespace ovi.player.share.ui -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; -ovi.player.share = ovi.player.share || -{}; -ovi.player.share.ui = ovi.player.share.ui || -{}; - -/** - * Label UI control implementation. TODO - * - * This API tries to imitate medos framework UI controls for future compability. - * @param {Object} params - * @param {Object} target - */ -ovi.player.share.ui.Label = function(params, target) { - - var CLICK_EVENT = "selected"; - var that = this; - - function createHtml() { - var template = '' + params.text + ''; - - var node = document.createElement("div"); // Do we need this ?? - node.innerHTML = template; - return node; - } - - var _root = createHtml(); - var _label = _root.firstChild; - - target.appendChild(_root); - - this.setProperty = function(name, value) { - _label[name] = value; - } - - this.getProperty = function(name) { - return _label[name]; - } - - for(var v in params) { - this.setProperty(v, params[v]); - } -} -// Create needed namespace ovi.player.share.ui -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; -ovi.player.share = ovi.player.share || -{}; -ovi.player.share.ui = ovi.player.share.ui || -{}; - -/** - * Textarea UI control implementation. TODO - * - * This API tries to imitate medos framework UI controls for future compability. - * @param {Object} params - * @param {Object} target - */ -ovi.player.share.ui.TextArea = function(params, target) { - - var CLICK_EVENT = "selected"; - var that = this; - - function createHtml() { - var template = ''; - - var node = document.createElement("div"); // Do we need this ?? - node.innerHTML = template; - return node; - } - - var _root = createHtml(); - var _textarea = _root.firstChild; - - target.appendChild(_root); - - this.setProperty = function(name, value) { - _textarea[name] = value; - } - - this.getProperty = function(name) { - return _textarea[name]; - } - - for(var v in params) { - this.setProperty(v, params[v]); - } -} -window["ovi"] = window["ovi"] || -{}; -ovi.player = ovi.player || -{}; -ovi.player.snc = ovi.player.snc || -{}; - -ovi.player.snc.getInstance = function(config) { - var player = {}; - player._cancel = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "CANCEL_PENDING"); - } - // TODO: cancel Player - }; - player._pick = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "PICK_PENDING"); - } - // TODO: offer list of configured networks - }; - player._view = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "VIEW_PENDING"); - } - // TODO: offer miniviews for networks list - }; - player._sync = function(options, handler, context) { - var callable = (typeof handler === "function"); - if (callable) { - handler.call(context, "SYNC_PENDING"); - } - // TODO: connect to the Ovi API and SNC - }; - ovi.player._getInstance.call(player, config); -}; - -ovi.player.snc.Player = ovi.player.snc.getInstance; diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/mpmediawallviewplugin.pro --- a/mpviewplugins/mpmediawallviewplugin/mpmediawallviewplugin.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpmediawallviewplugin/mpmediawallviewplugin.pro Fri Aug 06 16:51:36 2010 -0500 @@ -56,3 +56,4 @@ src/mpreflectioneffect.cpp RESOURCES += resources/mpmediawallviewresources.qrc +DOCML += resources/mediawall.docml diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/resources/mpmediawallviewresources.qrc --- a/mpviewplugins/mpmediawallviewplugin/resources/mpmediawallviewresources.qrc Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpmediawallviewplugin/resources/mpmediawallviewresources.qrc Fri Aug 06 16:51:36 2010 -0500 @@ -1,7 +1,7 @@ - mediawall.docml + mediawall.docml.bin diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/src/mptracklistwidget.cpp --- a/mpviewplugins/mpmediawallviewplugin/src/mptracklistwidget.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpmediawallviewplugin/src/mptracklistwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -18,7 +18,12 @@ #include +#ifndef UNIT_TESTING #include +#else +#include "hbinstancestub.h" +#endif + #include #include #include diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/tsrc.pro --- a/mpviewplugins/mpmediawallviewplugin/tsrc/tsrc.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -17,6 +17,8 @@ TEMPLATE = subdirs SUBDIRS += unittest_mpmediawalldocumentloader +SUBDIRS += unittest_mpmediawallview +SUBDIRS += unittest_mpmediawallviewplugin CONFIG += ordered diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/inc/unittest_mpmediawallview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/inc/unittest_mpmediawallview.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit Test for mpdetailsview. +* +*/ + +#ifndef UNITTEST_MPMEDIAWALLVIEW_H_ +#define UNITTEST_MPMEDIAWALLVIEW_H_ + +#include + +//Forward Declaration +class MpMediaWallView; + + + +class TestMpMediaWallView : public QObject +{ + Q_OBJECT + +public: + + TestMpMediaWallView(); + virtual ~TestMpMediaWallView(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + + void testInitializeView(); + void testActivateView(); + void testDeactivateView(); + void testSendToBackground(); + void testContextOpened(); + void testContainerContentsChanged(); + void testLibraryUpdated(); + void testUpdatePlayPauseAction(); + +private: + MpMediaWallView *mTest; + +}; + +#endif /* UNITTEST_MPMEDIAWALLVIEW_H_ */ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/src/unittest_mpmediawallview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/src/unittest_mpmediawallview.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,262 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit Test for mpmediawallview. +* +*/ + +#include +#include +#include +#include + +#include "unittest_mpmediawallview.h" +#include "stub/inc/mpplaybackdata.h" + +// Do this so we can access all member variables. +#define private public +#include "mpmediawallview.h" +#undef private + +// Do this so we can access all memeber functions +#include "../../src/mpmediawallview.cpp" + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + HbMainWindow window; + + TestMpMediaWallView tv; + +if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpmediawallview.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +//Constructor +TestMpMediaWallView::TestMpMediaWallView() + : mTest(0) +{ + +} + +//Destructor +TestMpMediaWallView::~TestMpMediaWallView() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpMediaWallView::initTestCase() +{ + +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpMediaWallView::cleanupTestCase() +{ +QCoreApplication::processEvents(); +} + +/*! + Called before each testfunction is executed. + */ +void TestMpMediaWallView::init() +{ + mTest = new MpMediaWallView(); +} + +/*! + Called after every testfunction. + */ +void TestMpMediaWallView::cleanup() +{ + delete mTest; + mTest = 0; +} + +/*! + Test InitializeView + */ +void TestMpMediaWallView::testInitializeView() +{ + + QVERIFY(!mTest->mEngine); + QVERIFY(!mTest->mCollectionData); + QVERIFY(!mTest->mModel); + QVERIFY(!mTest->mAlbumCover); + QVERIFY(!mTest->mTrackList); + QVERIFY(!mTest->mPlaybackData); + QVERIFY(!mTest->mPauseIcon); + QVERIFY(!mTest->mPlayIcon); + QVERIFY(!mTest->mPlayPauseContainer); + + //test member variables are initialized + mTest->initializeView(); + QVERIFY(mTest->mEngine); + QVERIFY(mTest->mCollectionData); + QVERIFY(mTest->mModel); + QVERIFY(mTest->mAlbumCover); + QVERIFY(mTest->mTrackList); + QVERIFY(mTest->mPlaybackData); + QVERIFY(mTest->mPauseIcon); + QVERIFY(mTest->mPlayIcon); + QVERIFY(mTest->mPlayPauseContainer); + +} + +/*! + Test ActivateView + */ +void TestMpMediaWallView::testActivateView() +{ + + //Create playbackdata and set to playing state + mTest->mPlaybackData = new MpPlaybackData(); + mTest->mPlaybackData->setPlaybackState(MpPlaybackData::Playing); + + mTest->mIconUpdateNedded=false; + mTest->mActivated=false; + + mTest->activateView(); + QCOMPARE(mTest->mActivated, true ); +} + +/*! + Test DeActivateView + */ +void TestMpMediaWallView::testDeactivateView() +{ + mTest->initializeView(); + mTest->mActivated = true; + mTest->mShowingSongsList = true; + mTest->setUpListAnimation(); + mTest->deactivateView(); + QCOMPARE(mTest->mActivated, false); + QCOMPARE(mTest->mShowingSongsList, false); + +} + +/*! + Test SendToBackground + */ +void TestMpMediaWallView::testSendToBackground() +{ + //test that signal gets emitted + QSignalSpy spy( mTest, SIGNAL(command(int)) ); + mTest->sendToBackground(); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant(MpCommon::SendToBackground)); + +} + +/*! + Test ContextOpened + */ +/* test case fails because potential problem in docml +void TestMpMediaWallView::testContextOpened() +{ + + mTest->mCollectionData = new MpMpxCollectionData(); + mTest->mDocumentLoader = new MpMediaWallDocumentLoader(); + + QVERIFY(mTest->mCollectionData->context() == QVariant(ECollectionContextUnknown)); + mTest->contextOpened(ECollectionContextArtists); + QVERIFY(mTest->mCollectionData->context() == QVariant(ECollectionContextAlbumsMediaWall)); + + //test loading 'empty' section, docml loading fails because initialize not called + QVERIFY(!mTest->mNoMusic); + mTest->contextOpened(ECollectionContextAlbumsMediaWall); + QVERIFY(mTest->mNoMusic); +} +*/ + +/*! + Test ContextOpened + */ +void TestMpMediaWallView::testContextOpened() +{ + //test loading 'empty' + mTest->initializeView(); + mTest->contextOpened(ECollectionContextAlbumsMediaWall); + //test loading 'mediawall' + mTest->mCollectionData->setCount(3); + mTest->contextOpened(ECollectionContextAlbumsMediaWall); +} + +/*! + Test ContainerContentsChanged + */ +void TestMpMediaWallView::testContainerContentsChanged() +{ + //test containerContetstsChanged calls opencallection when library not updating + mTest->initializeView(); + QVERIFY(mTest->mEngine->mOpenCollectionCalled == 1); + mTest->containerContentsChanged(); + QVERIFY(mTest->mEngine->mOpenCollectionCalled == 2); + mTest->libraryAboutToUpdate(); + mTest->containerContentsChanged(); + QVERIFY(mTest->mEngine->mOpenCollectionCalled == 2); +} + +/*! + Test LibraryUpdated + */ +void TestMpMediaWallView::testLibraryUpdated() +{ + //test libraryupdated changes flag and calls opencallection + mTest->initializeView(); + mTest->mEngine->mOpenCollectionCalled=0; + mTest->mLibraryUpdating=true; + mTest->libraryUpdated(); + QVERIFY(mTest->mLibraryUpdating == false); + QVERIFY(mTest->mEngine->mOpenCollectionCalled == 1); +} + +/*! + Test UpdatePlayPauseAction + */ +void TestMpMediaWallView::testUpdatePlayPauseAction() +{ + //test icon gets updated correctly + mTest->initializeView(); + mTest->mActivated = true; + + mTest->mPlaybackData->setPlaybackState( MpPlaybackData::Paused ); + mTest->updatePlayPauseAction(); + HbIcon temp = mTest->mPlayPauseAction->icon(); + QVERIFY( mTest->mPlayPauseAction->icon() == HbIcon( "qtg_mono_play" )); + + mTest->mPlaybackData->setPlaybackState( MpPlaybackData::Playing ); + mTest->updatePlayPauseAction(); + QVERIFY( mTest->mPlayPauseAction->icon() == HbIcon( "qtg_mono_pause" )); + + mTest->mPlaybackData->setPlaybackState( MpPlaybackData::Stopped ); + mTest->updatePlayPauseAction(); + QVERIFY( mTest->mPlayPauseAction->icon() == HbIcon( "qtg_mono_play" )); +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/hgmediawall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/hgmediawall.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HgMediawall stub for testing mpmediawallview +* +*/ + +#ifndef HGMEDIAWALL_H +#define HGMEDIAWALL_H + +//includes +#include +#include +#include +#include + +class HgWidget : public HbWidget +{ + Q_OBJECT + Q_PROPERTY(QSizeF itemSize READ itemSize WRITE setItemSize) + +public: + + enum ScrollBarPolicy { + ScrollBarAsNeeded = Qt::ScrollBarAsNeeded, + ScrollBarAlwaysOff = Qt::ScrollBarAlwaysOff, + ScrollBarAlwaysOn = Qt::ScrollBarAlwaysOn, + ScrollBarAutoHide + }; + + enum IndexFeedbackPolicy { + IndexFeedbackNone = 0, + IndexFeedbackSingleCharacter, + IndexFeedbackThreeCharacter, + IndexFeedbackString + }; + + explicit HgWidget ( QGraphicsItem *parent = 0 ); + virtual ~HgWidget (); + + void setScrollBarPolicy( ScrollBarPolicy policy ); + virtual void setModel(QAbstractItemModel *model); + void scrollTo(const QModelIndex &index); + QModelIndex currentIndex() const; + + void setItemSize(const QSizeF& size); + QSizeF itemSize() const; + void setDefaultImage(QImage defaultImage); + void setIndexFeedbackPolicy( IndexFeedbackPolicy policy); + HbScrollBar *scrollBar() const; + bool getItemOutline(const QModelIndex& index, QPolygonF& points); + +signals: + + void scrollingEnded(); + +}; + +class HgMediawall : public HgWidget +{ + Q_OBJECT + +public: + + enum LabelPosition { + PositionNone = 0, + PositionAboveImage, + PositionBelowImage + }; + + explicit HgMediawall( QGraphicsItem *parent = 0 ); + virtual ~HgMediawall(); + + void setTitlePosition( LabelPosition position ); + void setDescriptionPosition( LabelPosition position ); + void setTitleFontSpec( const HbFontSpec &fontSpec ); + void setDescriptionFontSpec( const HbFontSpec &fontSpec ); + + void enableReflections( bool enabled ); + bool reflectionsEnabled() const; + +public: + + bool mReflectionEnabled; + +}; + +#endif // HGMEDIAWALL_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpalbumcoverwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpalbumcoverwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpAlbumCoverWidget stub for testing mpmediawallview +* +*/ + +#ifndef MPALBUMCOVERWIDGET_H +#define MPALBUMCOVERWIDGET_H + +//includes +#include +#include +#include + +class HbIcon; + +class MpAlbumCoverWidget : public HbWidget +{ + Q_OBJECT + +public: + + explicit MpAlbumCoverWidget( QGraphicsItem *parent = 0 ); + virtual ~MpAlbumCoverWidget(); + void setIcon(const HbIcon &icon ); + void setDefaultIcon( const HbIcon &icon ); +}; + +#endif // MPALBUMCOVERWIDGET_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpcollectiondatamodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpcollectiondatamodel.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player collection abstract data model stub for testing mpmediawallview. +* +* +*/ + +#ifndef MPCOLLECTIONDATAMODEL_H +#define MPCOLLECTIONDATAMODEL_H + +#include + +class MpMpxCollectionData; +class MpCollectionAlbumArtManager; + + +class MpCollectionDataModel : public QAbstractListModel +{ + Q_OBJECT + +public: + + explicit MpCollectionDataModel( MpMpxCollectionData *data, QObject *parent=0 ); + virtual ~MpCollectionDataModel(); + + int rowCount(const QModelIndex &parent=QModelIndex()) const; + QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; + void setItemVisibility(const QModelIndex &index, bool visible); + + void refreshModel(); + MpMpxCollectionData *collectionData(); + +}; + +#endif // MPCOLLECTIONDATAMODEL_H + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpcollectiontbonelistdatamodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpcollectiontbonelistdatamodel.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player collection abstract data model (for TBone) stub +* for testing mpmediawallview. +* +*/ + +#ifndef MPCOLLECTIONTBONELISTDATAMODEL_H +#define MPCOLLECTIONTBONELISTDATAMODEL_H + +#include + +class MpMpxCollectionData; +class MpPlaybackData; + +class MpCollectionTBoneListDataModel : public QAbstractListModel +{ + Q_OBJECT + +public: + + explicit MpCollectionTBoneListDataModel( MpMpxCollectionData *collectionData, + MpPlaybackData *playbackData = 0, QObject *parent = 0 ); + virtual ~MpCollectionTBoneListDataModel(); + + int rowCount(const QModelIndex &parent=QModelIndex()) const; + QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; + + +}; + +#endif // MPCOLLECTIONTBONELISTDATAMODEL_H + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpengine.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player engine stub for testing mpmediawallview +* +*/ + +#ifndef MPENGINE_H +#define MPENGINE_H + +#include +#include "mpmpxcollectionviewdefs.h" +#include "mpmpxcommondefs.h" +#include "mpcommondefs.h" + +class MpMpxCollectionData; +class MpPlaybackData; +class MpSongData; +class XQSharableFile; +class MpEngine : public QObject +{ + Q_OBJECT + + friend class MpEngineFactory; + +public: + enum EngineMode{ + StandAlone, + Fetch, + Embedded, + MediaBrowsing + }; + +private: + + enum UsbBlockingState { + USB_NotConnected, // Not connected + USB_Connected, // Connected in MTP mode but not synchronizing + USB_Synchronizing // Connected in MassStorage mode or MTP mode and synchronizing + }; + +private: + explicit MpEngine(); + +public: + + virtual ~MpEngine(); + + // Harvester related + void refreshLibrary(); + bool verifyUsbBlocking( bool showMessage = false ); + void checkForSystemEvents(); + + // Collection related + + void openCollection( TCollectionContext context ); + void openCollectionItem( int index ); + void back(); + void findPlaylists( QStringList &playlists ); + void createPlaylist( QString &playlistName, QList &selection, MpMpxCollectionData* collectionData = 0 ); + void saveToPlaylist( int playlistIndex, QList &selection ); + void saveToCurrentPlaylist( QList &selection, MpMpxCollectionData *collectionData ); + void renamePlaylist( QString &newName, int index ); + void renamePlaylist( QString &newName ); + void deleteSongs( QList &selection ); + + void previewItem( int index ); + void openIsolatedCollection( TCollectionContext context ); + void releaseIsolatedCollection(); + + void findAlbumSongs( int index ); + void playAlbumSongs( int albumIndex, int songIndex, MpMpxCollectionData* collectionData = 0 ); + + MpMpxCollectionData *collectionData(); + + // Playback related + MpPlaybackData *playbackData(); + + // Details related + MpSongData *songData(); + void retrieveSong(); + + +public slots: + + // Collection related + void reopenCollection(); + void reorderPlaylist( int playlistId, int songId, int originalOrdinal, int newOrdinal ); + + // Playback related + void playEmbedded( QString aFilename ); + void playEmbedded( const XQSharableFile& file ); + void playPause(); + void stop(); + void skipForward(); + void skipBackward(); + void setPosition( int position ); + void setShuffle( bool mode ); + void setRepeat( bool mode ); + +public: + //for stubs + int mOpenCollectionCalled; + +private: + + Q_DISABLE_COPY( MpEngine ) + +}; + +#endif // MPENGINE_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpenginefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpenginefactory.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player enginefactory stub for testing mpmediawallview +* +*/ + +#ifndef MPENGINEFACTORY_H +#define MPENGINEFACTORY_H + +#include + +#include "mpengine.h" +#include "mpcommondefs.h" + + +class MpEngineFactory +{ +private: + explicit MpEngineFactory(); + +public: + virtual ~MpEngineFactory(); + static MpEngineFactory * instance(); + + static MpEngine *createSharedEngine( TUid uid = TUid::Uid( MpCommon::KMusicPlayerUid ), MpEngine::EngineMode mode = MpEngine::StandAlone ); + static MpEngine *sharedEngine(); + static MpEngine *createIsolatedEngine( MpEngine::EngineMode mode ); + static void close(); + +private: + MpEngine *mSharedEngine; + QList mEngines; +}; + +#endif // MPENGINEFACTORY_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpmediawalldocumentloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpmediawalldocumentloader.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player media wall view custom document loader stub for testing mpmediawallview. +* +*/ + +#ifndef MPMEDIAWALLDOCUMENTLOADER_H +#define MPMEDIAWALLDOCUMENTLOADER_H + + +#include + + +class MpMediaWallDocumentLoader : public HbDocumentLoader +{ +public: + virtual QObject *createObject(const QString& type, const QString &name); +}; + +#endif // MPMEDIAWALLDOCUMENTLOADER_H + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpmpxcollectiondata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpmpxcollectiondata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpMpxCollectionData stub for testing mpmediawallview +* +*/ + +#ifndef MPMPXCOLLECTIONDATA_H +#define MPMPXCOLLECTIONDATA_H + +#include +#include "mpmpxcollectionviewdefs.h" + +class CMPXMedia; + +class MpMpxCollectionData : public QObject +{ + +public: + + enum DataType { + Title, + Uri, + Duration, + Count, + Artist, + Album, + Genre, + Rating, + AlbumArtUri + }; + + // Stub functions + explicit MpMpxCollectionData( QObject *parent=0 ); + virtual ~MpMpxCollectionData(); + void setCount(int count); + + TCollectionContext context(); + + int count() const; + QString collectionTitle() const; + QString itemData( int index, MpMpxCollectionData::DataType type ) const; + void setContext( TCollectionContext context ); + int itemIndex( int itemUniqueId ); + bool setCurrentAlbum( int index ); + + const CMPXMedia& containerMedia(); + +public: + + CMPXMedia *mContainerMedia; + bool mMediaSet; + TCollectionContext mContext; + int mCount; + int mCurrentAlbumIndex; + bool mCurrentAlbumAvailable; + bool mReturnCollectionTitle; + +}; + +#endif // MPMPXCOLLECTIONDATA_H + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpplaybackdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpplaybackdata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpplaybackdata stub for testing mpmediawallview +* +*/ + +#ifndef MPPLAYBACKDATA_H +#define MPPLAYBACKDATA_H + +//includes +#include +#include + + +class MpPlaybackData : public QObject +{ + Q_OBJECT + +public: + + enum SimplifiedState { + NotPlaying, + Playing, + Paused, + Stopped + }; + + + + explicit MpPlaybackData(); + virtual ~MpPlaybackData(); + + // Stub functions + void emitPlaybackStateChanged(); + void setPlaybackState(MpPlaybackData::SimplifiedState state); + +signals: + void playbackStateChanged(); + void playbackInfoChanged(); + +public: + int albumId(); + const QString& title() const; + const QString& artist() const; + MpPlaybackData::SimplifiedState playbackState() const; + + +private: + QString mArtist; + QString mTitle; + SimplifiedState mPlaybackState; + +}; + +#endif // MPPLAYBACKDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpreflectioneffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mpreflectioneffect.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for mpreflectioneffect +* +*/ +#ifndef MPREFLECTIONEFFECT_H +#define MPREFLECTIONEFFECT_H + +#include + +class MpReflectionEffect: public QGraphicsEffect +{ + Q_OBJECT + +public: + MpReflectionEffect(QObject *parent = 0); + ~MpReflectionEffect(); + + QRectF boundingRectFor(const QRectF &rect) const; + +protected: + void draw(QPainter *painter); + +private: + Q_DISABLE_COPY(MpReflectionEffect) +}; + +#endif // MPREFLECTIONEFFECT_H + +// EOF diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mptracklistwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/inc/mptracklistwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Track List Widget stub for testing mpmediawallview +* +*/ +#ifndef MPTRACKLISTWIDGET_H +#define MPTRACKLISTWIDGET_H + +#include + +class HbListView; + +class MpTrackListWidget : public HbWidget +{ + Q_OBJECT + +public: + + MpTrackListWidget( QGraphicsItem *parent = 0 ); + virtual ~MpTrackListWidget(); + HbListView *list(); + +}; + +#endif // MPTRACKLISTWIDGET_H + +// EOF diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/hgmediawall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/hgmediawall.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HgMediawall stub for testing mpcollectioncontainers +* +*/ + +#include "hgmediawall.h" + + +/*! + Constructs the mediawall widget stub. + */ +HgWidget::HgWidget( QGraphicsItem *parent ) +{ + Q_UNUSED(parent); +} + +/*! + Destructs the mediawall widget stub. + */ +HgWidget::~HgWidget() +{ +} + +/*! + Stub function + */ +void HgWidget::setScrollBarPolicy( ScrollBarPolicy policy ) +{ + Q_UNUSED(policy); +} + +/*! + Stub function + */ +void HgWidget::setModel( QAbstractItemModel *model ) +{ + Q_UNUSED(model); +} + +/*! + Stub function + */ +void HgWidget::scrollTo( const QModelIndex &index ) +{ + Q_UNUSED(index); +} + +/*! + Stub function + */ +QModelIndex HgWidget::currentIndex() const +{ + return QModelIndex(); +} + +void HgWidget::setItemSize(const QSizeF& size) +{ + Q_UNUSED(size); +} + +QSizeF HgWidget::itemSize() const +{ + return QSizeF(); +} + +void HgWidget::setDefaultImage(QImage defaultImage) +{ + Q_UNUSED(defaultImage); +} + +void HgWidget::setIndexFeedbackPolicy( IndexFeedbackPolicy policy) +{ + Q_UNUSED(policy); +} +HbScrollBar *HgWidget::scrollBar() const +{ + return new HbScrollBar(); +} +bool HgWidget::getItemOutline(const QModelIndex& index, QPolygonF& points) +{ + Q_UNUSED(index); + Q_UNUSED(points); + return false; +} + +//=========================================================================== +//=========================================================================== + +/*! + Constructs the mediawall widget stub. + */ +HgMediawall::HgMediawall( QGraphicsItem *parent ) +{ + Q_UNUSED(parent); + mReflectionEnabled = true; +} + +/*! + Destructs the mediawall widget stub. + */ +HgMediawall::~HgMediawall() +{ +} + +/*! + Stub function + */ +void HgMediawall::setTitlePosition( LabelPosition position ) +{ + Q_UNUSED(position); +} + +/*! + Stub function + */ +void HgMediawall::setDescriptionPosition( LabelPosition position ) +{ + Q_UNUSED(position); +} + +/*! + Stub function + */ +void HgMediawall::setTitleFontSpec( const HbFontSpec &fontSpec ) +{ + Q_UNUSED(fontSpec); +} + +/*! + Stub function + */ +void HgMediawall::setDescriptionFontSpec( const HbFontSpec &fontSpec ) +{ + Q_UNUSED(fontSpec); +} + +/*! + Stub function + */ +void HgMediawall::enableReflections( bool enabled ) +{ + mReflectionEnabled = enabled; +} + +/*! + Stub function + */ +bool HgMediawall::reflectionsEnabled() const +{ + return mReflectionEnabled; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpalbumcoverwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpalbumcoverwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpAlbumCoverWidget stub for testing MpPlaybackDocumentLoader +* +*/ + +#include "mpalbumcoverwidget.h" + + +/*! +Stub + */ +MpAlbumCoverWidget::MpAlbumCoverWidget( QGraphicsItem *parent ): + HbWidget(parent) + +{ + Q_UNUSED(parent); +} + +/*! + Stub function + */ +MpAlbumCoverWidget::~MpAlbumCoverWidget() +{ +} + +/*! + Stub function + */ +void MpAlbumCoverWidget::setIcon(const HbIcon &icon ) +{ + Q_UNUSED(icon); +} + +/*! + Stub function + */ +void MpAlbumCoverWidget::setDefaultIcon( const HbIcon &icon ) +{ + Q_UNUSED(icon); +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpcollectiondatamodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpcollectiondatamodel.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player collection abstract data model stub for testing +* mpcollectioncontainers. +* +*/ + + +#include "stub/inc/mpcollectiondatamodel.h" +#include "stub/inc/mpmpxcollectiondata.h" + + +/*! + Stub function + */ +MpCollectionDataModel::MpCollectionDataModel( MpMpxCollectionData *data, QObject *parent ) + : QAbstractListModel(parent) +{ + Q_UNUSED(data); +} + +/*! + Stub function + */ +MpCollectionDataModel::~MpCollectionDataModel() +{ +} + +/*! + Stub function + */ +int MpCollectionDataModel::rowCount( const QModelIndex &parent ) const +{ + Q_UNUSED(parent); + return 0; +} + +/*! + Stub function + */ +QVariant MpCollectionDataModel::data(const QModelIndex &index, int role) const +{ + Q_UNUSED(index); + Q_UNUSED(role); + return QVariant(); +} + +/*! + Stub function + */ +void MpCollectionDataModel::refreshModel() +{ +} + +/*! + Stub function + */ +MpMpxCollectionData *MpCollectionDataModel::collectionData() +{ + return new MpMpxCollectionData(); +} + +/*! + Stub function + */ +void MpCollectionDataModel::setItemVisibility(const QModelIndex &index, bool visible) +{ + Q_UNUSED(index); + Q_UNUSED(visible); +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpcollectiontbonelistdatamodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpcollectiontbonelistdatamodel.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player collection abstract data model (for TBone) stub +* for testing mpcollectioncontainers. +* +*/ + +#include "stub/inc/mpcollectiontbonelistdatamodel.h" +#include "stub/inc/mpmpxcollectiondata.h" +#include "mptrace.h" + +/*! + Stub function + */ +MpCollectionTBoneListDataModel::MpCollectionTBoneListDataModel(MpMpxCollectionData *collectionData, + MpPlaybackData *playbackData, QObject *parent ) + : QAbstractListModel(parent) +{ + Q_UNUSED(collectionData); + Q_UNUSED(playbackData); +} + +/*! + Stub function + */ +MpCollectionTBoneListDataModel::~MpCollectionTBoneListDataModel() +{ +} + +/*! + Stub function + */ +int MpCollectionTBoneListDataModel::rowCount( const QModelIndex &parent ) const +{ + Q_UNUSED(parent); + return 0; +} + +/*! + Stub function + */ +QVariant MpCollectionTBoneListDataModel::data(const QModelIndex &index, int role) const +{ + Q_UNUSED(index); + Q_UNUSED(role); + return QVariant();; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpengine.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub for MpEngine for testing mpmediawallview +* +*/ + +#include "mpengine.h" +#include "mpplaybackdata.h" +#include "mptrace.h" +#include "mpmpxcollectiondata.h" + + +MpEngine::MpEngine() : mOpenCollectionCalled(0) +{ + TX_LOG_ARGS("Stub") +} + +/*! + Destructs music player engine. + */ +MpEngine::~MpEngine() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::refreshLibrary() +{ + TX_ENTRY_ARGS("Stub") +} + +bool MpEngine::verifyUsbBlocking( bool showMessage ) +{ + Q_UNUSED(showMessage) + TX_ENTRY_ARGS("Stub") + return false; +} + +void MpEngine::checkForSystemEvents() +{ + TX_ENTRY_ARGS("Stub") +} + + +void MpEngine::openCollection( TCollectionContext context ) +{ + Q_UNUSED(context) + mOpenCollectionCalled++; + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::openCollectionItem( int index ) +{ + Q_UNUSED(index) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::back() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::findPlaylists( QStringList &playlists ) +{ + Q_UNUSED(playlists) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::createPlaylist( QString &playlistName, QList &selection, MpMpxCollectionData* collectionData ) +{ + Q_UNUSED(playlistName) + Q_UNUSED(selection) + Q_UNUSED(collectionData) + + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::saveToPlaylist( int playlistIndex, QList &selection ) +{ + Q_UNUSED(playlistIndex) + Q_UNUSED(selection) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::renamePlaylist( QString &newName, int index ) +{ + Q_UNUSED(newName) + Q_UNUSED(index) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::saveToCurrentPlaylist( QList &selection, MpMpxCollectionData *collectionData ) +{ + Q_UNUSED(selection) + Q_UNUSED(collectionData) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::renamePlaylist( QString &newName ) +{ + Q_UNUSED(newName) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::deleteSongs( QList &selection ) +{ + Q_UNUSED(selection) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::previewItem( int index ) +{ + Q_UNUSED(index) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::openIsolatedCollection( TCollectionContext context ) +{ + Q_UNUSED(context) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::releaseIsolatedCollection() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::findAlbumSongs( int index ) +{ + Q_UNUSED(index) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::playAlbumSongs( int albumIndex, int songIndex, MpMpxCollectionData* collectionData ) +{ + Q_UNUSED(albumIndex) + Q_UNUSED(songIndex) + Q_UNUSED(collectionData) + TX_ENTRY_ARGS("Stub") +} + +MpMpxCollectionData *MpEngine::collectionData() +{ + TX_ENTRY_ARGS("Stub") + return new MpMpxCollectionData(); +} + +void MpEngine::reopenCollection() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::reorderPlaylist( int playlistId, int songId, int originalOrdinal, int newOrdinal ) +{ + Q_UNUSED(playlistId) + Q_UNUSED(songId) + Q_UNUSED(originalOrdinal) + Q_UNUSED(newOrdinal) + TX_ENTRY_ARGS("Stub") +} + +MpPlaybackData *MpEngine::playbackData() +{ + TX_ENTRY_ARGS("Stub") + return new MpPlaybackData(); +} + + +void MpEngine::playEmbedded( QString aFilename ) +{ + Q_UNUSED(aFilename) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::playEmbedded(const XQSharableFile& file ) +{ + Q_UNUSED(file) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::playPause() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::stop() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::skipForward() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::skipBackward() +{ + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::setPosition( int position ) +{ + Q_UNUSED(position) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::setShuffle( bool mode ) +{ + Q_UNUSED(mode) + TX_ENTRY_ARGS("Stub") +} + +void MpEngine::setRepeat( bool mode ) +{ + Q_UNUSED(mode) + TX_ENTRY_ARGS("Stub") +} + +MpSongData *MpEngine::songData() +{ + TX_ENTRY_ARGS("Stub") + return 0; +} + +void MpEngine::retrieveSong() +{ + TX_ENTRY_ARGS("Stub") +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpenginefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpenginefactory.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mp engine factory. +* +*/ + +#include "mpengine.h" +#include "mpenginefactory.h" +#include "mptrace.h" + +/*! + \class MpEngineFactory + \brief Music Player engine factory. + + MP Engine factory is responsible to create and mantain ownership of MP engines. +*/ + +/*! + Constructs music player engine factory. + */ +MpEngineFactory::MpEngineFactory() + : mSharedEngine( 0 ) +{ + TX_ENTRY_ARGS("Stub") +} + +/*! + Destructs music player engine factory. + */ +MpEngineFactory::~MpEngineFactory() +{ + TX_ENTRY_ARGS("Stub") +} + +/*! + Returns the singleton instance of music player engine factory. + */ +MpEngineFactory * MpEngineFactory::instance() +{ + TX_LOG_ARGS("MpEngineFactory::instance() Stub") + static MpEngineFactory instance; + return &instance; +} + +/*! + Returns an instance to an engine with \a hostUid, and \a mode, if the shared engine is + already created parameters are ignored. + */ +MpEngine *MpEngineFactory::createSharedEngine( TUid /*hostUid*/ , MpEngine::EngineMode /*mode*/ ) +{ + TX_LOG_ARGS("MpEngineFactory::createSharedEngine() Stub") + if ( !instance()->mSharedEngine ) { + instance()->mSharedEngine = new MpEngine(); + } + return instance()->mSharedEngine; +} + +/*! + Returns an instance to the current shared engine previously created with createEngine(). + */ +MpEngine *MpEngineFactory::sharedEngine() +{ + return instance()->mSharedEngine; +} + +/*! + Closes all engines created on this process. + */ +void MpEngineFactory::close() +{ + if ( instance()->mSharedEngine ) { + delete instance()->mSharedEngine; + instance()->mSharedEngine = 0; + } + MpEngine *ptr; + foreach ( ptr, instance()->mEngines ) { + delete ptr; + ptr = 0; + } +} + +/*! + Returns an instance to an isolated engine with \a mode. + */ +MpEngine *MpEngineFactory::createIsolatedEngine( MpEngine::EngineMode /*mode*/ ) +{ + instance()->mEngines.append( new MpEngine() ); + return instance()->mEngines.last(); +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpmediawalldocumentloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpmediawalldocumentloader.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub for Music Player media wall view custom document loader. +* +*/ + +#include "mpmediawalldocumentloader.h" +#include "mpcommondefs.h" +#include "hgmediawall.h" +#include "mptrace.h" + +#include + +/*! +Stub implementation - load real widgets + */ +QObject *MpMediaWallDocumentLoader::createObject(const QString& type, const QString &name) +{ + TX_LOG_ARGS("MpMediaWallDocumentLoader::createObject() Stub"); + TX_ENTRY_ARGS("type=" << type << ", name=" << name); + + if ( type == HgMediawall::staticMetaObject.className() ) { + QObject *object = new HgMediawall(); + object->setObjectName(name); + TX_EXIT + return object; + } + else if ( type == HbToolButton::staticMetaObject.className() ) { + QObject *object = new HbToolButton(); + object->setObjectName(name); + TX_EXIT + return object; + } + + TX_EXIT + return HbDocumentLoader::createObject(type, name); +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpmpxcollectiondata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpmpxcollectiondata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpMpxCollectionData stub for testing mpcollectioncontainers +* +*/ + +#include "mptrace.h" +#include "stub/inc/mpmpxcollectiondata.h" +#include + + +/*! + Stub function. + */ +MpMpxCollectionData::MpMpxCollectionData( QObject *parent ) + : QObject(parent), + mContainerMedia(0), + mMediaSet(false), + mContext(ECollectionContextUnknown), + mCount(0), + mCurrentAlbumIndex(-1), + mCurrentAlbumAvailable(false), + mReturnCollectionTitle(true) +{ +} + +/*! + Stub function. +*/ +MpMpxCollectionData::~MpMpxCollectionData() +{ +} + +/*! + Stub function. +*/ +TCollectionContext MpMpxCollectionData::context() +{ + return mContext; +} + +/*! + Stub function. + */ +int MpMpxCollectionData::count() const +{ + return mCount; +} + +/*! + Stub function. + */ +QString MpMpxCollectionData::collectionTitle() const +{ + if ( mReturnCollectionTitle ) { + return QString("Title"); + } + else { + return QString(); + } +} + +/*! + Stub function. +*/ +QString MpMpxCollectionData::itemData( int index, MpMpxCollectionData::DataType type ) const +{ + Q_UNUSED(index); + if ( type == MpMpxCollectionData::Uri ) { + return QString("Uri"); + } + else { + return QString(); + } +} + +/*! + Stub function. +*/ +bool MpMpxCollectionData::setCurrentAlbum( int index ) +{ + mCurrentAlbumIndex = index; + return mCurrentAlbumAvailable; +} + +/*! + Stub function. +*/ +const CMPXMedia& MpMpxCollectionData::containerMedia() +{ + return *mContainerMedia; +} + +void MpMpxCollectionData::setContext( TCollectionContext context ) +{ + TX_LOG_ARGS("MpMpxCollectionData::setContext() Stub" << context) + mContext=context; +} + +int MpMpxCollectionData::itemIndex( int itemUniqueId ) +{ + Q_UNUSED(itemUniqueId); + return 0; +} + +void MpMpxCollectionData::setCount(int count) + { + mCount=count; + } diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpplaybackdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpplaybackdata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpPlaybackData stub for testing mpnowplayingwidget +* +*/ + +#include "stub/inc/mpplaybackdata.h" + + +int gUpdateCounter = 0; + + +/*! + Stub function. + */ +MpPlaybackData::MpPlaybackData() + : mPlaybackState(NotPlaying) +{ + gUpdateCounter++; +} + +/*! + Stub function. + */ +MpPlaybackData::~MpPlaybackData() +{ +} + +/*! + Stub function. + */ +const QString& MpPlaybackData::title() const +{ + return mTitle; +} + +/*! + Stub function. + */ +const QString& MpPlaybackData::artist() const +{ + return mArtist; +} + +/*! + Stub function. + */ +MpPlaybackData::SimplifiedState MpPlaybackData::playbackState() const +{ + return mPlaybackState; +} + +/*! + Stub function. + */ +int MpPlaybackData::albumId() +{ + return 0; +} + +/*! + Stub function. + */ +void MpPlaybackData::emitPlaybackStateChanged() +{ + emit playbackStateChanged(); +} + + void MpPlaybackData::setPlaybackState(MpPlaybackData::SimplifiedState state) + { + mPlaybackState=state; + } diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpreflectioneffect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mpreflectioneffect.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for mpreflectioneffects +* +*/ + +#include "mpreflectioneffect.h" + +/*! + Stub +*/ +MpReflectionEffect::MpReflectionEffect(QObject *parent) + : QGraphicsEffect( parent ) +{ +} + +/*! + Stub +*/ +MpReflectionEffect::~MpReflectionEffect() +{ +} + +/*! + Stub +*/ +QRectF MpReflectionEffect::boundingRectFor(const QRectF &rect) const +{ + Q_UNUSED(rect) + return QRectF(); +} + +/*! + Stub +*/ +void MpReflectionEffect::draw(QPainter *painter) +{ + Q_UNUSED(painter) +} + +// EOF diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mptracklistwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/stub/src/mptracklistwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Track List Widget for Music Player Media Wall. +* +*/ + + +#include + +#include +#include +#include +#include +#include + + +#include "mptracklistwidget.h" +#include "mpreflectioneffect.h" + +/*! + Stub. + */ +MpTrackListWidget::MpTrackListWidget( QGraphicsItem *parent ) : HbWidget( parent ) +{ + +} + +/*! + Stub + */ +MpTrackListWidget::~MpTrackListWidget() +{ +} + +/*! + Stub + */ +HbListView *MpTrackListWidget::list() +{ + return new HbListView(); +} + +//EOF diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/unittest_mpmediawallview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallview/unittest_mpmediawallview.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,65 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpmediawallview +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += ./stub/inc \ + ../../inc \ + ../../../../inc + + +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +INCLUDEPATH += $$MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets) + +LIBS += -lmpxviewframeworkqt.dll \ + -lmpsettingsmanager.dll + + +# Input +HEADERS += inc/unittest_mpmediawallview.h \ + ../../inc/mpmediawallview.h \ + ../../../../inc/mpviewbase.h \ + stub/inc/hgmediawall.h \ + stub/inc/mpengine.h \ + stub/inc/mpenginefactory.h \ + stub/inc/mpmpxcollectiondata.h \ + stub/inc/mpcollectiondatamodel.h \ + stub/inc/mpplaybackdata.h \ + stub/inc/mpalbumcoverwidget.h \ + stub/inc/mpmediawalldocumentloader.h \ + stub/inc/mptracklistwidget.h \ + stub/inc/mpcollectiontbonelistdatamodel.h \ + stub/inc/mpreflectioneffect.h + +SOURCES += src/unittest_mpmediawallview.cpp \ + stub/src/hgmediawall.cpp \ + stub/src/mpengine.cpp \ + stub/src/mpenginefactory.cpp \ + stub/src/mpmpxcollectiondata.cpp \ + stub/src/mpcollectiondatamodel.cpp \ + stub/src/mpplaybackdata.cpp \ + stub/src/mpalbumcoverwidget.cpp \ + stub/src/mpmediawalldocumentloader.cpp \ + stub/src/mptracklistwidget.cpp \ + stub/src/mpcollectiontbonelistdatamodel.cpp \ + stub/src/mpreflectioneffect.cpp + + +RESOURCES += ../../resources/mpmediawallviewresources.qrc diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/inc/unittest_mpmediawallviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/inc/unittest_mpmediawallviewplugin.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpmediawallplugin +* +*/ + +#ifndef TESTMPMEDIAWALLVIEWPLUGIN_H +#define TESTMPMEDIAWALLVIEWPLUGIN_H + +#include + +class MpMediaWallViewPlugin; + +class TestMpMediaWallViewPlugin : public QObject +{ + Q_OBJECT + +public: + + TestMpMediaWallViewPlugin(); + virtual ~TestMpMediaWallViewPlugin(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void testConstructor(); + void testCreateView(); + void testdestroyView(); + void testActivateView(); + void testDeactivateView(); + void testGetView(); + +private: + + MpMediaWallViewPlugin *mTest; + +}; + +#endif // TESTMPMEDIAWALLVIEWPLUGIN_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/src/unittest_mpmediawallviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/src/unittest_mpmediawallviewplugin.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,262 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpMediaWallViewPlugin +* +*/ + +#include +#include + +#include "stub/inc/mpmediawallview.h" +#include "stub/inc/xqplugin.h" +#include "unittest_mpmediawallviewplugin.h" + + +// Do this so we can access all member variables. +#define private public +#include "mpmediawallviewplugin.h" +#undef private + +//This so MpMediaWallViewPlugin.cpp can load qt stub items +#include "../../src/mpmediawallviewplugin.cpp" + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + TestMpMediaWallViewPlugin tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpmediawallviewplugin.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpMediaWallViewPlugin::TestMpMediaWallViewPlugin() + : mTest(0) +{ +} + +TestMpMediaWallViewPlugin::~TestMpMediaWallViewPlugin() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpMediaWallViewPlugin::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpMediaWallViewPlugin::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpMediaWallViewPlugin::init() +{ + mTest = new MpMediaWallViewPlugin(); +} + +/*! + Called after every testfunction. + */ +void TestMpMediaWallViewPlugin::cleanup() +{ + delete mTest; + mTest = 0; +} + +/*! + testConstructor + */ +void TestMpMediaWallViewPlugin::testConstructor() +{ + QVERIFY(!mTest->mView); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::NullView); +} + +/*! + testCreateView + */ +void TestMpMediaWallViewPlugin::testCreateView() +{ + + mTest->createView(); + QVERIFY(mTest->mView); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::Created); + /* + QSignalSpy spy( mTest, SIGNAL(command(int)) ); + mTest->mView->emitCommand(123); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant(123)); + */ + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + delete mTest->mView; + //mTest->mView = 0; intentionally not = 0 to prevent unecesary double delete. + +} + + +/*! + testdestroyView + */ +void TestMpMediaWallViewPlugin::testdestroyView() +{ + + mTest->mView = new MpMediaWallView(); + mTest->mState = MpMediaWallViewPlugin::Created; + mTest->destroyView(); + QVERIFY(!mTest->mView); + mTest->mView = new MpMediaWallView(); + mTest->mState = MpMediaWallViewPlugin::NullView; + mTest->destroyView(); + QVERIFY(mTest->mView); + + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + delete mTest->mView; + //mTest->mView = 0; intentionally not = 0 to prevent unecesary double delete. + +} + + +/*! + testActivateView + */ +void TestMpMediaWallViewPlugin::testActivateView() +{ + + mTest->mState = MpMediaWallViewPlugin::NullView; + mTest->activateView(); // we should be able to call activate without a view and not crash. + + + mTest->mView = new MpMediaWallView(); + mTest->mState = MpMediaWallViewPlugin::NullView; + mTest->activateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::NullView); + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + mTest->mView->resetCounters(); + mTest->mState = MpMediaWallViewPlugin::Activated; + mTest->activateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::Activated); + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + mTest->mView->resetCounters(); + mTest->mState = MpMediaWallViewPlugin::Created; + mTest->activateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::Activated); + QCOMPARE(mTest->mView->mInitializeViewCount,1); + QCOMPARE(mTest->mView->mActivateViewCount,1); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + mTest->mView->resetCounters(); + mTest->mState = MpMediaWallViewPlugin::Initialized; + mTest->activateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::Activated); + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,1); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + + delete mTest->mView; + //mTest->mView = 0; intentionally not = 0 to prevent unecesary double delete. + +} + + +/*! + testDeactivateView + */ +void TestMpMediaWallViewPlugin::testDeactivateView() +{ + + mTest->mState = MpMediaWallViewPlugin::NullView; + mTest->deactivateView(); // we should be able to call deactivate without a view and not crash. + + mTest->mView = new MpMediaWallView(); + mTest->mState = MpMediaWallViewPlugin::NullView; + mTest->deactivateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::NullView); + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + mTest->mView->resetCounters(); + mTest->mState = MpMediaWallViewPlugin::Activated; + mTest->deactivateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::Initialized); + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,1); + + mTest->mView->resetCounters(); + mTest->mState = MpMediaWallViewPlugin::Created; + mTest->deactivateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::Created); + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + mTest->mView->resetCounters(); + mTest->mState = MpMediaWallViewPlugin::Initialized; + mTest->deactivateView(); + QCOMPARE(mTest->mState, MpMediaWallViewPlugin::Initialized); + QCOMPARE(mTest->mView->mInitializeViewCount,0); + QCOMPARE(mTest->mView->mActivateViewCount,0); + QCOMPARE(mTest->mView->mDeactivateViewCount,0); + + delete mTest->mView; + //mTest->mView = 0; intentionally not = 0 to prevent unecesary double delete. + +} + +void TestMpMediaWallViewPlugin::testGetView() +{ + MpMediaWallView* tmpView; + mTest->mView = new MpMediaWallView(); + tmpView = mTest->mView; + mTest->getView(); + QCOMPARE(int(tmpView),int(mTest->getView())); + delete mTest->mView; + //mTest->mView = 0; intentionally not = 0 to prevent unecesary double delete. + +} + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/stub/inc/mpmediawallview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/stub/inc/mpmediawallview.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub Music Player Media Wall view. +* +*/ + +#ifndef MPMEDIAWALLVIEW_H +#define MPMEDIAWALLVIEW_H + +#include + +class MpMediaWallView : public QGraphicsWidget +{ + Q_OBJECT + +public: + explicit MpMediaWallView(); + virtual ~MpMediaWallView(); + + void initializeView(); + void activateView(); + void deactivateView(); + void resetCounters(); + +signals: + void command( int aCommand ); + +public: + int mInitializeViewCount; + int mActivateViewCount; + int mDeactivateViewCount; + + +// Q_DISABLE_COPY(MpMediaWallView) +}; + + +#endif //MPMEDIAWALLVIEW_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/stub/inc/xqplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/stub/inc/xqplugin.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub for testing MpSettingsViewPlugin +* +*/ + +#ifndef XQPLUGIN_H +#define XQPLUGIN_H + +// convenience macro +#define XQ_EXPORT_PLUGIN(PLUGIN, PLUGINCLASS) + +#define XQ_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) + +#endif // XQ_PLUGIN_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/stub/src/mpmediawallview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/stub/src/mpmediawallview.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player Settings view Stub. +* +*/ + +#include "stub/inc/mpmediawallview.h" + + +MpMediaWallView::MpMediaWallView() : + mInitializeViewCount(0), + mActivateViewCount(0), + mDeactivateViewCount(0) +{ +} + +/*! + Destructs the media wall view. + */ +MpMediaWallView::~MpMediaWallView() +{ +} + +/*! + Initializes the media wall view. + */ +void MpMediaWallView::initializeView() +{ + mInitializeViewCount++; +} + +/*! + Activates the media wall view. + */ +void MpMediaWallView::activateView() +{ + mActivateViewCount++; +} + +/*! + Deactivates the media wall view. + */ +void MpMediaWallView::deactivateView() +{ + mDeactivateViewCount++; +} + +/*! + Resets counters + */ +void MpMediaWallView::resetCounters() +{ + mInitializeViewCount = 0; + mActivateViewCount = 0; + mDeactivateViewCount = 0; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/unittest_mpmediawallviewplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpmediawallviewplugin/unittest_mpmediawallviewplugin.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,38 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +CONFIG += qtestlib +CONFIG += symbian_test +TARGET = unittest_mpmediawallviewplugin +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + ../../inc \ + ../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lmpxviewframeworkqt.dll + +HEADERS += inc/unittest_mpmediawallviewplugin.h \ + stub/inc/xqplugin.h \ + stub/inc/mpmediawallview.h \ + ../../inc/mpmediawallviewplugin.h + +SOURCES += src/unittest_mpmediawallviewplugin.cpp \ + stub/src/mpmediawallview.cpp + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpreflectioneffect/inc/unittest_mpreflectioneffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpreflectioneffect/inc/unittest_mpreflectioneffect.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpReflectionEffect +* +*/ + +#ifndef TESTMPREFLECTIONEFFECT_H +#define TESTMPREFLECTIONEFFECT_H + +#include + +class MpReflectionEffect; + +class TestMpReflectionEffect : public QObject +{ + Q_OBJECT + +public: + + TestMpReflectionEffect(); + virtual ~TestMpReflectionEffect(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private: + MpReflectionEffect *mTest; +}; + +#endif // TESTMPREFLECTIONEFFECT_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpreflectioneffect/src/unittest_mpreflectioneffect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpreflectioneffect/src/unittest_mpreflectioneffect.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpReflectionEffect +* +*/ + +#include +#include "unittest_mpreflectioneffect.h" + +/*! + * Nothing valuable to test for following functions + * boundingRectFor() + * draw() + * + */ + +// Do this so we can access all member variables. +#define private public +#include "mpreflectioneffect.h" +#undef private + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + TestMpReflectionEffect tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpreflectioneffect.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpReflectionEffect::TestMpReflectionEffect() + : mTest(0) +{ +} + +TestMpReflectionEffect::~TestMpReflectionEffect() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpReflectionEffect::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpReflectionEffect::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpReflectionEffect::init() +{ + mTest = new MpReflectionEffect( new QObject() ); +} + +/*! + Called after every testfunction. + */ +void TestMpReflectionEffect::cleanup() +{ + delete mTest; + mTest = 0; +} + + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpreflectioneffect/unittest_mpreflectioneffect.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mpreflectioneffect/unittest_mpreflectioneffect.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,34 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpreflectioneffect unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpreflectioneffect +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + ../../inc \ + ../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +HEADERS += inc/unittest_mpreflectioneffect.h \ + ../../inc/mpreflectioneffect.h \ + + +SOURCES += src/unittest_mpreflectioneffect.cpp \ + ../../src/mpreflectioneffect.cpp \ + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/inc/unittest_mptracklistwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/inc/unittest_mptracklistwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpTrackListWidget +* +*/ + +#ifndef TESTMPREFLECTIONEFFECT_H +#define TESTMPREFLECTIONEFFECT_H + +#include + +class MpTrackListWidget; + +class TestMpTrackListWidget : public QObject +{ + Q_OBJECT + +public: + + TestMpTrackListWidget(); + virtual ~TestMpTrackListWidget(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void testConstructor(); + void testSwipeAngleToDirection(); + +private: + MpTrackListWidget *mTest; +}; + +#endif // TESTMPREFLECTIONEFFECT_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/src/unittest_mptracklistwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/src/unittest_mptracklistwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpTrackListWidget +* +*/ + +/* +* there are no valuable test cases for following functions +* resizeEvent() +* gestureEvent() +* mousePressEvent() +* +*/ + +#include "unittest_mptracklistwidget.h" +#include "hbinstancestub.h" +#include + +// Do this so we can access all member variables. +#define private public +#include "mptracklistwidget.h" +#undef private + +//This so we can test private functions +#include "../../src/mptracklistwidget.cpp" + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + TestMpTrackListWidget tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mptracklistwidget.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpTrackListWidget::TestMpTrackListWidget() + : mTest(0) +{ +} + +TestMpTrackListWidget::~TestMpTrackListWidget() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpTrackListWidget::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpTrackListWidget::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpTrackListWidget::init() +{ + mTest = new MpTrackListWidget(); +} + +/*! + Called after every testfunction. + */ +void TestMpTrackListWidget::cleanup() +{ + delete mTest; + mTest = 0; +} + +/*! + test constructor. +*/ +void TestMpTrackListWidget::testConstructor() +{ + QVERIFY( mTest->mList->layoutName() == "mpmwtracklist" ); +} + +/*! + test swipeAngleToDirection + */ +void TestMpTrackListWidget::testSwipeAngleToDirection() +{ + hbInstance->allMainWindows()[0]->mOrientation = Qt::Vertical; + QSwipeGesture::SwipeDirection direction; + + direction = mTest->swipeAngleToDirection( 70 ); + QVERIFY( direction == QSwipeGesture::Up ); + + direction = mTest->swipeAngleToDirection( 250 ); + QVERIFY( direction == QSwipeGesture::Down ); + + direction = mTest->swipeAngleToDirection( 20 ); + QVERIFY( direction == QSwipeGesture::Right ); + + direction = mTest->swipeAngleToDirection( 340 ); + QVERIFY( direction == QSwipeGesture::Right ); + + direction = mTest->swipeAngleToDirection( 160 ); + QVERIFY( direction == QSwipeGesture::Left ); + + hbInstance->allMainWindows()[0]->mOrientation = Qt::Horizontal; +#ifdef __WINS__ + direction = mTest->swipeAngleToDirection( 70 ); + QVERIFY( direction == QSwipeGesture::Right ); + + direction = mTest->swipeAngleToDirection( 100 ); + QVERIFY( direction == QSwipeGesture::Right ); +#else + direction = mTest->swipeAngleToDirection( 70 ); + QVERIFY( direction == QSwipeGesture::Left ); + + direction = mTest->swipeAngleToDirection( 340 ); + QVERIFY( direction == QSwipeGesture::Up ); +#endif +} + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/stub/inc/hbinstancestub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/stub/inc/hbinstancestub.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for hbinstance +* +*/ + +#ifndef HBINSTANCESTUB_H_ +#define HBINSTANCESTUB_H_ + +#include "stub/inc/hbmainwindowstub.h" + +#define hbInstance (HbInstanceStub::instance()) + +class HbInstanceStub +{ +public: + static HbInstanceStub *instance(); + + QList allMainWindows() const; + +private: + HbInstanceStub(); + ~HbInstanceStub(); + +public: + QList mList; +}; + + +#endif /* HBINSTANCESTUB_H_ */ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/stub/inc/hbmainwindowstub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/stub/inc/hbmainwindowstub.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for hbmainwindow +* +*/ + +#ifndef HBMAINWINDOWSTUB_H_ +#define HBMAINWINDOWSTUB_H_ + +#include + +class HbMainWindowStub +{ +public: + Qt::Orientation orientation() const { + return mOrientation; + } + +public: + Qt::Orientation mOrientation; +}; + + +#endif /* HBMAINWINDOWSTUB_H_ */ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/stub/src/hbinstancestub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/stub/src/hbinstancestub.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for hbinstance +* +*/ + +#include "stub/inc/hbinstancestub.h" + +/*! + Constructor + */ +HbInstanceStub::HbInstanceStub() +{ + HbMainWindowStub *mainwindowStub = new HbMainWindowStub(); + mList.append( mainwindowStub ); +} + +/*! + Destructor + */ +HbInstanceStub::~HbInstanceStub() +{ + mList.clear(); +} + +HbInstanceStub *HbInstanceStub::instance() +{ + static HbInstanceStub hbInstanceStub; + return &hbInstanceStub; +} + +QList HbInstanceStub::allMainWindows() const +{ + return mList; +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/unittest_mptracklistwidget.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpmediawallviewplugin/tsrc/unittest_mptracklistwidget/unittest_mptracklistwidget.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,37 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mptracklistwidget unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mptracklistwidget +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + ../../inc \ + ../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +HEADERS += inc/unittest_mptracklistwidget.h \ + ../../inc/mptracklistwidget.h \ + stub/inc/hbinstancestub.h \ + stub/inc/hbmainwindownstub.h \ + + +SOURCES += src/unittest_mptracklistwidget.cpp \ + stub/src/hbinstancestub.cpp \ + +DEFINES += UNIT_TESTING \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/mpplaybackviewplugin.pro --- a/mpviewplugins/mpplaybackviewplugin/mpplaybackviewplugin.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpplaybackviewplugin/mpplaybackviewplugin.pro Fri Aug 06 16:51:36 2010 -0500 @@ -59,3 +59,4 @@ RESOURCES += resources/mpplaybackviewpluginresources.qrc +DOCML += resources/playbackwidget.docml diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/resources/mpplaybackviewpluginresources.qrc --- a/mpviewplugins/mpplaybackviewplugin/resources/mpplaybackviewpluginresources.qrc Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpplaybackviewplugin/resources/mpplaybackviewpluginresources.qrc Fri Aug 06 16:51:36 2010 -0500 @@ -5,7 +5,7 @@ - playbackwidget.docml + playbackwidget.docml.bin diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/tsrc.pro --- a/mpviewplugins/mpplaybackviewplugin/tsrc/tsrc.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -18,7 +18,8 @@ SUBDIRS += unittest_mpequalizerwidget \ unittest_mpplaybackdocumentloader \ - unittest_mpplaybackviewplugin + unittest_mpplaybackviewplugin \ + unittest_mpplaybackview CONFIG += ordered diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/inc/unittest_mpplaybackview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/inc/unittest_mpplaybackview.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpplaybackview +* +*/ + +#ifndef TESTMPPLAYBACKVIEW_H +#define TESTMPPLAYBACKVIEW_H + +#include +#include "mpengine.h" +#include "mpviewbase.h" +#include "mpequalizerwidget.h" + + +class MpPlaybackView; + +class TestMpPlaybackView: public QObject +{ + Q_OBJECT + +public: + + TestMpPlaybackView(); + virtual ~TestMpPlaybackView(); + +signals: + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: +//Test Cases + void testActivateView(); + void testDeactivateView(); + void testShuffleEnabled(); + void testRepeatEnabled(); + void testPlaybackStatus(); + + void testStartSettingsView(); + void testBack(); + void testExit(); + + void testPlaybackStateChanged(); + void testFlip(); + void testShuffle(); + void testRepeat(); + + void testHandleSongSelected(); + void testShowEqualizerDialog(); + void testCloseEqualizerDialog(); + + void testSeekForward(); + void testSeekRewind(); + void testEndRewind(); + void testEndForward(); + +private: + MpPlaybackView *mTest; + MpPlaybackData *mPlaybackData; + MpViewBase *mViewBase; + MpEqualizerWidget *mEqualizerWidget; + +}; + +#endif // TESTMPPLAYBACKVIEW_H + + + + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/src/unittest_mpplaybackview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/src/unittest_mpplaybackview.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpplaybackview +* +*/ + +#include +#include +#include +#include +#include + +#include "stub/inc/mpequalizerwidget.h" +#include "mpcommondefs.h" +#include "stub/inc/mpviewbase.h" +#include "stub/inc/mpsettingsmanager.h" +#include "unittest_mpplaybackview.h" + +// Do this so we can access all member variables. +#define private public +#include "mpplaybackview.h" +#undef private + +//This so we can test private functions +#include "../../src/mpplaybackview.cpp" + + + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + TestMpPlaybackView tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpplaybackview.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpPlaybackView::TestMpPlaybackView() + : mTest(0) +{ + +} + +TestMpPlaybackView::~TestMpPlaybackView() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpPlaybackView::initTestCase() +{ + +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpPlaybackView::cleanupTestCase() +{ +QCoreApplication::processEvents(); +} + +/*! + Called before each testfunction is executed. + */ +void TestMpPlaybackView::init() +{ + mTest = new MpPlaybackView(); + mTest->initializeView(); +} + +/*! + Called after every testfunction. + */ +void TestMpPlaybackView::cleanup() +{ + mTest->mMpEngine->retrieveSongDetailsCount = 0; + mTest->mMpEngine->stopCount = 0; + mTest->mEqualizerWidget->showEqualizerWidgetCount = 0; + mTest->mEqualizerWidget->closeEqualizerWidgetCount = 0; + mTest->mMpEngine->startSeekBackwardCount = 0; + mTest->mMpEngine->startSeekForwardCount = 0; + mTest->mMpEngine->stopSeekingCount = 0; + mTest->mMpEngine->skipBackwardCount = 0; + mTest->mMpEngine->skipForwardCount = 0; + delete mTest; + mTest = 0; +} + + +/*! +Test ActivateView + */ +void TestMpPlaybackView::testActivateView() +{ + QCOMPARE( mTest->mActivated, false ); + mTest->activateView(); + QCOMPARE( mTest->mActivated, true ); + QVERIFY( mTest->navigationAction() == mTest->mSoftKeyBack ); + +} + +/*! + Test DeactivateView + */ +void TestMpPlaybackView::testDeactivateView() +{ + mTest->mActivated = true; + mTest->deactivateView(); + QCOMPARE( mTest->mActivated, false ); +} + +/*! + Test ShuffleEnabled + */ +void TestMpPlaybackView::testShuffleEnabled() +{ + mTest->mShuffle = false; + QCOMPARE(mTest->shuffleEnabled(), false); + mTest->mShuffle = true; + QCOMPARE(mTest->shuffleEnabled(), true); +} + +/*! + Test RepeatEnabled + */ +void TestMpPlaybackView::testRepeatEnabled() +{ + mTest->mRepeat = false; + QCOMPARE(mTest->repeatEnabled(), false); + mTest->mRepeat = true; + QCOMPARE(mTest->repeatEnabled(), true); +} + +/*! + Test PlaybackStatus + */ +void TestMpPlaybackView::testPlaybackStatus() +{ + mTest->mPlaybackData->setPlaybackState(MpPlaybackData::NotPlaying); + QCOMPARE(mTest->playbackStatus(),QString("NotPlaying")); + + mTest->mPlaybackData->setPlaybackState(MpPlaybackData::Playing); + QCOMPARE(mTest->playbackStatus(),QString("Playing")); + + mTest->mPlaybackData->setPlaybackState(MpPlaybackData::Paused); + QCOMPARE(mTest->playbackStatus(),QString("Paused")); + + mTest->mPlaybackData->setPlaybackState(MpPlaybackData::Stopped); + QCOMPARE(mTest->playbackStatus(),QString("Stopped")); +} + +/*! + Test StartSettingsView + */ +void TestMpPlaybackView::testStartSettingsView() +{ + QSignalSpy spy(mTest, SIGNAL(command(int))); + + mTest->startSettingsView(); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant(MpCommon::ActivateSettingsView)); +} + +/*! + Test Back + */ +void TestMpPlaybackView::testBack() +{ + //test Stop() gets called in MpEngine + mTest->mMpEngine->stopCount=0; + mTest->mViewMode = MpCommon::EmbeddedView; + mTest->back(); + QCOMPARE(mTest->mMpEngine->stopCount,1); + + mTest->mViewMode = MpCommon::FetchView; + mTest->back(); + QCOMPARE(mTest->mMpEngine->stopCount,2); + + QSignalSpy spy(mTest, SIGNAL(command(int))); + mTest->mMpEngine->stopCount = 0; + mTest->mViewMode = MpCommon::DefaultView; + + mTest->back(); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant(MpCommon::ActivateCollectionView)); + QCOMPARE(mTest->mMpEngine->stopCount,0); +} + +/*! + Test Exit + */ +void TestMpPlaybackView::testExit() +{ + QSignalSpy spy(mTest, SIGNAL(command(int))); + mTest->exit(); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant(MpCommon::Exit)); +} + +/*! + Test PlaybackStateChanged + */ +void TestMpPlaybackView::testPlaybackStateChanged() +{ + //test signal slot connection + mTest->mMpEngine->stopCount=0; + mTest->mViewMode = MpCommon::FetchView; + mTest->mPlaybackData->setPlaybackState(MpPlaybackData::Stopped); + + mTest->mPlaybackData->triggerStateUpdate(MpPlaybackData::Stopped); + QCOMPARE(mTest->mMpEngine->stopCount,1); +} + +/*! + Test Flip + */ +void TestMpPlaybackView::testFlip() +{ + QSignalSpy spy(mTest, SIGNAL(command(int))); + mTest->flip(); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant(MpCommon::ActivateDetailsView)); + QCOMPARE(mTest->mMpEngine->retrieveSongDetailsCount,1); +} + +/*! + Test ToggleShuffle and Shuffle changed + */ +void TestMpPlaybackView::testShuffle() +{ + mTest->mShuffle = false; + QCOMPARE(mTest->shuffleEnabled(), false); + + mTest->toggleShuffle(); + mTest->shuffleChanged(true); //simulate signal + QCOMPARE(mTest->shuffleEnabled(), true); + QVERIFY(mTest->mShuffleAction->icon() == *mTest->mShuffleOnIcon); + + mTest->toggleShuffle(); + mTest->shuffleChanged(false); + QCOMPARE(mTest->shuffleEnabled(), false); + QVERIFY(mTest->mShuffleAction->icon() == *mTest->mShuffleOffIcon); +} + +/*! + Test ToggleRepeat and RepeatChanged + */ +void TestMpPlaybackView::testRepeat() +{ + mTest->mRepeat = false; + QCOMPARE(mTest->repeatEnabled(),false); + + mTest->toggleRepeat(); + mTest->repeatChanged(true); + QCOMPARE(mTest->repeatEnabled(),true); + QCOMPARE(mTest->mRepeatAction->text(),hbTrId( "txt_mus_opt_repeat_off" )); + + mTest->toggleRepeat(); + mTest->repeatChanged(false); + QCOMPARE(mTest->repeatEnabled(),false); + QCOMPARE(mTest->mRepeatAction->text(),hbTrId( "txt_mus_opt_repeat_on" )); +} + +/*! + Test HandleSongSelected + */ +void TestMpPlaybackView::testHandleSongSelected() +{ + mTest->mMpEngine->stopCount=0; + mTest->mPlaybackData->setUri("testUri"); + + QSignalSpy spy(mTest, SIGNAL(songSelected(QString))); + mTest->handleSongSelected(); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant("testUri")); + QCOMPARE(mTest->mMpEngine->stopCount,1); +} + +/*! + Test ShowEqualizerDialog + */ +void TestMpPlaybackView::testShowEqualizerDialog() +{ + mTest->mEqualizerWidget->showEqualizerWidgetCount = 0; + mTest->showEqualizerDialog(); + QCOMPARE(mTest->mEqualizerWidget->showEqualizerWidgetCount,1); +} + +/*! + TestCloseEqualizerDialog + */ +void TestMpPlaybackView::testCloseEqualizerDialog() +{ + mTest->mEqualizerWidget->closeEqualizerWidgetCount = 0; + mTest->closeEqualizerDialog(); + QCOMPARE(mTest->mEqualizerWidget->closeEqualizerWidgetCount,1); +} + + +/*! + Test StartRewindTimer and startSeekRewind + */ +void TestMpPlaybackView::testSeekRewind() +{ + mTest->mMpEngine->startSeekBackwardCount = 0; + mTest->mSeeking = false; + + mTest->startRewindTimer(); + QTest::qWait(2000); // wait for timer to fire and call startSeekRewind() + + QCOMPARE(mTest->mMpEngine->startSeekBackwardCount,1); + QCOMPARE(mTest->mSeeking,true); +} + +/*! + Test StartForwardTimer and startSeekForward + */ +void TestMpPlaybackView::testSeekForward() +{ + mTest->mMpEngine->startSeekForwardCount = 0; + mTest->mSeeking = false; + + mTest->startForwardTimer(); + QTest::qWait(2000); // wait for timer to fire and call startSeekForward() + + QCOMPARE(mTest->mMpEngine->startSeekForwardCount,1); + QCOMPARE(mTest->mSeeking,true); +} + +/*! + Test EndRewind + */ +void TestMpPlaybackView::testEndRewind() +{ + mTest->mSeeking = true; + mTest->endRewind(); + QCOMPARE(mTest->mMpEngine->stopSeekingCount,1); + QCOMPARE(mTest->mSeeking,false); + + mTest->endRewind(); + QCOMPARE(mTest->mMpEngine->skipBackwardCount,1); + QCOMPARE(mTest->mSeeking,false); +} + +/*! + Test EndForward + */ +void TestMpPlaybackView::testEndForward() +{ + mTest->mSeeking = true; + mTest->endForward(); + QCOMPARE(mTest->mMpEngine->stopSeekingCount,1); + QCOMPARE(mTest->mSeeking,false); + + mTest->endForward(); + QCOMPARE(mTest->mMpEngine->skipForwardCount,1); + QCOMPARE(mTest->mSeeking,false); +} + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpengine.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player engine stub for mpplaybackview. +* +*/ + +#ifndef MPENGINE_H +#define MPENGINE_H + +#include +#include + + +class MpPlaybackData; + +class MpEngine : public QObject +{ + Q_OBJECT + + friend class MpEngineFactory; + +public: + enum EngineMode{ + StandAlone, + Fetch, + Embedded, + MediaBrowsing + }; + +private: + explicit MpEngine(); + +public: + + virtual ~MpEngine(); + + MpPlaybackData *playbackData(); + void retrieveSongDetails(); + + // Equalizer related + void applyPreset( int preset ); + void disableEqualizer(); + int activePreset(); + QStringList presetNames(); + +public slots: + // Playback related + void stop(); + void setShuffle(bool mode); + void setRepeat( bool mode); + void startSeekBackward(); + void startSeekForward(); + void stopSeeking(); + void skipBackward(); + void skipForward(); + void playPause(); + void setPosition( int position ); + +signals: + + // Equalizer related + void libraryUpdated(); + +private: + Q_DISABLE_COPY( MpEngine ) + +public: + int mActivePreset; + int mApplyPresetCount; + int mDisableEquqlizerCount; + int retrieveSongDetailsCount; + int stopCount; + int startSeekBackwardCount; + int startSeekForwardCount; + int stopSeekingCount; + int skipBackwardCount; + int skipForwardCount; + +}; + +#endif // MPENGINE_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpenginefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpenginefactory.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub for testing mpplaybackview +* +*/ + +#ifndef MPENGINEFACTORY_H +#define MPENGINEFACTORY_H + +#include + + +class MpPlaybackData; +class MpEngine; + +class MpEngineFactory +{ + +public: + // Stub functions +private: + explicit MpEngineFactory(); + +public: + virtual ~MpEngineFactory(); + static MpEngineFactory * instance(); + static MpEngine * sharedEngine(); + +private: + Q_DISABLE_COPY( MpEngineFactory ) + + MpEngine *mSharedEngine; + +}; + + +#endif // MPENGINEFACTORY_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpequalizerwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpequalizerwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Equalizer dialog widget stub. +* +*/ + +#ifndef MPEQUALIZERWIDGET_H +#define MPEQUALIZERWIDGET_H + +//includes +#include + +//forward declartions +class HbRadioButtonList; +class MpEngine; + +//class declaration +class MpEqualizerWidget : public HbDialog +{ + + Q_OBJECT + +public: + explicit MpEqualizerWidget(); + virtual ~MpEqualizerWidget(); + +public: + void initialize(); + void prepareDialog(); + void show(); + void close(); + +public slots: + void presetSelected(int index); + void cancelSelected(bool checked); + void okSelected(bool checked); + +private: // functions + QString getLocalizedString( QString name ); +public: + int showEqualizerWidgetCount; + int closeEqualizerWidgetCount; +private: + + MpEngine *mMpEngine; // Own + + Q_DISABLE_COPY(MpEqualizerWidget) + +}; + +#endif //MPEQUALIZERWIDGET_H + +//End of File diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpplaybackdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpplaybackdata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mpplaybackdata stub for testing mpplaybackview +* +*/ + +#ifndef MPPLAYBACKDATA_H +#define MPPLAYBACKDATA_H + +//includes +#include +#include + + +class MpPlaybackData : public QObject +{ + Q_OBJECT + +public: + +const QString& uri() const; + + + + enum SimplifiedState { + NotPlaying, + Playing, + Paused, + Stopped + }; + // Test utility functions + static int getUpdateCounter(); + static void resetUpdateCounter(); + void triggerStateUpdate(SimplifiedState state); + void triggerLabelsChanged(const QString &title, const QString &artist); + void setPlaybackState(MpPlaybackData::SimplifiedState state); + void setUri( QString uri ); + + // Stub functions + explicit MpPlaybackData(); + virtual ~MpPlaybackData(); + + +signals: + void playbackStateChanged(); + void playbackInfoChanged(); + +public: + const QString& title() const; + const QString& artist() const; + MpPlaybackData::SimplifiedState playbackState() const; + +public: + QString mArtist; + QString mTitle; + SimplifiedState mPlaybackState; + QString mUri; + +}; + +#endif // MPPLAYBACKDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpplaybackwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpplaybackwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Playback widget for Music Player playback view. +* +*/ + +#ifndef MPPLAYBACKWIDGET_H +#define MPPLAYBACKWIDGET_H + +#include + +class MpPlaybackData; +class HbStackedLayout; +class QString; +class HbTextItem; +class HbProgressSlider; +class HbLabel; +class MpPlaybackDocumentLoader; +class MpAlbumCoverWidget; + +class MpPlaybackWidget : public HbWidget +{ + Q_OBJECT + +public: + + MpPlaybackWidget( MpPlaybackData *data, QGraphicsItem *parent=0 ); + virtual ~MpPlaybackWidget(); + void repeatChanged( bool); + +signals: + + void setPlaybackPosition( int value ); + +private: + + MpPlaybackData *mPlaybackData; // Not own + MpPlaybackDocumentLoader *mDocumentLoader; // Own + + HbStackedLayout *mLayout; // Not own + HbLabel *mSongTitle; // Not own + HbLabel *mArtistName; // Not own + HbLabel *mAlbumName; // Not own + MpAlbumCoverWidget *mAlbumArt; // Not own + HbProgressSlider *mProgressBar; // Not own + HbLabel *mRealAudioIndicator; // Not own + HbLabel *mRepeatIndicator; // Not own + bool mProgreesBarDragging; + int mDuration; + + Q_DISABLE_COPY(MpPlaybackWidget) +}; + +#endif // MPPLAYBACKWIDGET_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpsettingsmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpsettingsmanager.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpSettingsManager stub for testing MpMtpInfoLink. +* +*/ + +#ifndef MPSETTINGSMANAGER_H +#define MPSETTINGSMANAGER_H + +#include +#include + +class MpSettingsManager: public QObject +{ + +Q_OBJECT + +private: + explicit MpSettingsManager(); + +public: + virtual ~MpSettingsManager(); + static MpSettingsManager *instance(); + static bool shuffle(); + static bool repeat(); + +public slots: + static void setShuffle(bool shuffle); + static void setRepeat(bool repeat); + +signals: + void shuffleChanged(bool shuffle); + void repeatChanged(bool repeat); + +public: + bool mShuffle; + bool mRepeat; + +private: + Q_DISABLE_COPY(MpSettingsManager) +}; + +#endif // MPSETTINGSMANAGER_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpviewbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/inc/mpviewbase.h Fri Aug 06 16:51:36 2010 -0500 @@ -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: Base class for all Music Player views. +* +*/ + +#ifndef MPVIEWBASE_H +#define MPVIEWBASE_H + +#include +#include +#include "mpcommondefs.h" + +class MpViewBase : public HbView +{ + Q_OBJECT + +public: + + void setViewMode(MpCommon::MpViewMode viewMode) { mViewMode = viewMode; } + MpCommon::MpViewMode viewMode() { return mViewMode; } + virtual void setDefaultView() { } + +signals: + + void songSelected( QString songPath ); + +protected: + + MpViewBase() : mViewMode(MpCommon::DefaultView) {} + +public: + + MpCommon::MpViewMode mViewMode; + +}; + +#endif // MPVIEWBASE_H + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpengine.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub for MpEngine +* +*/ + +#include "mpengine.h" +#include "stub\inc\mpplaybackdata.h" +#include "mptrace.h" + + +/*! + Stub + */ +MpEngine::MpEngine() +{ + TX_LOG_ARGS("Stub") +} + +/*! + Stub + */ +MpEngine::~MpEngine() +{ + TX_ENTRY_ARGS("Stub") +} + + +/*! + Stub + */ +void MpEngine::applyPreset( int preset ) +{ + mApplyPresetCount++; + mActivePreset = preset; +} + +/*! + Stub + */ +void MpEngine::disableEqualizer() +{ + mDisableEquqlizerCount++; + mActivePreset = -1; +} + +/*! + Stub + */ +int MpEngine::activePreset() +{ + return mActivePreset; +} + +/*! + Stub + */ +QStringList MpEngine::presetNames() +{ + QStringList presets; + presets << "Bass Booster" << "Classic" << "Jazz" << "Pop" << "Rock" << "New Preset"; + return presets; +} + + +/*! + Stub + */ +MpPlaybackData *MpEngine::playbackData() +{ + return new MpPlaybackData(); +} + +/*! + Stub + */ +void MpEngine::stop() +{ + stopCount++; +} + +/*! + Stub + */ +void MpEngine::retrieveSongDetails() +{ + retrieveSongDetailsCount++; +} + +/*! + Stub + */ +void MpEngine::setShuffle( bool mode ) +{ + Q_UNUSED(mode) +} +/*! + Stub + */ +void MpEngine::setRepeat( bool mode ) +{ + Q_UNUSED(mode) +} + +/*! + Stub + */ +void MpEngine::startSeekBackward() +{ + startSeekBackwardCount++; +} + +/*! + Stub + */ +void MpEngine::startSeekForward() +{ + startSeekForwardCount++; +} + +/*! + Stub + */ +void MpEngine::stopSeeking() +{ + stopSeekingCount++; +} + +/*! + Stub + */ +void MpEngine::skipBackward() +{ + skipBackwardCount++; +} + +/*! + Stub + */ +void MpEngine::skipForward() +{ + skipForwardCount++; +} + +/*! + Stub + */ +void MpEngine::playPause() +{ + +} + +/*! + Stub + */ +void MpEngine::setPosition(int position) +{ + Q_UNUSED(position) +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpenginefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpenginefactory.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub for testing mpplaybackview +* +*/ + + +#include "stub/inc/mpenginefactory.h" +#include "stub/inc/mpplaybackdata.h" +#include "stub/inc/mpengine.h" + + + +/*! + * Stub function + */ + +/*! + * Stub function + */ +MpEngineFactory::MpEngineFactory() + : mSharedEngine( 0 ) +{ +} + +/*! + * Stub function + */ +MpEngineFactory::~MpEngineFactory() +{ +} + +/*! + * Stub function + */ +MpEngineFactory * MpEngineFactory::instance() +{ + static MpEngineFactory instance; + return &instance; +} + +/*! + * Stub function + */ +MpEngine *MpEngineFactory::sharedEngine() +{ + if ( !instance()->mSharedEngine ) { + instance()->mSharedEngine = new MpEngine(); + } + return instance()->mSharedEngine; +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpequalizerwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpequalizerwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Equalizer widget stub for Music Player playback view. +* +*/ + +// System includes +#include +#include + +// User includes +#include "..\inc\mpequalizerwidget.h" +#include "..\inc\mpenginefactory.h" +#include "..\inc\mpengine.h" +#include "mptrace.h" + + +/*! + Constructs the Equalizer widget. + */ +MpEqualizerWidget::MpEqualizerWidget() : + mMpEngine(0) +{ + TX_ENTRY + initialize(); + TX_EXIT +} + +/*! + Destructs the widget. + */ +MpEqualizerWidget::~MpEqualizerWidget() +{ + TX_LOG +} + +/*! + Stub + */ +void MpEqualizerWidget::initialize() +{ + mMpEngine = MpEngineFactory::sharedEngine(); +} + +/*! + Stub + */ +void MpEqualizerWidget::prepareDialog() +{ +} + +/*! + Stub + */ +void MpEqualizerWidget::presetSelected(int index) +{ + Q_UNUSED(index) +} + +/*! +Stub + */ +void MpEqualizerWidget::cancelSelected(bool checked) +{ + TX_ENTRY + Q_UNUSED(checked); +} + +/*! +Stub + */ +void MpEqualizerWidget::okSelected(bool checked) +{ + Q_UNUSED(checked); +} + +/*! +Stub + */ +void MpEqualizerWidget::show() +{ + showEqualizerWidgetCount++; +} + +/*! +Stub + */ +void MpEqualizerWidget::close() +{ + closeEqualizerWidgetCount++; +} + +/*! + Return the localized string base on preset name. + */ +QString MpEqualizerWidget::getLocalizedString( QString name ) +{ + Q_UNUSED(name) + return QString(); +} + +//End of File diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpplaybackdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpplaybackdata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpPlaybackData stub for testing mpnowplayingwidget +* +*/ + +#include "../inc/mpplaybackdata.h" + + +int gUpdateCounter = 0; + + +/*! + Returns gUpdateCounter. + gUpdateCounter counts the number of MpNowPlayingBackEnd::update calls. + */ +int MpPlaybackData::getUpdateCounter() +{ + return gUpdateCounter; +} + +/*! + Resets gUpdateCounter to zero. + */ +void MpPlaybackData::resetUpdateCounter() +{ + gUpdateCounter = 0; +} + +/*! + Causes signal stateUpdate to be emitted. + */ +void MpPlaybackData::triggerStateUpdate(SimplifiedState state) +{ + mPlaybackState = state; + emit playbackStateChanged(); + +} + +/*! + Causes signal titleChanged to be emitted. + */ +void MpPlaybackData::triggerLabelsChanged(const QString &title, const QString &artist ) +{ + mArtist = artist; + mTitle = title; + emit playbackInfoChanged();; +} + +/*! + Stub function. + */ +MpPlaybackData::MpPlaybackData() + : mPlaybackState(NotPlaying) +{ + gUpdateCounter++; +} + +/*! + Stub function. + */ +MpPlaybackData::~MpPlaybackData() +{ +} + +/*! + Stub function. + */ +const QString& MpPlaybackData::title() const +{ + return mTitle; +} + +/*! + Stub function. + */ +const QString& MpPlaybackData::artist() const +{ + return mArtist; +} + +/*! + Stub function. + */ + +MpPlaybackData::SimplifiedState MpPlaybackData::playbackState() const +{ + return mPlaybackState; +} + +const QString& MpPlaybackData::uri() const +{ + return mUri; +} + +void MpPlaybackData::setPlaybackState(MpPlaybackData::SimplifiedState state) +{ + mPlaybackState=state; +} + +void MpPlaybackData::setUri(QString uri) +{ + mUri = uri; +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpplaybackwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpplaybackwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Playback widget stub for Music Player playback view. +* +*/ + +#include + +#include +#include +#include +#include +#include + +#include "..\inc\mpplaybackwidget.h" +#include "mpplaybackdata.h" +#include "mpalbumcoverwidget.h" +#include "mpplaybackdocumentloader.h" +#include "mptrace.h" + + + + +/*! + Constructs the collection view plugin. + */ +MpPlaybackWidget::MpPlaybackWidget(MpPlaybackData *data, QGraphicsItem *parent ) + : HbWidget(parent), + mPlaybackData(data), + mDocumentLoader(0), + mProgreesBarDragging(false), + mDuration(0) +{ +} + +/*! + Constructs the collection view plugin. + */ +MpPlaybackWidget::~MpPlaybackWidget() +{ + +} + +/*! + Handle Repeat changed. + */ +void MpPlaybackWidget::repeatChanged( bool ) +{ +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpsettingsmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpsettingsmanager.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpSettingsManager stub for testing mpplaybackview. +* +*/ + +#include "../inc/mpsettingsmanager.h" + + +/*! + Constructs the MP Settings Manager. + */ +MpSettingsManager::MpSettingsManager() : + mShuffle(true), + mRepeat(true) +{ +} + +/*! + Destructs the settings manager. + */ +MpSettingsManager::~MpSettingsManager() +{ +} + +/*! + Returns the singleton instance to the settings manager. + */ +MpSettingsManager * MpSettingsManager::instance() +{ + static MpSettingsManager instance; + return &instance; +} + +/*! + Stub function. + */ +void MpSettingsManager::setShuffle( bool shuffle ) +{ + instance()->mShuffle = shuffle; +} +/*! + Stub function. + */ +void MpSettingsManager::setRepeat( bool repeat ) +{ + instance()->mRepeat = repeat; +} + +/*! + Stub function. + */ +bool MpSettingsManager::shuffle() +{ + return instance()->mShuffle; +} + +/*! + Stub function. + */ +bool MpSettingsManager::repeat() +{ + return instance()->mRepeat; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/unittest_mpplaybackview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/unittest_mpplaybackview.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,52 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# Initial Contributors: +# Nokia Corporation - initial contribution. +# Contributors: +# Description: mpplaybackview unit test project file. + +TEMPLATE = app + +CONFIG += qtestlib \ + hb \ + symbian_test + +TARGET = unittest_mpplaybackview +TARGET.CAPABILITY = CAP_APPLICATION +DEPENDPATH += . + + +INCLUDEPATH += . \ + stub/inc \ + ../../inc \ + ../../../../inc + +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lestor.dll \ + -lfbscli.dll + + + +HEADERS += inc/unittest_mpplaybackview.h \ + ../../inc/mpplaybackview.h \ + ../../../../inc/mpviewbase.h \ + stub\inc\mpengine.h \ + stub\inc\mpenginefactory.h \ + stub\inc\mpplaybackwidget.h \ + stub\inc\mpequalizerwidget.h \ + stub\inc\mpsettingsmanager.h \ + stub\inc\mpplaybackdata.h + + +SOURCES += src/unittest_mpplaybackview.cpp \ + stub\src\mpengine.cpp \ + stub\src\mpenginefactory.cpp \ + stub\src\mpplaybackwidget.cpp \ + stub\src\mpequalizerwidget.cpp \ + stub\src\mpsettingsmanager.cpp \ + stub\src\mpplaybackdata.cpp diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/inc/unittest_mpplaybackwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/inc/unittest_mpplaybackwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpPlaybackWidget +* +*/ + +#ifndef TESTMPPLAYBACKWIDGET_H +#define TESTMPPLAYBACKWIDGET_H + +#include + +class MpPlaybackWidget; + +class TestMpPlaybackWidget : public QObject +{ + Q_OBJECT + +public: + + TestMpPlaybackWidget(); + virtual ~TestMpPlaybackWidget(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void testRepeatChanged(); + void testPlaybackInfoChanged(); + void testDurationChanged(); + void testPositionChanged(); + void testAlbumArtChanged(); + +private: + MpPlaybackWidget *mTest; + +}; + +#endif // TESTMPPLAYBACKWIDGET_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/src/unittest_mpplaybackwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/src/unittest_mpplaybackwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for MpPlaybackWidget +* +*/ +#include +#include +#include "unittest_mpplaybackwidget.h" +#include "mpplaybackdata.h" +#include "mpalbumcoverwidget.h" +#include +#include + +/* + * formatDuration() cannot be tested as it is private slot + */ + +// Do this so we can access all member variables. +#define private public +#include "mpplaybackwidget.h" +#undef private + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + TestMpPlaybackWidget tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpplaybackwidget.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpPlaybackWidget::TestMpPlaybackWidget() + : mTest(0) +{ +} + +TestMpPlaybackWidget::~TestMpPlaybackWidget() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpPlaybackWidget::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpPlaybackWidget::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpPlaybackWidget::init() +{ + mTest = new MpPlaybackWidget( new MpPlaybackData() ); +} + +/*! + Called after every testfunction. + */ +void TestMpPlaybackWidget::cleanup() +{ + delete mTest; + mTest = 0; +} + +/*! + test repeatChanged + */ +void TestMpPlaybackWidget::testRepeatChanged() +{ + mTest->repeatChanged( true ); + QVERIFY( mTest->mRepeatIndicator->isVisible() == true ); + + mTest->repeatChanged( false ); + QVERIFY( mTest->mRepeatIndicator->isVisible() == false ); +} + +/*! + test playbackInfoChanged + */ +void TestMpPlaybackWidget::testPlaybackInfoChanged() +{ + QSignalSpy spy( mTest, SIGNAL( signalPlaybackInfoChanged() ) ); + mTest->playbackInfoChanged(); + + QVERIFY( mTest->mSongTitle->plainText() == "title" ); + QVERIFY( mTest->mArtistName->plainText() == "artist" ); + QVERIFY( mTest->mAlbumName->plainText() == "album" ); + QVERIFY( mTest->mRealAudioIndicator->isVisible() == false ); + QVERIFY( spy.count() == 1 ); + spy.clear(); +} + +/*! + test durationChanged + */ +void TestMpPlaybackWidget::testDurationChanged() +{ + mTest->durationChanged(); + + QVERIFY( mTest->mProgressBar->maximum() == 20 ); + QVERIFY( mTest->mProgressBar->progressValue() == 0 ); + QVERIFY( mTest->mProgressBar->sliderValue() == 0 ); + QVERIFY( mTest->mProgressBar->isEnabled() == true ); +} + +/*! + test positionChanged + */ +void TestMpPlaybackWidget::testPositionChanged() +{ + mTest->positionChanged(); + mTest->mProgreesBarDragging = false; + + QVERIFY( mTest->mProgressBar->progressValue() == 10 ); + QVERIFY( mTest->mProgressBar->sliderValue() == 10 ); + // formatDuration is tested seperately +} + +/*! + test albumArtChanged + */ +void TestMpPlaybackWidget::testAlbumArtChanged() +{ + mTest->albumArtChanged(); + + QVERIFY( mTest->mAlbumArt->mIcon == mTest->mPlaybackData->mAlbumArt ); + QVERIFY( mTest->mAlbumArt->isEnabled() == true ); +} + + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpalbumcoverwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpalbumcoverwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Album Cover Widget for Music Player Media Wall. +* +*/ +#ifndef MPALBUMCOVERWIDGET_H +#define MPALBUMCOVERWIDGET_H + +#include +#include + +#include +#include + +class MpAlbumCoverWidget : public HbWidget + +{ + Q_OBJECT + +public: + + MpAlbumCoverWidget( QGraphicsItem *parent = 0 ); + virtual ~MpAlbumCoverWidget(); + void setIcon(const HbIcon &icon ); + void setDefaultIcon( const HbIcon &icon ); + +public: + + HbIcon mIcon; + HbIcon mDefaultIcon; + QPixmap mPixmap; +}; + + +#endif //MPALBUMCOVERWIDGET_H + +// EOF diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpplaybackdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpplaybackdata.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Playback Data provider for playback view. +* +*/ + +#ifndef MPPLAYBACKDATA_H +#define MPPLAYBACKDATA_H + +#include +#include +#include + +#include + +//forward declartions + +class MpPlaybackData : public QObject +{ + Q_OBJECT + +public: + + enum SimplifiedState { + NotPlaying, + Playing, + Paused, + Stopped + }; + + explicit MpPlaybackData( QObject *parent=0 ); + virtual ~MpPlaybackData(); + + int duration() const; + int position() const; + + const QString& title() const; + const QString& artist() const; + const QString& album() const; + const QString& uri() const; + void albumArt( HbIcon& icon ) const; + int albumId(); + bool setId( int id ); + int id(); + bool realAudio(); + MpPlaybackData::SimplifiedState playbackState() const; + + void commitPlaybackInfo(); + void resetData(); + +signals: + + void durationChanged(); + void positionChanged(); + void albumArtReady(); + void playbackStateChanged(); + void playbackInfoChanged(); + +public: + + int mReqId; + + int mDuration; + int mPosition; + QString mTitle; + QString mAlbum; + QString mArtist; + QString mUri; + int mAlbumId; + int mId; + HbIcon mAlbumArt; + SimplifiedState mPlaybackState; + bool mRealAudio; +}; + +#endif // MPPLAYBACKDATA_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpplaybackdocumentloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpplaybackdocumentloader.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub for Music Player playback view custom document loader. +* +*/ + +#ifndef MPPLAYBACKDOCUMENTLOADER_H +#define MPPLAYBACKDOCUMENTLOADER_H + + +#include + + +class MpPlaybackDocumentLoader : public HbDocumentLoader +{ +public: + virtual QObject *createObject(const QString& type, const QString &name); +}; + +#endif // MPPLAYBACKDOCUMENTLOADER_H + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mpalbumcoverwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mpalbumcoverwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Album Cover Widget. +* +*/ +#include +#include + + +#include "mpalbumcoverwidget.h" + + +/*! + Constructs the album cover widget + */ +MpAlbumCoverWidget::MpAlbumCoverWidget( QGraphicsItem *parent ) : + HbWidget( parent ) +{ + setFlag( QGraphicsItem::ItemHasNoContents, false ); + grabGesture(Qt::TapGesture); +} + +/*! + Destructs the album cover widget. + */ +MpAlbumCoverWidget::~MpAlbumCoverWidget() +{ +} + +/*! + Sets the \a icon as current album cover. + */ +void MpAlbumCoverWidget::setIcon( const HbIcon &icon ) +{ + if (icon != mIcon) { + mIcon = icon; + mPixmap = QPixmap(); + update(); + } +} + +/*! + Sets the \a icon as default cover, to be used in case the album cover is null icon. + */ +void MpAlbumCoverWidget::setDefaultIcon( const HbIcon &icon ) +{ + mDefaultIcon = icon; + update(); +} + +//EOF diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mpplaybackdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mpplaybackdata.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Playback Data provider for playback view. +* +*/ + +#include +#include +#include +#include +#include + +#include "mpplaybackdata.h" +#include "mptrace.h" + +const int KUndefined = -1; + + +/*! + Constructs a new MpPlaybackData. + */ +MpPlaybackData::MpPlaybackData( QObject *parent ) + : QObject( parent ), + mReqId( KUndefined ), + mDuration(20000), + mPosition(10000), + mTitle( QString( "title" ) ), + mAlbum( QString( "album" ) ), + mArtist( QString( "artist" ) ), + mAlbumId(0), + mId(0), + mAlbumArt( "qtg_large_music_album" ), + mPlaybackState( NotPlaying ), + mRealAudio( false ) +{ + TX_ENTRY + + TX_EXIT +} + +/*! + Constructs a new MpPlaybackData. + */ +MpPlaybackData::~MpPlaybackData() +{ + TX_ENTRY + TX_EXIT +} + + + +/*! + Returns the song duration. +*/ +int MpPlaybackData::duration() const +{ + TX_LOG_ARGS( "mDuration = " << mDuration ) + return mDuration; +} + + +/*! + Returns the song position. +*/ +int MpPlaybackData::position() const +{ + TX_ENTRY_ARGS( "mPosition = " << mPosition ) + return mPosition; +} + +/*! + Returns the song title. +*/ +const QString& MpPlaybackData::title() const +{ + TX_ENTRY_ARGS( "mTitle = " << mTitle ) + return mTitle; +} + + + +/*! + Returns the song artist. +*/ +const QString& MpPlaybackData::artist() const +{ + TX_ENTRY_ARGS( "mArtist = " << mArtist ) + return mArtist; +} + + + +/*! + Returns the song album. +*/ +const QString& MpPlaybackData::album() const +{ + TX_ENTRY_ARGS( "mAlbum = " << mAlbum ) + return mAlbum; +} + + +/*! + Returns the song uri. +*/ +const QString& MpPlaybackData::uri() const +{ + TX_ENTRY_ARGS( "mUri = " << mUri ) + return mUri; +} + + +/*! + Returns the song album art on \a icon. +*/ +void MpPlaybackData::albumArt( HbIcon& icon ) const +{ + TX_ENTRY + icon = mAlbumArt ; + TX_EXIT +} + + +/*! + Returns the id of the album to which the song belongs. +*/ +int MpPlaybackData::albumId() +{ + return mAlbumId; +} + + + +/*! + Returns the id the song. +*/ +int MpPlaybackData::id() +{ + return mId; +} + + +/*! + Returns the mode of Real Audio. +*/ +bool MpPlaybackData::realAudio() +{ + return mRealAudio; +} + + + +/*! + Returns the playback state. +*/ +MpPlaybackData::SimplifiedState MpPlaybackData::playbackState() const +{ + TX_LOG_ARGS( "mPlaybackState = " << mPlaybackState ) + return mPlaybackState; +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mpplaybackdocumentloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mpplaybackdocumentloader.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player Playback view custom document loader. +* +*/ + + +#include "mpplaybackdocumentloader.h" +#include "mpalbumcoverwidget.h" +#include "mptrace.h" + + +/*! + \class MpPlaybackDocumentLoader + \brief Music Player playback view custom document loader. + + Playback view document loader extends Orbit document loader to enable + loading of custom widgets. +*/ + +/*! + Creates and returns the object of the given \a type. + + \reimp + */ +QObject *MpPlaybackDocumentLoader::createObject(const QString& type, const QString &name) +{ + TX_ENTRY_ARGS("type=" << type << ", name=" << name); + + if ( type == MpAlbumCoverWidget::staticMetaObject.className() ) { + QObject *object = new MpAlbumCoverWidget(); + object->setObjectName(name); + TX_EXIT + return object; + } + + TX_EXIT + return HbDocumentLoader::createObject(type, name); +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/unittest_mpplaybackwidget.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/unittest_mpplaybackwidget.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,44 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpplaybackwidget unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpplaybackwidget +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + stub/inc \ + ../../inc \ + ../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lmpxviewframeworkqt.dll + +HEADERS += inc/unittest_mpplaybackwidget.h \ + stub/inc/mpplaybackdata.h \ + stub/inc/mpalbumcoverwidget.h \ + stub/inc/mpplaybackdocumentloader.h \ + ../../inc/mpplaybackwidget.h + + +SOURCES += src/unittest_mpplaybackwidget.cpp \ + stub/src/mpplaybackdata.cpp \ + stub/src/mpalbumcoverwidget.cpp \ + stub/src/mpplaybackdocumentloader.cpp \ + ../../src/mpplaybackwidget.cpp + +RESOURCES += ../../resources/mpplaybackviewpluginresources.qrc \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/mpsettingsviewplugin.pro --- a/mpviewplugins/mpsettingsviewplugin/mpsettingsviewplugin.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/mpsettingsviewplugin.pro Fri Aug 06 16:51:36 2010 -0500 @@ -50,3 +50,4 @@ RESOURCES += resources/mpsettingsview.qrc +DOCML += resources/settingsview.docml diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/resources/mpsettingsview.qrc --- a/mpviewplugins/mpsettingsviewplugin/resources/mpsettingsview.qrc Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/resources/mpsettingsview.qrc Fri Aug 06 16:51:36 2010 -0500 @@ -2,7 +2,7 @@ - settingsview.docml + settingsview.docml.bin
    diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/tsrc.pro --- a/mpviewplugins/mpsettingsviewplugin/tsrc/tsrc.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -17,7 +17,8 @@ TEMPLATE = subdirs SUBDIRS += unittest_mpsettingsviewplugin \ - unittest_mpsettingsaudioeffectswidget - + unittest_mpsettingsaudioeffectswidget \ + unittest_mpsettingsview + CONFIG += ordered diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/inc/unittest_mpsettingsaudioeffectswidget.h --- a/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/inc/unittest_mpsettingsaudioeffectswidget.h Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/inc/unittest_mpsettingsaudioeffectswidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -15,8 +15,8 @@ * */ -#ifndef TestMpSettingsAudioEffectsWidget_H -#define TestMpSettingsAudioEffectsWidget_H +#ifndef TESTMPSETTINGSAUDIOEFFECTSWIDGET_H +#define TESTMPSETTINGSAUDIOEFFECTSWIDGET_H #include @@ -53,7 +53,7 @@ }; -#endif // MpSettingsAudioEffectsWidget_H +#endif // TESTMPSETTINGSAUDIOEFFECTSWIDGET_H diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/src/unittest_mpsettingsaudioeffectswidget.cpp --- a/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/src/unittest_mpsettingsaudioeffectswidget.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/src/unittest_mpsettingsaudioeffectswidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -29,11 +29,6 @@ #include "MpSettingsAudioEffectsWidget.h" #undef private -//This so we can test private functions -//#include "../../src/mpsettingsaudioeffectswidget.cpp" - - - /*! Make our test case a stand-alone executable that runs all the test functions. */ @@ -110,10 +105,11 @@ } /*! - Tests constructor. + Tests InitializeSlider. */ void TestMpSettingsAudioEffectsWidget::testInitializeSlider() { + //test slider widget is set up correctly in initialize() mTest->initialize(); QVERIFY(mTest->mMpEngine != 0 ); @@ -122,7 +118,6 @@ QCOMPARE(mTest->mModel->rowCount(),2 ); QCOMPARE(mTest->mModel->columnCount(),1 ); - QCOMPARE( mTest->mModel->item( 0 )->type(), HbDataFormModelItem::SliderItem ); QCOMPARE( mTest->mModel->item( 1 )->type(), HbDataFormModelItem::ToggleValueItem ); @@ -140,8 +135,12 @@ } +/*! + Tests InitializeLoudnessOff. + */ void TestMpSettingsAudioEffectsWidget::testInitializeLoudnessOff() { + //test loudness HbDataFormModelItem is set up correctly in initialize() MpEngineFactory::sharedEngine()->setLoudness( false ); mTest->initialize(); QVERIFY( mTest->mModel->item( 1 )->type() == HbDataFormModelItem::ToggleValueItem ); @@ -149,8 +148,12 @@ QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("additionalText"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_on" )) ); } +/*! + Tests InitializeLoudnessOn. + */ void TestMpSettingsAudioEffectsWidget::testInitializeLoudnessOn() { + //test loudness HbDataFormModelItem is set up correctly in initialize() MpEngineFactory::sharedEngine()->setLoudness( true ); mTest->initialize(); QVERIFY( mTest->mModel->item( 1 )->type() == HbDataFormModelItem::ToggleValueItem ); @@ -159,17 +162,21 @@ } - +/*! + Tests FilterSignals. + */ void TestMpSettingsAudioEffectsWidget::testFilterSignals() -{ +{ + //filtersignals should not change loudness value MpEngineFactory::sharedEngine()->setLoudness( false ); - mTest->initialize(); - QCOMPARE(MpEngineFactory::sharedEngine()->loudness(), false); + mTest->initialize(); QModelIndex index1 = mTest->mModel->indexFromItem((mTest->mModel->item(1))); mTest->filterSignals(index1,index1); - QCOMPARE(MpEngineFactory::sharedEngine()->loudness(), true); + QCOMPARE(MpEngineFactory::sharedEngine()->loudness(), false); + } + // End of file diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/stub/src/mpengine.cpp --- a/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/stub/src/mpengine.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/stub/src/mpengine.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Wrapper for mpx framework utilities. +* Description: Stub for MpEngine for testing mpsettingsaudioeffecswidget * */ @@ -19,6 +19,9 @@ #include "mptrace.h" +/*! + Stub + */ MpEngine::MpEngine() : mBalance(0), mLoudness(0) @@ -27,7 +30,7 @@ } /*! - Destructs music player engine. + Stub */ MpEngine::~MpEngine() { @@ -36,7 +39,7 @@ // Audio Effects related /*! - Destructs music player engine. + Stub */ int MpEngine::balance() { @@ -44,7 +47,7 @@ } /*! - Destructs music player engine. +Stub */ bool MpEngine::loudness() { @@ -52,9 +55,8 @@ } -//slots: /*! - Destructs music player engine. +Stub */ void MpEngine::setBalance( int balance ) { @@ -62,7 +64,7 @@ } /*! - Destructs music player engine. +Stub */ void MpEngine::setLoudness( bool mode ) { diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/stub/src/mpenginefactory.cpp --- a/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/stub/src/mpenginefactory.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/stub/src/mpenginefactory.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: mp engine factory. +* Description: mp engine factory stub for testing mpsettingsaudioeffectswidget * */ @@ -20,10 +20,7 @@ #include "mptrace.h" /*! - \class MpEngineFactory - \brief Music Player engine factory. - - MP Engine factory is responsible to create and mantain ownership of MP engines. +Stub */ /*! diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/unittest_mpsettingsaudioeffectswidget.pro --- a/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/unittest_mpsettingsaudioeffectswidget.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsaudioeffectswidget/unittest_mpsettingsaudioeffectswidget.pro Fri Aug 06 16:51:36 2010 -0500 @@ -28,8 +28,6 @@ LIBS += -lestor.dll \ -lfbscli.dll -symbian: TARGET.EPOCALLOWDLLDATA = 1 - HEADERS += stub/inc/mpengine.h \ stub/inc/mpenginefactory.h \ inc/unittest_mpsettingsaudioeffectswidget.h \ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/inc/unittest_mpsettingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/inc/unittest_mpsettingsview.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit Test for mpsettingsview +* +*/ + +#ifndef UNITTEST_MPSETTINGSVIEW_H_ +#define UNITTEST_MPSETTINGSVIEW_H_ + +#include +#include + +//Forward Declaration +class MpSettingsView; + +class TestMpSettingsView : public QObject +{ + Q_OBJECT + +public: + + TestMpSettingsView(); + virtual ~TestMpSettingsView(); + + +signals: + void back (); + void albumArtChanged(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + + void testInitializeView(); + + void testActivateView(); + void testDeactivateView(); + void testBack(); + +private: + MpSettingsView *mTest; + +}; + +#endif /* UNITTEST_MPSETTINGSVIEW_H_ */ diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/src/unittest_mpsettingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/src/unittest_mpsettingsview.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit Test for mpsettingsview. +* +*/ + +#include +#include +#include + +#include "unittest_mpsettingsview.h" + +// Do this so we can access all member variables. +#define private public +#include "mpsettingsview.h" +#undef private + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + HbMainWindow window; + + TestMpSettingsView tv; + +if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpsettingsview.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +//Constructor +TestMpSettingsView::TestMpSettingsView() + : mTest(0) +{ + +} + +//Destructor +TestMpSettingsView::~TestMpSettingsView() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpSettingsView::initTestCase() +{ + +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpSettingsView::cleanupTestCase() +{ +QCoreApplication::processEvents(); +} + +/*! + Called before each testfunction is executed. + */ +void TestMpSettingsView::init() +{ + mTest = new MpSettingsView(); +} + +/*! + Called after every testfunction. + */ +void TestMpSettingsView::cleanup() +{ + delete mTest; + mTest = 0; +} + +/*! + Called before each testfunction is executed. + */ +void TestMpSettingsView::testInitializeView() +{ + //test widget initialization + QVERIFY(mTest->mAudioEffectsWidget == 0); + QVERIFY(mTest->mSoftKeyBack == 0); + QVERIFY(mTest->mWindow == 0); + + mTest->initializeView(); + QVERIFY(mTest->mAudioEffectsWidget != 0); + QVERIFY(mTest->mSoftKeyBack != 0); + +} + +/*! + Test ActivateView +*/ +void TestMpSettingsView::testActivateView() +{ + //test navigation action is set + mTest->initializeView(); + mTest->activateView(); + QCOMPARE(mTest->navigationAction(), mTest->mSoftKeyBack ); + +} + +/*! +test DecativateView + */ +void TestMpSettingsView::testDeactivateView() +{ + //test navigation action is set to 0 + mTest->initializeView(); + mTest->activateView(); + mTest->deactivateView(); + QVERIFY(mTest->navigationAction()== 0 ); + mTest->deactivateView(); + + +} +/*! +test Back() + */ +void TestMpSettingsView::testBack() +{ + QSignalSpy spy(mTest, SIGNAL(command(int))); + mTest->back(); + QCOMPARE(spy.count(), 1); + +} + diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/stub/inc/mpsettingsaudioeffectswidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/stub/inc/mpsettingsaudioeffectswidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player Settings view - audio settings -stub. +* +*/ + +#ifndef MPSETTINGSAUDIOEFFECTSWIDGET_H +#define MPSETTINGSAUDIOEFFECTSWIDGET_H + + +// INCLUDES +#include +#include + + +// CLASS DECLARATION +class MpEngine; +class HbSlider; + +/** + * Audio Effects widget definition. + * + */ +class MpSettingsAudioEffectsWidget : public HbWidget + { + Q_OBJECT + +public: + explicit MpSettingsAudioEffectsWidget( QGraphicsItem *parent=0 ); + virtual ~MpSettingsAudioEffectsWidget(); + + void initialize(); + +public slots: + + void filterSignals( QModelIndex startIn, QModelIndex endIn ); + +private: + + }; + +#endif // MPSETTINGSAUDIOEFFECTSWIDGET_H + +// End of File diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/stub/src/mpsettingsaudioeffectswidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/stub/src/mpsettingsaudioeffectswidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub for MpSettingsAudioEffectsWidget. +* +*/ + +// User includes +#include "mpsettingsaudioeffectswidget.h" +#include "mptrace.h" + + +MpSettingsAudioEffectsWidget::MpSettingsAudioEffectsWidget( QGraphicsItem *parent ) + : HbWidget( parent ) +{ + TX_LOG +} + + +MpSettingsAudioEffectsWidget::~MpSettingsAudioEffectsWidget() +{ + + TX_LOG +} + + +void MpSettingsAudioEffectsWidget::initialize() +{ +} + +void MpSettingsAudioEffectsWidget::filterSignals( QModelIndex startIn, QModelIndex endIn ) +{ + Q_UNUSED(startIn); + Q_UNUSED(endIn); +} diff -r 612c4815aebe -r 4cc1412daed0 mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/unittest_mpsettingsview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpsettingsviewplugin/tsrc/unittest_mpsettingsview/unittest_mpsettingsview.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,46 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpsettingsview +TARGET.CAPABILITY = CAP_APPLICATION + + +DEPENDPATH += . +INCLUDEPATH += ./stub/inc \ + ../../inc \ + ../../../../inc + + +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lmpxviewframeworkqt.dll \ + -lmpsettingsmanager.dll + + +# Input +HEADERS += inc/unittest_mpsettingsview.h \ + ../../inc/mpsettingsview.h \ + stub/inc/mpsettingsaudioeffectswidget.h \ + ../../../../inc/mpviewbase.h + + +SOURCES += src/unittest_mpsettingsview.cpp \ + ../../src/mpsettingsview.cpp \ + stub/src/mpsettingsaudioeffectswidget.cpp \ + +RESOURCES += ../../resources/mpsettingsview.qrc diff -r 612c4815aebe -r 4cc1412daed0 musicwidgetplugin/musicwidgetplugin.pro --- a/musicwidgetplugin/musicwidgetplugin.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/musicwidgetplugin/musicwidgetplugin.pro Fri Aug 06 16:51:36 2010 -0500 @@ -57,4 +57,6 @@ DEPLOYMENT += plugins \ widgetResources -} \ No newline at end of file +} + +DOCML += resource/music_widget.docml \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 musicwidgetplugin/resource/music_widget.docml --- a/musicwidgetplugin/resource/music_widget.docml Fri Jul 23 17:31:12 2010 -0500 +++ b/musicwidgetplugin/resource/music_widget.docml Fri Aug 06 16:51:36 2010 -0500 @@ -10,7 +10,7 @@ - + diff -r 612c4815aebe -r 4cc1412daed0 musicwidgetplugin/resource/musicwidgetui.qrc --- a/musicwidgetplugin/resource/musicwidgetui.qrc Fri Jul 23 17:31:12 2010 -0500 +++ b/musicwidgetplugin/resource/musicwidgetui.qrc Fri Aug 06 16:51:36 2010 -0500 @@ -1,6 +1,6 @@ - music_widget.docml + music_widget.docml.bin musicwidgeticon.png diff -r 612c4815aebe -r 4cc1412daed0 musicwidgetplugin/src/musicwidget.cpp --- a/musicwidgetplugin/src/musicwidget.cpp Fri Jul 23 17:31:12 2010 -0500 +++ b/musicwidgetplugin/src/musicwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -56,7 +56,7 @@ const QLatin1String ICON_PLAY ("qtg_mono_play"); const QLatin1String ICON_PAUSE ("qtg_mono_pause"); /** Music Player shortcut icon */ -const QLatin1String ICON_LARGE_MUSIC_PLAYER ("qtg_large_music_player"); +const QLatin1String ICON_LARGE_MUSIC_PLAYER ("qtg_large_music"); /** Music Player shortcut icon */ const QLatin1String ICON_FIRST_TIME_USE ("qtg_large_music_empty"); const QLatin1String ICON_DEFAULT_ART ("qtg_large_album_art"); @@ -664,7 +664,7 @@ TX_ENTRY HbIcon icon; - if ( mMusicPlayerNoSongData ) + if ( mMpPlaybackData->playbackState() == MpPlaybackData::NotPlaying ) { TX_LOG_ARGS("1st time album art") icon = HbIcon(ICON_FIRST_TIME_USE); diff -r 612c4815aebe -r 4cc1412daed0 qtmusicplayer.pro --- a/qtmusicplayer.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/qtmusicplayer.pro Fri Aug 06 16:51:36 2010 -0500 @@ -24,6 +24,7 @@ include(utilities/mpsettingsmanager/rom/rom.pri) include(utilities/mpnowplayingbanner/rom/rom.pri) include(utilities/mpalbumcoverwidget/rom/rom.pri) + include(utilities/mpmediacontroller/rom/rom.pri) include(mpviewplugins/mpcollectionviewplugin/rom/rom.pri) include(mpviewplugins/mpplaybackviewplugin/rom/rom.pri) include(mpviewplugins/mpsettingsviewplugin/rom/rom.pri) diff -r 612c4815aebe -r 4cc1412daed0 sis/musicplayer_stub.pkg --- a/sis/musicplayer_stub.pkg Fri Jul 23 17:31:12 2010 -0500 +++ b/sis/musicplayer_stub.pkg Fri Aug 06 16:51:36 2010 -0500 @@ -36,6 +36,7 @@ ""-"z:\sys\bin\mpnowplayingbanner.dll" ""-"z:\sys\bin\mpsettingsmanager.dll" ""-"z:\sys\bin\mpalbumcoverwidget.dll" +""-"z:\sys\bin\mpmediacontroller.dll" ""-"z:\sys\bin\mpdata.dll" ""-"z:\sys\bin\mpengine.dll" ""-"z:\sys\bin\musicservices.dll" diff -r 612c4815aebe -r 4cc1412daed0 sis/musicplayer_stub.sis Binary file sis/musicplayer_stub.sis has changed diff -r 612c4815aebe -r 4cc1412daed0 sis/musicplayer_udeb.pkg --- a/sis/musicplayer_udeb.pkg Fri Jul 23 17:31:12 2010 -0500 +++ b/sis/musicplayer_udeb.pkg Fri Aug 06 16:51:36 2010 -0500 @@ -245,7 +245,8 @@ ; DLLs "\epoc32\release\armv5\udeb\mpnowplayingbanner.dll" - "!:\sys\bin\mpnowplayingbanner.dll" "\epoc32\release\armv5\udeb\mpsettingsmanager.dll" - "!:\sys\bin\mpsettingsmanager.dll" -"\epoc32\release\armv5\udeb\mpalbumcoverwidget.dll" - "!:\sys\bin\mpalbumcoverwidget.dll" +"\epoc32\release\armv5\udeb\mpalbumcoverwidget.dll" - "!:\sys\bin\mpalbumcoverwidget.dll" +"\epoc32\release\armv5\udeb\mpmediacontroller.dll" - "!:\sys\bin\mpmediacontroller.dll" "\epoc32\release\armv5\udeb\mpdata.dll" - "!:\sys\bin\mpdata.dll" "\epoc32\release\armv5\udeb\mpengine.dll" - "!:\sys\bin\mpengine.dll" "\epoc32\release\armv5\udeb\musicservices.dll" - "!:\sys\bin\musicservices.dll" diff -r 612c4815aebe -r 4cc1412daed0 sis/musicplayer_urel.pkg --- a/sis/musicplayer_urel.pkg Fri Jul 23 17:31:12 2010 -0500 +++ b/sis/musicplayer_urel.pkg Fri Aug 06 16:51:36 2010 -0500 @@ -246,6 +246,7 @@ "\epoc32\release\armv5\urel\mpnowplayingbanner.dll" - "!:\sys\bin\mpnowplayingbanner.dll" "\epoc32\release\armv5\urel\mpsettingsmanager.dll" - "!:\sys\bin\mpsettingsmanager.dll" "\epoc32\release\armv5\urel\mpalbumcoverwidget.dll" - "!:\sys\bin\mpalbumcoverwidget.dll" +"\epoc32\release\armv5\urel\mpmediacontroller.dll" - "!:\sys\bin\mpmediacontroller.dll" "\epoc32\release\armv5\urel\mpdata.dll" - "!:\sys\bin\mpdata.dll" "\epoc32\release\armv5\urel\mpengine.dll" - "!:\sys\bin\mpengine.dll" "\epoc32\release\armv5\urel\musicservices.dll" - "!:\sys\bin\musicservices.dll" diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpalbumcoverwidget/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpalbumcoverwidget/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Music Player mpalbumcoverwidget unit test project file. +# + +TEMPLATE = subdirs + +SUBDIRS += unittest_mpalbumcoverwidget + +CONFIG += ordered + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpalbumcoverwidget/tsrc/unittest_mpalbumcoverwidget/inc/unittest_mpalbumcoverwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpalbumcoverwidget/tsrc/unittest_mpalbumcoverwidget/inc/unittest_mpalbumcoverwidget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpalbumcoverwidget +* +*/ + +#ifndef TESTMPALBUMCOVERWIDGET_H +#define TESTMPALBUMCOVERWIDGET_H + +#include + +class MpAlbumCoverWidget; + +class TestMpAlbumCoverWidget : public QObject +{ + Q_OBJECT + +public: + + TestMpAlbumCoverWidget(); + virtual ~TestMpAlbumCoverWidget(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void testSetIcon(); + void testSetDefaultIcon(); + +private: + + MpAlbumCoverWidget *mTest; +}; + +#endif // TESTMPALBUMCOVERWIDGET_H + + + + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpalbumcoverwidget/tsrc/unittest_mpalbumcoverwidget/src/unittest_mpalbumcoverwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpalbumcoverwidget/tsrc/unittest_mpalbumcoverwidget/src/unittest_mpalbumcoverwidget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpalbumcoverwidget +* +*/ + + +#include + +#include "unittest_mpalbumcoverwidget.h" + +// Do this so we can access all member variables. +#define private public +#include "mpalbumcoverwidget.h" +#undef private + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + TestMpAlbumCoverWidget tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpalbumcoverwidget.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpAlbumCoverWidget::TestMpAlbumCoverWidget() + : mTest(0) +{ +} + +TestMpAlbumCoverWidget::~TestMpAlbumCoverWidget() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpAlbumCoverWidget::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpAlbumCoverWidget::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpAlbumCoverWidget::init() +{ + mTest = new MpAlbumCoverWidget(); +} + +/*! + Called after every testfunction. + */ +void TestMpAlbumCoverWidget::cleanup() +{ + delete mTest; + mTest = 0; +} + +/*! + test setIcon + */ +void TestMpAlbumCoverWidget::testSetIcon() +{ + HbIcon *icon = new HbIcon(); + mTest->setIcon( *icon ); + + QVERIFY( *icon == mTest->mIcon ); + delete icon; +} + +/*! + test setDefaultIcon + */ +void TestMpAlbumCoverWidget::testSetDefaultIcon() +{ + HbIcon *icon = new HbIcon(); + mTest->setDefaultIcon( *icon ); + + QVERIFY( *icon == mTest->mDefaultIcon); + delete icon; +} + + + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpalbumcoverwidget/tsrc/unittest_mpalbumcoverwidget/unittest_mpalbumcoverwidget.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpalbumcoverwidget/tsrc/unittest_mpalbumcoverwidget/unittest_mpalbumcoverwidget.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,39 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpalbumcoverwidget unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib hb symbian_test +TARGET = unittest_mpalbumcoverwidget +TARGET.CAPABILITY = CAP_APPLICATION + +DEPENDPATH += . +INCLUDEPATH += . \ + ../../inc \ + ../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lestor.dll \ + -lfbscli.dll + +HEADERS += inc/unittest_mpalbumcoverwidget.h \ + ../../../../inc/mpalbumcoverwidget.h \ + + +SOURCES += src/unittest_mpalbumcoverwidget.cpp \ + ../../src/mpalbumcoverwidget.cpp \ + +DEFINES += BUILD_MPALBUMCOVERWIDGET + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/bwins/mpmediacontrolleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/bwins/mpmediacontrolleru.def Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,14 @@ +EXPORTS + ?staticMetaObject@MpMediaController@@2UQMetaObject@@B @ 1 NONAME ; struct QMetaObject const MpMediaController::staticMetaObject + ?qt_metacall@MpMediaController@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2 NONAME ; int MpMediaController::qt_metacall(enum QMetaObject::Call, int, void * *) + ??1MpMediaController@@UAE@XZ @ 3 NONAME ; MpMediaController::~MpMediaController(void) + ?tr@MpMediaController@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString MpMediaController::tr(char const *, char const *, int) + ?trUtf8@MpMediaController@@SA?AVQString@@PBD0H@Z @ 5 NONAME ; class QString MpMediaController::trUtf8(char const *, char const *, int) + ?trUtf8@MpMediaController@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString MpMediaController::trUtf8(char const *, char const *) + ??0MpMediaController@@QAE@PAVQObject@@@Z @ 7 NONAME ; MpMediaController::MpMediaController(class QObject *) + ?tr@MpMediaController@@SA?AVQString@@PBD0@Z @ 8 NONAME ; class QString MpMediaController::tr(char const *, char const *) + ?metaObject@MpMediaController@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * MpMediaController::metaObject(void) const + ?getStaticMetaObject@MpMediaController@@SAABUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const & MpMediaController::getStaticMetaObject(void) + ??_EMpMediaController@@UAE@I@Z @ 11 NONAME ; MpMediaController::~MpMediaController(unsigned int) + ?qt_metacast@MpMediaController@@UAEPAXPBD@Z @ 12 NONAME ; void * MpMediaController::qt_metacast(char const *) + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/eabi/mpmediacontrolleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/eabi/mpmediacontrolleru.def Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,14 @@ +EXPORTS + _ZN17MpMediaController11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN17MpMediaController11qt_metacastEPKc @ 2 NONAME + _ZN17MpMediaController16staticMetaObjectE @ 3 NONAME DATA 16 + _ZN17MpMediaController19getStaticMetaObjectEv @ 4 NONAME + _ZN17MpMediaControllerC1EP7QObject @ 5 NONAME + _ZN17MpMediaControllerC2EP7QObject @ 6 NONAME + _ZN17MpMediaControllerD0Ev @ 7 NONAME + _ZN17MpMediaControllerD1Ev @ 8 NONAME + _ZN17MpMediaControllerD2Ev @ 9 NONAME + _ZNK17MpMediaController10metaObjectEv @ 10 NONAME + _ZTI17MpMediaController @ 11 NONAME + _ZTV17MpMediaController @ 12 NONAME + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/inc/mpmediakeyhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/inc/mpmediakeyhandler.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player media key handler. +* +*/ + +#ifndef MPMEDIAKEYHANDLER_H +#define MPMEDIAKEYHANDLER_H + +#include + +class MpMediaKeyHandlerPrivate; + +class MpMediaKeyHandler : public QObject +{ + Q_OBJECT + + friend class MpMediaKeyHandlerPrivate; + +public: + + explicit MpMediaKeyHandler( QObject *parent = 0 ); + virtual ~MpMediaKeyHandler(); + +private: + + Q_DISABLE_COPY(MpMediaKeyHandler) + MpMediaKeyHandlerPrivate *d_ptr; + +}; + +#endif // MPMEDIAKEYHANDLER_H diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/inc/mpmediakeyhandler_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/inc/mpmediakeyhandler_p.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player media key handler - private implementation. +* +*/ + +#ifndef MPMEDIAKEYHANDLER_P_H +#define MPMEDIAKEYHANDLER_P_H + + +#include + +class CRemConInterfaceSelector; +class MpMediaKeyHandler; +class MpMediaKeyRemConResponse; +class MpEngine; + +class MpMediaKeyHandlerPrivate : public MRemConCoreApiTargetObserver +{ +public: + + MpMediaKeyHandlerPrivate( MpMediaKeyHandler *wrapper ); + virtual ~MpMediaKeyHandlerPrivate(); + + void init(); + +// From MRemConCoreApiTargetObserver + + /** + * From MRemConCoreApiTargetObserver + * A command has been received. + * + * @param aOperationId The operation ID of the command. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoCommand( + TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + /** + * From MRemConCoreApiTargetObserver + * A 'play' command has been received. + * + * @param aSpeed The playback speed. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoPlay( + TRemConCoreApiPlaybackSpeed aSpeed, + TRemConCoreApiButtonAction aButtonAct ); + + /** + * From MRemConCoreApiTargetObserver + * A 'tune function' command has been received. + * + * @param aTwoPart Determine which channel to be used. + * @param aMajorChannel The major channel number. + * @param aMinorChannel The minor channel number. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoTuneFunction( + TBool aTwoPart, + TUint aMajorChannel, + TUint aMinorChannel, + TRemConCoreApiButtonAction aButtonAct ); + + /** + * From MRemConCoreApiTargetObserver + * A 'select disk function' has been received. + * + * @param aDisk The disk. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoSelectDiskFunction( + TUint aDisk, + TRemConCoreApiButtonAction aButtonAct ); + + /** + * From MRemConCoreApiTargetObserver + * A 'select AV input function' has been received. + * + * @param aAvInputSignalNumber The AV input. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoSelectAvInputFunction( + TUint8 aAvInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct ); + + /** + * From MRemConCoreApiTargetObserver + * A 'select audio input function' has been received. + * + * @param aAudioInputSignalNumber The audio input. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoSelectAudioInputFunction( + TUint8 aAudioInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct ); + +private: + + void DoInitL(); + +private: + + MpMediaKeyHandler *q_ptr; + + CRemConInterfaceSelector *iInterfaceSelector; // owned + MpMediaKeyRemConResponse *iResponseHandler; // owned + MpEngine *iMpEngine; // not owned + bool iSideKeyAlreadyClicked; +}; + +#endif // MPMEDIAKEYHANDLER_P_H diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/inc/mpmediakeyremconresponse.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/inc/mpmediakeyremconresponse.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player media key handler. +* Helper class for sending response back to Remote Controller Framework. +* +*/ + +#ifndef MPMEDIAKEYREMCONKEYRESPONSE_H +#define MPMEDIAKEYREMCONKEYRESPONSE_H + +#include + + +NONSHARABLE_CLASS( MpMediaKeyRemConResponse ) : public CActive +{ +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @param aRemConCoreApiTarget RemCon core target object. + * @return Pointer to newly created object. + */ + static MpMediaKeyRemConResponse* NewL( CRemConCoreApiTarget& aRemConCoreApiTarget ); + + /** + * Destructor. + */ + virtual ~MpMediaKeyRemConResponse(); + + /** + * Send the any key response back to Remcon server + * + * @since 3.0 + * @param aOperationId RemCon operation Id. + */ + void CompleteAnyKey( TRemConCoreApiOperationId aOperationId ); + +private: + + /** + * C++ default constructor. + */ + MpMediaKeyRemConResponse( CRemConCoreApiTarget& aRemConCoreApiTarget ); + +// from base class CActive + + /** + * From CActive + * Handles an active object's request completion event. + */ + void RunL(); + + /** + * From CActive + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + +private: // Data + + // Response array. + RArray iResponseArray; // Own + CRemConCoreApiTarget& iRemConCoreApiTarget; // Not own +}; + +#endif // MPMEDIAKEYREMCONKEYRESPONSE_H + +// End of File + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/inc/mpvolumeslider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/inc/mpvolumeslider.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player volume slider. +* +*/ + +#ifndef MPVOLUMESLIDER_H +#define MPVOLUMESLIDER_H + +#include +#include "mpcommondefs.h" + +class MpEngine; +class HbVolumeSliderPopup; + +class MpVolumeSlider : public QObject +{ + Q_OBJECT + +public: + + explicit MpVolumeSlider( QObject *parent = 0 ); + virtual ~MpVolumeSlider(); + void showVolumeSlider(); + +public slots: + + // To handle Engine signals + void handleVolumeProperty( MpCommon::MpVolumeProperty property, int value ); + + // To handle VolumeSlider signals + void sliderPressed(); + void sliderReleased(); + void muteIconClicked(); + void volumeSliderChanged( int value ); + +private: + + void initializeVolumeSliderPopup(); + +private: + Q_DISABLE_COPY(MpVolumeSlider) + + MpEngine *mMpEngine; // not owned + HbVolumeSliderPopup *mVolumeSliderPopup; // owned + int mEngineVolumeMax; + int mEngineVolumeLevel; + bool mEngineMuted; + int mEngineDataCompleted; // 0x01 volume max, 0x02 volume level, 0x04 volume mute + bool mSliderPressed; + int mSliderStep; // VolumeLevelMax / DefaultSteps +}; + +#endif // MPVOLUMESLIDER_H diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/mpmediacontroller.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/mpmediacontroller.pro Fri Aug 06 16:51:36 2010 -0500 @@ -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 = lib +CONFIG += hb qt +TARGET = mpmediacontroller +symbian: { + TARGET.UID3 = 0x10207C97 + MMP_RULES += "DEFFILE mpmediacontroller.def" + defFilePath = . + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.EPOCALLOWDLLDATA = 1 +} +DEFINES += BUILD_MPMEDIACONTROLLER + +INCLUDEPATH += . \ + inc \ + ../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lmpengine \ + -lremconcoreapi \ + -lremconinterfacebase + +# Input +HEADERS += ../../inc/mpmediacontroller.h \ + inc/mpmediakeyhandler.h \ + inc/mpmediakeyhandler_p.h \ + inc/mpmediakeyremconresponse.h \ + inc/mpvolumeslider.h + +SOURCES += src/mpmediacontroller.cpp \ + src/mpmediakeyhandler.cpp \ + src/mpmediakeyhandler_p.cpp \ + src/mpmediakeyremconresponse.cpp \ + src/mpvolumeslider.cpp + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/rom/mpmediacontroller.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/rom/mpmediacontroller.iby Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MPMEDIACONTROLLER_IBY__ +#define __MPMEDIACONTROLLER_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\mpmediacontroller.dll SHARED_LIB_DIR\mpmediacontroller.dll + +#endif \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/rom/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/rom/rom.pri Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,21 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +symbian { +MP_IBY_DIR = $$section(PWD,":",1) + +BLD_INF_RULES.prj_exports += "$$MP_IBY_DIR/mpmediacontroller.iby CORE_APP_LAYER_IBY_EXPORT_PATH(mpmediacontroller.iby)" +} \ No newline at end of file diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/src/mpmediacontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/src/mpmediacontroller.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player Media Controller. +* +*/ + + +#include "mpmediacontroller.h" +#include "mpmediakeyhandler.h" +#include "mpvolumeslider.h" +#include "mptrace.h" + + +/*! + Constructs the MpMediaController. + */ +MpMediaController::MpMediaController( QObject *parent ) + : QObject( parent ), + mMpMediaKeyHandler( 0 ), + mMpVolumeSlider( 0 ) +{ + TX_ENTRY + mMpMediaKeyHandler = new MpMediaKeyHandler(); + mMpVolumeSlider = new MpVolumeSlider(); + TX_EXIT +} + +/*! + Destructs MpMediaController. + */ +MpMediaController::~MpMediaController() +{ + delete mMpMediaKeyHandler; + delete mMpVolumeSlider; +} + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/src/mpmediakeyhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/src/mpmediakeyhandler.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player media key handler. +* +*/ + +#include "mpmediakeyhandler.h" +#include "mpmediakeyhandler_p.h" +#include "mptrace.h" + +/*! + Constructs MpMediaKeyHandler. + */ +MpMediaKeyHandler::MpMediaKeyHandler( QObject *parent ) + : QObject(parent) +{ + TX_ENTRY + d_ptr = new MpMediaKeyHandlerPrivate(this); + d_ptr->init(); + TX_EXIT +} + +/*! + Destructs MpMediaKeyHandler. + */ +MpMediaKeyHandler::~MpMediaKeyHandler() +{ + TX_ENTRY + delete d_ptr; + TX_EXIT +} + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/src/mpmediakeyhandler_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/src/mpmediakeyhandler_p.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player media key handler - private implementation. +* +*/ + + +//symbian header files +#include +#include + +#include "mpmediakeyhandler_p.h" +#include "mpmediakeyhandler.h" +#include "mpmediakeyremconresponse.h" +#include "mpenginefactory.h" +#include "mpcommondefs.h" +#include "mptrace.h" + + +/*! + \internal + */ +MpMediaKeyHandlerPrivate::MpMediaKeyHandlerPrivate( MpMediaKeyHandler *wrapper ) + : q_ptr( wrapper ), + iInterfaceSelector(NULL), + iResponseHandler(NULL), + iMpEngine(NULL), + iSideKeyAlreadyClicked(false) +{ + TX_LOG +} + +/*! + \internal + */ +MpMediaKeyHandlerPrivate::~MpMediaKeyHandlerPrivate() +{ + TX_ENTRY + delete iResponseHandler; + delete iInterfaceSelector; + TX_EXIT +} + +/*! + \internal + */ +void MpMediaKeyHandlerPrivate::init() +{ + TX_ENTRY + TRAPD(err, DoInitL()); + if ( err != KErrNone ) { + TX_LOG_ARGS("Error: " << err << "; should never get here."); + } + TX_EXIT + +} + +/*! + From MRemConCoreApiTargetObserver + A command has been received. + */ +void MpMediaKeyHandlerPrivate::MrccatoCommand( + TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) +{ + TX_ENTRY_ARGS( " aOperationId=" << aOperationId << " aButtonAct=" << aButtonAct ); + + switch ( aOperationId ) { + case ERemConCoreApiPausePlayFunction: + if ( aButtonAct == ERemConCoreApiButtonClick ) { + iMpEngine->playPause(); + } + break; + case ERemConCoreApiPlay: + if ( aButtonAct == ERemConCoreApiButtonClick + || aButtonAct == ERemConCoreApiButtonPress ) { + iMpEngine->play(); + } + break; + case ERemConCoreApiStop: + if ( aButtonAct == ERemConCoreApiButtonClick + || aButtonAct == ERemConCoreApiButtonPress ) { + iMpEngine->stop(); + } + break; + case ERemConCoreApiPause: + if ( aButtonAct == ERemConCoreApiButtonClick + || aButtonAct == ERemConCoreApiButtonPress ) { + iMpEngine->pause(); + } + break; + case ERemConCoreApiRewind: + switch ( aButtonAct ) { + case ERemConCoreApiButtonPress: + iMpEngine->startSeekBackward(); + break; + case ERemConCoreApiButtonRelease: + iMpEngine->stopSeeking(); + break; + default: + break; + } + break; + case ERemConCoreApiFastForward: + switch ( aButtonAct ) { + case ERemConCoreApiButtonPress: + iMpEngine->startSeekForward(); + break; + case ERemConCoreApiButtonRelease: + iMpEngine->stopSeeking(); + break; + default: + break; + } + break; + case ERemConCoreApiBackward: + if ( aButtonAct == ERemConCoreApiButtonClick ) { + iMpEngine->skipBackward(); + } + break; + case ERemConCoreApiForward: + if ( aButtonAct == ERemConCoreApiButtonClick ) { + iMpEngine->skipForward(); + } + break; + // Pressing headset volume key only generates ButtonPress, however pressing and holding hardware side key + // generates ButtonClick and after a while ButtonPressed, we should make sure increase/decrease only once + case ERemConCoreApiVolumeUp: + if ( aButtonAct == ERemConCoreApiButtonClick || + ( aButtonAct == ERemConCoreApiButtonPress && !iSideKeyAlreadyClicked ) ) { + iSideKeyAlreadyClicked = true; + iMpEngine->increaseVolume(); + } + else if ( aButtonAct == ERemConCoreApiButtonRelease ) { + iSideKeyAlreadyClicked = false; + } + break; + case ERemConCoreApiVolumeDown: + if ( aButtonAct == ERemConCoreApiButtonClick || + ( aButtonAct == ERemConCoreApiButtonPress && !iSideKeyAlreadyClicked ) ) { + iSideKeyAlreadyClicked = true; + iMpEngine->decreaseVolume(); + } + else if ( aButtonAct == ERemConCoreApiButtonRelease ) { + iSideKeyAlreadyClicked = false; + } + break; + default: + break; + } + iResponseHandler->CompleteAnyKey( aOperationId ); + TX_EXIT +} + +/*! + From MRemConCoreApiTargetObserver + A 'play' command has been received. + */ +void MpMediaKeyHandlerPrivate::MrccatoPlay( + TRemConCoreApiPlaybackSpeed aSpeed, + TRemConCoreApiButtonAction aButtonAct ) +{ + TX_ENTRY_ARGS( "aButtonAct=" << aButtonAct ); + Q_UNUSED(aSpeed); + + if ( ( aButtonAct == ERemConCoreApiButtonClick ) || + ( aButtonAct == ERemConCoreApiButtonPress ) ) { + iMpEngine->play(); + } + iResponseHandler->CompleteAnyKey( ERemConCoreApiPlay ); + TX_EXIT +} + +/*! + From MRemConCoreApiTargetObserver + A 'tune function' command has been received. + */ +void MpMediaKeyHandlerPrivate::MrccatoTuneFunction( + TBool aTwoPart, + TUint aMajorChannel, + TUint aMinorChannel, + TRemConCoreApiButtonAction aButtonAct ) +{ + Q_UNUSED(aTwoPart); + Q_UNUSED(aMajorChannel); + Q_UNUSED(aMinorChannel); + Q_UNUSED(aButtonAct); + + iResponseHandler->CompleteAnyKey( ERemConCoreApiTuneFunction ); +} + +/*! + From MRemConCoreApiTargetObserver + A 'select disk function' has been received. + */ +void MpMediaKeyHandlerPrivate::MrccatoSelectDiskFunction( + TUint aDisk, + TRemConCoreApiButtonAction aButtonAct ) +{ + Q_UNUSED(aDisk); + Q_UNUSED(aButtonAct); + + iResponseHandler->CompleteAnyKey( ERemConCoreApiSelectDiskFunction ); +} + +/*! + From MRemConCoreApiTargetObserver + A 'select AV input function' has been received. + */ +void MpMediaKeyHandlerPrivate::MrccatoSelectAvInputFunction( + TUint8 aAvInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct ) +{ + Q_UNUSED(aAvInputSignalNumber); + Q_UNUSED(aButtonAct); + + iResponseHandler->CompleteAnyKey( ERemConCoreApiSelectAvInputFunction ); + +} + +/*! + From MRemConCoreApiTargetObserver + A 'select audio input function' has been received. +*/ +void MpMediaKeyHandlerPrivate::MrccatoSelectAudioInputFunction( + TUint8 aAudioInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct ) +{ + Q_UNUSED(aAudioInputSignalNumber); + Q_UNUSED(aButtonAct); + + iResponseHandler->CompleteAnyKey( ERemConCoreApiSelectAudioInputFunction ); + +} + +/*! + \internal + */ +void MpMediaKeyHandlerPrivate::DoInitL() +{ + TX_ENTRY + // Register to remote control framework + iInterfaceSelector = CRemConInterfaceSelector::NewL(); + CRemConCoreApiTarget *coreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); + CleanupStack::PushL( coreTarget ); + iInterfaceSelector->OpenTargetL(); + iResponseHandler = MpMediaKeyRemConResponse::NewL( *coreTarget ); + CleanupStack::Pop(coreTarget); + + iMpEngine = MpEngineFactory::sharedEngine(); + TX_EXIT +} + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/src/mpmediakeyremconresponse.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/src/mpmediakeyremconresponse.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player media key handler. +* Helper class for sending response back to Remote Controller Framework. +* +*/ + +// INCLUDE FILES +#include "mpmediakeyremconresponse.h" +#include "mptrace.h" + + +/*! + \internal + C++ default constructor can NOT contain any code, that + might leave. + */ +MpMediaKeyRemConResponse::MpMediaKeyRemConResponse( + CRemConCoreApiTarget& aRemConCoreApiTarget ) + : CActive( CActive::EPriorityStandard ), + iRemConCoreApiTarget( aRemConCoreApiTarget ) +{ + TX_ENTRY + CActiveScheduler::Add( this ); + TX_EXIT +} + +/*! + \internal + Two-phased constructor. + */ +MpMediaKeyRemConResponse* MpMediaKeyRemConResponse::NewL( + CRemConCoreApiTarget& aRemConCoreApiTarget ) +{ + MpMediaKeyRemConResponse* self = + new (ELeave) MpMediaKeyRemConResponse( aRemConCoreApiTarget ); + + return self; +} + +/*! + \internal + Destructor + */ +MpMediaKeyRemConResponse::~MpMediaKeyRemConResponse() +{ + TX_ENTRY + Cancel(); + iResponseArray.Close(); + TX_EXIT +} + +/*! + \internal + Send the any key response back to Remcon server + */ +void MpMediaKeyRemConResponse::CompleteAnyKey( + TRemConCoreApiOperationId aOperationId ) +{ + TX_ENTRY_ARGS(" OperationId: " << aOperationId ); + if ( !IsActive() ) { + switch ( aOperationId ) + { + case ERemConCoreApiPausePlayFunction: + { + iRemConCoreApiTarget.PausePlayFunctionResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiPlay: + { + iRemConCoreApiTarget.PlayResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiStop: + { + iRemConCoreApiTarget.StopResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiPause: + { + iRemConCoreApiTarget.PauseResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiRewind: + { + iRemConCoreApiTarget.RewindResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiFastForward: + { + iRemConCoreApiTarget.FastForwardResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiBackward: + { + iRemConCoreApiTarget.BackwardResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiForward: + { + iRemConCoreApiTarget.ForwardResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiVolumeUp: + { + iRemConCoreApiTarget.VolumeUpResponse( iStatus, KErrNone ); + SetActive(); + break; + } + case ERemConCoreApiVolumeDown: + { + iRemConCoreApiTarget.VolumeDownResponse( iStatus, KErrNone ); + SetActive(); + break; + } + default: + { + TInt error = KErrNone; + iRemConCoreApiTarget.SendResponse( + iStatus, aOperationId, error ); + SetActive(); + break; + } + } + } + // already active. Append to array and complete later. + else + { + iResponseArray.Append( aOperationId ); + } + TX_EXIT +} + +/*! + \internal + Implements cancellation of an outstanding request. + */ +void MpMediaKeyRemConResponse::DoCancel() +{ +} + +/*! + \internal + Handles an active object's request completion event. + */ +void MpMediaKeyRemConResponse::RunL() +{ + TX_ENTRY_ARGS( "iStatus=" << iStatus.Int() ); + // if any existing -> Send response + if ( iResponseArray.Count() ) { + CompleteAnyKey( iResponseArray[0] ); + // Remove already completed key + iResponseArray.Remove( 0 ); + iResponseArray.Compress(); + } + TX_EXIT +} + +// End of File diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/src/mpvolumeslider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/src/mpvolumeslider.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Music Player volume slider. +* +*/ + +#include + +#include "mpvolumeslider.h" +#include "mpenginefactory.h" +#include "mptrace.h" + +const int KVolumeMin = 0; +const int KVolumeMuted = 1; +const int KDefaultSteps = 10; +const int KDataCompleted = 0x07; // 0x01 volume max, 0x02 volume level, 0x04 volume mute + +/*! + Constructs MpVolumeSlider. + */ +MpVolumeSlider::MpVolumeSlider( QObject *parent ) + : QObject( parent), + mMpEngine( 0 ), + mVolumeSliderPopup( 0 ), + mEngineVolumeMax( 0 ), + mEngineVolumeLevel( 0 ), + mEngineMuted( false ), + mEngineDataCompleted( 0 ), + mSliderPressed( false ), + mSliderStep( 0 ) +{ + TX_ENTRY + mMpEngine = MpEngineFactory::sharedEngine(); + connect( mMpEngine, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), + this, SLOT( handleVolumeProperty( MpCommon::MpVolumeProperty, int ) ) ); + + //Request Volume properties + mMpEngine->getMaxVolume(); + mMpEngine->getVolume(); + mMpEngine->getMuteState(); + TX_EXIT +} + +/*! + Destructs MpVolumeSlider. + */ +MpVolumeSlider::~MpVolumeSlider() +{ + TX_ENTRY + delete mVolumeSliderPopup; + TX_EXIT +} + +/*! + Make volume slider visible with latest engine data. + */ +void MpVolumeSlider::showVolumeSlider() +{ + TX_ENTRY + + if ( !mSliderPressed ) { + + // Initialize popup until needed, in order to save time during app start up. + if ( !mVolumeSliderPopup ) { + initializeVolumeSliderPopup(); + } + + // Update VolumeSlider with Engine values + if ( mEngineMuted ) { + if ( mVolumeSliderPopup->value() != KVolumeMin ) { + // Muted from outside (possibly from Headset or MediaKeys), update volume slider as "muted" + // Todo: Replace with a more appropriate method to mute slider, when provided by Orbit. + mVolumeSliderPopup->setValue( KVolumeMin ); + } + } + else if ( mVolumeSliderPopup->value() != ( mEngineVolumeLevel / mSliderStep ) ){ + mVolumeSliderPopup->setValue( mEngineVolumeLevel / mSliderStep ); + } + + // Show VolumeSlider + if ( !mVolumeSliderPopup->isVisible() ) { + mVolumeSliderPopup->setVisible( true ); + } + } + + TX_EXIT +} + +/*! + Slot to handle volume property notifications + */ +void MpVolumeSlider::handleVolumeProperty( MpCommon::MpVolumeProperty property, int value ) +{ + TX_ENTRY_ARGS("Property: " << property << ", Value: " << value ); + switch( property ) + { + case MpCommon::MaxVolume : + mEngineVolumeMax = value; + mEngineDataCompleted |= 0x01; + break; + case MpCommon::Volume : + mEngineVolumeLevel = value; + // Framework automatically mutes if volume == KVolumeMin and unmutes when volume > KVolumeMin + mEngineMuted = mEngineVolumeLevel == KVolumeMin; + if ( mEngineDataCompleted == KDataCompleted ) { + showVolumeSlider(); + } + else { + mEngineDataCompleted |= 0x02; + } + break; + case MpCommon::MuteState : + mEngineMuted = ( value == KVolumeMuted ); + if ( mEngineDataCompleted == KDataCompleted ) { + showVolumeSlider(); + } + else { + mEngineDataCompleted |= 0x04; + } + break; + default: + TX_LOG_ARGS( "We should never be here" ); + break; + } + TX_EXIT +} + +/*! + Slot called when slider is pressed. + */ +void MpVolumeSlider::sliderPressed() +{ + TX_ENTRY + mSliderPressed = true; + TX_EXIT +} + +/*! + Slot called when slider is released. + */ +void MpVolumeSlider::sliderReleased() +{ + TX_ENTRY + mSliderPressed = false; + TX_EXIT +} + +/*! + Slot called when mute icon is clicekd. + */ +void MpVolumeSlider::muteIconClicked() +{ + TX_ENTRY + if ( mVolumeSliderPopup->value() ) { + mMpEngine->unmute(); + mEngineMuted = false; + } + else { + mMpEngine->mute(); + mEngineMuted = true; + } + TX_EXIT +} + +/*! + Slot called when volume slider value changes. + */ +void MpVolumeSlider::volumeSliderChanged( int value ) +{ + TX_ENTRY + + if ( mEngineVolumeLevel != ( value * mSliderStep ) ) { + // When Mute icon is clicked, slider value changes automatically to zero, + // don't send that change in order to avoid reset the engine previous volume. + if ( !( mEngineMuted && value == KVolumeMin ) ) { + mMpEngine->setVolume( value * mSliderStep ); + } + } + + TX_EXIT +} + +/*! + Inernal + */ +void MpVolumeSlider::initializeVolumeSliderPopup() +{ + TX_ENTRY + + mVolumeSliderPopup = new HbVolumeSliderPopup(); + mVolumeSliderPopup->setRange( KVolumeMin, KDefaultSteps ); + mVolumeSliderPopup->setSingleStep( 1 ); + mVolumeSliderPopup->setTickPosition( Hb::NoSliderTicks ); + mSliderStep = mEngineVolumeMax / KDefaultSteps ; + + connect( mVolumeSliderPopup, SIGNAL( sliderPressed() ), + this, SLOT( sliderPressed() ) ); + connect( mVolumeSliderPopup, SIGNAL( sliderReleased() ), + this, SLOT( sliderReleased() ) ); + connect( mVolumeSliderPopup, SIGNAL( iconClicked() ), + this, SLOT( muteIconClicked() ) ); + // volumeChanged event is also sent when VolumeSlider is Muted/Unmuted + // QueuedConnection used in order to handle Mute events first, + // and then be able to know whether to apply the slider volume changes to the engine + connect( mVolumeSliderPopup, SIGNAL( valueChanged( int ) ), + this, SLOT( volumeSliderChanged( int ) ), + Qt::QueuedConnection ); + + TX_EXIT +} + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,23 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Music Player mpnowplayingbanner unit test project file. +# + +TEMPLATE = subdirs + +SUBDIRS += unittest_mpmediakeyhandler \ + unittest_mpvolumeslider + +CONFIG += ordered + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/inc/unittest_mpmediakeyhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/inc/unittest_mpmediakeyhandler.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,75 @@ +/** +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpmediakeyhandler +* +*/ + +#ifndef TESTMPMEDIAKEYHANDLER_H +#define TESTMPMEDIAKEYHANDLER_H + +#include + +class MpMediaKeyHandler; +class MpMediaKeyHandlerPrivate; + +class TestMpMediaKeyHandler : public QObject +{ + Q_OBJECT + +public: + + TestMpMediaKeyHandler(); + virtual ~TestMpMediaKeyHandler(); + +// from QtTest +public slots: + + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +// internal +private slots: + + void testConstructor(); + void testDestructor(); + void testCommandPausePlayKey(); + void testCommandPlayKey(); + void testCommandStopKey(); + void testCommandPauseKey(); + void testCommandRewindKeyPress(); + void testCommandRewindKeyRelease(); + void testCommandFastForwardKeyPress(); + void testCommandFastForwardKeyRelease(); + void testCommandBackwardKey(); + void testCommandForwardKey(); + void testCommandVolumeUpKey(); + void testCommandVolumeDownKey(); + + void testPlay(); + void testTuneFunction(); + void testSelectDiskFunction(); + void testAudioInputFunction(); + void testSelectAvInputFunction(); + +private: + + MpMediaKeyHandler *mTest; + MpMediaKeyHandlerPrivate *mTestPrivate; + +}; + +#endif // TESTMPMEDIAKEYHANDLER_H + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/src/unittest_mpmediakeyhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/src/unittest_mpmediakeyhandler.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,316 @@ +/** +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpmediakeyhandler +* +*/ + +#include + +#include "stub/inc/mpenginefactory.h" +#include "stub/inc/remconcoreapitarget.h" +#include "stub/inc/remconcoreapitargetobserver.h" +#include "stub/inc/remconinterfaceselector.h" +#include "unittest_mpmediakeyhandler.h" +#include "mpcommondefs.h" + + +// Do this so we can access all member variables. +#define private public +#include "mpmediakeyhandler.h" +#include "mpmediakeyhandler_p.h" +#undef private + +//This so stub classes can be loaded +#include "mpmediakeyhandler_p.cpp" +#include "mpmediakeyremconresponse.cpp" + + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + TestMpMediaKeyHandler tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpmediakeyhandler.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpMediaKeyHandler::TestMpMediaKeyHandler() + : mTest(0) +{ +} + +TestMpMediaKeyHandler::~TestMpMediaKeyHandler() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpMediaKeyHandler::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpMediaKeyHandler::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpMediaKeyHandler::init() +{ + mTest = new MpMediaKeyHandler(); + mTestPrivate = mTest->d_ptr; +} + +/*! + Called after every testfunction. + */ +void TestMpMediaKeyHandler::cleanup() +{ + if (mTest) + { + delete mTest; + mTest = 0; + mTestPrivate = 0; + + MpEngineFactory::close(); + } +} + +void TestMpMediaKeyHandler::testConstructor() +{ + QVERIFY( mTest ); + QVERIFY( mTestPrivate ); + QVERIFY( mTestPrivate->iInterfaceSelector ); + QVERIFY( mTestPrivate->iResponseHandler ); + QVERIFY( mTestPrivate->iMpEngine ); +} + +void TestMpMediaKeyHandler::testDestructor() +{ + // it is been observed that CRemConCoreApiTarget is not being deleted by anyone + // the creator claim it does not own it, while others never claim the ownership neither + cleanup(); + QVERIFY( !mTest ); + //QCOMPARE(CRemConCoreApiTarget::getCount(), 0); + QCOMPARE(CRemConCoreApiTarget::getCount(), 2); + QCOMPARE(CRemConInterfaceSelector::getCount(), 0); +} + +void TestMpMediaKeyHandler::testCommandPausePlayKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiPausePlayFunction, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdPlayPause); + +} + +void TestMpMediaKeyHandler::testCommandPlayKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiPlay, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdPlay); +} + +void TestMpMediaKeyHandler::testCommandStopKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiStop, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdStop); +} + +void TestMpMediaKeyHandler::testCommandPauseKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiPause, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdPause); +} + +void TestMpMediaKeyHandler::testCommandRewindKeyPress() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiRewind, ERemConCoreApiButtonPress); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdStartSeekBackward); +} + +void TestMpMediaKeyHandler::testCommandRewindKeyRelease() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiRewind, ERemConCoreApiButtonRelease); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdStopSeeking); +} + +void TestMpMediaKeyHandler::testCommandFastForwardKeyPress() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiFastForward, ERemConCoreApiButtonPress); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdStartSeekForward); +} + +void TestMpMediaKeyHandler::testCommandFastForwardKeyRelease() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiFastForward, ERemConCoreApiButtonRelease); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdStopSeeking); +} + +void TestMpMediaKeyHandler::testCommandBackwardKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiBackward, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdSkipBackward); +} + +void TestMpMediaKeyHandler::testCommandForwardKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoCommand(ERemConCoreApiForward, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE(mTestPrivate->iMpEngine->iMediaCommandReceived, CmdSkipForward); +} + +void TestMpMediaKeyHandler::testCommandVolumeUpKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + + // Simulate hardware side key clicked. + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeUp, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdIncreaseVolume ); + QVERIFY( mTestPrivate->iSideKeyAlreadyClicked ); + QTest::qWait(100); + + // Simulate holding the hardware side key. + mTestPrivate->iMpEngine->iMediaCommandReceived = CmdNone; + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeUp, ERemConCoreApiButtonPress); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+2); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); + QVERIFY( mTestPrivate->iSideKeyAlreadyClicked ); + QTest::qWait(100); + + // Release hardware side key. + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeUp, ERemConCoreApiButtonRelease); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+3); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); + QVERIFY( !mTestPrivate->iSideKeyAlreadyClicked ); + QTest::qWait(100); + + // Simulate headset volume key pressed. + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeUp, ERemConCoreApiButtonPress); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+4); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdIncreaseVolume ); + QVERIFY( mTestPrivate->iSideKeyAlreadyClicked ); +} + +void TestMpMediaKeyHandler::testCommandVolumeDownKey() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + + // Simulate hardware side key clicked. + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeDown, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdDecreaseVolume ); + QVERIFY( mTestPrivate->iSideKeyAlreadyClicked ); + QTest::qWait(100); + + // Simulate holding the hardware side key. + mTestPrivate->iMpEngine->iMediaCommandReceived = CmdNone; + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeDown, ERemConCoreApiButtonPress); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+2); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); + QVERIFY( mTestPrivate->iSideKeyAlreadyClicked ); + QTest::qWait(100); + + // Release hardware side key. + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeDown, ERemConCoreApiButtonRelease); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+3); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); + QVERIFY( !mTestPrivate->iSideKeyAlreadyClicked ); + QTest::qWait(100); + + // Simulate headset volume key pressed. + mTestPrivate->MrccatoCommand(ERemConCoreApiVolumeDown, ERemConCoreApiButtonPress); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+4); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdDecreaseVolume ); + QVERIFY( mTestPrivate->iSideKeyAlreadyClicked ); +} + +void TestMpMediaKeyHandler::testPlay() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoPlay(ERemConCoreApiPlaybackSpeedX1, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdPlay ); +} + +void TestMpMediaKeyHandler::testTuneFunction() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoTuneFunction(ETrue, 0, 1, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); +} + +void TestMpMediaKeyHandler::testSelectDiskFunction() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoSelectDiskFunction(0, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); +} + +void TestMpMediaKeyHandler::testAudioInputFunction() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoSelectAudioInputFunction(0, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); +} + +void TestMpMediaKeyHandler::testSelectAvInputFunction() +{ + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + mTestPrivate->MrccatoSelectAvInputFunction(0, ERemConCoreApiButtonClick); + QCOMPARE(CRemConCoreApiTarget::getSendResponseCount(), oldCount+1); + QCOMPARE( mTestPrivate->iMpEngine->iMediaCommandReceived, CmdNone ); +} + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/mpenginefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/mpenginefactory.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub for testing mpmediakeyhandler +* +*/ + +#ifndef MPENGINEFACTORY_H +#define MPENGINEFACTORY_H + +enum MediaCommandReceived{ + CmdNone, + CmdPlay, + CmdPause, + CmdPlayPause, + CmdStop, + CmdSkipForward, + CmdStartSeekForward, + CmdStopSeeking, + CmdSkipBackward, + CmdStartSeekBackward, + CmdIncreaseVolume, + CmdDecreaseVolume, + CmdSetVolumeLevel, + CmdMuteVolume, + CmdUnmuteVolume + }; + +enum MediaPropertyRequested{ + PropNone, + PropVolumeLevelMax, + PropVolumeLevel, + PropVolumeMuteState + }; + +class MpEngine +{ +public: + // Stub functions + MpEngine(); + +public: + // Playback related + void play(); + void pause(); + void playPause(); + void stop(); + void skipForward(); + void startSeekForward(); + void stopSeeking(); + void skipBackward(); + void startSeekBackward(); + void getVolumeLevelMax(); + void getVolumeLevel(); + void increaseVolume(); + void decreaseVolume(); + void setVolumeLevel( int value ); + void getVolumeMuteState(); + void muteVolume(); + void unmuteVolume(); + +public: + MediaCommandReceived iMediaCommandReceived; + MediaPropertyRequested iMediaPropertyRequested; + +}; + +class MpEngineFactory +{ + +public: + // Stub functions +private: + explicit MpEngineFactory(); + +public: + virtual ~MpEngineFactory(); + static MpEngineFactory * instance(); + static MpEngine *sharedEngine(); + static void close(); + +private: + MpEngine *mSharedEngine; + +}; + + +#endif // MPENGINEFACTORY_H diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/remconcoreapitarget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/remconcoreapitarget.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: remconcoreapitarget stub for testing mpmediakeyhandler +* +*/ + + +#ifndef REMCONCOREAPITARGET_H +#define REMCONCOREAPITARGET_H + + +#include // TRemConCoreApiOperationId + + +class CRemConInterfaceSelector; +class MRemConCoreApiTargetObserver; + +class CRemConCoreApiTarget : public CActive + { + +public: + + static int getCount(); + static void setNewLLeave(); + static void NewLLeaveIfDesiredL(); + static int getSendResponseCount(); + +public: + + static CRemConCoreApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, MRemConCoreApiTargetObserver& aObserver); + virtual ~CRemConCoreApiTarget(); + + void PausePlayFunctionResponse(TRequestStatus& aStatus, TInt aError); + void PlayResponse(TRequestStatus& aStatus, TInt aError); + void StopResponse(TRequestStatus& aStatus, TInt aError); + void PauseResponse(TRequestStatus& aStatus, TInt aError); + void RewindResponse(TRequestStatus& aStatus, TInt aError); + void FastForwardResponse(TRequestStatus& aStatus, TInt aError); + void BackwardResponse(TRequestStatus& aStatus, TInt aError); + void ForwardResponse(TRequestStatus& aStatus, TInt aError); + void VolumeUpResponse(TRequestStatus& aStatus, TInt aError); + void VolumeDownResponse(TRequestStatus& aStatus, TInt aError); + void SendResponse(TRequestStatus& aStatus, TRemConCoreApiOperationId aOperationId, TInt aError); + +protected: + + // from CActive + virtual void DoCancel(); + virtual void RunL(); + +private: + + CRemConCoreApiTarget(); + +private: + + TRequestStatus* iClientStatus; + + }; + +#endif // REMCONCOREAPITARGET_H + +// End of File diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/remconcoreapitargetobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/remconcoreapitargetobserver.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: remconcoreapitargetobserver stub for testing mpmediakeyhandler +* +*/ + + +#ifndef REMCONCOREAPITARGETOBSERVER_H +#define REMCONCOREAPITARGETOBSERVER_H + +#include +#include + + +class MRemConCoreApiTargetObserver + { +public: + + virtual void MrccatoCommand(TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct) = 0; + + virtual void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed, + TRemConCoreApiButtonAction aButtonAct) = 0; + + virtual void MrccatoTuneFunction(TBool aTwoPart, + TUint aMajorChannel, + TUint aMinorChannel, + TRemConCoreApiButtonAction aButtonAct) = 0; + + virtual void MrccatoSelectDiskFunction(TUint aDisk, + TRemConCoreApiButtonAction aButtonAct) = 0; + + virtual void MrccatoSelectAvInputFunction(TUint8 aAvInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct) = 0; + + virtual void MrccatoSelectAudioInputFunction(TUint8 aAudioInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct) = 0; + }; + +#endif // REMCONCOREAPITARGETOBSERVER_H diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/remconinterfaceselector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/inc/remconinterfaceselector.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: remconinterfaceselector stub for testing mpmediakeyhandler +* +*/ + + +#ifndef REMCONINTERFACESELECTOR_H +#define REMCONINTERFACESELECTOR_H + + +#include + + +class CRemConInterfaceSelector : public CBase + { + +public: + + static int getCount(); + static void setNewLLeave(); + static void NewLLeaveIfDesiredL(); + static void setOpenTargetLLeave(); + static void OpenTargetLLeaveIfDesiredL(); + +public: + + static CRemConInterfaceSelector* NewL(); + virtual ~CRemConInterfaceSelector(); + + void OpenTargetL(); + +private: + + CRemConInterfaceSelector(); + + }; + +#endif // REMCONINTERFACESELECTOR_H + +// End of File diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/src/mpenginefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/src/mpenginefactory.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub for testing mpmediakeyhandler +* +*/ + + +#include "stub/inc/mpenginefactory.h" + +/*! + * Stub function + */ +MpEngine::MpEngine() + : iMediaCommandReceived( CmdNone ), + iMediaPropertyRequested( PropNone ) +{ +} + + +/*! + * Stub function + */ + +void MpEngine::play() +{ + iMediaCommandReceived = CmdPlay; +} + +/*! + * Stub function + */ +void MpEngine::pause() +{ + iMediaCommandReceived = CmdPause; +} + +/*! + * Stub function + */ +void MpEngine::playPause() +{ + iMediaCommandReceived = CmdPlayPause; +} + +/*! + * Stub function + */ +void MpEngine::stop() +{ + iMediaCommandReceived = CmdStop; +} + +/*! + * Stub function + */ +void MpEngine::skipForward() +{ + iMediaCommandReceived = CmdSkipForward; +} + +/*! + * Stub function + */ +void MpEngine::startSeekForward() +{ + iMediaCommandReceived = CmdStartSeekForward; +} + +/*! + * Stub function + */ +void MpEngine::stopSeeking() +{ + iMediaCommandReceived = CmdStopSeeking; +} + +/*! + * Stub function + */ +void MpEngine::skipBackward() +{ + iMediaCommandReceived = CmdSkipBackward; +} + +/*! + * Stub function + */ +void MpEngine::startSeekBackward() +{ + iMediaCommandReceived = CmdStartSeekBackward; +} + +/*! + * Stub function + */ +void MpEngine::getVolumeLevelMax( ) +{ + iMediaPropertyRequested = PropVolumeLevelMax; +} + +/*! + * Stub function + */ +void MpEngine::getVolumeLevel( ) +{ + iMediaPropertyRequested = PropVolumeLevel; +} + +/*! + * Stub function + */ +void MpEngine::increaseVolume() +{ + iMediaCommandReceived = CmdIncreaseVolume; +} + +/*! + * Stub function + */ +void MpEngine::decreaseVolume() +{ + iMediaCommandReceived = CmdDecreaseVolume; +} + +/*! + * Stub function + */ +void MpEngine::setVolumeLevel( int /*value*/ ) +{ + iMediaCommandReceived = CmdSetVolumeLevel; +} + +/*! + * Stub function + */ +void MpEngine::getVolumeMuteState( ) +{ + iMediaPropertyRequested = PropVolumeMuteState; +} + +/*! + * Stub function + */ +void MpEngine::muteVolume() +{ + iMediaCommandReceived = CmdMuteVolume; +} + +/*! + * Stub function + */ +void MpEngine::unmuteVolume() +{ + iMediaCommandReceived = CmdUnmuteVolume; +} + + +//============= MpEngineFactory ============= + +/*! + * Stub function + */ +MpEngineFactory::MpEngineFactory() + : mSharedEngine( 0 ) +{ +} + +/*! + * Stub function + */ +MpEngineFactory::~MpEngineFactory() +{ + delete mSharedEngine; + mSharedEngine = 0; +} + +/*! + * Stub function + */ +MpEngineFactory * MpEngineFactory::instance() +{ + static MpEngineFactory instance; + return &instance; +} + +/*! + * Stub function + */ +MpEngine *MpEngineFactory::sharedEngine() +{ + if ( !instance()->mSharedEngine ) { + instance()->mSharedEngine = new MpEngine(); + } + return instance()->mSharedEngine; +} + +/*! + * Stub function + */ +void MpEngineFactory::close() +{ + if ( instance()->mSharedEngine ) { + delete instance()->mSharedEngine; + instance()->mSharedEngine = 0; + } +} diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/src/remconcoreapitarget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/src/remconcoreapitarget.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: remconcoreapitarget stub for testing MpMediaKeyHandler +* +*/ + +#include + +#include "stub/inc/remconcoreapitargetobserver.h" +#include "stub/inc/remconcoreapitarget.h" + + +int gCRemConCoreApiTargetCount = 0; +bool gCRemConCoreApiTargetNewLLeave = false; +int gCRemConCoreApiTargetSendResponseCount = 0; + + +//static functions start + +int CRemConCoreApiTarget::getCount() +{ + return gCRemConCoreApiTargetCount; +} + +void CRemConCoreApiTarget::setNewLLeave() +{ + gCRemConCoreApiTargetNewLLeave = true; +} + +void CRemConCoreApiTarget::NewLLeaveIfDesiredL() +{ + if (gCRemConCoreApiTargetNewLLeave) + { + RDebug::Print(_L("CRemConCoreApiTarget::NewLLeaveIfDesiredL Leave")); + gCRemConCoreApiTargetNewLLeave = false; + User::Leave(KErrGeneral); + } +} + +int CRemConCoreApiTarget::getSendResponseCount() +{ + return gCRemConCoreApiTargetSendResponseCount; +} + +//static functions end + + +CRemConCoreApiTarget::CRemConCoreApiTarget() + : CActive(EPriorityStandard), + iClientStatus(NULL) +{ + gCRemConCoreApiTargetCount++; +} + +CRemConCoreApiTarget::~CRemConCoreApiTarget() +{ + gCRemConCoreApiTargetCount--; + gCRemConCoreApiTargetSendResponseCount = 0; +} + +CRemConCoreApiTarget* CRemConCoreApiTarget::NewL(CRemConInterfaceSelector& /*aInterfaceSelector*/, MRemConCoreApiTargetObserver& /*aObserver*/) +{ + RDebug::Print(_L("stub CRemConCoreApiTarget::NewL")); + CRemConCoreApiTarget::NewLLeaveIfDesiredL(); + CRemConCoreApiTarget* self = new(ELeave) CRemConCoreApiTarget(); + return self; +} + +void CRemConCoreApiTarget::PausePlayFunctionResponse(TRequestStatus& aStatus, TInt /*aError*/) +{ + RDebug::Print(_L(">>CRemConCoreApiTarget::PausePlayFunctionResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::PlayResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::StopResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::PauseResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::RewindResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::FastForwardResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::BackwardResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::ForwardResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::VolumeUpResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::VolumeDownResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::SendResponse")); + + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCoreApiTarget::RunL")); + User::RequestComplete(iClientStatus, KErrNone); + RDebug::Print(_L("< + +#include "stub/inc/remconinterfaceselector.h" + + +int gCRemConInterfaceSelectorCount = 0; +bool gCRemConInterfaceSelectorNewLLeave = false; +bool gCRemConInterfaceSelectorOpenTargetLLeave = false; + + +//static functions start + +int CRemConInterfaceSelector::getCount() +{ + return gCRemConInterfaceSelectorCount; +} + +void CRemConInterfaceSelector::setNewLLeave() +{ + gCRemConInterfaceSelectorNewLLeave = true; +} + +void CRemConInterfaceSelector::NewLLeaveIfDesiredL() +{ + if (gCRemConInterfaceSelectorNewLLeave) + { + RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave")); + gCRemConInterfaceSelectorNewLLeave = false; + User::Leave(KErrGeneral); + } +} + +void CRemConInterfaceSelector::setOpenTargetLLeave() +{ + gCRemConInterfaceSelectorOpenTargetLLeave = true; +} + +void CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL() +{ + if (gCRemConInterfaceSelectorOpenTargetLLeave) + { + RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave")); + gCRemConInterfaceSelectorOpenTargetLLeave = false; + User::Leave(KErrGeneral); + } +} + +//static functions end + +CRemConInterfaceSelector::CRemConInterfaceSelector() +{ + gCRemConInterfaceSelectorCount++; +} + +CRemConInterfaceSelector::~CRemConInterfaceSelector() +{ + gCRemConInterfaceSelectorCount--; +} + +CRemConInterfaceSelector* CRemConInterfaceSelector::NewL() +{ + RDebug::Print(_L("stub CRemConInterfaceSelector::NewL")); + CRemConInterfaceSelector::NewLLeaveIfDesiredL(); + CRemConInterfaceSelector* self = new(ELeave) CRemConInterfaceSelector(); + return self; +} + +void CRemConInterfaceSelector::OpenTargetL() +{ + CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL(); +} + +//end of file diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/unittest_mpmediakeyhandler.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/unittest_mpmediakeyhandler.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,52 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpmediakeyhandler unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib symbian_test +TARGET = unittest_mpmediakeyhandler +TARGET.CAPABILITY = CAP_APPLICATION + +symbian: { + MMP_RULES += SMPSAFE +} + +DEPENDPATH += . +INCLUDEPATH += . \ + stub/inc \ + ../../inc \ + ../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lestor \ + -lfbscli \ + -lremconcoreapi \ + -lremconinterfacebase + +HEADERS += stub/inc/mpenginefactory.h \ + stub/inc/remconcoreapitarget.h \ + stub/inc/remconcoreapitargetobserver.h \ + stub/inc/remconinterfaceselector.h \ + inc/unittest_mpmediakeyhandler.h \ + ../../inc/mpmediakeyhandler.h \ + ../../inc/mpmediakeyhandler_p.h \ + ../../inc/mpmediakeyremconresponse.h + +SOURCES += stub/src/mpenginefactory.cpp \ + stub/src/remconcoreapitarget.cpp \ + stub/src/remconinterfaceselector.cpp \ + src/unittest_mpmediakeyhandler.cpp \ + ../../src/mpmediakeyhandler.cpp + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/inc/unittest_mpvolumeslider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/inc/unittest_mpvolumeslider.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,70 @@ +/** +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpvolumeslider +* +*/ + +#ifndef TESTMPVOLUMESLIDER_H +#define TESTMPVOLUMESLIDER_H + +#include +#include "mpcommondefs.h" + +class MpVolumeSlider; + +class TestMpVolumeSlider : public QObject +{ + Q_OBJECT + +public: + + TestMpVolumeSlider(); + virtual ~TestMpVolumeSlider(); + +signals: + void triggerVolumePropertyChanged( MpCommon::MpVolumeProperty property, int value ); + void triggerSliderPressed(); + void triggerSliderReleased(); + void triggerIconClicked(); + void triggerValueChanged( int value ); + +// from QtTest +public slots: + + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +// internal +private slots: + + void testConstructor(); + void testShowVolumeSlider(); + void testHandleVolumeProperty(); + void testSliderPressed(); + void testSliderReleased(); + void testMuteIconClicked(); + void testVolumeSliderChanged(); + void testInitializeVolumeSliderPopup(); + +private: + + MpVolumeSlider *mTest; + + +}; + +#endif // TESTMPVOLUMESLIDER_H + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/src/unittest_mpvolumeslider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/src/unittest_mpvolumeslider.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,286 @@ +/** +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for mpvolumeslider +* +*/ + +#include + +#include "stub/inc/mpenginefactory.h" +#include "stub/inc/hbvolumesliderpopup.h" +#include "unittest_mpvolumeslider.h" + + +// Do this so we can access all member variables. +#define private public +#include "mpvolumeslider.h" +#undef private + +// Do this so private function can be accessed +#include <../../src/mpvolumeslider.cpp> + +/*! + Make our test case a stand-alone executable that runs all the test functions. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + TestMpVolumeSlider tv; + + if ( argc > 1 ) { + return QTest::qExec( &tv, argc, argv); + } + else { + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\unittest_mpvolumeslider.txt"; + + return QTest::qExec(&tv, 3, pass); + } +} + +TestMpVolumeSlider::TestMpVolumeSlider() + : mTest(0) +{ +} + +TestMpVolumeSlider::~TestMpVolumeSlider() +{ + delete mTest; +} + +/*! + Called before the first testfunction is executed. + */ +void TestMpVolumeSlider::initTestCase() +{ +} + +/*! + Called after the last testfunction was executed. + */ +void TestMpVolumeSlider::cleanupTestCase() +{ +} + +/*! + Called before each testfunction is executed. + */ +void TestMpVolumeSlider::init() +{ + mTest = new MpVolumeSlider(); +} + +/*! + Called after every testfunction. + */ +void TestMpVolumeSlider::cleanup() +{ + if (mTest) + { + delete mTest; + mTest = 0; + + MpEngineFactory::close(); + } +} + +void TestMpVolumeSlider::testConstructor() +{ + QVERIFY( mTest ); + QCOMPARE(mTest->mMpEngine->iMediaPropertyRequested.value(0), PropVolumeLevelMax); + QCOMPARE(mTest->mMpEngine->iMediaPropertyRequested.value(1), PropVolumeLevel); + QCOMPARE(mTest->mMpEngine->iMediaPropertyRequested.value(2), PropVolumeMuteState); +} + +void TestMpVolumeSlider::testShowVolumeSlider() +{ + mTest->mEngineVolumeMax = 100; + mTest->mEngineMuted = true; + mTest->mEngineVolumeLevel = 30; + + // While VolumeSlider is pressed showVolumeSlider() function does nothing. + mTest->mSliderPressed = true; + mTest->showVolumeSlider(); + QVERIFY( !mTest->mVolumeSliderPopup ); + + // When VolumeSlider is not being pressed, showVolumeSlider() attempts to show the slider. + mTest->mSliderPressed = false; + mTest->showVolumeSlider(); + QVERIFY( mTest->mVolumeSliderPopup ); + QCOMPARE( mTest->mVolumeSliderPopup->mValue, 0 ); //Currently in mute state + QVERIFY( mTest->mVolumeSliderPopup->isVisible() ); + + // Clearing mute state + mTest->mEngineMuted = false; + mTest->showVolumeSlider(); + QVERIFY( mTest->mVolumeSliderPopup ); + QCOMPARE( mTest->mVolumeSliderPopup->mValue, 3 ); + QVERIFY( mTest->mVolumeSliderPopup->isVisible() ); +} + +void TestMpVolumeSlider::testHandleVolumeProperty() +{ + MpEngine *mpEngineInstance = MpEngineFactory::sharedEngine(); + connect( this, SIGNAL(triggerVolumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), + mpEngineInstance, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); + + emit triggerVolumePropertyChanged( MpCommon::MaxVolume, 100 ); + QCOMPARE( mTest->mEngineDataCompleted, 0x01 ); + QCOMPARE( mTest->mEngineVolumeMax, 100 ); + QVERIFY( !mTest->mVolumeSliderPopup ); + + emit triggerVolumePropertyChanged( MpCommon::Volume, 0 ); + QCOMPARE( mTest->mEngineDataCompleted, 0x03 ); + QCOMPARE( mTest->mEngineVolumeLevel, 0 ); + QVERIFY( mTest->mEngineMuted ); + QVERIFY( !mTest->mVolumeSliderPopup ); + emit triggerVolumePropertyChanged( MpCommon::Volume, 30 ); + QCOMPARE( mTest->mEngineDataCompleted, 0x03 ); + QCOMPARE( mTest->mEngineVolumeLevel, 30 ); + QVERIFY( !mTest->mEngineMuted ); + QVERIFY( !mTest->mVolumeSliderPopup ); + mTest->mEngineDataCompleted = 0x07; + emit triggerVolumePropertyChanged( MpCommon::Volume, 40 ); + QCOMPARE( mTest->mEngineDataCompleted, 0x07 ); + QCOMPARE( mTest->mEngineVolumeLevel, 40 ); + QVERIFY( !mTest->mEngineMuted ); + QVERIFY( mTest->mVolumeSliderPopup->isVisible() ); + + mTest->mEngineDataCompleted = 0x03; + mTest->mVolumeSliderPopup->setVisible( false ); + emit triggerVolumePropertyChanged( MpCommon::MuteState, 1 ); + QCOMPARE( mTest->mEngineDataCompleted, 0x07 ); + QVERIFY( mTest->mEngineMuted ); + QVERIFY( !mTest->mVolumeSliderPopup->isVisible() ); + emit triggerVolumePropertyChanged( MpCommon::MuteState, 0 ); + QCOMPARE( mTest->mEngineDataCompleted, 0x07 ); + QVERIFY( !mTest->mEngineMuted ); + QVERIFY( mTest->mVolumeSliderPopup->isVisible() ); +} + +void TestMpVolumeSlider::testSliderPressed() +{ + mTest->mEngineMuted = false; + mTest->mEngineVolumeLevel = 20; + mTest->mEngineVolumeMax = 100; + mTest->initializeVolumeSliderPopup(); + connect( this, SIGNAL( triggerSliderPressed() ), + mTest->mVolumeSliderPopup, SIGNAL( sliderPressed() ) ); + + emit triggerSliderPressed(); + QVERIFY( mTest->mSliderPressed ); +} + +void TestMpVolumeSlider::testSliderReleased() +{ + mTest->mEngineMuted = false; + mTest->mEngineVolumeLevel = 20; + mTest->mEngineVolumeMax = 100; + mTest->initializeVolumeSliderPopup(); + connect( this, SIGNAL( triggerSliderReleased() ), + mTest->mVolumeSliderPopup, SIGNAL( sliderReleased() ) ); + mTest->mSliderPressed = true; + + emit triggerSliderReleased(); + QVERIFY( !mTest->mSliderPressed ); +} + +void TestMpVolumeSlider::testMuteIconClicked() +{ + mTest->mEngineMuted = false; + mTest->mEngineVolumeLevel = 20; + mTest->mEngineVolumeMax = 100; + mTest->initializeVolumeSliderPopup(); + connect( this, SIGNAL( triggerIconClicked() ), + mTest->mVolumeSliderPopup, SIGNAL( iconClicked() ) ); + + mTest->mVolumeSliderPopup->setValue( 0 ); + emit triggerIconClicked(); + QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdMuteVolume ); + QVERIFY( mTest->mEngineMuted ); + + mTest->mVolumeSliderPopup->setValue( 1 ); + emit triggerIconClicked(); + QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdUnmuteVolume ); + QVERIFY( !mTest->mEngineMuted ); +} + +void TestMpVolumeSlider::testVolumeSliderChanged() +{ + mTest->mEngineMuted = false; + mTest->mEngineVolumeLevel = 20; + mTest->mEngineVolumeMax = 100; + mTest->initializeVolumeSliderPopup(); + connect( this, SIGNAL( triggerValueChanged( int ) ), + mTest->mVolumeSliderPopup, SIGNAL( valueChanged( int ) ) ); + + mTest->mEngineVolumeLevel = 60; + mTest->mEngineMuted = false; + // Same values slider and engine + emit triggerValueChanged( 6 ); + QTest::qWait(25); + QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdNone ); + QCOMPARE( mTest->mMpEngine->iCommandValue, -1 ); + // Slider value smaller than engine + mTest->mMpEngine->iMediaCommandReceived = CmdNone; + mTest->mMpEngine->iCommandValue = -1; + emit triggerValueChanged( 0 ); + QTest::qWait(25); + QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdSetVolumeLevel ); + QCOMPARE( mTest->mMpEngine->iCommandValue, 0 ); + // Slider value bigger than engine + mTest->mMpEngine->iMediaCommandReceived = CmdNone; + mTest->mMpEngine->iCommandValue = -1; + emit triggerValueChanged( 7 ); + QTest::qWait(25); + QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdSetVolumeLevel ); + QCOMPARE( mTest->mMpEngine->iCommandValue, 70 ); + + mTest->mEngineMuted = true; + // Slider changes to 0 while engine in mute state. + mTest->mMpEngine->iMediaCommandReceived = CmdNone; + mTest->mMpEngine->iCommandValue = -1; + emit triggerValueChanged( 0 ); + QTest::qWait(25); + QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdNone ); + QCOMPARE( mTest->mMpEngine->iCommandValue, -1 ); + // Slider changes other than 0 while engine in mute state. + mTest->mMpEngine->iMediaCommandReceived = CmdNone; + mTest->mMpEngine->iCommandValue = -1; + emit triggerValueChanged( 8 ); + QTest::qWait(25); + QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdSetVolumeLevel ); + QCOMPARE( mTest->mMpEngine->iCommandValue, 80 ); +} + +void TestMpVolumeSlider::testInitializeVolumeSliderPopup() +{ + mTest->mEngineMuted = false; + mTest->mEngineVolumeLevel = 20; + mTest->mEngineVolumeMax = 100; + + mTest->initializeVolumeSliderPopup(); + QVERIFY( mTest->mVolumeSliderPopup ); + QCOMPARE( mTest->mVolumeSliderPopup->mMinRange, 0 ); + QCOMPARE( mTest->mVolumeSliderPopup->mMaxRange, 10 ); + QCOMPARE( mTest->mVolumeSliderPopup->mSingleStep, 1 ); + QCOMPARE( mTest->mVolumeSliderPopup->mSliderTickPosition, Hb::NoSliderTicks ); + QCOMPARE( mTest->mSliderStep, 10 ); +} + + +// End of file diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/inc/hbvolumesliderpopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/inc/hbvolumesliderpopup.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: hbvolumesliderpopup stub for testing mpvolumeslider +* +*/ + + +#ifndef HBVOLUMESLIDERPOPUP_H +#define HBVOLUMESLIDERPOPUP_H + +#include + +namespace Hb +{ + enum SliderTickPosition { + NoSliderTicks = 0, + SliderTicksAbove = 1, + SliderTicksLeft = SliderTicksAbove, + SliderTicksBelow = 2, + SliderTicksRight = SliderTicksBelow, + SliderTicksBothSides = 3, + SliderTicksAbsolute + }; + + Q_DECLARE_FLAGS(SliderTickPositions , SliderTickPosition) +} + +class HbVolumeSliderPopup : public QObject +{ + Q_OBJECT + +public: + explicit HbVolumeSliderPopup( QObject *parent = 0 ); + virtual ~HbVolumeSliderPopup(); + + int value() const; + bool isVisible() const; + void setVisible(bool visible); + void setRange(int min, int max); + void setSingleStep(int step); + void setTickPosition(Hb::SliderTickPositions position); + +signals : + void sliderPressed(); + void sliderReleased(); + void iconClicked(); + void valueChanged(int value); + +public slots: + void setValue(int value); + +public: + int mValue; + int mMinRange; + int mMaxRange; + int mSingleStep; + bool mVisible; + Hb::SliderTickPositions mSliderTickPosition; +}; + +#endif // HBVOLUMESLIDERPOPUP_H + +// End of File diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/inc/mpenginefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/inc/mpenginefactory.h Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub for testing mpvolumeslider +* +*/ + +#ifndef MPENGINEFACTORY_H +#define MPENGINEFACTORY_H + +#include + +#include "mpcommondefs.h" + +enum MediaCommandReceived{ + CmdNone, + CmdPlay, + CmdPause, + CmdPlayPause, + CmdStop, + CmdSkipForward, + CmdStartSeekForward, + CmdStopSeeking, + CmdSkipBackward, + CmdStartSeekBackward, + CmdIncreaseVolume, + CmdDecreaseVolume, + CmdSetVolumeLevel, + CmdMuteVolume, + CmdUnmuteVolume + }; + +enum MediaPropertyRequested{ + PropNone, + PropVolumeLevelMax, + PropVolumeLevel, + PropVolumeMuteState + }; + +class MpEngine : public QObject +{ + Q_OBJECT + +public: + // Stub functions + MpEngine(); + +public: + // Playback related + void play(); + void pause(); + void playPause(); + void stop(); + void skipForward(); + void startSeekForward(); + void stopSeeking(); + void skipBackward(); + void startSeekBackward(); + void getMaxVolume(); + void getVolume(); + void increaseVolume(); + void decreaseVolume(); + void setVolume( int value ); + void getMuteState(); + void mute(); + void unmute(); + +signals: + void volumePropertyChanged( MpCommon::MpVolumeProperty property, int value ); + +public: + MediaCommandReceived iMediaCommandReceived; + QList iMediaPropertyRequested; + int iCommandValue; + +}; + +class MpEngineFactory : public QObject +{ + Q_OBJECT + +public: + // Stub functions +private: + explicit MpEngineFactory(); + +public: + virtual ~MpEngineFactory(); + static MpEngineFactory * instance(); + static MpEngine *sharedEngine(); + static void close(); + +private: + MpEngine *mSharedEngine; + +}; + + +#endif // MPENGINEFACTORY_H diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/src/hbvolumesliderpopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/src/hbvolumesliderpopup.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: hbvolumesliderpopup stub for testing mpvolumeslider +* +*/ + + +#include "stub/inc/hbvolumesliderpopup.h" + +/* + * Stub function + */ +HbVolumeSliderPopup::HbVolumeSliderPopup( QObject *parent ) + : QObject( parent ), + mValue( 0 ), + mMinRange( 0 ), + mMaxRange( 0 ), + mSingleStep( 0 ), + mVisible( false ), + mSliderTickPosition( Hb::SliderTicksAbsolute ) +{ +} + +/* + * Stub function + */ +HbVolumeSliderPopup::~HbVolumeSliderPopup() +{ +} + +/* + * Stub function + */ +int HbVolumeSliderPopup::value() const +{ + return mValue; +} + +/* + * Stub function + */ +bool HbVolumeSliderPopup::isVisible() const +{ + return mVisible; +} + +/* + * Stub function + */ +void HbVolumeSliderPopup::setVisible(bool visible) +{ + mVisible = visible; +} + +/* + * Stub function + */ +void HbVolumeSliderPopup::setRange(int min, int max) +{ + mMinRange = min; + mMaxRange = max; +} + +/* + * Stub function + */ +void HbVolumeSliderPopup::setSingleStep(int step) +{ + mSingleStep = step; +} + +/* + * Stub function + */ +void HbVolumeSliderPopup::setTickPosition(Hb::SliderTickPositions position) +{ + mSliderTickPosition = position; +} + +/* + * Stub function + */ +void HbVolumeSliderPopup::setValue(int value) +{ + mValue = value; +} + +//end of file diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/src/mpenginefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/src/mpenginefactory.cpp Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpEngineFactory stub for testing MpMediaKeyHandler +* +*/ + + +#include "stub/inc/mpenginefactory.h" + +/*! + * Stub function + */ +MpEngine::MpEngine() + : iMediaCommandReceived( CmdNone ), + iCommandValue( -1 ) +{ +} + + +/*! + * Stub function + */ + +void MpEngine::play() +{ + iMediaCommandReceived = CmdPlay; +} + +/*! + * Stub function + */ +void MpEngine::pause() +{ + iMediaCommandReceived = CmdPause; +} + +/*! + * Stub function + */ +void MpEngine::playPause() +{ + iMediaCommandReceived = CmdPlayPause; +} + +/*! + * Stub function + */ +void MpEngine::stop() +{ + iMediaCommandReceived = CmdStop; +} + +/*! + * Stub function + */ +void MpEngine::skipForward() +{ + iMediaCommandReceived = CmdSkipForward; +} + +/*! + * Stub function + */ +void MpEngine::startSeekForward() +{ + iMediaCommandReceived = CmdStartSeekForward; +} + +/*! + * Stub function + */ +void MpEngine::stopSeeking() +{ + iMediaCommandReceived = CmdStopSeeking; +} + +/*! + * Stub function + */ +void MpEngine::skipBackward() +{ + iMediaCommandReceived = CmdSkipBackward; +} + +/*! + * Stub function + */ +void MpEngine::startSeekBackward() +{ + iMediaCommandReceived = CmdStartSeekBackward; +} + +/*! + * Stub function + */ +void MpEngine::getMaxVolume( ) +{ + iMediaPropertyRequested << PropVolumeLevelMax; +} + +/*! + * Stub function + */ +void MpEngine::getVolume( ) +{ + iMediaPropertyRequested << PropVolumeLevel; +} + +/*! + * Stub function + */ +void MpEngine::increaseVolume() +{ + iMediaCommandReceived = CmdIncreaseVolume; +} + +/*! + * Stub function + */ +void MpEngine::decreaseVolume() +{ + iMediaCommandReceived = CmdDecreaseVolume; +} + +/*! + * Stub function + */ +void MpEngine::setVolume( int value ) +{ + iMediaCommandReceived = CmdSetVolumeLevel; + iCommandValue = value; +} + +/*! + * Stub function + */ +void MpEngine::getMuteState( ) +{ + iMediaPropertyRequested << PropVolumeMuteState; +} + +/*! + * Stub function + */ +void MpEngine::mute() +{ + iMediaCommandReceived = CmdMuteVolume; +} + +/*! + * Stub function + */ +void MpEngine::unmute() +{ + iMediaCommandReceived = CmdUnmuteVolume; +} + + +//============= MpEngineFactory ============= + +/*! + * Stub function + */ +MpEngineFactory::MpEngineFactory() + : mSharedEngine( 0 ) +{ +} + +/*! + * Stub function + */ +MpEngineFactory::~MpEngineFactory() +{ + delete mSharedEngine; + mSharedEngine = 0; +} + +/*! + * Stub function + */ +MpEngineFactory * MpEngineFactory::instance() +{ + static MpEngineFactory instance; + return &instance; +} + +/*! + * Stub function + */ +MpEngine *MpEngineFactory::sharedEngine() +{ + if ( !instance()->mSharedEngine ) { + instance()->mSharedEngine = new MpEngine(); + } + return instance()->mSharedEngine; +} + +/*! + * Stub function + */ +void MpEngineFactory::close() +{ + if ( instance()->mSharedEngine ) { + delete instance()->mSharedEngine; + instance()->mSharedEngine = 0; + } +} diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/unittest_mpvolumeslider.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/unittest_mpvolumeslider.pro Fri Aug 06 16:51:36 2010 -0500 @@ -0,0 +1,44 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: mpvolumeslider unit test project file. +# + +TEMPLATE = app +CONFIG += qtestlib symbian_test +TARGET = unittest_mpvolumeslider +TARGET.CAPABILITY = CAP_APPLICATION + +symbian: { + MMP_RULES += SMPSAFE +} + +DEPENDPATH += . +INCLUDEPATH += . \ + stub/inc \ + ../../inc \ + ../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lestor \ + -lfbscli + +HEADERS += stub/inc/mpenginefactory.h \ + stub/inc/hbvolumesliderpopup.h \ + inc/unittest_mpvolumeslider.h \ + ../../inc/mpvolumeslider.h + +SOURCES += stub/src/mpenginefactory.cpp \ + stub/src/hbvolumesliderpopup.cpp \ + src/unittest_mpvolumeslider.cpp + diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpnowplayingbanner/mpnowplayingbanner.pro --- a/utilities/mpnowplayingbanner/mpnowplayingbanner.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/utilities/mpnowplayingbanner/mpnowplayingbanner.pro Fri Aug 06 16:51:36 2010 -0500 @@ -45,3 +45,4 @@ RESOURCES += resources/mpnowplayingbanner.qrc +DOCML += resources/nowplaying.docml diff -r 612c4815aebe -r 4cc1412daed0 utilities/mpnowplayingbanner/resources/mpnowplayingbanner.qrc --- a/utilities/mpnowplayingbanner/resources/mpnowplayingbanner.qrc Fri Jul 23 17:31:12 2010 -0500 +++ b/utilities/mpnowplayingbanner/resources/mpnowplayingbanner.qrc Fri Aug 06 16:51:36 2010 -0500 @@ -1,6 +1,6 @@ - nowplaying.docml + nowplaying.docml.bin banner_color.css diff -r 612c4815aebe -r 4cc1412daed0 utilities/tsrc/tsrc.pro --- a/utilities/tsrc/tsrc.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/utilities/tsrc/tsrc.pro Fri Aug 06 16:51:36 2010 -0500 @@ -17,7 +17,8 @@ TEMPLATE = subdirs SUBDIRS += ../mpnowplayingbanner/tsrc \ - ../mpsettingsmanager/tsrc + ../mpsettingsmanager/tsrc \ + ../mpmediacontroller/tsrc CONFIG += ordered diff -r 612c4815aebe -r 4cc1412daed0 utilities/utilities.pro --- a/utilities/utilities.pro Fri Jul 23 17:31:12 2010 -0500 +++ b/utilities/utilities.pro Fri Aug 06 16:51:36 2010 -0500 @@ -17,7 +17,7 @@ TEMPLATE = subdirs SUBDIRS = mpnowplayingbanner \ mpsettingsmanager \ - mpalbumcoverwidget - + mpalbumcoverwidget \ + mpmediacontroller CONFIG += ordered