# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277306056 -10800 # Node ID adbe7d5ba2f57f2e53fce9c3fcbcfa03b976df3b # Parent c48470be1ba700561c7070c880e3ebdabf11eeba Revision: 201023 Kit: 2010125 diff -r c48470be1ba7 -r adbe7d5ba2f5 inc/videoactivitystate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/videoactivitystate.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VideoActivityState class definition +* +*/ + +// Version : %version: 1 % + +#ifndef __VIDEOACTIVITYSTATE_H__ +#define __VIDEOACTIVITYSTATE_H__ + +#include +#include +#include "videoplayerappexport.h" + +// videoplayer activity id +static const QString ACTIVITY_VIDEOPLAYER_MAINVIEW = "VideosMainView"; + + +namespace VideoActivityData +{ + // consts to be used as key values + // plugin type (int): collectionplugin or videoplaybackplugin + static const QString KEY_VIEWPLUGIN_TYPE = "_VideoActivity_viewplugin_type_"; + + // type of collectionview plugin's widget level(int): + // all videos, collections or collection video list + static const QString KEY_WIDGET_LEVEL = "_VideoActivity_widget_level_"; + + // id of the collection whose videolist is to be shown (int). + static const QString KEY_WIDGET_ID = "_VideoActivity_view_item_id_"; + + // for playback plugin: view to activate either play or details + static const QString KEY_PLAYB_VIEW = "_VideoActivity_playb_view_type_"; + + // for playback plugin: video path + static const QString KEY_VIDEO_PATH = "_VideoActivity_video_path_"; + + // for playback plugin: video playback position + static const QString KEY_VIDEO_POS = "_VideoActivity_video_pos_"; + + // for playback plugin: video playback state + static const QString KEY_PLAYB_STATE = "_VideoActivity_playb_state_"; + + // for playback plugin: video playback volume + static const QString KEY_PLAYB_VOLUME = "_VideoActivity_playb_volume_"; + +} + +/** + * Class is used as a static activity data container for videoplayer application + * for other videoplayer components to use. + * + * Data is excepted to be saved as QHash. Keys defined above + * should be used to access data + * + */ +class VIDEOPLAYERAPP_DLL_EXPORT VideoActivityState +{ + +public: + + /** + * method returns a static instance of this class + */ + static VideoActivityState &instance(); + + /** + * Sets activity data. If dataKey is not defined, all activity data + * will be overwritten by a provided data. + * + * @param data Data to save + * @param dataKey Key indicating dataitem. If empty, all data will be overwritten by provided data + */ + void setActivityData(const QVariant& data, const QString& dataKey = QString("")); + + /** + * Get activity data. If dataKey is not defined, all activity data + * will be returned. If item corresponding provided dataKey is not found, + * method returns empty QVariant. + * + * @param dataKey Key indicating dataitem client wants. If empty, all data will be returned + * + * @return QVariant + */ + const QVariant getActivityData(const QString& dataKey = QString("")); + +private: + + /** + * private default contructor + */ + VideoActivityState(); + + /** + * copy contructor definition + */ + VideoActivityState(const VideoActivityState& other); + + /** + * Private destructor. + * + */ + virtual ~VideoActivityState(); + +private: + + /** + * locally saved activity data + */ + QHash mActivityData; + +}; + +#endif //__VIDEOACTIVITYSTATE_H__ diff -r c48470be1ba7 -r adbe7d5ba2f5 layers.sysdef.xml --- a/layers.sysdef.xml Fri Jun 11 13:39:54 2010 +0300 +++ b/layers.sysdef.xml Wed Jun 23 18:14:16 2010 +0300 @@ -14,7 +14,7 @@ - + @@ -40,10 +40,10 @@ - + - + diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/mediasettings.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/mediasettings.pro Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Project file for building Videoplayer components +# +# + +TEMPLATE = subdirs +CONFIG += ordered +symbian: { +BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"group/bld.inf\"" + +#SUBDIRS += videosettingsplugin +} + \ No newline at end of file diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/inc/videosettingsaccesspointentry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/inc/videosettingsaccesspointentry.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef VIDEOSETTINGSACCESSPOINTENTRY_H +#define VIDEOSETTINGSACCESSPOINTENTRY_H + +#include +#include + +class VideoSettingsGroup; +class CmConnectionMethodShim; +class CmManagerShim; + +class VideoSettingsAccessPointEntry : public CpSettingFormEntryItemData +{ + Q_OBJECT +public: + + /** + * Constructor + */ + VideoSettingsAccessPointEntry(CpItemDataHelper &itemDataHelper, + const QString& text = QString(), + VideoSettingsGroup *parent = 0); + + /** + * Destructor + */ + ~VideoSettingsAccessPointEntry(); + + /** + * sets the iap id. + * + * @param apId The iap id. + */ + void setIapId(const uint& apId); + +private: + + /** + * From CpSettingFormEntryItemData. + * + * Creates a view for this, if needed. In our case always + * returns 0 as we don't want a new view. + */ + virtual CpBaseSettingView *createSettingView() const; + + /** + * Convinience method for fetching a connection method + * with a given id. + * + * @param id Connection method id. + * @return The connection method object. + */ + CmConnectionMethodShim* getConnectionMethod(const uint& id); + + /** + * Fetches the connection name from the given connection method + * and sets it as the description for this. + */ + void setAccessPointName(CmConnectionMethodShim* connMethod); + +private slots: + + /** + * Slot that is called when the button is pressed. + * Opens the access point selection dialog. + */ + void openSelectionDialogSlot(); + + /** + * Slot that is called when the access point selection + * dialog closes. + * + * @param error Possible error code. One from enum + * CmApplSettingsUi::ApplSettingsError. + */ + void accessPointDialogFinished(uint error); + +private: + + /** + * The VideoSettingsGroup. + */ + VideoSettingsGroup* mParent; + + /** + * The access point selection dialog. + */ + CmApplSettingsUi* mApplSettings; + + /** + * The current access point selection. + */ + CmApplSettingsUi::SettingSelection mSelection; + + /** + * The manager that handles all destinations and connection methods. + * Used for getting the connection methods. + */ + CmManagerShim* mCmManager; + +}; + +#endif // VIDEOSETTINGSACCESSPOINTENTRY_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/inc/videosettingsgroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/inc/videosettingsgroup.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef VIDEOSETTINGSGROUP_H +#define VIDEOSETTINGSGROUP_H + +#include +#include + +class CpItemDataHelper; +class CMPSettingsModel; +class VideoSettingsAccessPointEntry; + +class VideoSettingsGroup : public CpSettingFormItemData +{ + Q_OBJECT +public: + + /** + * Constructor + */ + VideoSettingsGroup(CpItemDataHelper &itemDataHelper); + + /** + * Destructor + */ + ~VideoSettingsGroup(); + + /** + * Getter for the default access point id. + * + * @return Default access point id. + */ + uint getAccessPointId(); + + /** + * Setter for the default access point id. + * + * @param defaultAp Access point id. + */ + void setAccessPointId(const uint& defaultAp); + +private slots: + + /** + * Slot for when mLowestUDPPortItem editing finishes. + */ + void lowestUdpPortEditingFinished(); + + /** + * Slot for when mHighestUDPPortItem editing finishes. + */ + void highestUdpPortEditingFinished(); + + /** + * Slot for when mUseProxyItem editing finishes. + */ + void useProxyToggled(int state); + + /** + * Slot for when mProxyServerItem editing finishes. + */ + void proxyServerEditingFinished(); + + /** + * Slot for when mProxyPortItem editing finishes. + */ + void proxyPortEditingFinished(); + + /** + * Called when item is shown. Connected to the form's + * itemShown signal. + */ + void itemShown(const QModelIndex& index); + +private: + + /** + * Initializes the mSettingsModel. + */ + void InitSettingsModelL(); + + /** + * Loads all settings data from the mSettingsModel to items. + */ + void loadSettings(); + +private: + + /** + * Item data helper given by the CP framework. + */ + CpItemDataHelper& mItemDataHelper; + + /** + * The settings model where settings are loaded and saved. + */ + CMPSettingsModel* mSettingsModel; + + /** + * The access point multiselect item. + */ + VideoSettingsAccessPointEntry *mAccessPointItem; + + /** + * The lowest UDP port text item. + */ + CpSettingFormItemData *mLowestUDPPortItem; + + /** + * The highest UDP port text item. + */ + CpSettingFormItemData *mHighestUDPPortItem; + + /** + * The use proxy checkbox item. + */ + CpSettingFormItemData *mUseProxyItem; + + /** + * The proxy server text item. + */ + CpSettingFormItemData *mProxyServerItem; + + /** + * The proxy port text item. + */ + CpSettingFormItemData *mProxyPortItem; +}; + +#endif // VIDEOSETTINGSGROUP_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/inc/videosettingsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/inc/videosettingsplugin.h Wed Jun 23 18:14:16 2010 +0300 @@ -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: + * + */ +#ifndef VIDEOSETTINGSPLUGIN_H +#define VIDEOSETTINGSPLUGIN_H + +#include +#include + +class VideoSettingsPlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) + +public: + + /** + * Constructor + */ + VideoSettingsPlugin(); + + /** + * Destructor + */ + virtual ~VideoSettingsPlugin(); + + /** + * Creates the CpSettingFormItemData for video settings to be shown in control panel. + */ + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif // VIDEOSETTINGSPLUGIN_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/rom/videosettingsplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/rom/videosettingsplugin.iby Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,28 @@ +/* +* 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: +* +*/ + +#ifndef __VIDEOSETTINGSPLUGIN_IBY__ +#define __VIDEOSETTINGSPLUGIN_IBY__ + +#include +#include + +file=ABI_DIR/BUILD_DIR/videosettingsplugin.dll SHARED_LIB_DIR/videosettingsplugin.dll + +data=/epoc32/data/c/resource/qt/plugins/controlpanel/videosettingsplugin.qtplugin resource/qt/plugins/controlpanel/videosettingsplugin.qtplugin + +#endif // __VIDEOSETTINGSPLUGIN_IBY__ diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/src/videosettingsaccesspointentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/src/videosettingsaccesspointentry.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 "mpxvideo_debug.h" +#include "videosettingsaccesspointentry.h" +#include "videosettingsgroup.h" +#include +#include +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoSettingsAccessPointEntry::VideoSettingsAccessPointEntry( + CpItemDataHelper &itemDataHelper, + const QString& text, + VideoSettingsGroup *parent) : + CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, + itemDataHelper, text, QString(), QString(), parent), + mParent(parent) +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::VideoSettingsAccessPointEntry()")); + + itemDataHelper.addConnection(this,SIGNAL(clicked()),this,SLOT(openSelectionDialogSlot())); + mApplSettings = new CmApplSettingsUi(this); + connect(mApplSettings, SIGNAL(finished(uint)), this, SLOT(accessPointDialogFinished(uint))); + mSelection.result = CmApplSettingsUi::SelectionTypeConnectionMethod; + mSelection.id = 0; + mCmManager = new CmManagerShim(); +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoSettingsAccessPointEntry::~VideoSettingsAccessPointEntry() +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::~VideoSettingsAccessPointEntry()")); + + delete mCmManager; +} + +// --------------------------------------------------------------------------- +// accessPointNameFromIapId +// --------------------------------------------------------------------------- +// +void VideoSettingsAccessPointEntry::setIapId(const uint& apId) +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::accessPointNameFromIapId()"), + _L("apId = %i"), apId); + + QList cmArray; + mCmManager->connectionMethod(cmArray, false); + + bool found = false; + foreach(uint id, cmArray) + { + CmConnectionMethodShim* connMethod = getConnectionMethod(id); + if(connMethod && connMethod->getIntAttribute(CMManagerShim::CmIapId) == apId) + { + mSelection.id = connMethod->getIntAttribute(CMManagerShim::CmId); + setAccessPointName(connMethod); + found = true; + break; + } + } + + if(!found) + { + this->setDescription(hbTrId("txt_videos_dblist_none")); + } +} + +// --------------------------------------------------------------------------- +// createSettingView +// --------------------------------------------------------------------------- +// +CpBaseSettingView* VideoSettingsAccessPointEntry::createSettingView() const +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::createSettingView()")); + + // does not create a new view. + return 0; +} + +// --------------------------------------------------------------------------- +// getConnectionMethod +// --------------------------------------------------------------------------- +// +CmConnectionMethodShim* VideoSettingsAccessPointEntry::getConnectionMethod(const uint& id) +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::getConnectionMethod()")); + + CmConnectionMethodShim* connMethod = 0; + try { + connMethod = mCmManager->connectionMethod(id); + } catch (const std::exception& exc) { + MPX_DEBUG(_L("Caught exception while fetching connection method. Exception: %s"), exc.what()); + return 0; + } + + return connMethod; +} + +// --------------------------------------------------------------------------- +// setName +// --------------------------------------------------------------------------- +// +void VideoSettingsAccessPointEntry::setAccessPointName(CmConnectionMethodShim* connMethod) +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::setAccessPointName()")); + + QString name = connMethod->getStringAttribute(CMManagerShim::CmName); + this->setDescription(name); +} + +// --------------------------------------------------------------------------- +// openSelectionDialogSlot +// --------------------------------------------------------------------------- +// +void VideoSettingsAccessPointEntry::openSelectionDialogSlot() +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::openSelectionDialogSlot()")); + + QFlags listItems; + QSet filter; + + listItems |= CmApplSettingsUi::ShowConnectionMethods; + + mApplSettings->setOptions(listItems, filter); + mApplSettings->setSelection(mSelection); + + mApplSettings->open(); +} + +// --------------------------------------------------------------------------- +// accessPointDialogFinished +// --------------------------------------------------------------------------- +// +void VideoSettingsAccessPointEntry::accessPointDialogFinished(uint error) +{ + MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::accessPointDialogFinished()"), + _L("error = %i"), error); + + if(error == CmApplSettingsUi::ApplSettingsErrorNone) + { + CmApplSettingsUi::SettingSelection selection = + mApplSettings->selection(); + MPX_DEBUG(_L("New access point connection method id = %i"), selection.id); + CmConnectionMethodShim* connMethod = getConnectionMethod(selection.id); + if(connMethod) + { + mSelection.id = selection.id; + mParent->setAccessPointId(connMethod->getIntAttribute(CMManagerShim::CmIapId)); + setAccessPointName(connMethod); + } + else + { + MPX_DEBUG(_L("FATAL: Could not find connection method with id %i"), selection.id); + } + } +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/src/videosettingsgroup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/src/videosettingsgroup.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 "mpxvideo_debug.h" +#include "videosettingsgroup.h" +#include "videosettingsaccesspointentry.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoSettingsGroup::VideoSettingsGroup(CpItemDataHelper &itemDataHelper) : + CpSettingFormItemData(HbDataFormModelItem::GroupItem, QString()), + mItemDataHelper(itemDataHelper), + mSettingsModel(0), + mAccessPointItem(0), + mLowestUDPPortItem(0), + mHighestUDPPortItem(0), + mUseProxyItem(0), + mProxyServerItem(0), + mProxyPortItem(0) +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::VideoSettingsGroup()")); + + // Load the translation file. + QString lang = QLocale::system().name(); + QTranslator translator; + bool loaded(false); + + loaded = translator.load( "videos_" + lang, QString("c:/resource/qt/translations") ); + + if (!loaded) + { + translator.load("videos_" + lang, QString("z:/resource/qt/translations") ); + } + + // Install the translator + HbApplication* app = qobject_cast(qApp); + if(app) + { + app->installTranslator(&translator); + } + + this->setLabel(hbTrId("txt_videos_subhead_video_streaming_settings")); + + TRAPD(err, InitSettingsModelL()); + if(err != KErrNone) + { + delete mSettingsModel; + mSettingsModel = 0; + return; + } + + itemDataHelper.connectToForm(SIGNAL(itemShown(const QModelIndex)), this, SLOT(itemShown(const QModelIndex))); + + // Access point in use + mAccessPointItem = new VideoSettingsAccessPointEntry(itemDataHelper, + hbTrId("txt_videos_dblist_access_point"), this); + this->appendChild(mAccessPointItem); + + // Lowest UDP port + mLowestUDPPortItem = new CpSettingFormItemData(HbDataFormModelItem::TextItem, + hbTrId("txt_videos_dblist_min_udp_port")); + mLowestUDPPortItem->setContentWidgetData(QString("maxRows"), 1); + mItemDataHelper.addConnection(mLowestUDPPortItem, SIGNAL(editingFinished()), + this, SLOT(lowestUdpPortEditingFinished())); + this->appendChild(mLowestUDPPortItem); + + // Highest UDP port + mHighestUDPPortItem = new CpSettingFormItemData(HbDataFormModelItem::TextItem, + hbTrId("txt_videos_dblist_max_udp_port")); + mHighestUDPPortItem->setContentWidgetData(QString("maxRows"), 1); + mItemDataHelper.addConnection(mHighestUDPPortItem, SIGNAL(editingFinished()), + this, SLOT(highestUdpPortEditingFinished())); + this->appendChild(mHighestUDPPortItem); + + // Use proxy + mUseProxyItem = new CpSettingFormItemData(HbDataFormModelItem::CheckBoxItem, QString()); + mUseProxyItem->setContentWidgetData(QString("text"), hbTrId("txt_videos_formlabel_proxy_in_use")); + this->appendChild(mUseProxyItem); + + // Proxy server address + mProxyServerItem = new CpSettingFormItemData(HbDataFormModelItem::TextItem, + hbTrId("txt_videos_dblist_proxy_host_name")); + mProxyServerItem->setContentWidgetData(QString("maxRows"), 1); + mProxyServerItem->setContentWidgetData(QString("placeholderText"), hbTrId("txt_videos_dblist_none")); + mItemDataHelper.addConnection(mProxyServerItem, SIGNAL(editingFinished()), + this, SLOT(proxyServerEditingFinished())); + this->appendChild(mProxyServerItem); + + // Proxy port number + mProxyPortItem = new CpSettingFormItemData(HbDataFormModelItem::TextItem, + hbTrId("txt_videos_dblist_proxy_port")); + mProxyPortItem->setContentWidgetData(QString("maxRows"), 1); + mItemDataHelper.addConnection(mProxyPortItem, SIGNAL(editingFinished()), + this, SLOT(proxyPortEditingFinished())); + this->appendChild(mProxyPortItem); + + loadSettings(); +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoSettingsGroup::~VideoSettingsGroup() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::~VideoSettingsGroup()")); + + TRAP_IGNORE( mSettingsModel->StoreSettingsL() ); + + delete mSettingsModel; +} + +// --------------------------------------------------------------------------- +// getAccessPointId +// --------------------------------------------------------------------------- +// +uint VideoSettingsGroup::getAccessPointId() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::getAccessPointId()")); + + TUint32 defaultAp(0); + mSettingsModel->GetDefaultAp(defaultAp); + + MPX_DEBUG(_L("Returned access point id = %i"), defaultAp); + + return defaultAp; +} + +// --------------------------------------------------------------------------- +// setAccessPointId +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::setAccessPointId(const uint& defaultAp) +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::setAccessPointId()"), + _L("defaultAp = %i"), defaultAp); + + mSettingsModel->SetDefaultAp(defaultAp); +} + +// --------------------------------------------------------------------------- +// lowestUdpPortValueChanged +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::lowestUdpPortEditingFinished() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::lowestUdpPortValueChanged()")); + + int minPort = mLowestUDPPortItem->contentWidgetData(QString("text")).toString().toInt(); + int maxPort = mHighestUDPPortItem->contentWidgetData(QString("text")).toString().toInt(); + + MPX_DEBUG(_L("minudp = %i, maxudp = %i"), minPort, maxPort); + + if(minPort > maxPort) + { + minPort = maxPort; + mLowestUDPPortItem->setContentWidgetData(QString("text"), QString::number(minPort)); + } + + mSettingsModel->SetMinUDPPort(minPort); +} + +// --------------------------------------------------------------------------- +// highestUdpPortValueChanged +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::highestUdpPortEditingFinished() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::highestUdpPortValueChanged()")); + + int maxPort = mHighestUDPPortItem->contentWidgetData(QString("text")).toString().toInt(); + int minPort = mLowestUDPPortItem->contentWidgetData(QString("text")).toString().toInt(); + + MPX_DEBUG(_L("minudp = %i, maxudp = %i"), minPort, maxPort); + + if(maxPort < minPort) + { + maxPort = minPort; + mHighestUDPPortItem->setContentWidgetData(QString("text"), QString::number(maxPort)); + } + + mSettingsModel->SetMaxUDPPort(maxPort); +} + +// --------------------------------------------------------------------------- +// useProxyToggled +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::useProxyToggled(int state) +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::useProxyToggled()"), + _L("state = %i"), state); + + mProxyServerItem->setEnabled(state == Qt::Checked); + mProxyPortItem->setEnabled(state == Qt::Checked); + + mSettingsModel->SetProxyMode(state == Qt::Checked ? 1 : 0); +} + +// --------------------------------------------------------------------------- +// proxyServerValueChanged +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::proxyServerEditingFinished() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::proxyServerValueChanged()")); + + QString text = mProxyServerItem->contentWidgetData(QString("text")).toString(); + + MPX_DEBUG(_L("new proxy server = '%s'"), text.data()); + + HBufC* proxyServer = XQConversions::qStringToS60Desc(text); + TRAP_IGNORE( mSettingsModel->SetProxyHostNameL(*proxyServer) ); + delete proxyServer; +} + +// --------------------------------------------------------------------------- +// proxyPortValueChanged +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::proxyPortEditingFinished() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::proxyPortValueChanged()")); + + int proxyPort = mProxyPortItem->contentWidgetData(QString("text")).toString().toInt(); + + MPX_DEBUG(_L("new proxy port = %i"), proxyPort); + + mSettingsModel->SetProxyPort(proxyPort); +} + +// --------------------------------------------------------------------------- +// itemShown +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::itemShown(const QModelIndex& index) +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::itemShown()"), + _L("index row = %i"), index.row()); + + HbDataFormModelItem* modelItem = mItemDataHelper.modelItemFromModelIndex(index); + + if(modelItem == mLowestUDPPortItem || + modelItem == mHighestUDPPortItem || + modelItem == mProxyPortItem ) + { + HbLineEdit *editor = static_cast(mItemDataHelper.widgetFromModelIndex(index)); + + HbEditorInterface editorIf(editor); + editorIf.setFilter(HbDigitsOnlyFilter::instance()); + + HbValidator *validator = new HbValidator(this); + int lowestAllowedPort = modelItem == mProxyPortItem ? 1 : 1024; + validator->addField(new QIntValidator(lowestAllowedPort, 65535, validator), modelItem->contentWidgetData(QString("text")).toString()); + editor->setValidator(validator); + } + + if(modelItem == mProxyServerItem) + { + mItemDataHelper.addConnection(mUseProxyItem, SIGNAL(stateChanged(int)), this, SLOT(useProxyToggled(int))); + HbEditorInterface editor(mItemDataHelper.widgetFromModelIndex(index)); + editor.setFilter(HbUrlFilter::instance()); + } +} + +// --------------------------------------------------------------------------- +// InitSettingsModelL +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::InitSettingsModelL() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::InitSettingsModelL()")); + + TUid settingsUid = {KMPSettEngImplUidROP}; + mSettingsModel = CMPSettingsModel::NewL(settingsUid); + mSettingsModel->LoadSettingsL(EConfigUser); +} + +// --------------------------------------------------------------------------- +// loadSettings +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::loadSettings() +{ + MPX_ENTER_EXIT(_L("VideoSettingsGroup::loadSettings()")); + + int lowestUdpPort(0); + mSettingsModel->GetMinUDPPort(lowestUdpPort); + mLowestUDPPortItem->setContentWidgetData(QString("text"), QString::number(lowestUdpPort)); + + int highestUdpPort(0); + mSettingsModel->GetMaxUDPPort(highestUdpPort); + mHighestUDPPortItem->setContentWidgetData(QString("text"), QString::number(highestUdpPort)); + + int proxyMode(0); + mSettingsModel->GetProxyMode(proxyMode); + mUseProxyItem->setContentWidgetData(QString("checked"), proxyMode == 1); + useProxyToggled(proxyMode == 1 ? Qt::Checked : Qt::Unchecked); + + TBuf<2048> proxyServerBuf; + mSettingsModel->GetProxyHostName(proxyServerBuf); + QString proxyServer = XQConversions::s60DescToQString(proxyServerBuf); + mProxyServerItem->setContentWidgetData(QString("text"), proxyServer); + + int proxyPort; + mSettingsModel->GetProxyPort(proxyPort); + mProxyPortItem->setContentWidgetData(QString("text"), QString::number(proxyPort)); + + mAccessPointItem->setIapId(getAccessPointId()); +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/src/videosettingsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/src/videosettingsplugin.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "videosettingsplugin.h" +#include "videosettingsgroup.h" +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoSettingsPlugin::VideoSettingsPlugin() +{ +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoSettingsPlugin::~VideoSettingsPlugin() +{ +} + +// --------------------------------------------------------------------------- +// createSettingFormItemData +// --------------------------------------------------------------------------- +// +QList VideoSettingsPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + return QList() << new VideoSettingsGroup(itemDataHelper); +} + +Q_EXPORT_PLUGIN2(videosettingsplugin, VideoSettingsPlugin); diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/inc/testvideosettingsaccesspointentry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/inc/testvideosettingsaccesspointentry.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TestVideoSettingsAccessPointEntry class definition +* +*/ + +#ifndef TESTVIDEOSETTINGSACCESSPOINTENTRY_H +#define TESTVIDEOSETTINGSACCESSPOINTENTRY_H + + +// INCLUDES +#include + +class CpItemDataHelper; +class VideoSettingsAccessPointEntry; +class VideoSettingsGroup; + +class TestVideoSettingsAccessPointEntry : public QObject + { + + Q_OBJECT + +signals: + + void testSignal(); + +private slots: + + /** + * called at the very beginning of the test + */ + void initTestCase(); + + /** + * called at the very end of the test + */ + void cleanupTestCase(); + + /** + * called at the start of every test. + */ + void init(); + + /** + * called at the end of every test. + */ + void cleanup(); + + /** + * tests constructor + */ + void testConstructor(); + + /** + * tests destructor + */ + void testDestructor(); + + /** + * tests setIapId + */ + void testSetIapId(); + + /** + * tests createSettingsView + */ + void testCreateSettingView(); + + /** + * tests openSelectionDialogSlot + */ + void testOpenSelectionDialogSlot(); + + /** + * tests accessPointDialogFinished + */ + void testAccessPointDialogFinished(); + +private: + + CpItemDataHelper* mItemHelper; + + VideoSettingsGroup* mGroup; + + VideoSettingsAccessPointEntry* mTestObject; + + }; + +#endif // TESTVIDEOSETTINGSACCESSPOINTENTRY_H + +// End of File diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/src/testvideosettingsaccesspointentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/src/testvideosettingsaccesspointentry.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,243 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TestVideoSettingsAccessPointEntry class implementation +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "testvideosettingsaccesspointentry.h" +#include "videosettingsgroup.h" +#include "cmmanager_shim.h" +#include "cmconnectionmethod_shim.h" + +// trick to get access to protected/private members. +#define private public +#include "videosettingsaccesspointentry.h" +#undef private + +// --------------------------------------------------------------------------- +// initTestCase +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::initTestCase() +{ + mItemHelper = new CpItemDataHelper; + mGroup = new VideoSettingsGroup(*mItemHelper); +} + +// --------------------------------------------------------------------------- +// cleanupTestCase +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::cleanupTestCase() +{ + delete mGroup; + mGroup = 0; + delete mItemHelper; + mItemHelper = 0; +} + +// --------------------------------------------------------------------------- +// init +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::init() +{ + mTestObject = new VideoSettingsAccessPointEntry(*mItemHelper, QString("test"), mGroup); +} + +// --------------------------------------------------------------------------- +// cleanup +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::cleanup() +{ + delete mTestObject; + mTestObject = 0; +} + +// --------------------------------------------------------------------------- +// testConstructor +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::testConstructor() +{ + // verify clicked signal connection. + ConnectionHolder connection = mItemHelper->mConnections[mTestObject]; + QCOMPARE( connection.signal, SIGNAL(clicked()) ); + QVERIFY( connection.receiver == mTestObject ); + QCOMPARE( connection.method, SLOT(openSelectionDialogSlot()) ); + + // verify mApplSettings construction + QVERIFY( mTestObject->mApplSettings ); + QVERIFY( disconnect(mTestObject->mApplSettings, SIGNAL(finished(uint)), mTestObject, SLOT(accessPointDialogFinished(uint))) ); + connect(mTestObject->mApplSettings, SIGNAL(finished(uint)), mTestObject, SLOT(accessPointDialogFinished(uint))); + + // verify mSelection initial values + QVERIFY( mTestObject->mSelection.result == CmApplSettingsUi::SelectionTypeConnectionMethod ); + QVERIFY( mTestObject->mSelection.id == 0 ); + + // verify CmManagerShim construction + QVERIFY( mTestObject->mCmManager ); + + // verify base class 'construction' + QCOMPARE( mTestObject->mText, QString("test") ); + QVERIFY( mTestObject->mDescription.isNull() ); +} + +// --------------------------------------------------------------------------- +// testConstructor +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::testDestructor() +{ + CmManagerShim::mDestructorCount = 0; + cleanup(); + QCOMPARE( CmManagerShim::mDestructorCount, 1 ); +} + +// --------------------------------------------------------------------------- +// testSetIapId +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::testSetIapId() +{ + // with empty cmArray + mTestObject->setIapId(5); + QCOMPARE( mTestObject->mDescription, hbTrId("txt_videos_dblist_none") ); + + // with non-empty cmArray, but id is not found. + mTestObject->mCmManager->mConnectionMethods[0] = new CmConnectionMethodShim(0, 4, QString("0")); + mTestObject->mCmManager->mConnectionMethods[2] = new CmConnectionMethodShim(2, 6, QString("2")); + mTestObject->setIapId(5); + QCOMPARE( mTestObject->mDescription, hbTrId("txt_videos_dblist_none") ); + + // with non-empty cmArray, and id is found, but CmManagerShim throws at that id. + mTestObject->mCmManager->mConnectionMethods[1] = new CmConnectionMethodShim(1, 5, QString("1")); + CmManagerShim::mConnectionMethodThrowsAtId = 1; + mTestObject->setIapId(5); + QCOMPARE( mTestObject->mDescription, hbTrId("txt_videos_dblist_none") ); + + // with non-empty cmArray, and id is found. + CmManagerShim::mConnectionMethodThrowsAtId = -1; + mTestObject->setIapId(5); + QCOMPARE( mTestObject->mDescription, QString("1") ); + + // with non-empty cmArray, and id is found, but CmManagerShim throws at id before. + CmManagerShim::mConnectionMethodThrowsAtId = 0; + mTestObject->mDescription = QString(); + mTestObject->setIapId(5); + QCOMPARE( mTestObject->mDescription, QString("1") ); + + // with non-empty cmArray, and id is found, but CmManagerShim throws at id after. + CmManagerShim::mConnectionMethodThrowsAtId = 2; + mTestObject->mDescription = QString(); + mTestObject->setIapId(5); + QCOMPARE( mTestObject->mDescription, QString("1") ); +} + +// --------------------------------------------------------------------------- +// testCreateSettingView +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::testCreateSettingView() +{ + QVERIFY(mTestObject->callCreateSettingView() == 0 ); +} + +// --------------------------------------------------------------------------- +// testOpenSelectionDialogSlot +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::testOpenSelectionDialogSlot() +{ + connect(this, SIGNAL(testSignal()), mTestObject, SLOT(openSelectionDialogSlot())); + QSet filter; + filter.insert(1); + mTestObject->mApplSettings->mListItems = QFlags(); + mTestObject->mApplSettings->mBearerTypeFilter = filter; + mTestObject->mApplSettings->mOpenCallAmount = 0; + + emit testSignal(); + + QVERIFY( mTestObject->mApplSettings->mListItems.testFlag(CmApplSettingsUi::ShowConnectionMethods) ); + QVERIFY( mTestObject->mApplSettings->mListItems.testFlag(CmApplSettingsUi::ShowDestinations) == false); + QCOMPARE( mTestObject->mApplSettings->mBearerTypeFilter.count(), 0); + QVERIFY( mTestObject->mApplSettings->mSelection.result == CmApplSettingsUi::SelectionTypeConnectionMethod ); + QCOMPARE( mTestObject->mApplSettings->mOpenCallAmount, 1 ); +} + +// --------------------------------------------------------------------------- +// testAccessPointDialogFinished +// --------------------------------------------------------------------------- +// +void TestVideoSettingsAccessPointEntry::testAccessPointDialogFinished() +{ + // error + mTestObject->mApplSettings->mSelection.id = 5; + mTestObject->mSelection.id = 0; + mTestObject->mDescription = QString(); + mGroup->mApId = 0; + + mTestObject->mApplSettings->emitFinished(CmApplSettingsUi::ApplSettingsErrorCancel); + + QCOMPARE( mTestObject->mSelection.id, (uint)0 ); + + // no error + mTestObject->mDescription = QString(); + mTestObject->mCmManager->mConnectionMethods[5] = new CmConnectionMethodShim(5, 4, QString("5")); + + mTestObject->mApplSettings->emitFinished(CmApplSettingsUi::ApplSettingsErrorNone); + + QCOMPARE( mTestObject->mSelection.id, mTestObject->mApplSettings->mSelection.id ); + QCOMPARE( mGroup->mApId, (uint)4 ); + QCOMPARE( mTestObject->mDescription, QString("5") ); + + // no error, but CmManagerShim throws at that id. + mTestObject->mSelection.id = 0; + mTestObject->mDescription = QString(); + mGroup->mApId = 0; + CmManagerShim::mConnectionMethodThrowsAtId = 5; + + mTestObject->mApplSettings->emitFinished(CmApplSettingsUi::ApplSettingsErrorNone); + + QCOMPARE( mTestObject->mSelection.id, (uint)0 ); + QCOMPARE( mGroup->mApId, (uint)0 ); + QVERIFY( mTestObject->mDescription.isNull() ); +} + +// --------------------------------------------------------------------------- +// main +// --------------------------------------------------------------------------- +// +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + + TestVideoSettingsAccessPointEntry tc; + + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\testvideosettingsaccesspointentry.txt"; + + return QTest::qExec(&tc, 3, pass); +} + +// end of file diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cmapplsettingsui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cmapplsettingsui.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,105 @@ +/* +* 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: CmApplSettingsUi stub +* +*/ + +#ifndef CMAPPLSETTINGSUI_H +#define CMAPPLSETTINGSUI_H + +#include +#include +#include + +class CmApplSettingsUi : public QObject +{ + Q_OBJECT + +public: + + enum SelectionType + { + //! The user selected a destination + SelectionTypeDestination, + //! The user selected a connection method + SelectionTypeConnectionMethod + }; + + enum SelectionDialogItems + { + //! Support destination selection + ShowDestinations = 0x01, + //! Support connection method selection + ShowConnectionMethods = 0x02 + }; + + enum ApplSettingsError { + //! No error. Dialog succeeded. + ApplSettingsErrorNone = 0, + //! Selection was canceled. + ApplSettingsErrorCancel, + //! No items to show (e.g. too strict filters). + ApplSettingsErrorNoContent, + //! Settings reading failed. + ApplSettingsErrorSettingsRead + }; + + struct SettingSelection + { + SelectionType result; + uint id; + }; + + typedef uint BearerTypeFilter; + + /*! + Constructor. + + @param parent Parent object. + */ + explicit CmApplSettingsUi(QObject *parent = 0); + + /*! + Destructor. + */ + virtual ~CmApplSettingsUi(); + + void setOptions( + const QFlags &listItems, + const QSet &bearerFilter); + + void setSelection(const SettingSelection &selection); + + SettingSelection selection() const; + + void open(); + + void emitFinished(uint status); + +signals: + + void finished(uint status); + +public: // data + + SettingSelection mSelection; + + QFlags mListItems; + + QSet mBearerTypeFilter; + + int mOpenCallAmount; +}; + +#endif // CMAPPLSETTINGSUI_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cmconnectionmethod_shim.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cmconnectionmethod_shim.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: CmConnectionMethodShim stub + * + */ + +#ifndef CMCONNECTIONMETHOD_SHIM_H +#define CMCONNECTIONMETHOD_SHIM_H + +#include +#include +#include "cmmanager_shim.h" + +class CmConnectionMethodShim +{ + +public: + + /*! + * Constructor. + * + * @param[in] cm CM Manager connection method object. + */ + CmConnectionMethodShim(uint id, uint iapId, QString name); + + /*! + * Destructor. + */ + ~CmConnectionMethodShim(); + + uint getIntAttribute( + CMManagerShim::ConnectionMethodAttribute attribute) const; + + QString getStringAttribute( + CMManagerShim::ConnectionMethodAttribute attribute) const; + +public: // data + + QHash mAttributes; + +}; + +#endif /* CMCONNECTIONMETHOD_SHIM_H */ diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cmmanager_shim.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cmmanager_shim.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: CmManagerShim stub + */ + +#ifndef CMMANAGER_SHIM_H +#define CMMANAGER_SHIM_H + +#include +#include + +class CmConnectionMethodShim; + +namespace CMManagerShim { + enum ConnectionMethodAttribute { + CmName, + CmIapId, + CmId, + }; +} + + +class CmManagerShim +{ + +public: + + /*! + * Constructor. + */ + CmManagerShim(); + + /*! + * Destructor. + */ + ~CmManagerShim(); + + /*! + * Returns the connection method queried by its ID. + * + * @param[in] connectionMethodId Id of the connection method. + * @return Found connection method instance. + */ + CmConnectionMethodShim *connectionMethod(uint connectionMethodId) const; + + /*! + * Returns the list of connection methods that do not belong to any + * destination. + * + * @param[out] cmArray On return it is the array of connection method ids. + * @param[in] legacyOnly When set to true only Legacy connection method + * ids (connection methods which do not belong to + * any destination) will be returned + */ + void connectionMethod( + QList &cmArray, + bool legacyOnly = true) const; + + + void clear(); + +public: // data + + QHash mConnectionMethods; + + static int mConnectionMethodThrowsAtId; + static int mDestructorCount; +}; + +#endif /* CMMANAGER_SHIM_H */ diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cpitemdatahelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cpitemdatahelper.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CpItemDataHelper stub +* +*/ + +#ifndef CP_ITEM_DATA_HELPER_H +#define CP_ITEM_DATA_HELPER_H + +#include +#include + +class HbWidget; +class QModelIndex; +class HbDataFormModelItem; + +struct ConnectionHolder +{ + ConnectionHolder() {} + + ConnectionHolder(const char* signal, QObject* receiver, const char* method) + { + this->signal = signal; + this->receiver = receiver; + this->method = method; + } + + const char* signal; + QObject* receiver; + const char* method; +}; + +class CpItemDataHelper : public QObject +{ + Q_OBJECT +public: + CpItemDataHelper(); + virtual ~CpItemDataHelper(); + + void addConnection(HbDataFormModelItem *item, + const char *signal, + QObject *receiver, + const char *method); + + void connectToForm(const char *signal, + QObject *receiver, + const char *method); + + HbWidget *widgetFromModelIndex(const QModelIndex &index); + + HbDataFormModelItem *modelItemFromModelIndex(const QModelIndex &index); + +public: + + HbWidget* mWidgetReturnValue; + + HbDataFormModelItem* mModelItemReturnValue; + + ConnectionHolder mFormConnection; + + QMap mConnections; +}; + +#endif diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cpsettingformentryitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/cpsettingformentryitemdata.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPSETTINGFORMENTRYITEMDATA_H +#define CPSETTINGFORMENTRYITEMDATA_H + +#include +#include + +class CpItemDataHelper; +class CpBaseSettingView; + +class CpSettingFormEntryItemData : public QObject, public HbDataFormModelItem +{ + Q_OBJECT +public: + enum EntryItemType { + ListEntryItem = HbDataFormModelItem::CustomItemBase + 1, + ButtonEntryItem = HbDataFormModelItem::CustomItemBase + 2 + }; + + explicit CpSettingFormEntryItemData( + EntryItemType type, + CpItemDataHelper &itemDataHelper, + const QString &text = QString(), + const QString &description = QString(), + const QString &iconName = QString(), + const HbDataFormModelItem *parent = 0); + + virtual ~CpSettingFormEntryItemData(); + + QString text() const; + void setText(const QString &text); + + QString description() const; + void setDescription(const QString &description); + + CpBaseSettingView* callCreateSettingView() const; + +private: + virtual CpBaseSettingView *createSettingView() const = 0; + +public: + + QString mText; + + QString mDescription; + +}; + +#endif //CPSETTINGFORMENTRYITEMDATA_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/videosettingsgroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/inc/videosettingsgroup.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef VIDEOSETTINGSGROUP_H +#define VIDEOSETTINGSGROUP_H + +#include +#include + +class CpItemDataHelper; + +class VideoSettingsGroup : public CpSettingFormItemData +{ + Q_OBJECT +public: + + /** + * Constructor + */ + VideoSettingsGroup(CpItemDataHelper &itemDataHelper); + + /** + * Destructor + */ + ~VideoSettingsGroup(); + + /** + * Setter for the default access point id. + * + * @param defaultAp Access point id. + */ + void setAccessPointId(const uint& defaultAp); + +public: + /** + * Item data helper given by the CP framework. + */ + CpItemDataHelper& mItemDataHelper; + + /** + * Access point id set by the setAccessPointId + */ + uint mApId; +}; + +#endif // VIDEOSETTINGSGROUP_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmapplsettingsui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmapplsettingsui.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CmApplSettingsUi stub +* +*/ + +// INCLUDE FILES +#include "cmapplsettingsui.h" + +// --------------------------------------------------------------------------- +// CmApplSettingsUi +// --------------------------------------------------------------------------- +// +CmApplSettingsUi::CmApplSettingsUi(QObject* parent) + : QObject(parent), + mOpenCallAmount(0) +{ +} + +// --------------------------------------------------------------------------- +// CmApplSettingsUi +// --------------------------------------------------------------------------- +// +CmApplSettingsUi::~CmApplSettingsUi() +{ +} + +// --------------------------------------------------------------------------- +// setOptions +// --------------------------------------------------------------------------- +// +void CmApplSettingsUi::setOptions( + const QFlags &listItems, + const QSet &bearerFilter) +{ + mListItems = listItems; + mBearerTypeFilter = bearerFilter; +} + +// --------------------------------------------------------------------------- +// setSelection +// --------------------------------------------------------------------------- +// +void CmApplSettingsUi::setSelection(const SettingSelection &selection) +{ + mSelection = selection; +} + +// --------------------------------------------------------------------------- +// selection +// --------------------------------------------------------------------------- +// +CmApplSettingsUi::SettingSelection CmApplSettingsUi::selection() const +{ + return mSelection; +} + +// --------------------------------------------------------------------------- +// open +// --------------------------------------------------------------------------- +// +void CmApplSettingsUi::open() +{ + mOpenCallAmount++; +} + +// --------------------------------------------------------------------------- +// emitFinished +// --------------------------------------------------------------------------- +// +void CmApplSettingsUi::emitFinished(uint status) +{ + emit finished(status); +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmconnectionmethod_shim.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmconnectionmethod_shim.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CmConnectionMethodShim stub +* +*/ + +// INCLUDE FILES +#include "cmconnectionmethod_shim.h" +#include +#include + +// --------------------------------------------------------------------------- +// CmConnectionMethodShim +// --------------------------------------------------------------------------- +// +CmConnectionMethodShim::CmConnectionMethodShim(uint id, uint iapId, QString name) +{ + mAttributes[CMManagerShim::CmId] = id; + mAttributes[CMManagerShim::CmIapId] = iapId; + mAttributes[CMManagerShim::CmName] = name; +} + +// --------------------------------------------------------------------------- +// CmConnectionMethodShim +// --------------------------------------------------------------------------- +// +CmConnectionMethodShim::~CmConnectionMethodShim() +{ +} + +// --------------------------------------------------------------------------- +// getIntAttribute +// --------------------------------------------------------------------------- +// +uint CmConnectionMethodShim::getIntAttribute( + CMManagerShim::ConnectionMethodAttribute attribute) const +{ + return mAttributes[attribute].toUInt(); +} + +// --------------------------------------------------------------------------- +// getStringAttribute +// --------------------------------------------------------------------------- +// +QString CmConnectionMethodShim::getStringAttribute( + CMManagerShim::ConnectionMethodAttribute attribute) const +{ + return mAttributes[attribute].toString(); +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmmanager_shim.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmmanager_shim.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CmManagerShim stub +* +*/ + +// INCLUDE FILES +#include "cmmanager_shim.h" +#include "cmconnectionmethod_shim.h" +#include + +int CmManagerShim::mDestructorCount = 0; +int CmManagerShim::mConnectionMethodThrowsAtId = -1; + +// --------------------------------------------------------------------------- +// CmManagerShim +// --------------------------------------------------------------------------- +// +CmManagerShim::CmManagerShim() +{ +} + +// --------------------------------------------------------------------------- +// CmManagerShim +// --------------------------------------------------------------------------- +// +CmManagerShim::~CmManagerShim() +{ + mDestructorCount++; + clear(); +} + +// --------------------------------------------------------------------------- +// connectionMethod +// --------------------------------------------------------------------------- +// +CmConnectionMethodShim* CmManagerShim::connectionMethod(uint connectionMethodId) const +{ + if(mConnectionMethodThrowsAtId == connectionMethodId) + { + throw std::exception(); + } + + return mConnectionMethods.value(connectionMethodId, 0); +} + +// --------------------------------------------------------------------------- +// connectionMethod +// --------------------------------------------------------------------------- +// +void CmManagerShim::connectionMethod( + QList &cmArray, + bool legacyOnly) const +{ + Q_UNUSED(legacyOnly); + cmArray.append(mConnectionMethods.keys()); +} + +// --------------------------------------------------------------------------- +// clear +// --------------------------------------------------------------------------- +// +void CmManagerShim::clear() +{ + foreach(uint key, mConnectionMethods.keys()) + { + delete mConnectionMethods[key]; + mConnectionMethods[key] = 0; + } + + mConnectionMethods.clear(); +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cpitemdatahelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cpitemdatahelper.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CpItemDataHelper stub +* +*/ + +// INCLUDE FILES +#include "cpitemdatahelper.h" + +// --------------------------------------------------------------------------- +// CpItemDataHelper +// --------------------------------------------------------------------------- +// +CpItemDataHelper::CpItemDataHelper() +{ +} + +// --------------------------------------------------------------------------- +// CpItemDataHelper +// --------------------------------------------------------------------------- +// +CpItemDataHelper::~CpItemDataHelper() +{ +} + +// --------------------------------------------------------------------------- +// addConnection +// --------------------------------------------------------------------------- +// +void CpItemDataHelper::addConnection(HbDataFormModelItem *item, + const char *signal, + QObject *receiver, + const char *method) +{ + mConnections[item] = ConnectionHolder(signal, receiver, method); +} + +// --------------------------------------------------------------------------- +// connectToForm +// --------------------------------------------------------------------------- +// +void CpItemDataHelper::connectToForm(const char *signal, + QObject *receiver, + const char *method) +{ + mFormConnection = ConnectionHolder(signal, receiver, method); +} + +// --------------------------------------------------------------------------- +// widgetFromModelIndex +// --------------------------------------------------------------------------- +// +HbWidget* CpItemDataHelper::widgetFromModelIndex(const QModelIndex &index) +{ + Q_UNUSED(index); + return mWidgetReturnValue; +} + +HbDataFormModelItem* CpItemDataHelper::modelItemFromModelIndex(const QModelIndex &index) +{ + Q_UNUSED(index); + return mModelItemReturnValue; +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cpsettingformentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cpsettingformentryitemdata.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CpSettingFormEntryItemData stub +* +*/ + +// INCLUDE FILES +#include "cpsettingformentryitemdata.h" + +// --------------------------------------------------------------------------- +// CpSettingFormEntryItemData +// --------------------------------------------------------------------------- +// +CpSettingFormEntryItemData::CpSettingFormEntryItemData( + EntryItemType type, + CpItemDataHelper &itemDataHelper, + const QString &text, + const QString &description, + const QString &iconName, + const HbDataFormModelItem *parent) : + mText(text), + mDescription(description) +{ + Q_UNUSED(type); + Q_UNUSED(itemDataHelper); + Q_UNUSED(iconName); + Q_UNUSED(parent); +} + +// --------------------------------------------------------------------------- +// CpSettingFormEntryItemData +// --------------------------------------------------------------------------- +// +CpSettingFormEntryItemData::~CpSettingFormEntryItemData() +{ +} + +// --------------------------------------------------------------------------- +// text +// --------------------------------------------------------------------------- +// +QString CpSettingFormEntryItemData::text() const +{ + return mText; +} + +// --------------------------------------------------------------------------- +// setText +// --------------------------------------------------------------------------- +// +void CpSettingFormEntryItemData::setText(const QString &text) +{ + mText = text; +} + +// --------------------------------------------------------------------------- +// description +// --------------------------------------------------------------------------- +// +QString CpSettingFormEntryItemData::description() const +{ + return mDescription; +} + +// --------------------------------------------------------------------------- +// setDescription +// --------------------------------------------------------------------------- +// +void CpSettingFormEntryItemData::setDescription(const QString &description) +{ + mDescription = description; +} + +// --------------------------------------------------------------------------- +// callCreateSettingView +// --------------------------------------------------------------------------- +// +CpBaseSettingView* CpSettingFormEntryItemData::callCreateSettingView() const +{ + return createSettingView(); +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/videosettingsgroup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/videosettingsgroup.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "videosettingsgroup.h" +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoSettingsGroup::VideoSettingsGroup(CpItemDataHelper &itemDataHelper) : + CpSettingFormItemData(HbDataFormModelItem::GroupItem,QString("VideoSettings")), + mItemDataHelper(itemDataHelper), + mApId(0) +{ +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoSettingsGroup::~VideoSettingsGroup() +{ +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +void VideoSettingsGroup::setAccessPointId(const uint& defaultAp) +{ + mApId = defaultAp; +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testaccesspointentry/testvideosettingsaccesspointentry.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testaccesspointentry/testvideosettingsaccesspointentry.pro Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,55 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TARGET = testvideosettingsaccesspointentry +TEMPLATE = app + +DEPENDPATH += . \ + inc \ + src + +INCLUDEPATH += inc \ + stub/inc \ + ../../inc \ + ../../../../inc \ + +CONFIG += qtestlib \ + Hb \ + symbian_test + +LIBS += -lcpframework \ + -lxqutils.dll + +# Input +HEADERS += inc/testvideosettingsaccesspointentry.h \ + ../../inc/videosettingsaccesspointentry.h \ + stub/inc/videosettingsgroup.h \ + stub/inc/cpitemdatahelper.h \ + stub/inc/cpsettingformentryitemdata.h \ + stub/inc/cmapplsettingsui.h \ + stub/inc/cmmanager_shim.h \ + stub/inc/cmconnectionmethod_shim.h \ + +SOURCES += src/testvideosettingsaccesspointentry.cpp \ + ../../src/videosettingsaccesspointentry.cpp \ + stub/src/videosettingsgroup.cpp \ + stub/src/cpitemdatahelper.cpp \ + stub/src/cpsettingformentryitemdata.cpp \ + stub/src/cmapplsettingsui.cpp \ + stub/src/cmmanager_shim.cpp \ + stub/src/cmconnectionmethod_shim.cpp \ + +TARGET.CAPABILITY = All -Tcb diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/inc/testvideosettingsgroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/inc/testvideosettingsgroup.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TestVideoSettingsGroup class definition +* +*/ + +#ifndef TESTVIDEOSETTINGSGROUP_H +#define TESTVIDEOSETTINGSGROUP_H + + +// INCLUDES +#include +#include + +class CpItemDataHelper; +class VideoSettingsGroup; + +class TestVideoSettingsGroup : public QObject + { + + Q_OBJECT + +signals: + + void testTextSignal(); + void testIntSignal(int); + void testShownSignal(const QModelIndex&); + +private slots: + + /** + * called at the very beginning of the test + */ + void initTestCase(); + + /** + * called at the very end of the test + */ + void cleanupTestCase(); + + /** + * called at the start of every test. + */ + void init(); + + /** + * called at the end of every test. + */ + void cleanup(); + + /** + * tests mSettingsModel construction. + */ + void testSettingsConstruction(); + + /** + * tests mAccessPointItem construction. + */ + void testAccessPointConstruction(); + + /** + * tests mLowestUDPPortItem construction. + */ + void testLowestUdpPortConstruction(); + + /** + * tests mHighestUDPPortItem construction. + */ + void testHighestUdpPortConstruction(); + + /** + * tests mUseProxyItem construction. + */ + void testUseProxyConstruction(); + + /** + * tests mProxyServerItem construction. + */ + void testProxyServerConstruction(); + + /** + * tests mProxyPortItem construction. + */ + void testProxyPortConstruction(); + + /** + * tests destructor + */ + void testDestructor(); + + /** + * tests getAccessPointId + */ + void testGetAccessPointId(); + + /** + * tests setAccessPointId + */ + void testSetAccessPointId(); + + /** + * tests lowestUdpPortEditingFinished + */ + void testLowestUdpPortEditingFinished(); + + /** + * tests highestUdpPortEditingFinished + */ + void testHighestUdpPortEditingFinished(); + + /** + * tests useProxyToggled + */ + void testUseProxyToggled(); + + /** + * tests proxyServerEditingFinished + */ + void testProxyServerEditingFinished(); + + /** + * tests proxyPortEditingFinished + */ + void testProxyPortEditingFinished(); + + /** + * tests itemShown + */ + void testItemShown(); + +private: + + CpItemDataHelper* mItemHelper; + + VideoSettingsGroup* mTestObject; + + }; + +#endif // TESTVIDEOSETTINGSGROUP_H + +// End of File diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/src/testvideosettingsgroup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/src/testvideosettingsgroup.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,443 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TestVideoSettingsGroup class implementation +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include + +#include "testvideosettingsgroup.h" +#include "videosettingsaccesspointentry.h" +#include "mpsettingsmodel.h" +#include "hbdataformmodel.h" +#include "cpitemdatahelper.h" +#include "hbvalidator.h" + +// trick to get access to protected/private members. +#define private public +#include "videosettingsgroup.h" +#undef private + +// --------------------------------------------------------------------------- +// main +// --------------------------------------------------------------------------- +// +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + + TestVideoSettingsGroup tc; + + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\testvideosettingsgroup.txt"; + + return QTest::qExec(&tc, 3, pass); +} + +// --------------------------------------------------------------------------- +// initTestCase +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::initTestCase() +{ + mItemHelper = new CpItemDataHelper; +} + +// --------------------------------------------------------------------------- +// cleanupTestCase +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::cleanupTestCase() +{ + delete mItemHelper; + mItemHelper = 0; +} + +// --------------------------------------------------------------------------- +// init +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::init() +{ + CMPSettingsModel::mImplUid = TUid::Null(); + CMPSettingsModel::mConfigMode = -1; + CMPSettingsModel::mProxyMode = 0; + CMPSettingsModel::mHostName = QString("testhostname"); + CMPSettingsModel::mProxyPort = 4096; + CMPSettingsModel::mMinUdpPort = 2048; + CMPSettingsModel::mMaxUdpPort = 8080; + CMPSettingsModel::mStoreSettingsCount = 0; + CMPSettingsModel::mDestructorCount = 0; + CMPSettingsModel::mApId = 5; + HbEditorInterface::mFilter = 0; + + mTestObject = new VideoSettingsGroup(*mItemHelper); +} + +// --------------------------------------------------------------------------- +// cleanup +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::cleanup() +{ + disconnect(); + delete mTestObject; + mTestObject = 0; +} + +// --------------------------------------------------------------------------- +// testSettingsConstruction +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testSettingsConstruction() +{ + QVERIFY( mTestObject->mSettingsModel != 0 ); + QCOMPARE( mTestObject->mSettingsModel->mConfigMode, (int)EConfigUser); + QVERIFY( CMPSettingsModel::mImplUid == TUid::Uid(KMPSettEngImplUidROP) ); + + // verify also the itemShown connection to form here. + QCOMPARE( mItemHelper->mFormConnection.signal, SIGNAL(itemShown(const QModelIndex)) ); + QVERIFY( mItemHelper->mFormConnection.receiver == mTestObject ); + QCOMPARE( mItemHelper->mFormConnection.method, SLOT(itemShown(const QModelIndex)) ); +} + +// --------------------------------------------------------------------------- +// testAccessPointConstruction +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testAccessPointConstruction() +{ + QVERIFY( mTestObject->mAccessPointItem != 0 ); + QVERIFY( mTestObject->indexOf(static_cast(mTestObject->mAccessPointItem)) >= 0 ); + QCOMPARE( mTestObject->mAccessPointItem->mText, hbTrId("txt_videos_dblist_access_point") ); + QCOMPARE( mTestObject->mAccessPointItem->mApId, (uint)CMPSettingsModel::mApId ); +} + +// --------------------------------------------------------------------------- +// testLowestUdpPortConstruction +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testLowestUdpPortConstruction() +{ + QVERIFY( mTestObject->mLowestUDPPortItem != 0 ); + QVERIFY( mTestObject->indexOf(mTestObject->mLowestUDPPortItem) >= 0 ); + QCOMPARE( mTestObject->mLowestUDPPortItem->contentWidgetData(QString("maxRows")).toInt(), 1); + QCOMPARE( mTestObject->mLowestUDPPortItem->contentWidgetData(QString("text")).toString(), + QString::number(CMPSettingsModel::mMinUdpPort) ); + + ConnectionHolder connection = mItemHelper->mConnections[mTestObject->mLowestUDPPortItem]; + QCOMPARE( connection.signal, SIGNAL(editingFinished()) ); + QVERIFY( connection.receiver == mTestObject ); + QCOMPARE( connection.method, SLOT(lowestUdpPortEditingFinished()) ); +} + +// --------------------------------------------------------------------------- +// testHighestUdpPortConstruction +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testHighestUdpPortConstruction() +{ + QVERIFY( mTestObject->mHighestUDPPortItem != 0 ); + QVERIFY( mTestObject->indexOf(mTestObject->mHighestUDPPortItem) >= 0 ); + QCOMPARE( mTestObject->mHighestUDPPortItem->contentWidgetData(QString("maxRows")).toInt(), 1); + QCOMPARE( mTestObject->mHighestUDPPortItem->contentWidgetData(QString("text")).toString(), + QString::number(CMPSettingsModel::mMaxUdpPort) ); + + ConnectionHolder connection = mItemHelper->mConnections[mTestObject->mHighestUDPPortItem]; + QCOMPARE( connection.signal, SIGNAL(editingFinished()) ); + QVERIFY( connection.receiver == mTestObject ); + QCOMPARE( connection.method, SLOT(highestUdpPortEditingFinished()) ); +} + +// --------------------------------------------------------------------------- +// testUseProxyConstruction +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testUseProxyConstruction() +{ + QVERIFY( mTestObject->mUseProxyItem != 0 ); + QVERIFY( mTestObject->indexOf(mTestObject->mUseProxyItem) >= 0 ); + QCOMPARE( mTestObject->mUseProxyItem->contentWidgetData(QString("checked")).toBool(), + CMPSettingsModel::mProxyMode == 1 ); + + // connection checking in the testItemShown. +} + +// --------------------------------------------------------------------------- +// testProxyServerConstruction +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testProxyServerConstruction() +{ + QVERIFY( mTestObject->mProxyServerItem != 0 ); + QVERIFY( mTestObject->indexOf(mTestObject->mProxyServerItem) >= 0 ); + QCOMPARE( mTestObject->mProxyServerItem->contentWidgetData(QString("maxRows")).toInt(), 1); + QCOMPARE( mTestObject->mProxyServerItem->contentWidgetData(QString("text")).toString(), + CMPSettingsModel::mHostName ); + QCOMPARE( mTestObject->mProxyServerItem->contentWidgetData(QString("placeholderText")).toString(), + hbTrId("txt_videos_dblist_none") ); + + ConnectionHolder connection = mItemHelper->mConnections[mTestObject->mProxyServerItem]; + QCOMPARE( connection.signal, SIGNAL(editingFinished()) ); + QVERIFY( connection.receiver == mTestObject ); + QCOMPARE( connection.method, SLOT(proxyServerEditingFinished()) ); +} + +// --------------------------------------------------------------------------- +// testProxyPortConstruction +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testProxyPortConstruction() +{ + QVERIFY( mTestObject->mProxyPortItem != 0 ); + QVERIFY( mTestObject->indexOf(mTestObject->mProxyPortItem) >= 0 ); + QCOMPARE( mTestObject->mProxyPortItem->contentWidgetData(QString("maxRows")).toInt(), 1); + QCOMPARE( mTestObject->mProxyPortItem->contentWidgetData(QString("text")).toString(), + QString::number(CMPSettingsModel::mProxyPort) ); + + ConnectionHolder connection = mItemHelper->mConnections[mTestObject->mProxyPortItem]; + QCOMPARE( connection.signal, SIGNAL(editingFinished()) ); + QVERIFY( connection.receiver == mTestObject ); + QCOMPARE( connection.method, SLOT(proxyPortEditingFinished()) ); +} + +// --------------------------------------------------------------------------- +// testDestructor +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testDestructor() +{ + delete mTestObject; + mTestObject = 0; + QCOMPARE( CMPSettingsModel::mStoreSettingsCount, 1 ); + QCOMPARE( CMPSettingsModel::mDestructorCount, 1 ); +} + +// --------------------------------------------------------------------------- +// testDestructor +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testGetAccessPointId() +{ + CMPSettingsModel::mApId = 4; + + QCOMPARE( mTestObject->getAccessPointId(), (uint)CMPSettingsModel::mApId ); +} + +// --------------------------------------------------------------------------- +// testDestructor +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testSetAccessPointId() +{ + CMPSettingsModel::mApId = -1; + + uint ap = 3; + + mTestObject->setAccessPointId(ap); + + QCOMPARE( CMPSettingsModel::mApId, (int)ap ); +} + +// --------------------------------------------------------------------------- +// testLowestUdpPortEditingFinished +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testLowestUdpPortEditingFinished() +{ + connect(this, SIGNAL(testTextSignal()), + mTestObject, SLOT(lowestUdpPortEditingFinished())); + + QString highText("12345"); + mTestObject->mHighestUDPPortItem->setContentWidgetData(QString("text"), highText); + + QString testString("1234"); + mTestObject->mLowestUDPPortItem->setContentWidgetData(QString("text"), testString); + + emit testTextSignal(); + + QCOMPARE( CMPSettingsModel::mMinUdpPort, testString.toInt() ); + + CMPSettingsModel::mMinUdpPort = 0; + mTestObject->mLowestUDPPortItem->setContentWidgetData(QString("text"), QString("12346")); + + emit testTextSignal(); + + QCOMPARE( CMPSettingsModel::mMinUdpPort, highText.toInt() ); + + CMPSettingsModel::mMinUdpPort = 0; + testString = "12345"; + mTestObject->mLowestUDPPortItem->setContentWidgetData(QString("text"), testString); + + emit testTextSignal(); + + QCOMPARE( CMPSettingsModel::mMinUdpPort, testString.toInt() ); +} + +// --------------------------------------------------------------------------- +// testHighestUdpPortEditingFinished +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testHighestUdpPortEditingFinished() +{ + connect(this, SIGNAL(testTextSignal()), + mTestObject, SLOT(highestUdpPortEditingFinished())); + + QString lowText("1234"); + mTestObject->mLowestUDPPortItem->setContentWidgetData(QString("text"), lowText); + + QString testString("12345"); + mTestObject->mHighestUDPPortItem->setContentWidgetData(QString("text"), testString); + + emit testTextSignal(); + + QCOMPARE( CMPSettingsModel::mMaxUdpPort, testString.toInt() ); + + CMPSettingsModel::mMaxUdpPort = 0; + mTestObject->mHighestUDPPortItem->setContentWidgetData(QString("text"), QString("1233")); + + emit testTextSignal(); + + QCOMPARE( CMPSettingsModel::mMaxUdpPort, lowText.toInt() ); + + CMPSettingsModel::mMaxUdpPort = 0; + testString = "1234"; + mTestObject->mHighestUDPPortItem->setContentWidgetData(QString("text"), testString); + + emit testTextSignal(); + + QCOMPARE( CMPSettingsModel::mMaxUdpPort, testString.toInt() ); +} + +// --------------------------------------------------------------------------- +// testUseProxyToggled +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testUseProxyToggled() +{ + connect(this, SIGNAL(testIntSignal(int)), + mTestObject, SLOT(useProxyToggled(int))); + + emit testIntSignal(Qt::Unchecked); + + QVERIFY( mTestObject->mProxyServerItem->isEnabled() == false ); + QVERIFY( mTestObject->mProxyPortItem->isEnabled() == false ); + QCOMPARE( CMPSettingsModel::mProxyMode, 0); + + emit testIntSignal(Qt::Checked); + + QVERIFY( mTestObject->mProxyServerItem->isEnabled() ); + QVERIFY( mTestObject->mProxyPortItem->isEnabled() ); + QCOMPARE( CMPSettingsModel::mProxyMode, 1); +} + +// --------------------------------------------------------------------------- +// testProxyServerEditingFinished +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testProxyServerEditingFinished() +{ + connect(this, SIGNAL(testTextSignal()), + mTestObject, SLOT(proxyServerEditingFinished())); + + QString testString("testtesttest"); + mTestObject->mProxyServerItem->setContentWidgetData(QString("text"), testString); + + emit testTextSignal(); + QCOMPARE( CMPSettingsModel::mHostName, testString ); +} + +// --------------------------------------------------------------------------- +// testProxyPortEditingFinished +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testProxyPortEditingFinished() +{ + connect(this, SIGNAL(testTextSignal()), + mTestObject, SLOT(proxyPortEditingFinished())); + + QString testString("1234"); + mTestObject->mProxyPortItem->setContentWidgetData(QString("text"), testString); + + emit testTextSignal(); + QCOMPARE( CMPSettingsModel::mProxyPort, testString.toInt() ); +} + +// --------------------------------------------------------------------------- +// testItemShown +// --------------------------------------------------------------------------- +// +void TestVideoSettingsGroup::testItemShown() +{ + connect(this, SIGNAL(testShownSignal(const QModelIndex&)), + mTestObject, SLOT(itemShown(const QModelIndex&))); + + QModelIndex index; + + HbLineEdit* editor = new HbLineEdit(); + mItemHelper->mWidgetReturnValue = editor; + + QIntValidator* val; + + mItemHelper->mModelItemReturnValue = mTestObject->mLowestUDPPortItem; + HbEditorInterface::mFilter = 0; + emit testShownSignal(index); + QVERIFY( HbEditorInterface::mFilter == HbDigitsOnlyFilter::instance() ); + QCOMPARE( editor->mValidator->mValidators.count(), 1 ); + val = static_cast(editor->mValidator->mValidators.at(0)); + QCOMPARE( val->bottom(), 1024 ); + QCOMPARE( val->top(), 65535 ); + + mItemHelper->mModelItemReturnValue = mTestObject->mProxyPortItem; + HbEditorInterface::mFilter = 0; + emit testShownSignal(index); + QVERIFY( HbEditorInterface::mFilter == HbDigitsOnlyFilter::instance() ); + QCOMPARE( editor->mValidator->mValidators.count(), 1 ); + val = static_cast(editor->mValidator->mValidators.at(0)); + QCOMPARE( val->bottom(), 1 ); + QCOMPARE( val->top(), 65535 ); + + mItemHelper->mModelItemReturnValue = mTestObject->mHighestUDPPortItem; + HbEditorInterface::mFilter = 0; + emit testShownSignal(index); + QVERIFY( HbEditorInterface::mFilter == HbDigitsOnlyFilter::instance() ); + QCOMPARE( editor->mValidator->mValidators.count(), 1 ); + val = static_cast(editor->mValidator->mValidators.at(0)); + QCOMPARE( val->bottom(), 1024 ); + QCOMPARE( val->top(), 65535 ); + + mItemHelper->mModelItemReturnValue = mTestObject->mProxyServerItem; + HbEditorInterface::mFilter = 0; + emit testShownSignal(index); + QVERIFY( HbEditorInterface::mFilter == HbUrlFilter::instance() ); + + // verify the use proxy connection: + ConnectionHolder connection = mItemHelper->mConnections[mTestObject->mUseProxyItem]; + QCOMPARE( connection.signal, SIGNAL(stateChanged(int)) ); + QVERIFY( connection.receiver == mTestObject ); + QCOMPARE( connection.method, SLOT(useProxyToggled(int)) ); + + delete editor; +} + +// end of file diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/cpitemdatahelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/cpitemdatahelper.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CpItemDataHelper stub +* +*/ + +#ifndef CP_ITEM_DATA_HELPER_H +#define CP_ITEM_DATA_HELPER_H + +#include +#include + +class HbWidget; +class QModelIndex; +class HbDataFormModelItem; + +struct ConnectionHolder +{ + ConnectionHolder() {} + + ConnectionHolder(const char* signal, QObject* receiver, const char* method) + { + this->signal = signal; + this->receiver = receiver; + this->method = method; + } + + const char* signal; + QObject* receiver; + const char* method; +}; + +class CpItemDataHelper : public QObject +{ + Q_OBJECT +public: + CpItemDataHelper(); + virtual ~CpItemDataHelper(); + + void addConnection(HbDataFormModelItem *item, + const char *signal, + QObject *receiver, + const char *method); + + void connectToForm(const char *signal, + QObject *receiver, + const char *method); + + HbWidget *widgetFromModelIndex(const QModelIndex &index); + + HbDataFormModelItem *modelItemFromModelIndex(const QModelIndex &index); + +public: + + HbWidget* mWidgetReturnValue; + + HbDataFormModelItem* mModelItemReturnValue; + + ConnectionHolder mFormConnection; + + QMap mConnections; +}; + +#endif diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hbdataformmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hbdataformmodel.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HbDataFormModel stub +* +*/ + +#ifndef HBDATAFORMMODEL_H +#define HBDATAFORMMODEL_H + +#include + +#include +#include + +class HbDataFormModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + + HbDataFormModel(QObject *parent = 0); + virtual ~HbDataFormModel(); + + HbDataFormModelItem* itemFromIndex(const QModelIndex &index) const; + + virtual QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &child) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +public: + + HbDataFormModelItem* mItemReturnValue; + +}; + +#endif //HBDATAFORMMODEL_H + diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hbinputeditorinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hbinputeditorinterface.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HbLineEdit stub +* +*/ +#ifndef HB_EDITOR_INTERFACE_H +#define HB_EDITOR_INTERFACE_H + +#include + +#include + +class HbEditorInterface : public QObject +{ + Q_OBJECT + +public: + HbEditorInterface(QObject* editor); + ~HbEditorInterface(); + + void setFilter(HbInputFilter *filter); + +public: + + static HbInputFilter* mFilter; +}; + +#endif // HB_EDITOR_INTERFACE_H + +// End of file + diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hblineedit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hblineedit.h Wed Jun 23 18:14:16 2010 +0300 @@ -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: HbLineEdit stub +* +*/ + +#ifndef HBLINEEDIT_H +#define HBLINEEDIT_H + +#include +#include +#include +#include + +class HbLineEdit : public HbWidget +{ + Q_OBJECT + +public: + + HbLineEdit(QGraphicsItem *parent = 0); + HbLineEdit(const QString &text, QGraphicsItem *parent = 0); + virtual ~HbLineEdit(); + + void setValidator(HbValidator *validator); + +public: + + HbValidator* mValidator; + +}; + +#endif // HBLINEEDIT_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hbvalidator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/hbvalidator.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HbValidator stub +* +*/ + +#ifndef HBVALIDATOR_H +#define HBVALIDATOR_H + +#include +#include + +#include + +class HbValidator : public QObject +{ +public: + HbValidator(QObject *parent=0); + virtual ~HbValidator(); + + void addField(QValidator *validator, const QString &defaultValue); + +public: + + QList mValidators; + QList mDefaultValues; + +}; + +#endif // HBVALIDATOR_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/mpsettingsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/mpsettingsmodel.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMPSettingsModel stub +* +*/ + +// Version : %version: 2 % + + + + +#ifndef MMPSETTINGSMODEL_H +#define MMPSETTINGSMODEL_H + +// INCLUDES +#include +#include + +// DATA TYPES +// Config file version +enum TConfigVersion + { + EConfigDefault, + EConfigUser + }; + +// Bearer type +enum TDataBearer + { + EBearerGPRS, + EBearerEGPRS, + EBearerWCDMA, + EBearerCDMA, + EBearerCDMA2000, + EBearerWLAN, + EBearerHSDPA + }; + +// CLASS DECLARATION + +/** +* CMPSettingsModel +* Common API for MMF specific settings models. +* +* @lib MPSettEngine.dll +* @since 2.0 +*/ +class CMPSettingsModel + { + public: + + /** + * Constructor. Uses ECom to construct an instance of this class. + * @param aUid Implementation uid of the object that is to be constructed. + */ + static CMPSettingsModel* NewL(TUid aUid); + + /** + * Constructor + */ + CMPSettingsModel(); + + /** + * Destructor. + */ + virtual ~CMPSettingsModel(); + + public: // New functions + + /** + * Reads settings from MMF controller. + * @since 2.0 + * @param aSettingsType Settings value type: + * EConfigDefault: Load default values + * EConfigUser: Load user values + */ + void LoadSettingsL(TInt aConfigVersion); + + /** + * Writes settings to MMF controller. + * @since 2.0 + */ + void StoreSettingsL(); + + /** + * Sets proxy mode.. + * @since 2.0 + * @param aMode Proxy mode. + * @return Error value. + */ + TInt SetProxyMode(TInt aMode); + + /** + * Returns proxy mode. + * @since 2.0 + * @param aMode Proxy mode: + * 0: Disabled + * 1: Enabled + * @return Error value. + */ + TInt GetProxyMode(TInt& aMode); + + /** + * Sets Proxy host name. + * @since 2.0 + * @param aHostName Proxy host name. + * @return Error value. + */ + TInt SetProxyHostNameL(const TDesC& aHostName); + + /** + * Returns proxy host name. + * @since 2.0 + * @param aHostName Proxy host name. + * @return Error value. + */ + TInt GetProxyHostName(TDes& aHostName); + + /** + * Sets proxy port number. + * @since 2.0 + * @param aPort Proxy port number. + * @return Error value. + */ + TInt SetProxyPort(TInt aPort); + + /** + * Returns proxy port number.. + * @since 2.0 + * @return Integer: Proxy port number. + * @return Error value. + */ + TInt GetProxyPort(TInt& aPort); + + /** + * Sets default access point. + * @since 2.0 + * @param aApId Access point ID. + * @return Error value. + */ + TInt SetDefaultAp(TUint32 aApId); + + /** + * Returns default access point ID. + * @since 2.0 + * @param aApId Access point ID. + * @return Error value. + */ + TInt GetDefaultAp(TUint32& aApId); + + /** + * Sets minimum UDP port number. + * @since 2.0 + * @param aPort minimum port number. + * @return Error value. + */ + TInt SetMinUDPPort(TInt aPort); + + /** + * Returns minimum UDP port number. + * @since 2.0 + * @param aPort minimum UDP port number in minutes. + * @return Error value. + */ + TInt GetMinUDPPort(TInt& aPort); + + /** + * Sets maximum UDP port number. + * @since 2.0 + * @param aPort maximum port number. + * @return Error value. + */ + TInt SetMaxUDPPort(TInt aPort); + + /** + * Returns maximum UDP port number. + * @since 2.0 + * @param aPort maximum UDP port number in minutes. + * @return Error value. + */ + TInt GetMaxUDPPort(TInt& aPort); + +public: + static TUid mImplUid; + static TInt mConfigMode; + static TInt mProxyMode; + static QString mHostName; + static TInt mProxyPort; + static TInt mMinUdpPort; + static TInt mMaxUdpPort; + static int mStoreSettingsCount; + static int mDestructorCount; + static int mApId; + + }; + +#endif // MMPSETTINGSMODEL_H + +// End of File diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/videosettingsaccesspointentry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/inc/videosettingsaccesspointentry.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: VideoSettingsAccessPointEntry stub + * + */ +#ifndef VIDEOSETTINGSACCESSPOINTENTRY_H +#define VIDEOSETTINGSACCESSPOINTENTRY_H + +#include + +class VideoSettingsGroup; + +class VideoSettingsAccessPointEntry : public CpSettingFormItemData +{ + Q_OBJECT +public: + + /** + * Constructor + */ + VideoSettingsAccessPointEntry(CpItemDataHelper &itemDataHelper, + const QString& text = QString(), + VideoSettingsGroup *parent = 0); + + /** + * Destructor + */ + ~VideoSettingsAccessPointEntry(); + + /** + * sets the iap id. + * + * @param apId The iap id. + */ + void setIapId(const uint& apId); + +public: + + QString mText; + + VideoSettingsGroup* mParent; + + uint mApId; + +}; + +#endif // VIDEOSETTINGSACCESSPOINTENTRY_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/cpitemdatahelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/cpitemdatahelper.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CpItemDataHelper stub +* +*/ + +// INCLUDE FILES +#include "cpitemdatahelper.h" + +// --------------------------------------------------------------------------- +// CpItemDataHelper +// --------------------------------------------------------------------------- +// +CpItemDataHelper::CpItemDataHelper() +{ +} + +// --------------------------------------------------------------------------- +// CpItemDataHelper +// --------------------------------------------------------------------------- +// +CpItemDataHelper::~CpItemDataHelper() +{ +} + +// --------------------------------------------------------------------------- +// addConnection +// --------------------------------------------------------------------------- +// +void CpItemDataHelper::addConnection(HbDataFormModelItem *item, + const char *signal, + QObject *receiver, + const char *method) +{ + mConnections[item] = ConnectionHolder(signal, receiver, method); +} + +// --------------------------------------------------------------------------- +// connectToForm +// --------------------------------------------------------------------------- +// +void CpItemDataHelper::connectToForm(const char *signal, + QObject *receiver, + const char *method) +{ + mFormConnection = ConnectionHolder(signal, receiver, method); +} + +// --------------------------------------------------------------------------- +// widgetFromModelIndex +// --------------------------------------------------------------------------- +// +HbWidget* CpItemDataHelper::widgetFromModelIndex(const QModelIndex &index) +{ + Q_UNUSED(index); + return mWidgetReturnValue; +} + +HbDataFormModelItem* CpItemDataHelper::modelItemFromModelIndex(const QModelIndex &index) +{ + Q_UNUSED(index); + return mModelItemReturnValue; +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hbdataformmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hbdataformmodel.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -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: HbDataFormModel stub +* +*/ + +// INCLUDE FILES +#include "hbdataformmodel.h" + +// --------------------------------------------------------------------------- +// HbDataFormModel +// --------------------------------------------------------------------------- +// +HbDataFormModel::HbDataFormModel(QObject *parent) : QAbstractItemModel(parent) +{ +} + +// --------------------------------------------------------------------------- +// ~HbDataFormModel +// --------------------------------------------------------------------------- +// +HbDataFormModel::~HbDataFormModel() +{ +} + +// --------------------------------------------------------------------------- +// itemFromIndex +// --------------------------------------------------------------------------- +// +HbDataFormModelItem* HbDataFormModel::itemFromIndex(const QModelIndex &index) const +{ + Q_UNUSED(index); + return mItemReturnValue; +} + +// --------------------------------------------------------------------------- +// index +// --------------------------------------------------------------------------- +// +QModelIndex HbDataFormModel::index(int row, int column, const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return createIndex(row, column); +} + +// --------------------------------------------------------------------------- +// parent +// --------------------------------------------------------------------------- +// +QModelIndex HbDataFormModel::parent(const QModelIndex &child) const +{ + Q_UNUSED(child); + return QModelIndex(); +} + +// --------------------------------------------------------------------------- +// rowCount +// --------------------------------------------------------------------------- +// +int HbDataFormModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return 0; +} + +// --------------------------------------------------------------------------- +// columnCount +// --------------------------------------------------------------------------- +// +int HbDataFormModel::columnCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return 0; +} + +// --------------------------------------------------------------------------- +// data +// --------------------------------------------------------------------------- +// +QVariant HbDataFormModel::data(const QModelIndex &index, int role) const +{ + Q_UNUSED(index); + Q_UNUSED(role); + return QVariant(); +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hbinputeditorinterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hbinputeditorinterface.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -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: HbEditorInterface stub +* +*/ + +// INCLUDE FILES +#include "hbinputeditorinterface.h" + +HbInputFilter* HbEditorInterface::mFilter(0); + +// --------------------------------------------------------------------------- +// HbLineEdit +// --------------------------------------------------------------------------- +// +HbEditorInterface::HbEditorInterface(QObject *parent) : QObject(parent) +{ +} + +// --------------------------------------------------------------------------- +// ~HbLineEdit +// --------------------------------------------------------------------------- +// +HbEditorInterface::~HbEditorInterface() +{ +} + +// --------------------------------------------------------------------------- +// setFilter +// --------------------------------------------------------------------------- +// +void HbEditorInterface::setFilter(HbInputFilter *filter) +{ + mFilter = filter; +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hblineedit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hblineedit.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HbLineEdit stub +* +*/ + +// INCLUDE FILES +#include "hblineedit.h" + +// --------------------------------------------------------------------------- +// HbLineEdit +// --------------------------------------------------------------------------- +// +HbLineEdit::HbLineEdit(QGraphicsItem *parent) : HbWidget(parent) +{ +} + +// --------------------------------------------------------------------------- +// HbLineEdit +// --------------------------------------------------------------------------- +// +HbLineEdit::HbLineEdit(const QString &text, QGraphicsItem *parent) : HbWidget(parent) +{ + Q_UNUSED(text); +} + +// --------------------------------------------------------------------------- +// ~HbLineEdit +// --------------------------------------------------------------------------- +// +HbLineEdit::~HbLineEdit() +{ +} + +// --------------------------------------------------------------------------- +// setValidator +// --------------------------------------------------------------------------- +// +void HbLineEdit::setValidator(HbValidator *validator) +{ + mValidator = validator; +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hbvalidator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/hbvalidator.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HbValidator stub +* +*/ + +// INCLUDE FILES +#include "hbvalidator.h" + +// --------------------------------------------------------------------------- +// HbValidator +// --------------------------------------------------------------------------- +// +HbValidator::HbValidator(QObject *parent) : QObject(parent) +{ +} + +// --------------------------------------------------------------------------- +// ~HbValidator +// --------------------------------------------------------------------------- +// +HbValidator::~HbValidator() +{ +} + +// --------------------------------------------------------------------------- +// addField +// --------------------------------------------------------------------------- +// +void HbValidator::addField(QValidator *validator, const QString &defaultValue) +{ + mValidators.append(validator); + mDefaultValues.append(defaultValue); +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/mpsettingsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/mpsettingsmodel.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPSettingsModel stub +* +*/ + +// INCLUDE FILES +#include "mpsettingsmodel.h" +#include +#include + +TUid CMPSettingsModel::mImplUid(TUid::Null()); +TInt CMPSettingsModel::mConfigMode(-1); +TInt CMPSettingsModel::mProxyMode(-1); +QString CMPSettingsModel::mHostName = QString(); +TInt CMPSettingsModel::mProxyPort(-1); +TInt CMPSettingsModel::mMinUdpPort(-1); +TInt CMPSettingsModel::mMaxUdpPort(-1); +int CMPSettingsModel::mStoreSettingsCount(0); +int CMPSettingsModel::mDestructorCount(0); +int CMPSettingsModel::mApId(0); + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CMPSettingsModel* CMPSettingsModel::NewL(TUid aUid) +{ + mImplUid = aUid; + return new CMPSettingsModel; +} + +// --------------------------------------------------------------------------- +// CMPSettingsModel +// --------------------------------------------------------------------------- +// +CMPSettingsModel::CMPSettingsModel() +{ +} + +// --------------------------------------------------------------------------- +// ~CMPSettingsModel +// --------------------------------------------------------------------------- +// +CMPSettingsModel::~CMPSettingsModel() +{ + mDestructorCount++; +} + +// --------------------------------------------------------------------------- +// LoadSettingsL +// --------------------------------------------------------------------------- +// +void CMPSettingsModel::LoadSettingsL(TInt aConfigVersion) +{ + mConfigMode = aConfigVersion; +} + +// --------------------------------------------------------------------------- +// StoreSettingsL +// --------------------------------------------------------------------------- +// +void CMPSettingsModel::StoreSettingsL() +{ + mStoreSettingsCount++; +} + +// --------------------------------------------------------------------------- +// SetProxyMode +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::SetProxyMode(TInt aMode) +{ + mProxyMode = aMode; + return 0; +} + +// --------------------------------------------------------------------------- +// GetProxyMode +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::GetProxyMode(TInt& aMode) +{ + aMode = mProxyMode; + return 0; +} + +// --------------------------------------------------------------------------- +// SetProxyHostNameL +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::SetProxyHostNameL(const TDesC& aHostName) +{ + mHostName = XQConversions::s60DescToQString(aHostName); + return 0; +} + +// --------------------------------------------------------------------------- +// GetProxyHostName +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::GetProxyHostName(TDes& aHostName) +{ + HBufC* name = XQConversions::qStringToS60Desc(mHostName); + aHostName.Append(*name); + delete name; + return 0; +} + +// --------------------------------------------------------------------------- +// SetProxyPort +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::SetProxyPort(TInt aPort) +{ + mProxyPort = aPort; + return 0; +} + +// --------------------------------------------------------------------------- +// GetProxyPort +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::GetProxyPort(TInt& aPort) +{ + aPort = mProxyPort; + return 0; +} + +// --------------------------------------------------------------------------- +// SetDefaultAp +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::SetDefaultAp(TUint32 aApId) +{ + mApId = aApId; + return 0; +} + +// --------------------------------------------------------------------------- +// GetDefaultAp +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::GetDefaultAp(TUint32& aApId) +{ + aApId = mApId; + return 0; +} + +// --------------------------------------------------------------------------- +// SetMinUDPPort +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::SetMinUDPPort(TInt aPort) +{ + mMinUdpPort = aPort; + return 0; +} + +// --------------------------------------------------------------------------- +// GetMinUDPPort +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::GetMinUDPPort(TInt& aPort) +{ + aPort = mMinUdpPort; + return 0; +} + +// --------------------------------------------------------------------------- +// SetMaxUDPPort +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::SetMaxUDPPort(TInt aPort) +{ + mMaxUdpPort = aPort; + return 0; +} + +// --------------------------------------------------------------------------- +// GetMaxUDPPort +// --------------------------------------------------------------------------- +// +TInt CMPSettingsModel::GetMaxUDPPort(TInt& aPort) +{ + aPort = mMaxUdpPort; + return 0; +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/videosettingsaccesspointentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/stub/src/videosettingsaccesspointentry.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -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: + * + */ + +#include "videosettingsaccesspointentry.h" +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoSettingsAccessPointEntry::VideoSettingsAccessPointEntry( + CpItemDataHelper &itemDataHelper, + const QString& text, + VideoSettingsGroup *parent) : + CpSettingFormItemData(HbDataFormModelItem::CustomItemBase, text), + mText(text), + mParent(parent) +{ + Q_UNUSED(itemDataHelper); +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoSettingsAccessPointEntry::~VideoSettingsAccessPointEntry() +{ +} + +// --------------------------------------------------------------------------- +// accessPointNameFromIapId +// --------------------------------------------------------------------------- +// +void VideoSettingsAccessPointEntry::setIapId(const uint& apId) +{ + mApId = apId; +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testgroup/testvideosettingsgroup.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testgroup/testvideosettingsgroup.pro Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,58 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TARGET = testvideosettingsgroup +TEMPLATE = app + +DEPENDPATH += . \ + inc \ + src + +INCLUDEPATH += inc \ + stub/inc \ + ../../inc \ + ../../../mediasettingsengine/inc \ + ../../../../inc \ + +CONFIG += qtestlib \ + Hb \ + symbian_test + +LIBS += -lcpframework \ + -lxqutils.dll + +# Input +HEADERS += inc/testvideosettingsgroup.h \ + ../../inc/videosettingsgroup.h \ + stub/inc/mpsettingsmodel.h \ + stub/inc/hbdataformmodel.h \ + stub/inc/cpitemdatahelper.h \ + stub/inc/hbvalidator.h \ + stub/inc/hblineedit.h \ + stub/inc/hbinputeditorinterface.h \ + stub/inc/videosettingsaccesspointentry.h \ + +SOURCES += src/testvideosettingsgroup.cpp \ + ../../src/videosettingsgroup.cpp \ + stub/src/mpsettingsmodel.cpp \ + stub/src/hbdataformmodel.cpp \ + stub/src/cpitemdatahelper.cpp \ + stub/src/hbvalidator.cpp \ + stub/src/hblineedit.cpp \ + stub/src/hbinputeditorinterface.cpp \ + stub/src/videosettingsaccesspointentry.cpp \ + +TARGET.CAPABILITY = All -Tcb diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testplugin/inc/testvideosettingsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testplugin/inc/testvideosettingsplugin.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TestVideoSettingsPlugin class definition +* +*/ + +#ifndef TESTVIDEOSETTINGSPLUGIN_H +#define TESTVIDEOSETTINGSPLUGIN_H + + +// INCLUDES +#include + +class CpItemDataHelper; +class VideoSettingsPlugin; + +class TestVideoSettingsPlugin : public QObject + { + + Q_OBJECT + +private slots: + + /** + * called at the very beginning of the test + */ + void initTestCase(); + + /** + * called at the very end of the test + */ + void cleanupTestCase(); + + /** + * called at the start of every test. + */ + void init(); + + /** + * called at the end of every test. + */ + void cleanup(); + + /** + * test createSettingFormItemData + */ + void testCreateSettingFormItemData(); + +private: + + CpItemDataHelper* mItemHelper; + + VideoSettingsPlugin* mPlugin; + + }; + +#endif // TESTVIDEOSETTINGSPLUGIN_H + +// End of File diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testplugin/src/testvideosettingsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testplugin/src/testvideosettingsplugin.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TestVideoSettingsPlugin class implementation +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "videosettingsgroup.h" +#include "testvideosettingsplugin.h" + +// trick to get access to protected/private members. +#define private public +#include "videosettingsplugin.h" +#undef private + +// --------------------------------------------------------------------------- +// initTestCase +// --------------------------------------------------------------------------- +// +void TestVideoSettingsPlugin::initTestCase() +{ + mItemHelper = new CpItemDataHelper; +} + +// --------------------------------------------------------------------------- +// cleanupTestCase +// --------------------------------------------------------------------------- +// +void TestVideoSettingsPlugin::cleanupTestCase() +{ + delete mItemHelper; + mItemHelper = 0; +} + +// --------------------------------------------------------------------------- +// init +// --------------------------------------------------------------------------- +// +void TestVideoSettingsPlugin::init() +{ + mPlugin = new VideoSettingsPlugin(); +} + +// --------------------------------------------------------------------------- +// cleanup +// --------------------------------------------------------------------------- +// +void TestVideoSettingsPlugin::cleanup() +{ + delete mPlugin; + mPlugin = 0; +} + +// --------------------------------------------------------------------------- +// testCreateSettingFormItemData +// --------------------------------------------------------------------------- +// +void TestVideoSettingsPlugin::testCreateSettingFormItemData() +{ + QList list = mPlugin->createSettingFormItemData(*mItemHelper); + QCOMPARE( list.count(), 1 ); + VideoSettingsGroup* group = static_cast(list.at(0)); + QVERIFY( group ); + QVERIFY( &(group->mItemDataHelper) == mItemHelper ); +} + +// --------------------------------------------------------------------------- +// main +// --------------------------------------------------------------------------- +// +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); +/* HbApplication::setKeypadNavigationEnabled(false); + HbMainWindow mainWindow; + mainWindow.show();*/ + + TestVideoSettingsPlugin tc; + + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\testvideosettingsplugin.txt"; + + return QTest::qExec(&tc, 3, pass); +} + +// end of file diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testplugin/stub/inc/videosettingsgroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testplugin/stub/inc/videosettingsgroup.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef VIDEOSETTINGSGROUP_H +#define VIDEOSETTINGSGROUP_H + +#include +#include + +class CpItemDataHelper; + +class VideoSettingsGroup : public CpSettingFormItemData +{ + Q_OBJECT +public: + + /** + * Constructor + */ + VideoSettingsGroup(CpItemDataHelper &itemDataHelper); + + /** + * Destructor + */ + ~VideoSettingsGroup(); + +public: + /** + * Item data helper given by the CP framework. + */ + CpItemDataHelper& mItemDataHelper; + +}; + +#endif // VIDEOSETTINGSGROUP_H diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testplugin/stub/src/videosettingsgroup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testplugin/stub/src/videosettingsgroup.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "videosettingsgroup.h" +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoSettingsGroup::VideoSettingsGroup(CpItemDataHelper &itemDataHelper) : + CpSettingFormItemData(HbDataFormModelItem::GroupItem,QString("VideoSettings")), + mItemDataHelper(itemDataHelper) +{ +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoSettingsGroup::~VideoSettingsGroup() +{ +} diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/tsrc/testplugin/testvideosettingsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/tsrc/testplugin/testvideosettingsplugin.pro Wed Jun 23 18:14:16 2010 +0300 @@ -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: +# + +TARGET = testvideosettingsplugin +TEMPLATE = app + +DEPENDPATH += . \ + inc \ + src + +INCLUDEPATH += inc \ + stub/inc \ + ../../inc + +CONFIG += qtestlib \ + Hb \ + symbian_test + +LIBS += -lcpframework \ + -lxqutils.dll + +# Input +HEADERS += inc/testvideosettingsplugin.h \ + ../../inc/videosettingsplugin.h \ + stub/inc/videosettingsgroup.h \ + +SOURCES += src/testvideosettingsplugin.cpp \ + ../../src/videosettingsplugin.cpp \ + stub/src/videosettingsgroup.cpp \ + +TARGET.CAPABILITY = All -Tcb diff -r c48470be1ba7 -r adbe7d5ba2f5 mediasettings/videosettingsplugin/videosettingsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mediasettings/videosettingsplugin/videosettingsplugin.pro Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,57 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = videosettingsplugin + +CONFIG += hb \ + plugin + +LIBS += -lcpframework \ + -lMPSettEngine.dll \ + -lxqutils.dll \ + -lcmapplsettingsui \ + -lconnection_settings_shim + +INCLUDEPATH += ../mediasettingsengine/inc \ + ../../inc + +HEADERS += inc/videosettingsplugin.h \ + inc/videosettingsgroup.h \ + inc/videosettingsaccesspointentry.h + +SOURCES += src/videosettingsplugin.cpp \ + src/videosettingsgroup.cpp \ + src/videosettingsaccesspointentry.cpp + +symbian: { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x2002BC69 + + BLD_INF_RULES.prj_exports += "rom/videosettingsplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videosettingsplugin.iby)" +} + +TARGET.CAPABILITY = CAP_GENERAL_DLL + +deploy.path = C: +qtplugins.path = /resource/qt/plugins/controlpanel +qtplugins.sources += qmakepluginstubs/videosettingsplugin.qtplugin + +for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" + +plugin.sources += videosettingsplugin.dll +plugin.path = /resource/qt/plugins/controlpanel +DEPLOYMENT += plugin diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbum.h --- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbum.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbum.h Wed Jun 23 18:14:16 2010 +0300 @@ -177,11 +177,9 @@ * Calculates KVcxMediaMyVideosCategoryItemCount, KVcxMediaMyVideosCategoryNewItemCount, * KVcxMediaMyVideosCategoryNewItemName and KMPXMediaGeneralDate attributes to iMedia. * - * @param aStartIndex Start position of the calculations in iVideoList. - * Can be used to update values when items are appended - * to old list, without calculating everything from scratch. + * @return Returns ETrue if album attributes were modified, EFalse otherwise. */ - void CalculateAttributesL( TInt aStartIndex = 0 ); + TBool CalculateAttributesL(); private: diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbums.h --- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbums.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbums.h Wed Jun 23 18:14:16 2010 +0300 @@ -160,8 +160,13 @@ /** * Calculates and updates album media attributes. + * Adds events to iCollection.iMessageList if albums + * are modified. Does not send them. + * + * @return Returns ETrue if events were added to iCollection.iMessageList, + * EFalse otherwise. */ - void CalculateAttributesL(); + TBool CalculateAttributesL(); /** * Called when video's New Video flag changes. Calculates diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionplugin.h --- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionplugin.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionplugin.h Wed Jun 23 18:14:16 2010 +0300 @@ -199,13 +199,13 @@ * From MVcxMyVideosMdsDbObserver. */ void HandleMyVideosDbEvent( TMPXChangeEventType aEvent, - RArray& aId ); + RArray& aId, TInt aEventsLeft ); /** * Leaving version of HandleMyVideosDbEvent. */ void DoHandleMyVideosDbEventL( TMPXChangeEventType aEvent, - RArray& aId ); + RArray& aId, TInt aEventsLeft ); /** * From MVcxMyVideosMdsDbObserver. diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionutil.h --- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionutil.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionutil.h Wed Jun 23 18:14:16 2010 +0300 @@ -252,6 +252,30 @@ static TUint32 Uint32ValueL( CMPXMedia& aMedia ); /** + * Gets KVcxMediaMyVideosCategoryItemCount attribute from aVideo. + * + * @param aMedia Media where from the attribute is fetched. + * @return Returns 0, if attribute is not supported. + */ + static TUint32 CategoryItemCountL( CMPXMedia& aVideo ); + + /** + * Gets KVcxMediaMyVideosCategoryNewItemCount attribute from aVideo. + * + * @param aMedia Media where from the attribute is fetched. + * @return Returns 0, if attribute is not supported. + */ + static TUint32 CategoryNewItemCountL( CMPXMedia& aVideo ); + + /** + * Gets KVcxMediaMyVideosCategoryNewItemName attribute from aVideo. + * + * @param aMedia Media where from the attribute is fetched. + * @return Category new video name. + */ + static const TDesC& CategoryNewVideoName( const CMPXMedia& aVideo ); + + /** * Gets KMPXMediaGeneralId attributes from aMediaArray and * puts them to aIdArray. aIdArray is reset before adding. * diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h --- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Wed Jun 23 18:14:16 2010 +0300 @@ -61,10 +61,11 @@ /** * Handler function for database events. * - * @param aEvent Event type. - * @param aId Array of IDs in database. + * @param aEvent Event type. + * @param aId Array of IDs in database. + * @param aEventsLeft How many events are still coming. */ - virtual void HandleMyVideosDbEvent( TMPXChangeEventType aEvent, RArray& aId ) = 0; + virtual void HandleMyVideosDbEvent( TMPXChangeEventType aEvent, RArray& aId, TInt aEventsLeft ) = 0; /** * Handler function for video list fetching events. This callback is called as a response @@ -275,6 +276,14 @@ ERemoveAlbums }; + class TEvent + { + public: + + TUint32 iMdsId; + TInt iEventType; + }; + /** * Two-phased constructor. * @param aObserver The db change observer. @@ -356,6 +365,11 @@ */ CMPXMedia* CreateVideoL( TUint32 aId, TBool aFullDetails = ETrue ); + /** + * Called by iEventProcessor. + */ + static TInt ProcessEvents( TAny* aPtr ); + protected: // from MMdESessionObserver @@ -548,6 +562,11 @@ */ CMdESession& MdsSessionL(); + /** + * Called by ProcessEvents. + */ + TInt DoProcessEvents(); + public: /** @@ -767,6 +786,15 @@ */ CVcxMdsShutdownMonitor* iMdsShutdownMonitor; + /** + * Used for handling events on background. + */ + CIdle* iEventProcessor; + + /** + * Incoming events are stored here and "slowly" fed to observer. + */ + RArray iEvents; }; #endif // VCXMYVIDEOSMDSDB_H diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h --- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Wed Jun 23 18:14:16 2010 +0300 @@ -295,10 +295,12 @@ * * @param aVideo Video to add. * @param aSortingOrder Sorting order. + * @param aUpdateCategores If ETrue, then category and album attributes are updated. * @return KErrNone if added, KErrAlreadyExists if already exists and * was not added. */ - TInt AddL( CMPXMedia* aVideo, TVcxMyVideosSortingOrder aSortingOrder ); + TInt AddL( CMPXMedia* aVideo, TVcxMyVideosSortingOrder aSortingOrder, + TBool aUpdateCategories = ETrue ); /** * Adds video to iPartialVideoList. Ownership moves. @@ -413,9 +415,10 @@ * @param aNonVideoIds If argument given then Ids which were detected to not be * videos are written here. Caller owns the array, ownership * does not move. + * @param aUpdateCategories If ETrue, then category/album attributes are updated. */ void AddVideosFromMdsL( RArray& aMdsIds, TBool& aListFetchingWasCanceled, - RArray* aNonVideoIds = NULL ); + RArray* aNonVideoIds = NULL, TBool aUpdateCategories = ETrue ); /** * Deletes old and creates new iVideoList. After the function call iVideoList exists, diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -292,7 +292,7 @@ // CVcxMyVideosAlbum::CalculateAttributesL // --------------------------------------------------------------------------- // -void CVcxMyVideosAlbum::CalculateAttributesL( TInt aStartIndex ) +TBool CVcxMyVideosAlbum::CalculateAttributesL() { TInt videoCount = 0; TUint32 count = iVideoList.Count(); @@ -303,7 +303,7 @@ TUint32 flags; TInt64 currentItemsCreationDate = 0; TInt64 latestCreationDate = TVcxMyVideosCollectionUtil::CreationDateL( *iMedia ); - for ( TInt i = aStartIndex; i < count; i++ ) + for ( TInt i = 0; i < count; i++ ) { video = iCollection.iCache->FindVideoByMdsIdL( iVideoList[i].iMdsId, pos ); if ( video ) @@ -322,13 +322,36 @@ } } } - iMedia->SetTObjectValueL( KVcxMediaMyVideosCategoryItemCount, videoCount ); - iMedia->SetTObjectValueL( KVcxMediaMyVideosCategoryNewItemCount, newCount ); + + TBool modified = EFalse; + + TUint32 prevValue = TVcxMyVideosCollectionUtil::CategoryItemCountL( *iMedia ); + if ( prevValue != videoCount ) + { + iMedia->SetTObjectValueL( KVcxMediaMyVideosCategoryItemCount, videoCount ); + modified = ETrue; + } + + prevValue = TVcxMyVideosCollectionUtil::CategoryNewItemCountL( *iMedia ); + if ( prevValue != newCount ) + { + iMedia->SetTObjectValueL( KVcxMediaMyVideosCategoryNewItemCount, newCount ); + modified = ETrue; + } + if ( latestNewVideo ) { - iMedia->SetTextValueL( KVcxMediaMyVideosCategoryNewItemName, - TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) ); + TPtrC prevNewVideoName( TVcxMyVideosCollectionUtil::CategoryNewVideoName( *iMedia ) ); + TPtrC latestNewVideoName( TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) ); + if ( prevNewVideoName != latestNewVideoName ) + { + iMedia->SetTextValueL( KVcxMediaMyVideosCategoryNewItemName, + TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) ); + iMedia->SetTObjectValueL( KMPXMediaGeneralDate, latestCreationDate ); + modified = ETrue; + } } - iMedia->SetTObjectValueL( KMPXMediaGeneralDate, latestCreationDate ); + + return modified; } diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideosalbums.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbums.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbums.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -264,7 +264,7 @@ // void CVcxMyVideosAlbums::AddAlbumL( CMPXMedia& aCmd ) { - if ( TVcxMyVideosCollectionUtil::Title( aCmd ).Length() > 255 ) + if ( TVcxMyVideosCollectionUtil::Title( aCmd ).Length() > KVcxMvcMaxTitleLength ) { User::Leave( KErrArgument ); } @@ -351,13 +351,23 @@ // CVcxMyVideosAlbums::CalculateAttributesL // ---------------------------------------------------------------------------- // -void CVcxMyVideosAlbums::CalculateAttributesL() +TBool CVcxMyVideosAlbums::CalculateAttributesL() { + TBool eventsAdded = EFalse; + TBool modified = EFalse; TInt count = iAlbums.Count(); for ( TInt i = 0; i < count; i++ ) { - iAlbums[i]->CalculateAttributesL(); + modified = iAlbums[i]->CalculateAttributesL(); + if ( modified ) + { + iCollection.iMessageList->AddEventL( + TMPXItemId( iAlbums[i]->iMdsId, KVcxMvcMediaTypeAlbum ), + EMPXItemModified, 0 ); + eventsAdded = ETrue; + } } + return eventsAdded; } // ---------------------------------------------------------------------------- diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideoscategories.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideoscategories.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideoscategories.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -551,7 +551,7 @@ return KVcxMyVideosCapturedCategoryIndex; case EVcxMyVideosOriginDownloaded: -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_DOWNLOADS_CATEGORY return KVcxMyVideosDownloadsCategoryIndex; #endif case EVcxMyVideosOriginTvRecording: diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionplugin.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionplugin.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionplugin.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -100,7 +100,7 @@ MPX_FUNC("CVcxMyVideosCollectionPlugin::ConstructL"); User::LeaveIfError( iFs.Connect() ); -#ifdef VIDEO_COLLECTION_PLUGIN_TB92 +#ifndef VCX_ALBUMS iMyVideosMdsDb = CVcxMyVideosMdsDb::NewL( this, iFs ); #else iMyVideosMdsDb = CVcxMyVideosMdsDb::NewL( this, iFs, &AlbumsL() ); @@ -403,9 +403,10 @@ // void CVcxMyVideosCollectionPlugin::HandleMyVideosDbEvent( TMPXChangeEventType aEvent, - RArray& aId ) + RArray& aId, + TInt aEventsLeft ) { - TRAPD( err, DoHandleMyVideosDbEventL( aEvent, aId )); + TRAPD( err, DoHandleMyVideosDbEventL( aEvent, aId, aEventsLeft )); if ( err != KErrNone ) { MPX_DEBUG2("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() leaved with error code: %d", err); @@ -418,7 +419,8 @@ // void CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL( TMPXChangeEventType aEvent, - RArray& aId ) + RArray& aId, + TInt /*aEventsLeft*/ ) { MPX_FUNC("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL"); @@ -433,9 +435,14 @@ MPX_DEBUG1("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() --------------------------------------------."); MPX_DEBUG1("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() Items from MDS deleted, deleting from cache |" ); MPX_DEBUG1("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() --------------------------------------------'"); - - iCache->RemoveL( aId ); -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 + + iCache->RemoveL( aId, EFalse ); + + CategoriesL().ResetVideoCountersL(); + CategoriesL().UpdateCategoriesL( *iCache->iVideoList, 0 ); + CategoriesL().UpdateCategoriesNewVideoNamesL(); + +#ifdef VCX_ALBUMS AlbumsL().RemoveAlbumsL( aId ); #endif } @@ -460,9 +467,14 @@ // We receive add events for all object types. When fetching the item from MDS we use // video condition and only video objects are added to cache. Items which were detected // to not be videos are added to nonVideoIds. - iCache->AddVideosFromMdsL( aId, videoListFetchingWasCancelled, &nonVideoIds ); + iCache->AddVideosFromMdsL( aId, videoListFetchingWasCancelled, + &nonVideoIds, EFalse /* dont update categories*/ ); -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 + CategoriesL().ResetVideoCountersL(); + CategoriesL().UpdateCategoriesL( *iCache->iVideoList, 0 ); + CategoriesL().UpdateCategoriesNewVideoNamesL(); + +#ifdef VCX_ALBUMS #if 0 //TODO: do this if we want to support albums which are being added by someone else than My Videos Collection //After the call nonVideoIds will contain only items which were actually added @@ -485,7 +497,7 @@ MPX_DEBUG1("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() Items modified in MDS, updating cache |"); MPX_DEBUG1("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() --------------------------------------'"); CMPXMedia* video; -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS CMPXMedia* album; #endif TInt count = aId.Count(); @@ -501,7 +513,7 @@ } else { -#ifdef VIDEO_COLLECTION_PLUGIN_TB92 +#ifndef VCX_ALBUMS MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: couldn't find the modified item from MDS"); aId.Remove( i ); #else @@ -545,7 +557,7 @@ } } -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS //nonVideoIds are albums count = nonVideoIds.Count(); for ( TInt i = 0; i < count; i++ ) @@ -709,6 +721,7 @@ SetTransactionIdL( cmd, *message ); iMessageList->AddL( message ); + CleanupStack::Pop( message ); // <-3 iMessageList->SendL(); if ( videoListFetchingWasCancelled ) @@ -717,7 +730,6 @@ RestartVideoListFetchingL(); } - CleanupStack::Pop( message ); // <-3 CleanupStack::PopAndDestroy( &mdsIds2 ); // <-2 CleanupStack::PopAndDestroy( &mdsIds ); // <-1 @@ -964,7 +976,7 @@ ids.Reset(); CleanupClosePushL( ids ); // 1-> ids.AppendL( mpxId.iId1 ); - HandleMyVideosDbEvent( EMPXItemInserted, ids ); //this will fetch from mds to cache + HandleMyVideosDbEvent( EMPXItemInserted, ids, 0 ); //this will fetch from mds to cache CleanupStack::PopAndDestroy( &ids ); // <-1 } diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionutil.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionutil.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionutil.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -254,7 +254,7 @@ if ( aVideo.IsSupported( KVcxMediaMyVideosOrigin ) ) { origin = aVideo.ValueTObjectL( KVcxMediaMyVideosOrigin ); -#ifdef VIDEO_COLLECTION_PLUGIN_TB92 +#ifndef VCX_DOWNLOADS_CATEGORY if ( origin != EVcxMyVideosOriginCapturedWithCamera ) { origin = EVcxMyVideosOriginOther; @@ -542,6 +542,52 @@ } // ---------------------------------------------------------------------------- +// TVcxMyVideosCollectionUtil::CategoryItemCountL +// ---------------------------------------------------------------------------- +// +TUint32 TVcxMyVideosCollectionUtil::CategoryItemCountL( CMPXMedia& aVideo ) + { + TUint32 categoryItemCount = 0; + + if ( aVideo.IsSupported( KVcxMediaMyVideosCategoryItemCount ) ) + { + categoryItemCount = aVideo.ValueTObjectL( KVcxMediaMyVideosCategoryItemCount ); + } + return categoryItemCount; + } + +// ---------------------------------------------------------------------------- +// TVcxMyVideosCollectionUtil::CategoryNewItemCountL +// ---------------------------------------------------------------------------- +// +TUint32 TVcxMyVideosCollectionUtil::CategoryNewItemCountL( CMPXMedia& aVideo ) + { + TUint32 categoryNewItemCount = 0; + + if ( aVideo.IsSupported( KVcxMediaMyVideosCategoryNewItemCount ) ) + { + categoryNewItemCount = aVideo.ValueTObjectL( KVcxMediaMyVideosCategoryNewItemCount ); + } + return categoryNewItemCount; + } + +// ---------------------------------------------------------------------------- +// TVcxMyVideosCollectionUtil::CategoryNewVideoName +// ---------------------------------------------------------------------------- +// +const TDesC& TVcxMyVideosCollectionUtil::CategoryNewVideoName( const CMPXMedia& aVideo ) + { + if ( aVideo.IsSupported( KVcxMediaMyVideosCategoryNewItemName ) ) + { + return aVideo.ValueText( KVcxMediaMyVideosCategoryNewItemName ); + } + else + { + return KNullDesC; + } + } + +// ---------------------------------------------------------------------------- // TVcxMyVideosCollectionUtil::GetIdsFromMediaArrayL // ---------------------------------------------------------------------------- // diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -446,6 +446,11 @@ // TITLE (NAME) if ( aAlbum.IsSupported( KMPXMediaGeneralTitle ) ) { + if ( TVcxMyVideosCollectionUtil::Title( aAlbum ).Length() > KVcxMvcMaxTitleLength ) + { + User::Leave( KErrArgument ); + } + if ( aObject.Property( *iMdsDb.iTitlePropertyDef, property, 0 ) != KErrNotFound ) { static_cast(property)->SetValueL( diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -191,6 +191,8 @@ iMdsShutdownMonitor = CVcxMdsShutdownMonitor::NewL( *this, KHarvesterPSShutdown, KMdSShutdown, EFalse ); + + iEvents.Reset(); MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL exit" ); } @@ -256,7 +258,7 @@ TBool aPresent, const RArray& aObjectIdArray) { MPX_DEBUG1( "CVcxMyVideosMdsDb::--------------------------------------------------------------." ); - MPX_DEBUG3( "CVcxMyVideosMdsDb::HandleObjectPresentNotification( aPresent = %1d, count = %3d) |", aPresent, aObjectIdArray.Count() ); + MPX_DEBUG3( "CVcxMyVideosMdsDb::HandleObjectPresentNotification( aPresent = %1d, count = %4d) |", aPresent, aObjectIdArray.Count() ); MPX_DEBUG1( "CVcxMyVideosMdsDb::--------------------------------------------------------------'" ); TObserverNotificationType type; @@ -305,6 +307,9 @@ { MPX_DEBUG1( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb() start" ); + delete iEventProcessor; + iEvents.Close(); + Cancel( EGetVideoList ); delete iAlbums; @@ -1026,7 +1031,7 @@ if ( aObject.Property( *iOriginPropertyDef, property, 0 ) != KErrNotFound ) { TUint8 origin = static_cast(property)->Value(); -#ifdef VIDEO_COLLECTION_PLUGIN_TB92 +#ifndef VCX_DOWNLOADS_CATEGORY if( origin != EVcxMyVideosOriginCapturedWithCamera ) { origin = EVcxMyVideosOriginOther; @@ -1604,30 +1609,116 @@ if ( iMdsDbObserver ) { - RArray idArray; - CleanupClosePushL( idArray ); // 1-> - - for ( TInt i = 0; i < aObjectIdArray.Count(); i++ ) + // Let delete events bypass buffer only if it empty. + // This assures that event arriving order stays the same. + if ( aType & ENotifyRemove && iEvents.Count() == 0 ) { - idArray.Append( aObjectIdArray[i] ); + // Delete handling is so fast that we dont buffer them at all. + // Modify and add require fetch from mds -> they are slow. + RArray idArray; + CleanupClosePushL( idArray ); // 1-> + + for ( TInt i = 0; i < aObjectIdArray.Count(); i++ ) + { + idArray.Append( aObjectIdArray[i] ); + } + + iMdsDbObserver->HandleMyVideosDbEvent( EMPXItemDeleted, idArray, iEvents.Count() ); + + CleanupStack::PopAndDestroy( &idArray ); // <-1 } - - if ( aType & ENotifyAdd ) + else { - iMdsDbObserver->HandleMyVideosDbEvent( EMPXItemInserted, idArray ); - } - else if ( aType & ENotifyModify ) - { - iMdsDbObserver->HandleMyVideosDbEvent( EMPXItemModified, idArray ); - } - else if ( aType & ENotifyRemove ) - { - iMdsDbObserver->HandleMyVideosDbEvent( EMPXItemDeleted, idArray ); - } + // Buffer modify & add events, since their handling is slow. + // Process them on background. + TInt count = aObjectIdArray.Count(); + + if ( iEvents.Count() == 0 ) + { + iEvents.ReserveL( count ); + } + + TEvent event; + for ( TInt i = 0; i < count; i++ ) + { + event.iMdsId = aObjectIdArray[i]; + event.iEventType = aType; + iEvents.AppendL( event ); + } + + if ( !iEventProcessor ) + { + iEventProcessor = CIdle::NewL( CActive::EPriorityIdle ); + } + + if ( !iEventProcessor->IsActive() ) + { + iEventProcessor->Start( TCallBack( ProcessEvents, this )); + } + } + } + } + +// --------------------------------------------------------------------------- +// CVcxMyVideosMdsDb::ProcessEvents +// --------------------------------------------------------------------------- +// +TInt CVcxMyVideosMdsDb::ProcessEvents( TAny* aPtr ) + { + return static_cast(aPtr)->DoProcessEvents(); + } - CleanupStack::PopAndDestroy( &idArray ); // <-1 +// --------------------------------------------------------------------------- +// CVcxMyVideosMdsDb::DoProcessEvents +// --------------------------------------------------------------------------- +// +TInt CVcxMyVideosMdsDb::DoProcessEvents() + { + TInt sent = 0; + TInt currentEventType = -1; + const TInt sendAtOnce = 10; + + RArray idArray; + CleanupClosePushL( idArray ); // 1-> + + idArray.Reserve( sendAtOnce ); // may fail, it's ok + + while ( sent < sendAtOnce ) + { + if ( iEvents.Count() == 0 ) + { + break; + } + + if ( iEvents[0].iEventType != currentEventType && + currentEventType != -1 ) + { + break; + } + currentEventType = iEvents[0].iEventType; + idArray.Append( iEvents[0].iMdsId ); // this may fail, it is ok, we can't do anything for it + iEvents.Remove( 0 ); + sent++; } - + + iEvents.Compress(); + + if ( currentEventType & ENotifyAdd ) + { + iMdsDbObserver->HandleMyVideosDbEvent( EMPXItemInserted, idArray, iEvents.Count() ); + } + else if ( currentEventType & ENotifyModify ) + { + iMdsDbObserver->HandleMyVideosDbEvent( EMPXItemModified, idArray, iEvents.Count() ); + } + else if ( currentEventType & ENotifyRemove ) + { + iMdsDbObserver->HandleMyVideosDbEvent( EMPXItemDeleted, idArray, iEvents.Count() ); + } + + CleanupStack::PopAndDestroy( &idArray ); // <-1 + + return iEvents.Count(); } // --------------------------------------------------------------------------- diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -139,6 +139,11 @@ iMessageCount++; iMessageList->SetTObjectValueL( KMPXMessageArrayCount, iMessageCount ); + + if ( iMessageArray->Count() > 100 ) + { + SendL(); + } } // ---------------------------------------------------------------------------------------------------------- @@ -277,10 +282,9 @@ #endif CreateMessageListL(); //does nothing if already created - iMessageArray->AppendL( aMessage ); // ownership moves iMessageCount++; iMessageList->SetTObjectValueL( KMPXMessageArrayCount, iMessageCount ); - + iMessageArray->AppendL( aMessage ); // ownership moves } // ---------------------------------------------------------------------------------------------------------- diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -126,7 +126,7 @@ { //we are at root level, return main level items (categories + albums) -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS iCollection.AlbumsL().CreateAlbumListL(); //async #endif @@ -146,7 +146,7 @@ !iCache.IsComplete() ); TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.CategoriesL().iList ); -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.AlbumsL().iAlbumList ); #endif itemList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); @@ -160,7 +160,7 @@ { //we are at second level, return video list from some category or album -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS iCollection.AlbumsL().CreateAlbumListL(); //async #endif @@ -390,7 +390,7 @@ iCollection.CategoriesL().UpdateCategoriesNewVideoNamesL(); - iCollection.AlbumsL().CalculateAttributesL(); + iCollection.AlbumsL().CalculateAttributesL(); // adds events if attributes modified, does not send iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); } @@ -511,11 +511,6 @@ MPX_DEBUG2("CVcxMyVideosOpenHandler:: First videos for album %d arrived, calling HandleOpen()", aAlbumId); iAlbumVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); - if ( aComplete ) - { - iAlbumVideoList->SetTObjectValueL( KVcxMediaMyVideosInt32Value, - EVcxMyVideosVideoListComplete ); - } iCollection.iObs->HandleOpen( iAlbumVideoList, aError ); iPendingAlbumOpenId = 0; } @@ -526,14 +521,16 @@ MPX_DEBUG3("CVcxMyVideosOpenHandler:: adding modify event for album %d, extra info = %d", aAlbumId, EVcxMyVideosVideoListOrderChanged ); - iCollection.iMessageList->AddEventL( TMPXItemId( aAlbumId, 2 ), EMPXItemModified, + iCollection.iMessageList->AddEventL( TMPXItemId( aAlbumId, KVcxMvcMediaTypeAlbum ), EMPXItemModified, EVcxMyVideosVideoListOrderChanged ); } else { //TODO: should add album id - iCollection.AlbumsL().CalculateAttributesL(); + iCollection.AlbumsL().CalculateAttributesL(); // adds events if attributes modified, does not send + iAlbumVideoList->SetTObjectValueL( KVcxMediaMyVideosInt32Value, + EVcxMyVideosVideoListComplete ); iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -512,7 +512,7 @@ // ---------------------------------------------------------------------------- // void CVcxMyVideosVideoCache::AddVideosFromMdsL( RArray& aMdsIds, - TBool& aListFetchingWasCanceled, RArray* aNonVideoIds ) + TBool& aListFetchingWasCanceled, RArray* aNonVideoIds, TBool aUpdateCategories ) { MPX_FUNC("CVcxMyVideosVideoCache::AddVideosFromMdsL"); @@ -547,7 +547,7 @@ { CleanupStack::PushL( videoToCache ); // 1-> - TInt err = AddL( videoToCache, sortingOrder ); + TInt err = AddL( videoToCache, sortingOrder, aUpdateCategories ); if ( err == KErrNone ) { @@ -584,7 +584,8 @@ // This is for single adds, video list fetching does not call this. // ---------------------------------------------------------------------------- // -TInt CVcxMyVideosVideoCache::AddL( CMPXMedia* aVideo, TVcxMyVideosSortingOrder aSortingOrder ) +TInt CVcxMyVideosVideoCache::AddL( CMPXMedia* aVideo, TVcxMyVideosSortingOrder aSortingOrder, + TBool aUpdateCategories ) { MPX_FUNC("CVcxMyVideosVideoCache::AddL"); @@ -596,7 +597,7 @@ else { MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList is complete, adding to iVideoList"); - return AddToCorrectPlaceL( *aVideo, aSortingOrder ); + return AddToCorrectPlaceL( *aVideo, aSortingOrder, aUpdateCategories ); } } @@ -945,7 +946,7 @@ origin, modified ); -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS iCollection.AlbumsL().NewVideoFlagChangedL( TVcxMyVideosCollectionUtil::IdL( *videoInCache ).iId1 ); #endif @@ -1190,7 +1191,7 @@ iCollection.CategoriesL().UpdateCategoryNewVideoNameAndDateL( *aVideoInCache, modified ); -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS iCollection.AlbumsL().VideoTitleChangedL( TVcxMyVideosCollectionUtil::IdL( *aVideoInCache ).iId1 ); #endif @@ -1501,7 +1502,7 @@ if ( aUpdateCategories ) { iCollection.CategoriesL().VideoAddedL( aVideo ); -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS iCollection.AlbumsL().VideoAddedOrRemovedFromCacheL( aVideo ); #endif } @@ -1561,7 +1562,7 @@ pos != KErrNotFound /* no need to update if item is on iPartialVideoList*/ ) { iCollection.CategoriesL().VideoRemovedL( *video ); -#ifndef VIDEO_COLLECTION_PLUGIN_TB92 +#ifdef VCX_ALBUMS iCollection.AlbumsL().VideoAddedOrRemovedFromCacheL( *video ); #endif } diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/tsrc/stubs/inc/hbdialog.h --- a/videocollection/tsrc/stubs/inc/hbdialog.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/hbdialog.h Wed Jun 23 18:14:16 2010 +0300 @@ -174,6 +174,12 @@ * if true, secondaryAction() -method returns null */ static bool secondaryReturnNull; + + /** + * the amount how many times the open has been called. + */ + static int openAmount; + }; #endif diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/tsrc/stubs/inc/videoactivitystate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/tsrc/stubs/inc/videoactivitystate.h Wed Jun 23 18:14:16 2010 +0300 @@ -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: stub VideoActivityState class definition for collection view unite tests +* +*/ + +// Version : %version: 1 % + +#ifndef __VIDEOACTIVITYSTATE_H__ +#define __VIDEOACTIVITYSTATE_H__ + +#include +#include + + + +namespace VideoActivityData +{ + // type of collectionview plugin's widget level(int): + // all videos, collections or collection video list + static const QString KEY_WIDGET_LEVEL = "_VideoActivity_widget_level_"; + + // id of the collection whose videolist is to be shown (int). + static const QString KEY_WIDGET_ID = "_VideoActivity_view_item_id_"; +} + + +class VideoActivityState +{ + +public: + + /** + * method returns a static instance of this class + */ + static VideoActivityState &instance(); + + /** + * Sets activity data. If dataKey is not defined, all activity data + * will be overwritten by a provided data. + * + * @param data Data to save + * @param dataKey Key indicating dataitem. If empty, all data will be overwritten by provided data + */ + void setActivityData(const QVariant& data, const QString& dataKey = QString("")); + + /** + * Get activity data. If dataKey is not defined, all activity data + * will be returned. If item corresponding provided dataKey is not found, + * method returns empty QVariant. + * + * @param dataKey Key indicating dataitem client wants. If empty, all data will be returned + * + * @return QVariant + */ + const QVariant getActivityData(const QString& dataKey = QString("")); + +private: + + /** + * private default contructor + */ + VideoActivityState(); + + /** + * copy contructor definition + */ + VideoActivityState(const VideoActivityState& other); + + /** + * Private destructor. + * + */ + virtual ~VideoActivityState(); + +private: + + /** + * locally saved activity data + */ + QHash mActivityData; + +}; + +#endif //__VIDEOACTIVITYSTATE_H__ diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/tsrc/stubs/src/hbdialog.cpp --- a/videocollection/tsrc/stubs/src/hbdialog.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/tsrc/stubs/src/hbdialog.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -24,6 +24,7 @@ bool HbDialog::execReturnPrimary = true; bool HbDialog::primaryReturnNull = false; bool HbDialog::secondaryReturnNull = false; +int HbDialog::openAmount = 0; HbDialog::HbDialog(QGraphicsItem *parent) : HbWidget(parent), @@ -50,6 +51,7 @@ void HbDialog::open( QObject* receiver, const char* member) { + openAmount++; if(receiver && member) { connect(this, SIGNAL(finished(HbAction*)), receiver, SLOT(member)); diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/tsrc/stubs/src/videoactivitystate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/tsrc/stubs/src/videoactivitystate.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub implementation of VideoActivityState +* +*/ + +// Version : %version: 1 % + +#include "videoactivitystate.h" +#include "mpxvideo_debug.h" + +// ------------------------------------------------------------------------------------------------- +// instance() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState& VideoActivityState::instance() +{ + MPX_ENTER_EXIT(_L("VideoActivityState::instance()")); + + static VideoActivityState _staticWrapper; + return _staticWrapper; +} + +// ------------------------------------------------------------------------------------------------- +// VideoActivityState() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState::VideoActivityState() +{ + // NOP +} + +// ------------------------------------------------------------------------------------------------- +// ~VideoActivityState() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState::~VideoActivityState() +{ + MPX_ENTER_EXIT(_L("VideoActivityState::~VideoActivityState()")); + mActivityData.clear(); + +} + +// ------------------------------------------------------------------------------------------------- +// setActivityData() +// ------------------------------------------------------------------------------------------------- +// +void VideoActivityState::setActivityData(const QVariant& data, const QString& dataKey) +{ + MPX_ENTER_EXIT(_L("VideoActivityState::setActivityData()")); + if(dataKey.length()) + { + // setting particular dataitem + mActivityData[dataKey] = data; + } + else + { + // overwriting all data + mActivityData.clear(); + mActivityData = data.toHash(); + } +} + +// ------------------------------------------------------------------------------------------------- +// getActivityData() +// ------------------------------------------------------------------------------------------------- +// +const QVariant VideoActivityState::getActivityData(const QString& dataKey) +{ + MPX_ENTER_EXIT(_L("VideoActivityState::getData()")); + if(dataKey.length()) + { + return mActivityData[dataKey]; + } + else + { + return QVariant::fromValue(mActivityData); + } +} +// End of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/tsrc/stubs/src/videolistview.cpp --- a/videocollection/tsrc/stubs/src/videolistview.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videolistview.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -146,16 +146,6 @@ // not stubbed } -void VideoListView::openNewAlbumSlot(const QModelIndex &parent, - int start, - int end) -{ - Q_UNUSED(parent); - Q_UNUSED(start); - Q_UNUSED(end); - // not stubbed -} - void VideoListView::openServicesViewSlot() { // not stubbed @@ -246,10 +236,4 @@ // not stubbed } -void VideoListView::createCollectionDialogFinished(HbAction *action) -{ - Q_UNUSED(action); - // not stubbed -} - // end of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/tsrc/stubs/src/videolistwidget.cpp --- a/videocollection/tsrc/stubs/src/videolistwidget.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videolistwidget.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -110,9 +110,9 @@ return mCurrentLevel; } -VideoSortFilterProxyModel& VideoListWidget::getModel() +VideoSortFilterProxyModel* VideoListWidget::getModel() { - return *mModel; + return mModel; } void VideoListWidget::emitActivated (const QModelIndex &modelIndex) diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/tsrc/stubs/stubs.pro --- a/videocollection/tsrc/stubs/stubs.pro Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/tsrc/stubs/stubs.pro Wed Jun 23 18:14:16 2010 +0300 @@ -76,6 +76,7 @@ inc/videoplayerappexport.h \ inc/videosortfilterproxymodeldata.h \ inc/videothumbnailtestdata.h \ + inc/videoactivitystate.h \ inc/xqserviceutilxtra.h \ # We need stub for this because it has static data and HW compilation of moc file fails because of that. inc/videoservices.h \ @@ -126,7 +127,8 @@ src/videothumbnaildata.cpp \ src/videoservices.cpp \ src/videoserviceurifetch.cpp \ - src/videoservicebrowse.cpp + src/videoservicebrowse.cpp \ + src/videoactivitystate.cpp HEADERS += $$find(HEADERS_TEMP, ^(?!.*$$TESTEDCLASS).*$) SOURCES += $$find(SOURCES_TEMP, ^(?!.*$$TESTEDCLASS).*$) diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/inc/videolistselectiondialog.h --- a/videocollection/videocollectionview/inc/videolistselectiondialog.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/inc/videolistselectiondialog.h Wed Jun 23 18:14:16 2010 +0300 @@ -54,6 +54,7 @@ EDeleteVideos, EAddToCollection, ERemoveFromCollection, + ECreateCollection, ESelectCollection }; @@ -220,6 +221,11 @@ TMPXItemId mSelectedAlbumId; /** + * Text for a new album. + */ + QString mNewAlbumText; + + /** * header label */ HbLabel *mHeading; diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/inc/videolistview.h --- a/videocollection/videocollectionview/inc/videolistview.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/inc/videolistview.h Wed Jun 23 18:14:16 2010 +0300 @@ -119,13 +119,6 @@ */ void viewReady(); -public slots: - - /** - * Signaled by HbInputDialog when it's closed. - */ - void createCollectionDialogFinished(HbAction *action); - private slots: /** @@ -170,12 +163,6 @@ void openCollectionViewSlot(); /** - * Slot is connected to model's about to insert rows signal. - * Opens the new album which was created. - */ - void openNewAlbumSlot(const QModelIndex &parent, int start, int end); - - /** * Slot is connected into toolbar's Service tab's * triggered signal. * diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/inc/videolistwidget.h --- a/videocollection/videocollectionview/inc/videolistwidget.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/inc/videolistwidget.h Wed Jun 23 18:14:16 2010 +0300 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "videoservices.h" #include "videocollectioncommon.h" @@ -108,7 +109,7 @@ * * @return VideoSortFilterProxyModel* */ - VideoSortFilterProxyModel& getModel(); + VideoSortFilterProxyModel* getModel(); public: @@ -355,7 +356,7 @@ * Provided model * Not own. */ - VideoSortFilterProxyModel *mModel; + QPointer mModel; /** * pointer to videoservices instance diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/src/videocollectionviewutils.cpp --- a/videocollection/videocollectionview/src/videocollectionviewutils.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/src/videocollectionviewutils.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,11 +15,9 @@ * */ -// Version : %version: 39 % +// Version : %version: 41 % // INCLUDE FILES -#include -#include #include #include #include @@ -32,6 +30,7 @@ #include "videocollectioncommon.h" #include "videocollectionviewutils.h" #include "videosortfilterproxymodel.h" +#include "videoactivitystate.h" #include "videocollectiontrace.h" // Object names. @@ -51,7 +50,6 @@ const int KAddToCollectionCountIndex(0); const int KAddToCollectionNameIndex(1); -static const char* ACTIVITY_VIDEOS_MAINVIEW = "VideosMainView"; // --------------------------------------------------------------------------- // instance @@ -320,20 +318,9 @@ // void VideoCollectionViewUtils::saveWidgetLevel(VideoCollectionCommon::TCollectionLevels &level) { - FUNC_LOG; - HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); - if(!activityManager) - { - return; - } - // clean up any previous versions of this activity from the activity manager. - activityManager->removeActivity(ACTIVITY_VIDEOS_MAINVIEW); - - QVariant data = int(level); - - activityManager->addActivity(ACTIVITY_VIDEOS_MAINVIEW, data, QVariantHash()); - - + FUNC_LOG; + QVariant data = int(level); + VideoActivityState::instance().setActivityData(data, VideoActivityData::KEY_WIDGET_LEVEL); } // --------------------------------------------------------------------------- @@ -346,13 +333,7 @@ // all videos view is the default value to be returned in case nothing can be read // from the activity manager VideoCollectionCommon::TCollectionLevels level(VideoCollectionCommon::ELevelVideos); - - HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); - if(!activityManager) - { - return level; - } - QVariant data =activityManager->activityData(ACTIVITY_VIDEOS_MAINVIEW); + QVariant data = VideoActivityState::instance().getActivityData(VideoActivityData::KEY_WIDGET_LEVEL); if(data.toInt() == VideoCollectionCommon::ELevelCategory) { level = VideoCollectionCommon::ELevelCategory; diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/src/videolistselectiondialog.cpp --- a/videocollection/videocollectionview/src/videolistselectiondialog.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistselectiondialog.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 29 % +// Version : %version: 30 % // INCLUDE FILES #include @@ -40,6 +40,7 @@ // Object names. const char* const SELECTION_DIALOG_OBJECT_NAME_LIST_WIDGET = "vc:SelectionDialogListWidget"; const char* const SELECTION_DIALOG_OBJECT_NAME_NEW_COLLECTION = "vc:SelectionDialogNewCollection"; +const char* const LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION = "vc::ListViewInputDialogCreateCollection"; const char* const SELECTION_DIALOG_OBJECT_NAME_BUTTON_OK = "vc:SelectionDialogButtonOk"; const char* const SELECTION_DIALOG_OBJECT_NAME_BUTTON_CANCEL = "vc:SelectionDialogButtonCancel"; @@ -53,6 +54,21 @@ return qHash(keyPair); } +/** + * Helper function for creating a new album name query dialog + */ +HbInputDialog* gCreateNewAlbumNameDialog(const char* objectName) +{ + QString label(hbTrId("txt_videos_title_enter_name")); + QString text(hbTrId("txt_videos_dialog_entry_new_collection")); + HbInputDialog *dialog = new HbInputDialog(); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->setObjectName(objectName); + dialog->setPromptText(label); + dialog->setValue(text); + return dialog; +} + // --------------------------------------------------------------------------- // VideoListSelectionDialog // --------------------------------------------------------------------------- @@ -135,6 +151,7 @@ mSelection.clear(); mSelectedVideos.clear(); mSelectedAlbumId = TMPXItemId::InvalidId(); + mNewAlbumText = QString(); // if provided "owner" is album or category if(activeItem != TMPXItemId::InvalidId()) @@ -151,7 +168,9 @@ } // set (or reset) generic id filter bool filterValue = true; - if(mTypeOfSelection == EAddToCollection || mTypeOfSelection == ESelectCollection) + if(mTypeOfSelection == EAddToCollection || + mTypeOfSelection == ESelectCollection || + mTypeOfSelection == ECreateCollection) { filterValue = false; } @@ -250,10 +269,11 @@ void VideoListSelectionDialog::activateSelection() { FUNC_LOG; - // "add to collection" and "remove from collection -selections needs - // additional functionality for primary key + // "add to collection", "remove from collection" and "create collection" -selections + // needs additional functionality for primary key if(mTypeOfSelection == EAddToCollection || - mTypeOfSelection == ERemoveFromCollection) + mTypeOfSelection == ERemoveFromCollection || + mTypeOfSelection == ECreateCollection) { mPrimaryAction->disconnect(SIGNAL(triggered())); connect(mPrimaryAction, SIGNAL(triggered()), this, SLOT(primaryActionTriggeredSlot())); @@ -269,6 +289,9 @@ case EAddToCollection: primaryTxt = hbTrId("txt_common_button_add"); break; + case ECreateCollection: + primaryTxt = hbTrId("txt_common_button_ok"); + break; case ERemoveFromCollection: primaryTxt = hbTrId("txt_common_button_remove"); break; @@ -298,8 +321,9 @@ mCheckboxContainer->setVisible(true); mItemCount->setPlainText(tr("0/%1").arg(mModel->rowCount())); mCheckBox->setChecked(false); + // Add button will be enabled when videos are selected from the list. - mPrimaryAction->setDisabled(true); + mPrimaryAction->setDisabled(mTypeOfSelection != ECreateCollection); } mHeading->setPlainText(headingTxt); // sort to make sure dialog has correctly filtered content @@ -321,13 +345,22 @@ // scroll list back to top mListWidget->scrollTo(mModel->index(0, 0)); - + if(mModel->rowCount()) { connectSignals(); - // show dialog - HbDialog::open(); + if(mTypeOfSelection == ECreateCollection) + { + // note this does not leak memory as the dialog will destroy itself upon close. + HbInputDialog *dialog = gCreateNewAlbumNameDialog(LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION); + dialog->open(this, SLOT(newAlbumNameDialogFinished(HbAction *))); + } + else + { + // show dialog + HbDialog::open(); + } } else { @@ -350,18 +383,14 @@ INFO("VideoListSelectionDialog::exec(): secondary action triggered.") return; } - QString albumName(""); + if(mTypeOfSelection == ESelectCollection) { mTypeOfSelection = EAddToCollection; if(mSelectedAlbumId == TMPXItemId::InvalidId()) { - QString label(hbTrId("txt_videos_title_enter_name")); - HbInputDialog *dialog = new HbInputDialog(); - dialog->setObjectName(SELECTION_DIALOG_OBJECT_NAME_NEW_COLLECTION); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setPromptText(label); - dialog->setValue(hbTrId("txt_videos_dialog_entry_new_collection")); + // note this does not leak memory as the dialog will destroy itself upon close. + HbInputDialog *dialog = gCreateNewAlbumNameDialog(SELECTION_DIALOG_OBJECT_NAME_NEW_COLLECTION); dialog->open(this, SLOT(newAlbumNameDialogFinished(HbAction *))); } else @@ -393,8 +422,17 @@ QString text = mModel->resolveAlbumName(variant.toString()); if(text.length()) { - mSelectedAlbumId = mModel->addNewAlbum(text); - finalize(text); + if(mSelectedVideos.count() == 0) + { + mNewAlbumText = text; + // show video selection dialog + HbDialog::open(); + } + else + { + mSelectedAlbumId = mModel->addNewAlbum(text); + finalize(text); + } } } } @@ -406,8 +444,15 @@ void VideoListSelectionDialog::finalize(QString albumName) { // Must be checked again if type was ESelectCollection - if(mTypeOfSelection == EAddToCollection) - { + if(mTypeOfSelection == EAddToCollection || + mTypeOfSelection == ECreateCollection) + { + if(mTypeOfSelection == ECreateCollection) + { + mSelectedAlbumId = mModel->addNewAlbum(mNewAlbumText); + albumName = mNewAlbumText; + } + if(mSelectedAlbumId != TMPXItemId::InvalidId() && mSelectedVideos.count()) { if(mModel->addItemsInAlbum(mSelectedAlbumId, mSelectedVideos.toList()) == 0) @@ -498,10 +543,20 @@ if(mSelection.indexes().count() > 0) { mPrimaryAction->setDisabled(false); + + if(mTypeOfSelection == ECreateCollection) + { + mPrimaryAction->setText(hbTrId("txt_common_button_add")); + } } else { - mPrimaryAction->setDisabled(true); + mPrimaryAction->setDisabled(mTypeOfSelection != ECreateCollection); + + if(mTypeOfSelection == ECreateCollection) + { + mPrimaryAction->setText(hbTrId("txt_common_button_ok")); + } } updateCounterSlot(); @@ -595,7 +650,8 @@ } } - if(mSelectedAlbumId != TMPXItemId::InvalidId()) + if(mSelectedAlbumId != TMPXItemId::InvalidId() || + mTypeOfSelection == ECreateCollection) { INFO("VideoListSelectionDialog::primaryActionTriggeredSlot(): closing dialog.") mPrimaryAction->trigger(); diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/src/videolistview.cpp --- a/videocollection/videocollectionview/src/videolistview.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistview.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 108 % +// Version : %version: 110 % // INCLUDE FILES #include @@ -48,7 +48,6 @@ #include "videocollectiontrace.h" // Object names. -const char* const LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION = "vc::ListViewInputDialogCreateCollection"; const char* const LIST_VIEW_OBJECT_NAME_OPTIONS_MENU = "vc::ListViewOptionsMenu"; // --------------------------------------------------------------------------- @@ -291,10 +290,10 @@ &mWrapper, SIGNAL(asyncStatus(int, QVariant&)), this, SLOT(handleAsyncStatusSlot(int, QVariant&))) || !connect( - mCurrentList->getModel().sourceModel(), SIGNAL(modelChanged()), + mCurrentList->getModel()->sourceModel(), SIGNAL(modelChanged()), this, SLOT(layoutChangedSlot())) || !connect( - mCurrentList->getModel().sourceModel(), SIGNAL(modelReady()), + mCurrentList->getModel()->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelReadySlot()))) { ERROR(-1, "VideoListView::activateView() failed to connect signals."); @@ -384,13 +383,13 @@ menu->setObjectName(LIST_VIEW_OBJECT_NAME_OPTIONS_MENU); menu->hide(); } - - if(mCurrentList && &(mCurrentList->getModel()) && mCurrentList->getModel().sourceModel()) + + if(mCurrentList && mCurrentList->getModel() && mCurrentList->getModel()->sourceModel()) { - disconnect(mCurrentList->getModel().sourceModel(), + disconnect(mCurrentList->getModel()->sourceModel(), SIGNAL(modelChanged()), this, SLOT(layoutChangedSlot())); - disconnect(mCurrentList->getModel().sourceModel(), + disconnect(mCurrentList->getModel()->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelReadySlot())); @@ -549,9 +548,9 @@ return; } - VideoSortFilterProxyModel &model = mCurrentList->getModel(); + VideoSortFilterProxyModel *model = mCurrentList->getModel(); - if(!mModelReady && model.rowCount() == 0) + if(!model || (!mModelReady && model->rowCount() == 0)) { return; } @@ -559,7 +558,7 @@ mModelReady = true; // decide if the hintwidget needs to be shown or not. - show = show && model.rowCount() == 0; + show = show && model->rowCount() == 0; // If show is false, then hint widget is fetched only if it exists. If // show is true then hint widget is also created and prepared if it does not exists. @@ -633,7 +632,7 @@ VideoSortFilterProxyModel *model = 0; if(mCurrentList) { - model = &mCurrentList->getModel(); + model = mCurrentList->getModel(); } if (model && mModelReady) @@ -746,7 +745,7 @@ VideoListWidget *collectionContentWidget = mUiLoader->findWidget( DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); - if (collectionContentWidget) + if (collectionContentWidget && collectionContentWidget->getModel()) { // no need to deactivate since there cannot be previous widget mCurrentList = collectionContentWidget; @@ -765,8 +764,8 @@ mCurrentList->activate(VideoCollectionCommon::ELevelDefaultColl); // open the model - VideoSortFilterProxyModel &model = mCurrentList->getModel(); - model.openItem(itemId); + VideoSortFilterProxyModel *model = mCurrentList->getModel(); + model->openItem(itemId); // sort model int sortRole = VideoCollectionCommon::KeyDateTime; @@ -799,7 +798,7 @@ } } } - model.doSorting(sortRole, Qt::AscendingOrder); + model->doSorting(sortRole, Qt::AscendingOrder); // set hint level to collections setHintLevel(VideoHintWidget::Collection); @@ -888,36 +887,6 @@ } // --------------------------------------------------------------------------- -// openNewAlbumSlot() -// --------------------------------------------------------------------------- -// -void VideoListView::openNewAlbumSlot(const QModelIndex &parent, - int start, - int end) -{ - FUNC_LOG; - Q_UNUSED(end); - if(!mCurrentList) - { - return; - } - // invalidate model - VideoSortFilterProxyModel &model = mCurrentList->getModel(); - model.invalidate(); - - // activate new index - QModelIndex index = model.index(start, 0, parent); - if (index.isValid()) - { - // disconnect rowsInserted signal to prevent obsolete slot calls - disconnect( &model, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(openNewAlbumSlot(const QModelIndex&, int, int))); - - mCurrentList->emitActivated(index); - } -} - -// --------------------------------------------------------------------------- // openservicesViewSlot() // --------------------------------------------------------------------------- // @@ -960,18 +929,27 @@ void VideoListView::doSorting(int role) { FUNC_LOG; + if(!mCurrentList || !mCurrentList->getModel()) + { + // no list or model, cannot sort + return; + } // sort model Qt::SortOrder order(Qt::AscendingOrder); - VideoSortFilterProxyModel &model = mCurrentList->getModel(); - if(model.sortRole() == role && model.sortOrder() == Qt::AscendingOrder) + VideoSortFilterProxyModel *model = mCurrentList->getModel(); + if(model->sortRole() == role && model->sortOrder() == Qt::AscendingOrder) { order = Qt::DescendingOrder; } - model.doSorting(role, order); - + model->doSorting(role, order); + if (mCurrentList == mUiLoader->findWidget(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET)) { - mUiLoader->findWidget(DOCML_NAME_VC_VIDEOLISTWIDGET)->getModel().doSorting(role, order); + VideoListWidget *allVideosList = mUiLoader->findWidget(DOCML_NAME_VC_VIDEOLISTWIDGET); + if(allVideosList && allVideosList->getModel()) + { + allVideosList->getModel()->doSorting(role, order); + } } // save sorting values only if the application is not started as a service @@ -1015,17 +993,13 @@ void VideoListView::deleteItemsSlot() { FUNC_LOG; - if(!mCurrentList) - { - return; - } VideoListSelectionDialog *dialog = mUiLoader->findWidget( DOCML_NAME_DIALOG); if (dialog) { - TMPXItemId collectionId = mCurrentList->getModel().getOpenItem(); + TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem(); dialog->setupContent(VideoListSelectionDialog::EDeleteVideos, collectionId); dialog->exec(); } @@ -1038,55 +1012,18 @@ void VideoListView::createCollectionSlot() { FUNC_LOG; - if(!mCurrentList) + + VideoListSelectionDialog *dialog = + mUiLoader->findWidget( + DOCML_NAME_DIALOG); + if (!dialog) { + // fatal: no selection dialog return; } - // query a name for the collection - QString label(hbTrId("txt_videos_title_enter_name")); - QString text(hbTrId("txt_videos_dialog_entry_new_collection")); - - HbInputDialog *dialog = new HbInputDialog(); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setObjectName(LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION); - dialog->setPromptText(label); - dialog->setValue(text); - dialog->open(this, SLOT(createCollectionDialogFinished(HbAction *))); -} - -// ------------------------------------------------------------------------------------------------- -// createCollectionDialogFinished -// ------------------------------------------------------------------------------------------------- -// -void VideoListView::createCollectionDialogFinished(HbAction *action) -{ - FUNC_LOG; - - HbInputDialog *dialog = static_cast(sender()); - - QVariant variant = dialog->value(); - - if(dialog->actions().first() == action && variant.isValid()) - { - VideoSortFilterProxyModel &model = mCurrentList->getModel(); - - // resolve collection true name and add new album - QString text = model.resolveAlbumName(variant.toString()); - - if(text.length()) - { - // when collection reports about new collection, we open it right away, - // for that, connect to rowsInserted so that the new album can be opened - if(!connect(&model, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(openNewAlbumSlot(const QModelIndex&, int, int)))) - { - return; - } - - model.addNewAlbum(text); - } - } + dialog->setupContent(VideoListSelectionDialog::ECreateCollection, TMPXItemId::InvalidId()); + dialog->exec(); } // ------------------------------------------------------------------------------------------------- @@ -1096,7 +1033,7 @@ void VideoListView::addVideosToCollectionSlot() { FUNC_LOG; - if(!mCurrentList) + if(!mCurrentList || !mCurrentList->getModel()) { return; } @@ -1115,10 +1052,10 @@ // of videos than all videos view. VideoListWidget *allVideos = mUiLoader->findWidget( DOCML_NAME_VC_VIDEOLISTWIDGET); - if(allVideos) + if(allVideos && allVideos->getModel()) { - int count = allVideos->getModel().rowCount(); - if(count == mCurrentList->getModel().rowCount()) + int count = allVideos->getModel()->rowCount(); + if(count == mCurrentList->getModel()->rowCount()) { if(count) { @@ -1131,7 +1068,7 @@ } } } - TMPXItemId collectionId = mCurrentList->getModel().getOpenItem(); + TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem(); dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId); dialog->exec(); } @@ -1143,14 +1080,14 @@ void VideoListView::removeVideosFromCollectionSlot() { FUNC_LOG; - if(!mCurrentList) + if(!mCurrentList || !mCurrentList->getModel()) { return; } // not allowed if for some reason current widget // is all videos or collection or there are no items if(mCurrentList->getLevel() < VideoCollectionCommon::ELevelDefaultColl || - !mCurrentList->getModel().rowCount()) + !mCurrentList->getModel()->rowCount()) { return; } @@ -1163,7 +1100,7 @@ ERROR(-1, "VideoListView::removeVideosFromCollectionSlot() failed to load selection dialog."); return; } - TMPXItemId collectionId = mCurrentList->getModel().getOpenItem(); + TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem(); if(collectionId != TMPXItemId::InvalidId() && collectionId.iId2 != KVcxMvcMediaTypeVideo) { dialog->setupContent(VideoListSelectionDialog::ERemoveFromCollection, collectionId); @@ -1202,8 +1139,8 @@ showAction(false, DOCML_NAME_SORT_BY_SIZE); showAction(false, DOCML_NAME_SORT_MENU); - VideoSortFilterProxyModel &model = mCurrentList->getModel(); - if (!model.rowCount()) + VideoSortFilterProxyModel *model = mCurrentList->getModel(); + if (!model || !model->rowCount()) { return; } @@ -1211,7 +1148,7 @@ // get current sorting values int role; Qt::SortOrder order; - model.getSorting(role, order); + model->getSorting(role, order); HbAction *firstAction = (HbAction*)(toolBar()->actions().first()); @@ -1294,8 +1231,8 @@ showAction(false, DOCML_NAME_SORT_BY_SIZE); showAction(false, DOCML_NAME_SORT_MENU); - VideoSortFilterProxyModel &model = mCurrentList->getModel(); - if (!model.rowCount()) + VideoSortFilterProxyModel *model = mCurrentList->getModel(); + if (!model || !model->rowCount()) { return; } @@ -1312,7 +1249,7 @@ // set current sort action selected int role; Qt::SortOrder order; - model.getSorting(role, order); + model->getSorting(role, order); HbAction* action = mSortingRoles.key(role); if (action) { @@ -1341,6 +1278,10 @@ { FUNC_LOG; + if(!mCurrentList || !mCurrentList->getModel()) + { + return; + } // clear toolbar actions. toolBar()->clearActions(); @@ -1370,7 +1311,7 @@ } // get item id before deactivating - TMPXItemId itemId = mCurrentList->getModel().getMediaIdAtIndex(index); + TMPXItemId itemId = mCurrentList->getModel()->getMediaIdAtIndex(index); // get level from the item to be opened only default // or user defined collections can be activated here @@ -1390,8 +1331,13 @@ } // Start fetching content before changing. - VideoSortFilterProxyModel &model = collectionContentWidget->getModel(); - model.openItem(itemId); + VideoSortFilterProxyModel *model = collectionContentWidget->getModel(); + if(!model) + { + // no model for content widget, cannot activate + return; + } + model->openItem(itemId); // deactivat current widget. mCurrentList->deactivate(); @@ -1402,10 +1348,10 @@ updateSubLabel(); - model.invalidate(); + model->invalidate(); // update hint widget for correct content - mModelReady = model.rowCount() > 0; + mModelReady = model->rowCount() > 0; setHintLevel(VideoHintWidget::Collection); // update toolbar for albums, default categories don't have one. diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/src/videolistwidget.cpp --- a/videocollection/videocollectionview/src/videolistwidget.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistwidget.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -614,10 +614,10 @@ // getModel // --------------------------------------------------------------------------- // -VideoSortFilterProxyModel& VideoListWidget::getModel() +VideoSortFilterProxyModel* VideoListWidget::getModel() { FUNC_LOG_ADDR(this); - return *mModel; + return mModel; } // --------------------------------------------------------------------------- diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h --- a/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Wed Jun 23 18:14:16 2010 +0300 @@ -169,11 +169,6 @@ void testDoDelayedsSlot(); /** - * Tests openNewAlbumSlot - */ - void testOpenNewAlbumSlot(); - - /** * Tests aboutToChangeOrientationSlot */ void testAboutToChangeOrientationSlot(); diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp --- a/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 44 % +// Version : %version: 46 % #define private public #include "videoservices.h" @@ -848,13 +848,13 @@ sortMenu = mUiLoader->findWidget(DOCML_NAME_SORT_MENU); sortMenuAction->setMenu(sortMenu); HbMenuData::mMenuAction = sortMenuAction; - VideoSortFilterProxyModel& model = mTestView->mCurrentList->getModel(); + VideoSortFilterProxyModel* model = mTestView->mCurrentList->getModel(); QVERIFY(action != 0); mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->setActiveAction(sortMenuAction); HbAction* sortAction = mUiLoader->findObject(DOCML_NAME_SORT_BY_NAME); QVERIFY(sortAction != 0); sortMenu->setActiveAction(sortAction); - model.setSortRole(1); + model->setSortRole(1); connect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestView, SLOT(objectReadySlot(QObject*, const QString))); emit testObjectReadySignal(mUiLoader->findObject(DOCML_NAME_SORT_BY_DATE), DOCML_NAME_SORT_BY_DATE); emit testObjectReadySignal(mUiLoader->findObject(DOCML_NAME_SORT_BY_NAME), DOCML_NAME_SORT_BY_NAME); @@ -885,7 +885,7 @@ QVERIFY(VideoSortFilterProxyModelData::mSortAsync); // test that after changing the sort role, the order is also switched to ascending. - model.doSorting(model.sortRole(), Qt::DescendingOrder); + model->doSorting(model->sortRole(), Qt::DescendingOrder); sortAction = mUiLoader->findObject(DOCML_NAME_SORT_BY_DATE); QVERIFY(sortAction != 0); sortMenu->setActiveAction(sortAction); @@ -966,15 +966,6 @@ { init(); connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) ); - //////////// - // no current list - //////////// - VideoListWidget *backup = mTestView->mCurrentList; - mTestView->mCurrentList = 0; - emit testSignal(); - QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 0); - mTestView->mCurrentList = backup; - mTestView->activateView(TMPXItemId::InvalidId()); //////////// // dialog loading fails @@ -1119,7 +1110,7 @@ init(true); connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot())); mTestView->activateView(TMPXItemId::InvalidId()); - setRowCount(3, &mTestView->mCurrentList->getModel()); + setRowCount(3, mTestView->mCurrentList->getModel()); emit testSignal(); QVERIFY(isActionVisible(DOCML_NAME_DELETE_MULTIPLE)); QVERIFY(isActionVisible(DOCML_NAME_SORT_BY_DATE)); @@ -1470,41 +1461,6 @@ } // --------------------------------------------------------------------------- -// testOpenNewAlbumSlot -// --------------------------------------------------------------------------- -// -void TestListView::testOpenNewAlbumSlot() -{ - init(false); - - QVERIFY(connect(this, SIGNAL(testSignal(const QModelIndex &, int, int)), mTestView, SLOT(openNewAlbumSlot(const QModelIndex &, int, int)))); - - QModelIndex index; - - // Not initialized, no mCurrentList - emit testSignal(index, 0, 0); - // no verification needed, this tests that method does not crash if mCurrentList is not set. - - // Good case - QVERIFY(mTestView->initializeView() == 0); - mTestView->activateView(TMPXItemId::InvalidId()); - setRowCount(1); - VideoListWidgetData::mEmitActivatedIndex = QModelIndex(); - emit testSignal(index, 0, 0); - - QModelIndex expectedIndex = mTestView->mCurrentList->mModel->index(0,0); - QCOMPARE(VideoListWidgetData::mEmitActivatedIndex, expectedIndex); - - VideoListWidgetData::mEmitActivatedIndex = QModelIndex(); - // Invalid index - emit testSignal(index, -1, 0); - QCOMPARE(VideoListWidgetData::mEmitActivatedIndex, QModelIndex()); - - disconnect(this, SIGNAL(testSignal()), mTestView, SLOT(doDelayedsSlot())); - cleanup(); -} - -// --------------------------------------------------------------------------- // testAboutToChangeOrientationSlot // --------------------------------------------------------------------------- // @@ -1552,50 +1508,19 @@ { init(false); QVERIFY(connect(this, SIGNAL(testSignal()), mTestView, SLOT(createCollectionSlot()))); - - HbInputDialog *dialog = new HbInputDialog(); - - // not initialized, no mCurrentList - emit testSignal(); - QCOMPARE(HbInputDialog::mOpenCallCount, 0); - QVERIFY(VideoSortFilterProxyModelData::mLastAddedAlbumName == ""); - - QVERIFY(mTestView->initializeView() == 0); - mTestView->activateView(TMPXItemId::InvalidId()); - - // dialog canceled - HbInputDialog::mValueCallCount = 0; - HbInputDialog::mOpenCallCount = 0; + + // dialog finding fails + VideoCollectionUiLoaderData::mFailDialogLoad = true; emit testSignal(); - dialog->emitDialogFinished(mTestView, SLOT(createCollectionDialogFinished(HbAction *)), 1); - QVERIFY(VideoSortFilterProxyModelData::mLastAddedAlbumName == ""); - QCOMPARE(HbInputDialog::mValueCallCount, 1); - QCOMPARE(HbInputDialog::mOpenCallCount, 1); - - // empty name - HbInputDialog::mValueCallCount = 0; - HbInputDialog::mValueReturnValue = ""; - HbInputDialog::mOpenCallCount = 0; - emit testSignal(); - dialog->emitDialogFinished(mTestView, SLOT(createCollectionDialogFinished(HbAction *)), 0); - QVERIFY(VideoSortFilterProxyModelData::mLastAddedAlbumName == ""); - QCOMPARE(HbInputDialog::mValueCallCount, 1); - QCOMPARE(HbInputDialog::mOpenCallCount, 1); - - // Good case. - HbInputDialog::mValueCallCount = 0; - HbInputDialog::mValueReturnValue = "testAlbum"; - HbInputDialog::mOpenCallCount = 0; - emit testSignal(); - dialog->emitDialogFinished(mTestView, SLOT(createCollectionDialogFinished(HbAction *)), 0); - QVERIFY(VideoSortFilterProxyModelData::mLastAddedAlbumName == "testAlbum"); - QCOMPARE(HbInputDialog::mValueCallCount, 1); - QCOMPARE(HbInputDialog::mOpenCallCount, 1); - - HbInputDialog::mValueCallCount = 0; - HbInputDialog::mValueReturnValue = ""; - HbInputDialog::mOpenCallCount = 0; - VideoSortFilterProxyModelData::mLastAddedAlbumName = ""; + QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 0); + QCOMPARE(VideoListSelectionDialogData::mSelectionType, -1); + // dialog finding succeeds + VideoCollectionUiLoaderData::mFailDialogLoad = false; + emit testSignal(); + QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId()); + QCOMPARE(VideoListSelectionDialogData::mSelectionType, (int)VideoListSelectionDialog::ECreateCollection); + QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 1); + disconnect(this, SIGNAL(testSignal()), mTestView, SLOT(createCollectionSlot())); cleanup(); } diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp --- a/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 51 % +// Version : %version: 52 % #include #include @@ -368,13 +368,13 @@ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance(); VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos); - QVERIFY(&(mTestWidget->getModel()) == 0); + QVERIFY(mTestWidget->getModel() == 0); HbListView::mVScrollBarIsNull = false; HbListView::mReturnNullPrototype = false; mTestWidget->initialize(*model); - QVERIFY(&(mTestWidget->getModel()) == model); + QVERIFY(mTestWidget->getModel() == model); } // --------------------------------------------------------------------------- diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h --- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h Wed Jun 23 18:14:16 2010 +0300 @@ -91,16 +91,19 @@ void disconnectSignals() { - disconnect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int))); - disconnect(this, SIGNAL(selectionChangedSignal(const QItemSelection&, const QItemSelection&)), - mTestable, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection&))); - disconnect(this, SIGNAL(singleItemSelectedSignal(const QModelIndex&)), - mTestable, SLOT(singleItemSelectedSlot(const QModelIndex&))); - disconnect(this, SIGNAL(modelReadySignal()), mTestable, SLOT(modelReadySlot())); - disconnect(this, SIGNAL(updateCounterSignal()), mTestable, SLOT(updateCounterSlot())); - disconnect(this, SIGNAL(primaryActionTriggeredSignal()), - mTestable, SLOT(primaryActionTriggeredSlot())); - disconnect(this, SIGNAL(finishedSignal(HbAction*)), mTestable, SLOT(finishedSlot(HbAction*))); + if(mTestable) + { + disconnect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int))); + disconnect(this, SIGNAL(selectionChangedSignal(const QItemSelection&, const QItemSelection&)), + mTestable, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection&))); + disconnect(this, SIGNAL(singleItemSelectedSignal(const QModelIndex&)), + mTestable, SLOT(singleItemSelectedSlot(const QModelIndex&))); + disconnect(this, SIGNAL(modelReadySignal()), mTestable, SLOT(modelReadySlot())); + disconnect(this, SIGNAL(updateCounterSignal()), mTestable, SLOT(updateCounterSlot())); + disconnect(this, SIGNAL(primaryActionTriggeredSignal()), + mTestable, SLOT(primaryActionTriggeredSlot())); + disconnect(this, SIGNAL(finishedSignal(HbAction*)), mTestable, SLOT(finishedSlot(HbAction*))); + } } void emitMarkAllStateChanged(int state) diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp --- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -178,6 +178,8 @@ void TestVideoListSelectionDialog::testConstructDestruct() { QVERIFY(mInitOk == true); + mTestHelper->disconnectSignals(); + mTestHelper->mTestable = 0; QVERIFY(mTestObject != 0); QVERIFY(mTestObject->mModel != 0); @@ -234,6 +236,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 1); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -256,6 +259,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 1); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -282,6 +286,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 1); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -308,6 +313,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 1); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -322,6 +328,29 @@ QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue); + // No data. type ECreateCollection:. Default mpx item + setRowCount(0); + mpxId = TMPXItemId(); + mTestObject->setupContent(VideoListSelectionDialog::ECreateCollection, mpxId); + QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::ECreateCollection); + QCOMPARE(mTestObject->mSelection.count(), 0); + QCOMPARE(mTestObject->mSelectedVideos.count(), 1); + QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); + QVERIFY(mTestObject->mModel != 0); + QVERIFY(mTestObject->mListWidget != 0); + QVERIFY(mTestObject->mListContainer != 0); + QVERIFY(mTestObject->mListContainer->mCurrentWidget == mTestObject->mListWidget); + QVERIFY(mTestObject->mHeading != 0); + QVERIFY(mTestObject->mCheckboxContainer != 0); + QVERIFY(mTestObject->mCheckboxContainer->isVisible() == true); + QVERIFY(mTestObject->mItemCount != 0); + QVERIFY(mTestObject->mCheckBox != 0); + QVERIFY(mTestObject->mPrimaryAction != 0); + QVERIFY(mTestObject->mSecondaryAction != 0); + QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId); + QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue); + delete mTestObject; mTestObject = new VideoListSelectionDialog(mTestUiLoader); VideoSortFilterProxyModelData::reset(); @@ -334,6 +363,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 1); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -360,6 +390,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 0); QVERIFY(mTestObject->mSelectedAlbumId == mpxId); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -385,6 +416,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 0); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -410,6 +442,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 0); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -435,6 +468,7 @@ QCOMPARE(mTestObject->mSelection.count(), 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 0); QVERIFY(mTestObject->mSelectedAlbumId == TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mNewAlbumText.isNull()); QVERIFY(mTestObject->mModel != 0); QVERIFY(mTestObject->mListWidget != 0); QVERIFY(mTestObject->mListContainer != 0); @@ -522,8 +556,6 @@ // void TestVideoListSelectionDialog::testExec() { - // there's not much to test in exec -method, basically these - // are for coberity only // we're using EDeleteVideos type and make sure correct // status exists in view utils after exec TMPXItemId mpxId = TMPXItemId(0, KVcxMvcMediaTypeVideo); @@ -533,22 +565,39 @@ VideoCollectionViewUtilsData::mLastError = -1; + HbDialog::openAmount = 0; + // empty model row count setRowCount(0); mTestObject->exec(); QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusDeleteInProgress); + QCOMPARE(HbDialog::openAmount, 0); + QCOMPARE(HbInputDialog::mOpenCallCount, 0); VideoCollectionViewUtilsData::mLastError = -1; // model contains data setRowCount(10); mTestObject->exec(); QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusDeleteInProgress); + QCOMPARE(HbDialog::openAmount, 1); + QCOMPARE(HbInputDialog::mOpenCallCount, 0); // just to make sure finishedSlot is called with correct params + HbDialog::openAmount = 0; VideoCollectionViewUtilsData::mLastError = -1; HbDialog::execReturnPrimary = false; mTestObject->exec(); QVERIFY(VideoCollectionViewUtilsData::mLastError == -1); + QCOMPARE(HbDialog::openAmount, 1); + QCOMPARE(HbInputDialog::mOpenCallCount, 0); + + // test with type ECreateCollection + HbDialog::openAmount = 0; + mTestObject->setupContent(VideoListSelectionDialog::ECreateCollection, TMPXItemId::InvalidId()); + HbDialog::execReturnPrimary = true; + mTestObject->exec(); + QCOMPARE(HbDialog::openAmount, 0); + QCOMPARE(HbInputDialog::mOpenCallCount, 1); } // --------------------------------------------------------------------------- @@ -841,8 +890,27 @@ QVERIFY(mTestObject->mSelection.count() == 0); QVERIFY(mTestObject->mPrimaryAction->isEnabled() == false); + mTestObject->setupContent(VideoListSelectionDialog::ECreateCollection, TMPXItemId::InvalidId()); + QVERIFY(mTestObject->mPrimaryAction->isEnabled() == true); + QCOMPARE(mTestObject->mPrimaryAction->text(), hbTrId("txt_common_button_ok")); + + // select item, type ECreateCollection + deselected.clear(); + selected.append(range); + mTestHelper->emitSelectionChangedSlot(selected, deselected); + QVERIFY(mTestObject->mSelection.count() == 1); + QVERIFY(mTestObject->mPrimaryAction->isEnabled() == true); + QCOMPARE(mTestObject->mPrimaryAction->text(), hbTrId("txt_common_button_add")); + + // desect item, type ECreateCollection + selected.clear(); + deselected.append(range); + mTestHelper->emitSelectionChangedSlot(selected, deselected); + QVERIFY(mTestObject->mSelection.count() == 0); + QVERIFY(mTestObject->mPrimaryAction->isEnabled() == true); + QCOMPARE(mTestObject->mPrimaryAction->text(), hbTrId("txt_common_button_ok")); + mTestHelper->disconnectSignals(); - } void TestVideoListSelectionDialog::testSingleItemSelectedSlot() @@ -988,6 +1056,16 @@ QCOMPARE(mTestObject->mSecondaryAction->mTriggeredCount, 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 0); + // nothing selected, album id invalid, type ECreateCollection + mTestObject->mSelectedAlbumId = TMPXItemId::InvalidId(); + mTestObject->mPrimaryAction->mTriggeredCount = 0; + mTestObject->mSecondaryAction->mTriggeredCount = 0; + mTestObject->mTypeOfSelection = VideoListSelectionDialog::ECreateCollection; + mTestHelper->emitPrimaryActionTriggeredSlot(); + QCOMPARE(mTestObject->mPrimaryAction->mTriggeredCount, 1); + QCOMPARE(mTestObject->mSecondaryAction->mTriggeredCount, 0); + QCOMPARE(mTestObject->mSelectedVideos.count(), 0); + // nothing selected, album id ok mTestObject->mSelectedAlbumId = TMPXItemId(0, KVcxMvcMediaTypeAlbum); mTestObject->mPrimaryAction->mTriggeredCount = 0; @@ -997,7 +1075,7 @@ QCOMPARE(mTestObject->mPrimaryAction->mTriggeredCount, 1); QCOMPARE(mTestObject->mSecondaryAction->mTriggeredCount, 0); QCOMPARE(mTestObject->mSelectedVideos.count(), 0); - + setRowCount(10); VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0,0)); VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(1,2)); diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionwrapper/inc/videocollectionwrapper.h --- a/videocollection/videocollectionwrapper/inc/videocollectionwrapper.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videocollectionwrapper.h Wed Jun 23 18:14:16 2010 +0300 @@ -80,11 +80,12 @@ static VideoCollectionWrapper &instance(); /** - * Returns pointer to model + * Returns pointer to model. Null if creation fails or if + * application is closing. * * @param type of the model * - * @return address to model or NULL if fails. + * @return address to model or NULL if fails or if application is closing. */ VideoSortFilterProxyModel* getModel(VideoCollectionCommon::TModelType type); diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h --- a/videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h Wed Jun 23 18:14:16 2010 +0300 @@ -55,8 +55,12 @@ /** * Returns the pointer into model. Creates the model if it doesn't exists yet. * + * Noter that if application has signaled aboutToQuit -signal indicating closing, all + * previously created models have been removed and new ones will not be created + * anymore + * * @param type type of model - * @return address of model, NULL if creation did not succeed. + * @return address of model, NULL if creation did not succeed or if application is closing. */ VideoSortFilterProxyModel* getModel(VideoCollectionCommon::TModelType &type); @@ -65,7 +69,7 @@ /** * Signaled when UI environment is about to be destroyed. - * Source model needs to be cleaned up before of that + * All models needs to be cleaned up before of that. * */ void aboutToQuitSlot(); @@ -96,6 +100,12 @@ * source model */ QPointer mSourceModel; + + /** + * flag to indicate, that object is to be deallocated, so no + * models are to be returned anymore + */ + bool mAboutToClose; }; #endif // __VIDEOCOLLECTIONWRAPPERPRIVATE_H__ diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp --- a/videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 31 % // INCLUDE FILES #include @@ -55,7 +55,7 @@ VideoCollectionWrapper::~VideoCollectionWrapper() { FUNC_LOG; - // NOP + delete d; } // ----------------------------------------------------------------------------- diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionwrapper/src/videocollectionwrapper_p.cpp --- a/videocollection/videocollectionwrapper/src/videocollectionwrapper_p.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videocollectionwrapper_p.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 27 % // INCLUDE FILES #include @@ -40,8 +40,10 @@ VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate() : mAllVideosModel( 0 ) , mCollectionsModel( 0 ) + , mCollectionContentModel( 0 ) , mGenericModel( 0 ) , mSourceModel( 0 ) + , mAboutToClose( false ) { FUNC_LOG; // NOP @@ -54,7 +56,6 @@ VideoCollectionWrapperPrivate::~VideoCollectionWrapperPrivate() { FUNC_LOG; - // NOP here } @@ -67,6 +68,11 @@ FUNC_LOG; INFO_1("VideoCollectionWrapperPrivate::getModel() type: %d", type); + if(mAboutToClose) + { + return 0; + } + VideoSortFilterProxyModel *model = 0; if(!mSourceModel) { @@ -143,6 +149,11 @@ if(!mSourceModel.isNull()) { delete mSourceModel; + delete mAllVideosModel; + delete mCollectionsModel; + delete mCollectionContentModel; + delete mGenericModel; + mAboutToClose = true; } } diff -r c48470be1ba7 -r adbe7d5ba2f5 videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -1365,6 +1365,7 @@ // no albums in model QVERIFY(mTestObject->removeAlbums(indexList) == -1); + indexList.clear(); mStubModel->removeAll(); delete mTestObject; mTestObject = new FilterProxyTester(VideoCollectionCommon::EModelTypeCollections); @@ -1374,9 +1375,9 @@ mStubModel->appendData(TMPXItemId(1,2)); mStubModel->appendData(TMPXItemId(2,2)); mStubModel->appendData(TMPXItemId(3,2)); - indexList.append(mTestObject->index(0,2)); - indexList.append(mTestObject->index(1,2)); - indexList.append(mTestObject->index(2,2)); + indexList.append(mTestObject->index(0,0)); + indexList.append(mTestObject->index(1,0)); + indexList.append(mTestObject->index(2,0)); // succeed QVERIFY(mTestObject->removeAlbums(indexList) == 0); diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackdetailsplaybackwindow.h --- a/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackdetailsplaybackwindow.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackdetailsplaybackwindow.h Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 6 % +// Version : %version: 7 % @@ -37,8 +37,6 @@ virtual ~QMPXVideoPlaybackDetailsPlaybackWindow(); void initialize(); void updateState( TMPXPlaybackState state ); - void mousePressEvent( QGraphicsSceneMouseEvent *event ); - void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ); private slots: void playPause(); diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#40 % +// Version : %version: da1mmcf#41 % @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include "mpxvideoviewwrapper.h" #include "hbvideobaseplaybackview.h" @@ -96,7 +98,7 @@ this, SLOT( handleOrientationChanged( Qt::Orientation ) ) ); MPX_DEBUG( - _L("QMPXVideoPlaybackControlsController::initializeController() orientation = %d, ok =%d"), + _L("QMPXVideoPlaybackControlsController::initializeController() orientation = %d, ok =%d"), mOrientation, ok ); setParent( mView ); @@ -129,15 +131,16 @@ mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName ); + // + // Controls dismissing timer + // mControlsTimer = new QTimer( this ); mControlsTimer->setInterval( KMPXControlsTimeOut ); mControlsTimer->setSingleShot( false ); connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) ); - connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) ); - mControlsPolicy = new QMPXVideoPlaybackControlPolicy(); - + mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this ); connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) ); mControlsConfig->createControlList(); @@ -152,14 +155,30 @@ mVolumeControl->setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax ); // + // grab tap gesture + // + mView->grabGesture( Qt::TapGesture ); + connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) ); + + // + // grab pan gesture for playlist + // + if ( mFileDetails->mMultiItemPlaylist ) + { + mView->grabGesture( Qt::PanGesture ); + connect( mView, SIGNAL( pannedToRight() ), this, SLOT( skipToPreviousVideoItem() ) ); + connect( mView, SIGNAL( pannedToLeft() ), this, SLOT( skipToNextVideoItem() ) ); + } + + // // if videoplayback is in service mode, create a videoservices instance // if ( XQServiceUtil::isService() && ! mVideoServices ) { // - // obtain VideoServices instance + // obtain VideoServices instance // - mVideoServices = VideoServices::instance(); + mVideoServices = VideoServices::instance(); // // allow 'attach' operation only for non-streaming media clips @@ -170,14 +189,14 @@ // determine if this is 'attach' operation // mIsAttachOperation = ( mVideoServices->currentService() == VideoServices::EUriFetcher ); - + if ( mIsAttachOperation ) { // // connect signal filePath() to videoservices slot itemSelected() // - connect( this, SIGNAL( attachVideoPath( const QString& ) ), - mVideoServices, SLOT( itemSelected( const QString& ) ) ); + connect( this, SIGNAL( attachVideoPath( const QString& ) ), + mVideoServices, SLOT( itemSelected( const QString& ) ) ); } } } @@ -191,8 +210,18 @@ { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()")); + mView->ungrabGesture( Qt::TapGesture ); + disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) ); + + if ( mFileDetails->mMultiItemPlaylist ) + { + mView->ungrabGesture( Qt::PanGesture ); + + disconnect( mView, SIGNAL( pannedToRight() ), this, SLOT( skipToNextVideoItem() ) ); + disconnect( mView, SIGNAL( pannedToLeft() ), this, SLOT( skipToPreviousVideoItem() ) ); + } + disconnect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) ); - disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) ); disconnect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) ); disconnect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ), this, SLOT( handleOrientationChanged( Qt::Orientation ) ) ); @@ -209,7 +238,7 @@ if ( mRNLogoTimer ) { - disconnect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) ); + disconnect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) ); delete mRNLogoTimer; mRNLogoTimer = NULL; @@ -236,7 +265,7 @@ if ( mThumbnailManager ) { delete mThumbnailManager; - mThumbnailManager = NULL; + mThumbnailManager = NULL; } if ( mVolumeControl ) @@ -244,18 +273,18 @@ delete mVolumeControl; mVolumeControl = NULL; } - + if ( mIsAttachOperation ) { // // disable connection for 'attach' operation // - disconnect( this, SIGNAL( attachVideoPath( const QString& ) ), - mVideoServices, SLOT( itemSelected( const QString& ) ) ); + disconnect( this, SIGNAL( attachVideoPath( const QString& ) ), + mVideoServices, SLOT( itemSelected( const QString& ) ) ); } - + if ( mVideoServices ) - { + { // // decrease videoservices instance count // @@ -275,6 +304,8 @@ mFileDetails = details; + mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName ); + mControlsConfig->updateControlsWithFileDetails(); // @@ -438,7 +469,7 @@ } default: { - break; + break; } } } @@ -482,7 +513,7 @@ // Update the policy property based on file details and view mode to the controls // TUint properties = 0; - mControlsPolicy->setControlProperties( + mControlsPolicy->setControlProperties( mControls[i]->controlIndex(), properties, mFileDetails, mViewMode ); mControls[i]->updateControlProperties( properties ); @@ -567,7 +598,7 @@ // Status key (signal + title + back key) // control = new QMPXVideoPlaybackStatusPaneControl( this, - controlIndex, + controlIndex, NULL, properties ); mControls.append( control ); @@ -580,7 +611,7 @@ // Button bar // QGraphicsWidget *widget = mLoader->findWidget( QString( "controlBarLayout" ) ); - QMPXVideoPlaybackControlBar *controlBar = + QMPXVideoPlaybackControlBar *controlBar = qobject_cast( widget ); controlBar->initialize(); @@ -595,7 +626,7 @@ case EMPXFileDetailsWidget: { QGraphicsWidget *widget = mLoader->findWidget( QString( "fileDetailsLayout" ) ); - QMPXVideoPlaybackFileDetailsWidget *fileDetails = + QMPXVideoPlaybackFileDetailsWidget *fileDetails = qobject_cast( widget ); control = new QMPXVideoPlaybackFullScreenControl( this, @@ -639,7 +670,7 @@ case EMPXDetailsViewPlaybackWindow: { QGraphicsWidget *widget = mLoader->findWidget( QString( "detailsPlaybackWindow" ) ); - QMPXVideoPlaybackDetailsPlaybackWindow *detailsPlaybackWindow = + QMPXVideoPlaybackDetailsPlaybackWindow *detailsPlaybackWindow = qobject_cast( widget ); detailsPlaybackWindow->initialize(); @@ -664,33 +695,41 @@ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleTappedOnScreen()")); // - // Toggle visibility only if the followings are true - // - TV-Out is not connected - // - Video is available - // - We are in playing or paused state + // If we are in full screen view, toggle the visibility when playing and paused + // If we are in details view, issue playpause + // If we are in audio only view, ignore // - if ( ! isTvOutConnected() && - mFileDetails->mVideoEnabled && - ( mState == EPbStatePlaying || mState == EPbStatePaused ) ) + switch( mViewMode ) { - if ( mViewMode == EFullScreenView ) + case EFullScreenView: { - if ( isVisible() ) + if ( mState == EPbStatePlaying || mState == EPbStatePaused ) { - // - // If the volume control is visible, hide it - // - if ( mVolumeControl->isVisible() ) + if ( isVisible() ) { - mVolumeControl->setVisible( false ); + // + // If the volume control is visible, hide it + // + if ( mVolumeControl->isVisible() ) + { + mVolumeControl->setVisible( false ); + } + + hideAllControls(); } - - hideAllControls(); + else + { + showControls(); + } } - else - { - showControls(); - } + + break; + } + case EDetailsView: + { + handleCommand( EMPXPbvCmdPlayPause ); + + break; } } } @@ -753,7 +792,7 @@ { mControls[i]->setVisibility( mState ); } - } + } } // ------------------------------------------------------------------------------------------------- @@ -786,7 +825,7 @@ // QMPXVideoPlaybackControlsController::handleCommand() // ------------------------------------------------------------------------------------------------- // -void QMPXVideoPlaybackControlsController::handleCommand( +void QMPXVideoPlaybackControlsController::handleCommand( TMPXVideoPlaybackViewCommandIds command, int value ) { MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command); @@ -795,14 +834,14 @@ { case EMPXPbvCmdSetPosition: { - TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyPosition, + TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyPosition, value * KPbMilliMultiplier ) ); break; } case EMPXPbvCmdSetVolume: { TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyVolume, value ) ); - break; + break; } default: { @@ -970,7 +1009,7 @@ fileName->Des()[j]='/'; } } - err = filePath.Set( fileName->Des(), NULL, NULL ); + err = filePath.Set( fileName->Des(), NULL, NULL ); } if ( fileName ) @@ -1017,10 +1056,10 @@ bool QMPXVideoPlaybackControlsController::realFormatForLocal() { bool realFormat = false; - + QString real( "real" ); QString rn( "rn" ); - + if ( mFileDetails->mMimeType.contains( real, Qt::CaseInsensitive ) || mFileDetails->mMimeType.contains( rn, Qt::CaseInsensitive ) ) { @@ -1123,7 +1162,7 @@ } // - // Change the view. + // Change the view. // If Tv-out is connected, go to AudioOnlyView. // If not, go back to default view. // @@ -1141,7 +1180,7 @@ // QMPXVideoPlaybackControlsController::changeViewMode // ------------------------------------------------------------------------------------------------- // -void QMPXVideoPlaybackControlsController::changeViewMode( +void QMPXVideoPlaybackControlsController::changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect ) { MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode( %d, %d )"), @@ -1215,7 +1254,10 @@ { MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()")); - handleCommand( EMPXPbvCmdPreviousListItem ); + if ( mViewMode == EFullScreenView ) + { + handleCommand( EMPXPbvCmdPreviousListItem ); + } } // ------------------------------------------------------------------------------------------------- @@ -1226,7 +1268,10 @@ { MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToNextVideoItem()")); - handleCommand( EMPXPbvCmdNextListItem ); + if ( mViewMode == EFullScreenView ) + { + handleCommand( EMPXPbvCmdNextListItem ); + } } // ------------------------------------------------------------------------------------------------- @@ -1246,7 +1291,7 @@ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRect() : mViewMode = %d )"), mViewMode ); - + if ( mViewMode == EDetailsView ) { QGraphicsWidget *parent = mLoader->findWidget( QString( "detailsPlaybackWindow" ) ); @@ -1260,7 +1305,7 @@ rect = widget->geometry(); } - mViewWrapper->UpdateVideoRect( + mViewWrapper->UpdateVideoRect( rect.x(), rect.y(), rect.width(), rect.height(), transitionEffect ); } } @@ -1295,7 +1340,7 @@ { tvOutBitmap->setVisible( true ); } - else if ( mFileDetails->mRNFormat ) + else if ( mFileDetails->mRNFormat ) { realAudioOnlyBitmap->setVisible( true ); } @@ -1307,7 +1352,7 @@ { audioOnlyBitmap->setVisible( true ); } - } + } } // ------------------------------------------------------------------------------------------------- @@ -1325,12 +1370,12 @@ { if ( mThumbNailState == EThumbNailEmpty ) { - mThumbnailManager = new ThumbnailManager(); ; + mThumbnailManager = new ThumbnailManager(); ; mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge ); mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForPerformance ); - - if ( connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), + + if ( connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ) ) { mThumbnailManager->getThumbnail( mFileDetails->mClipName ); @@ -1348,7 +1393,7 @@ // QMPXVideoPlaybackControlsController::handleThumbnailReady() // ------------------------------------------------------------------------------------------------- // -void QMPXVideoPlaybackControlsController::handleThumbnailReady( +void QMPXVideoPlaybackControlsController::handleThumbnailReady( QPixmap tnData, void *internal , int id, int error ) { Q_UNUSED( internal ); @@ -1374,7 +1419,7 @@ setDefaultBitmap(); - disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), + disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ); } @@ -1386,17 +1431,17 @@ { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()"), _L("file = %s"), mFileDetails->mClipName.data() ); - + // // close playback view // mView->closePlaybackView(); - + // // emit signal to launch videoservices itemSelected() slot // emit( attachVideoPath( mFileDetails->mClipName ) ); - + } // ------------------------------------------------------------------------------------------------- @@ -1407,19 +1452,19 @@ { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::sendVideo()"), _L("file = %s"), mFileDetails->mClipName.data() ); - + // // pause playback // handleCommand( EMPXPbvCmdPause ); - - // + + // // send video to shareUI // ShareUi dlg; QStringList fileList; fileList.append( mFileDetails->mClipName ); - dlg.send( fileList, true ); + dlg.send( fileList, true ); } // ------------------------------------------------------------------------------------------------- @@ -1443,7 +1488,7 @@ mRNLogoTimer = new QTimer( this ); mRNLogoTimer->setInterval( KMPXRNLogoTimeOut ); mRNLogoTimer->setSingleShot( true ); - connect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) ); + connect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) ); mRNLogoTimer->start(); } diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 16 % +// Version : %version: 17 % @@ -34,7 +34,7 @@ // QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow // ------------------------------------------------------------------------------------------------- // -QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow( +QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow( QMPXVideoPlaybackControlsController* controller ) : mController( controller ) , mInitialized( false ) @@ -107,7 +107,7 @@ QGraphicsWidget *detailsShareWidget = loader->findWidget( QString( "detailsShareButton" ) ); HbPushButton *shareButton = qobject_cast( detailsShareWidget ); connect( shareButton, SIGNAL( released() ), mController, SLOT( sendVideo() ) ); - + // // by default in xml layout, attachButton is not visible while shareButton is visible. // if it's an 'attach' operation, reverse the visibility order @@ -116,9 +116,9 @@ { attachButton->setVisible( true ); shareButton->setVisible( false ); - } + } else - { + { // // dim "share" button for streaming // @@ -167,28 +167,4 @@ mController->handleCommand( EMPXPbvCmdPlayPause ); } -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackDetailsPlaybackWindow::mousePressEvent -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackDetailsPlaybackWindow::mousePressEvent( QGraphicsSceneMouseEvent *event ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackDetailsPlaybackWindow::mousePressEvent")); - - event->accept(); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackDetailsPlaybackWindow::mouseReleaseEvent -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackDetailsPlaybackWindow::mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::mouseReleaseEvent")); - - playPause(); - - event->accept(); -} - //End of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 16 % +// Version : %version: 17 % @@ -99,6 +99,8 @@ // void QMPXVideoPlaybackStatusPaneControl::setVisible( bool visible ) { + MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setVisible visible = %d"), visible); + mVisible = visible; if ( mVisible ) diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml --- a/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml Wed Jun 23 18:14:16 2010 +0300 @@ -20,7 +20,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -143,7 +143,7 @@ - + @@ -165,7 +165,7 @@ - + diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/inc/testdetailsplaybackwindow.h --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/inc/testdetailsplaybackwindow.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/inc/testdetailsplaybackwindow.h Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 4 % +// Version : %version: 5 % #ifndef __TESTDETAILSPLAYBACKWINDOW_H__ @@ -54,8 +54,6 @@ // changing this order will affect the test results void testUpdateState(); void testPlayPause(); - void testMousePressEvent(); - void testMouseReleaseEvent(); void testAttach(); void testSend(); diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/src/testdetailsplaybackwindow.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/src/testdetailsplaybackwindow.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/src/testdetailsplaybackwindow.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 6 % +// Version : %version: 7 % #include @@ -115,51 +115,6 @@ } // --------------------------------------------------------------------------- -// testMousePressEvent -// --------------------------------------------------------------------------- -// -void TestDetailsPlaybackWindow::testMousePressEvent() -{ - MPX_ENTER_EXIT( - _L("TestDetailsPlaybackWindow::testMousePressEvent()")); - - init(); - - QGraphicsSceneMouseEvent* event = - new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMousePress ); - event->setAccepted( false ); - - mWindow->mousePressEvent( event ); - - QVERIFY( event->isAccepted() ); - - cleanup(); -} - -// --------------------------------------------------------------------------- -// testMouseReleaseEvent -// --------------------------------------------------------------------------- -// -void TestDetailsPlaybackWindow::testMouseReleaseEvent() -{ - MPX_ENTER_EXIT( - _L("TestDetailsPlaybackWindow::testMouseReleaseEvent()")); - - init(); - - QGraphicsSceneMouseEvent* event = - new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMouseRelease ); - - mWindow->mouseReleaseEvent( event ); - QVERIFY( mController->mCommand == EMPXPbvCmdPlayPause ); - - delete event; - event = NULL; - - cleanup(); -} - -// --------------------------------------------------------------------------- // testPlayPause // --------------------------------------------------------------------------- // diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 7 % +// Version : %version: 8 % #include #include @@ -189,10 +189,16 @@ // // Test 'PlayPause' command // + mVideoViewWrapper->iPlaybackState = EPbStatePlaying; TRAP( errHdlCmd, mVideoViewWrapper->HandleCommandL( EMPXPbvCmdPlayPause ) ); QVERIFY( errHdlCmd == KErrNone ); - QVERIFY( mVideoViewWrapper->iPlaybackUtility->iCommand == EPbCmdPlayPause ); - + QVERIFY( mVideoViewWrapper->iPlaybackUtility->iCommand == EPbCmdPause ); + + mVideoViewWrapper->iPlaybackState = EPbStatePaused; + TRAP( errHdlCmd, mVideoViewWrapper->HandleCommandL( EMPXPbvCmdPlayPause ) ); + QVERIFY( errHdlCmd == KErrNone ); + QVERIFY( mVideoViewWrapper->iPlaybackUtility->iCommand == EPbCmdPlay ); + // // Test 'Stop' command // diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/inc/testmpxvideoplaybackcontrolscontroller.h --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/inc/testmpxvideoplaybackcontrolscontroller.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/inc/testmpxvideoplaybackcontrolscontroller.h Wed Jun 23 18:14:16 2010 +0300 @@ -1,5 +1,5 @@ /** -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -12,10 +12,10 @@ * Contributors: * * Description: tester for methods in Video Playback Controls Controller -* +* */ -// Version : %version: 5 % +// Version : %version: 6 % #ifndef __TESTMPXVIDEOPLAYBACKCONTROLSCONTROLLER_H__ #define __TESTMPXVIDEOPLAYBACKCONTROLSCONTROLLER_H__ @@ -41,21 +41,21 @@ * will be called before each testfunction is executed. * */ - void init(); - + void init(); + /** * will be called after every testfunction. * */ void cleanup(); - + private: void verifyHandleEventStateChangedResult( int value ); void verifyHandleEventTvOutResult( bool tvOutConnected, bool value ); - + private slots: - + void testAddFileDetails(); void testHandleEventSetPosition(); void testHandleEventSetDuration(); @@ -71,17 +71,17 @@ void testHandleEventTvOutDisconnected(); void testHandleEventHandleErrors(); void testHandleEventShowVolumeControls(); - + // // test handleCommand() // void testHandleCommand(); - + // // test handleTappedOnScreen() // void testHandleTappedOnScreen(); - + // // test updateVideoRectDone() // @@ -105,7 +105,7 @@ // // test private slot attachVideo() // - void testslot_attachVideo(); + void testslot_attachVideo(); // // test private slot attachVideo() @@ -120,18 +120,18 @@ void testslot_handleRNLogoVisibleChanged(); void testslot_handleRNLogoTimeout(); void testIsRNLogoBitmapVisible(); - + signals: void commandSignal(); void commandSignal( Qt::Orientation ); - + private: HbVideoBasePlaybackView* mBaseVideoView; CMPXVideoViewWrapper* mViewWrapper; QMPXVideoPlaybackControlsController* mController; QMPXVideoPlaybackViewFileDetails* mFileDetails; - + }; diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/src/testmpxvideoplaybackcontrolscontroller.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/src/testmpxvideoplaybackcontrolscontroller.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/src/testmpxvideoplaybackcontrolscontroller.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -1,5 +1,5 @@ /** -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -12,10 +12,10 @@ * Contributors: * * Description: tester for methods in Video Playback Controls Controller -* +* */ -// Version : %version: 9 % +// Version : %version: 10 % #include #include @@ -61,9 +61,9 @@ pass[0] = argv[0]; pass[1] = "-o"; pass[2] = "c:\\data\\TestMPXVideoPlaybackControlsController.txt"; - + int res = QTest::qExec(&tv, 3, pass); - + return res; } @@ -72,19 +72,19 @@ // --------------------------------------------------------------------------- // void TestMPXVideoPlaybackControlsController::init() -{ +{ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlsController::init()")); - + mBaseVideoView = new HbVideoBasePlaybackView(); if ( ! mFileDetails ) { - mFileDetails = new QMPXVideoPlaybackViewFileDetails(); + mFileDetails = new QMPXVideoPlaybackViewFileDetails(); } - mViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView ); + mViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView ); mController = new QMPXVideoPlaybackControlsController( mBaseVideoView, mViewWrapper, - mFileDetails ); + mFileDetails ); } // --------------------------------------------------------------------------- @@ -94,7 +94,7 @@ void TestMPXVideoPlaybackControlsController::cleanup() { MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlsController::cleanup()")); - + delete mController; mController = NULL; @@ -103,7 +103,7 @@ delete mViewWrapper; mViewWrapper = NULL; - + delete mBaseVideoView; mBaseVideoView = NULL; } @@ -125,14 +125,14 @@ init(); - mController->addFileDetails( mFileDetails ); - + mController->addFileDetails( mFileDetails ); + QVERIFY( mController->mFileDetails->mRNFormat == true ); QVERIFY( mController->mViewMode == EAudioOnlyView ); QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true ); QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdTvOutConnected ); - cleanup(); + cleanup(); // // local 3GPP media with video-only @@ -149,11 +149,11 @@ mController->mViewMode = EFullScreenView; QFileInfo videoOnlyFile( mFileDetails->mClipName ); - mController->addFileDetails( mFileDetails ); - + mController->addFileDetails( mFileDetails ); + QVERIFY( mController->mFileDetails->mRNFormat == false ); - QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true ); - + QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true ); + // // validate 'TvOutConnected' // @@ -162,22 +162,22 @@ // // video-only, validate volume control is dimmed // - QVERIFY( mController->mVolumeControl->mValue == 0 ); - QVERIFY( mController->mVolumeControl->isEnabled() == false ); - + QVERIFY( mController->mVolumeControl->mValue == 0 ); + QVERIFY( mController->mVolumeControl->isEnabled() == false ); + // // verify 'title' (via mClipName) is set properly // for ( int i=0 ; i < mController->mLoader->mWidgets.count() ; i++ ) - { + { if( mController->mLoader->mWidgets[i]->objectName() == QString( "title" ) ) - { - HbLabel *titleLabel = qobject_cast( mController->mLoader->mWidgets[i] ); - QVERIFY( titleLabel->plainText() == videoOnlyFile.baseName() ); + { + HbLabel *titleLabel = qobject_cast( mController->mLoader->mWidgets[i] ); + QVERIFY( titleLabel->plainText() == videoOnlyFile.baseName() ); break; } - } - cleanup(); + } + cleanup(); // // non-local audio-video media, TvOut is not connected @@ -192,25 +192,25 @@ init(); - mController->addFileDetails( mFileDetails ); - + mController->addFileDetails( mFileDetails ); + QVERIFY( mController->mFileDetails->mRNFormat == true ); - QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true ); - + QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true ); + // // verify 'title' (via mTitle) is set properly // for ( int i=0 ; i < mController->mLoader->mWidgets.count() ; i++ ) - { + { if( mController->mLoader->mWidgets[i]->objectName() == QString( "title" ) ) - { - HbLabel *titleLabel = qobject_cast( mController->mLoader->mWidgets[i] ); - QVERIFY( titleLabel->plainText() == mFileDetails->mTitle ); + { + HbLabel *titleLabel = qobject_cast( mController->mLoader->mWidgets[i] ); + QVERIFY( titleLabel->plainText() == mFileDetails->mTitle ); break; } - } - - cleanup(); + } + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -219,16 +219,16 @@ // void TestMPXVideoPlaybackControlsController::testHandleEventSetPosition() { - MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetPosition()")); - - init(); - int value = 20000; - - mController->handleEvent( EMPXControlCmdSetPosition, value ); + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetPosition()")); + + init(); + int value = 20000; + + mController->handleEvent( EMPXControlCmdSetPosition, value ); QVERIFY( mController->mControls[0]->mPosition == ( value / KPbMilliMultiplier ) ); - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -237,16 +237,16 @@ // void TestMPXVideoPlaybackControlsController::testHandleEventSetDuration() { - MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetDuration()")); - - init(); - int value = 30000; - - mController->handleEvent( EMPXControlCmdSetDuration, value ); + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetDuration()")); + + init(); + int value = 30000; + + mController->handleEvent( EMPXControlCmdSetDuration, value ); QVERIFY( mController->mControls[0]->mDuration == ( value / KPbMilliMultiplier ) ); - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -255,90 +255,90 @@ // void TestMPXVideoPlaybackControlsController::testHandleEventStateChanged() { - MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventStateChanged()")); - - init(); + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventStateChanged()")); + + init(); TMPXVideoPlaybackControlCommandIds event = EMPXControlCmdStateChanged; mController->mOrientation = Qt::Horizontal; // // state change (EPbStateInitialising) // - int value = EPbStateInitialising; - mController->handleEvent( event, value ); + int value = EPbStateInitialising; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - + // // state change (EPbStateBuffering) // - value = EPbStateBuffering; - mController->handleEvent( event, value ); + value = EPbStateBuffering; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - + // // state change (EPbStatePlaying) // - value = EPbStatePlaying; - mController->handleEvent( event, value ); + value = EPbStatePlaying; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - + // // state change (EPbStatePaused) // - value = EPbStatePaused; - mController->handleEvent( event, value ); + value = EPbStatePaused; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); // // state change (EPbStateNotInitialised) // - value = EPbStateNotInitialised; - mController->handleEvent( event, value ); + value = EPbStateNotInitialised; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); // // state change (EPbStateStopped) // - value = EPbStateStopped; - mController->handleEvent( event, value ); + value = EPbStateStopped; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); // // state change (EPbStateSeekingForward) // - value = EPbStateSeekingForward; - mController->handleEvent( event, value ); + value = EPbStateSeekingForward; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - + // // state change (EPbStateSeekingBackward) // - value = EPbStateSeekingBackward; - mController->handleEvent( event, value ); + value = EPbStateSeekingBackward; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - + // // state change (EPbStateShuttingDown) // - value = EPbStateShuttingDown; - mController->handleEvent( event, value ); + value = EPbStateShuttingDown; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - + // // state change (EPbStateDownloading) // - value = EPbStateDownloading; - mController->handleEvent( event, value ); + value = EPbStateDownloading; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - + // // state change (EPbStatePluginSeeking) // - value = EPbStatePluginSeeking; - mController->handleEvent( event, value ); + value = EPbStatePluginSeeking; + mController->handleEvent( event, value ); verifyHandleEventStateChangedResult( value ); - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -347,29 +347,29 @@ // void TestMPXVideoPlaybackControlsController::verifyHandleEventStateChangedResult( int value ) { - MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::verifyHandleEventStateChangedResult()")); + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::verifyHandleEventStateChangedResult()")); mController->mOrientation = Qt::Horizontal; - if ( value == EPbStateInitialised && + if ( value == EPbStateInitialised && ( mController->mFileDetails->mPlaybackMode == EMPXVideoStreaming || mController->mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming ) ) { - QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdPluginInitialized ); + QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdPluginInitialized ); } - else if ( value == EPbStatePlaying || value == EPbStateInitialising || - value == EPbStateBuffering || value == EPbStatePaused || + else if ( value == EPbStatePlaying || value == EPbStateInitialising || + value == EPbStateBuffering || value == EPbStatePaused || value == EPbStateNotInitialised ) { for ( int i = 0 ; i < mController->mControls.count() ; i++ ) { - QVERIFY( mController->mControls[i]->mState == value ); - QVERIFY( mController->mControls[i]->mVisibilityState == value ); + QVERIFY( mController->mControls[i]->mState == value ); + QVERIFY( mController->mControls[i]->mVisibilityState == value ); } } else { - QVERIFY( mController->mState == value ); + QVERIFY( mController->mState == value ); } } @@ -379,15 +379,15 @@ // void TestMPXVideoPlaybackControlsController::testHandleEventSetVolume() { - MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetVolume()")); - - init(); - int value = 40; - - mController->handleEvent( EMPXControlCmdSetVolume, value ); - QVERIFY( mController->mVolumeControl->mValue == value ); - - cleanup(); + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetVolume()")); + + init(); + int value = 40; + + mController->handleEvent( EMPXControlCmdSetVolume, value ); + QVERIFY( mController->mVolumeControl->mValue == value ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -396,19 +396,19 @@ // void TestMPXVideoPlaybackControlsController::testHandleEventSetAspectRatio() { - MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetAspectRatio()")); - - init(); + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetAspectRatio()")); + + init(); int numScalingType = 5; - + for ( int i = 0; i < numScalingType; i++ ) - { - mController->handleEvent( EMPXControlCmdSetAspectRatio, i ); - - QVERIFY( mController->mControls[0]->mAspectRatio == i ); + { + mController->handleEvent( EMPXControlCmdSetAspectRatio, i ); + + QVERIFY( mController->mControls[0]->mAspectRatio == i ); } - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -418,15 +418,15 @@ void TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadSize() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadSize()") ); - - init(); - int value = 50; - - mController->handleEvent( EMPXControlCmdSetDownloadSize, value ); - - QVERIFY( mController->mControls[0]->mDownloadSize == value ); - - cleanup(); + + init(); + int value = 50; + + mController->handleEvent( EMPXControlCmdSetDownloadSize, value ); + + QVERIFY( mController->mControls[0]->mDownloadSize == value ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -436,15 +436,15 @@ void TestMPXVideoPlaybackControlsController::testHandleEventDownloadUpdated() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventDownloadUpdated()") ); - - init(); + + init(); int value = 55; - - mController->handleEvent( EMPXControlCmdDownloadUpdated, value ); + + mController->handleEvent( EMPXControlCmdDownloadUpdated, value ); - QVERIFY( mController->mControls[0]->mDownloadPosition == value ); - - cleanup(); + QVERIFY( mController->mControls[0]->mDownloadPosition == value ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -454,15 +454,15 @@ void TestMPXVideoPlaybackControlsController::testHandleEventDownloadComplete() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventDownloadComplete()") ); - - init(); + + init(); int value = 60; - - mController->handleEvent( EMPXControlCmdDownloadComplete, value ); + + mController->handleEvent( EMPXControlCmdDownloadComplete, value ); - QVERIFY( mController->mControls[0]->mDownloadPosition == value ); - - cleanup(); + QVERIFY( mController->mControls[0]->mDownloadPosition == value ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -472,15 +472,15 @@ void TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadPaused() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadPaused()") ); - - init(); + + init(); int value = 0; - - mController->handleEvent( EMPXControlCmdSetDownloadPaused, value ); - - QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated ); - - cleanup(); + + mController->handleEvent( EMPXControlCmdSetDownloadPaused, value ); + + QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -490,15 +490,15 @@ void TestMPXVideoPlaybackControlsController::testHandleEventClearDownloadPaused() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventClearDownloadPaused()") ); - - init(); + + init(); int value = 0; - - mController->handleEvent( EMPXControlCmdClearDownloadPaused, value ); - - QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated ); - - cleanup(); + + mController->handleEvent( EMPXControlCmdClearDownloadPaused, value ); + + QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -508,29 +508,29 @@ void TestMPXVideoPlaybackControlsController::testHandleEventTvOutConnected() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventTvOutConnected()") ); - - init(); - + + init(); + // // TV-Out Connected, value = true, EMPXVideoLocal // - mController->handleEvent( EMPXControlCmdTvOutConnected, true ); + mController->handleEvent( EMPXControlCmdTvOutConnected, true ); verifyHandleEventTvOutResult( true, true ); - + // // TV-Out Connected, value = false, EMPXVideoLocal // - mController->handleEvent( EMPXControlCmdTvOutConnected, false ); + mController->handleEvent( EMPXControlCmdTvOutConnected, false ); verifyHandleEventTvOutResult( true, false ); - + // // TV-Out Connected, value = false, non-EMPXVideoLocal // mController->mFileDetails->mPlaybackMode = EMPXVideoStreaming; - mController->handleEvent( EMPXControlCmdTvOutConnected, false ); + mController->handleEvent( EMPXControlCmdTvOutConnected, false ); verifyHandleEventTvOutResult( true, false ); - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -541,58 +541,58 @@ bool value ) { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::verifyHandleEventTvOutResult(%d,%d)"), - tvOutConnected, value ); - - QVERIFY( mController->mFileDetails->mTvOutConnected == tvOutConnected ); - + tvOutConnected, value ); + + QVERIFY( mController->mFileDetails->mTvOutConnected == tvOutConnected ); + // // validate setDefaultBitmap() // for ( int i=0 ; i < mController->mLoader->mWidgets.count() ; i++ ) - { + { bool val = mController->mLoader->isVisible(i); - + if( mController->mLoader->mWidgets[i]->objectName() == QString( "tvOutBitmap" ) ) { - QVERIFY( tvOutConnected? val == true : val == false ); + QVERIFY( tvOutConnected? val == true : val == false ); } else if( mController->mLoader->mWidgets[i]->objectName() == QString( "realAudioOnlyBitmap" ) ) { - QVERIFY( mFileDetails->mRNFormat? val == true : val == false ); + QVERIFY( mFileDetails->mRNFormat? val == true : val == false ); } else if( mController->mLoader->mWidgets[i]->objectName() == QString( "partialAudioOnlyBitmap" ) ) { - QVERIFY( mFileDetails->mPartialPlayback? val == true : val == false ); + QVERIFY( mFileDetails->mPartialPlayback? val == true : val == false ); } else if( mController->mLoader->mWidgets[i]->objectName() == QString( "audioOnlyBitmap" ) ) { - QVERIFY( tvOutConnected? val == false : val == true ); + QVERIFY( tvOutConnected? val == false : val == true ); } } - + // // validate generateThumbNail() // if ( tvOutConnected ) { - QVERIFY( ( mController->mFileDetails->mPlaybackMode == EMPXVideoLocal )? - mController->mThumbNailState == EThumbNailRequsted : - mController->mThumbNailState == EThumbNailNotAvailable ); - QVERIFY( mController->mViewMode == EAudioOnlyView ); - QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdTvOutConnected ); - QVERIFY( mController->mThumbnailManager->mThumbSize == ThumbnailManager::ThumbnailLarge ); - QVERIFY( mController->mThumbnailManager->mQuality == ThumbnailManager::OptimizeForPerformance ); - QVERIFY( mController->mViewTransitionIsGoingOn == false ); + QVERIFY( ( mController->mFileDetails->mPlaybackMode == EMPXVideoLocal )? + mController->mThumbNailState == EThumbNailRequsted : + mController->mThumbNailState == EThumbNailNotAvailable ); + QVERIFY( mController->mViewMode == EAudioOnlyView ); + QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdTvOutConnected ); + QVERIFY( mController->mThumbnailManager->mThumbSize == ThumbnailManager::ThumbnailLarge ); + QVERIFY( mController->mThumbnailManager->mQuality == ThumbnailManager::OptimizeForPerformance ); + QVERIFY( mController->mViewTransitionIsGoingOn == false ); } else if ( mController->mFileDetails->mVideoEnabled ) { - QVERIFY( mController->mViewTransitionIsGoingOn == true ); - QVERIFY( mController->mViewMode == EFullScreenView ); + QVERIFY( mController->mViewTransitionIsGoingOn == true ); + QVERIFY( mController->mViewMode == EFullScreenView ); } else if ( ! mController->mFileDetails->mVideoEnabled ) { - QVERIFY( mController->mViewTransitionIsGoingOn == false ); - QVERIFY( mController->mViewMode == EAudioOnlyView ); + QVERIFY( mController->mViewTransitionIsGoingOn == false ); + QVERIFY( mController->mViewMode == EAudioOnlyView ); } } @@ -604,22 +604,22 @@ void TestMPXVideoPlaybackControlsController::testHandleEventTvOutDisconnected() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventTvOutDisconnected()") ); - - init(); - + + init(); + // // TV-Out Disconnected, value = true // - mController->handleEvent( EMPXControlCmdTvOutDisconnected, true ); + mController->handleEvent( EMPXControlCmdTvOutDisconnected, true ); verifyHandleEventTvOutResult( false, true ); - + // // TV-Out Disconnected, value = false // - mController->handleEvent( EMPXControlCmdTvOutDisconnected, false ); + mController->handleEvent( EMPXControlCmdTvOutDisconnected, false ); verifyHandleEventTvOutResult( false, false ); - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -629,19 +629,19 @@ void TestMPXVideoPlaybackControlsController::testHandleEventHandleErrors() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventHandleErrors()") ); - - init(); - + + init(); + // // handle error // - mController->handleEvent( EMPXControlCmdHandleErrors, 0 ); - - QVERIFY( mController->mThumbNailState == EThumbNailEmpty ); - QVERIFY( mController->mState == EPbStateNotInitialised ); - QVERIFY( mController->mViewMode == EFullScreenView ); - - cleanup(); + mController->handleEvent( EMPXControlCmdHandleErrors, 0 ); + + QVERIFY( mController->mThumbNailState == EThumbNailEmpty ); + QVERIFY( mController->mState == EPbStateNotInitialised ); + QVERIFY( mController->mViewMode == EFullScreenView ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -651,14 +651,14 @@ void TestMPXVideoPlaybackControlsController::testHandleEventShowVolumeControls() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventShowVolumeControls()") ); - - init(); - - mController->handleEvent( EMPXControlCmdShowVolumeControls, 0 ); - - QVERIFY( mController->mVolumeControl->mVisible == true ); - - cleanup(); + + init(); + + mController->handleEvent( EMPXControlCmdShowVolumeControls, 0 ); + + QVERIFY( mController->mVolumeControl->mVisible == true ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -668,106 +668,106 @@ void TestMPXVideoPlaybackControlsController::testHandleCommand() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleCommand()") ); - - init(); - - mController->handleCommand( EMPXPbvCmdSetPosition, 0 ); - QVERIFY( mViewWrapper->mProperty == EPbPropertyPosition ); - - mController->handleCommand( EMPXPbvCmdSetVolume, 0 ); - QVERIFY( mViewWrapper->mProperty == EPbPropertyVolume ); - - mController->handleCommand( EMPXPbvCmdPlay, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPlay ); - - mController->handleCommand( EMPXPbvCmdPause, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPause ); - - mController->handleCommand( EMPXPbvCmdPlayPause, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPlayPause ); - - mController->handleCommand( EMPXPbvCmdStop, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdStop ); - - mController->handleCommand( EMPXPbvCmdClose, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdClose ); - - mController->handleCommand( EMPXPbvCmdMute, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdMute ); - - mController->handleCommand( EMPXPbvCmdUnMute, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdUnMute ); - - mController->handleCommand( EMPXPbvCmdChangeAspectRatio, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdChangeAspectRatio ); - - mController->handleCommand( EMPXPbvCmdNaturalAspectRatio, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNaturalAspectRatio ); - - mController->handleCommand( EMPXPbvCmdZoomAspectRatio, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdZoomAspectRatio ); - - mController->handleCommand( EMPXPbvCmdStretchAspectRatio, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdStretchAspectRatio ); - - mController->handleCommand( EMPXPbvCmdSeekForward, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSeekForward ); - - mController->handleCommand( EMPXPbvCmdSeekBackward, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSeekBackward ); - - mController->handleCommand( EMPXPbvCmdEndSeek, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdEndSeek ); - - mController->handleCommand( EMPXPbvCmdNextListItem, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNextListItem ); - - mController->handleCommand( EMPXPbvCmdPreviousListItem, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPreviousListItem ); - - mController->handleCommand( EMPXPbvCmdDecreaseVolume, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdDecreaseVolume ); - - mController->handleCommand( EMPXPbvCmdIncreaseVolume, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdIncreaseVolume ); - - mController->handleCommand( EMPXPbvCmdPosition, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPosition ); - - mController->handleCommand( EMPXPbvCmdSave, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSave ); - - mController->handleCommand( EMPXPbvCmdResetControls, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdResetControls ); - - mController->handleCommand( EMPXPbvCmdShortPressForward, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShortPressForward ); - - mController->handleCommand( EMPXPbvCmdShortPressBackward, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShortPressBackward ); - - mController->handleCommand( EMPXPbvCmdShowFileDetails, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShowFileDetails ); - - mController->handleCommand( EMPXPbvCmdEndOfClip, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdEndOfClip ); - - mController->handleCommand( EMPXPbvCmdCustomPause, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdCustomPause ); - - mController->handleCommand( EMPXPbvCmdCustomPlay, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdCustomPlay ); - - mController->handleCommand( EMPXPbvCmdExit, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdExit ); - - mController->handleCommand( EMPXPbvLaunchDRMDetails, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvLaunchDRMDetails ); - - mController->handleCommand( EMPXPbvSurfaceCreated, 0 ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvSurfaceCreated ); - - cleanup(); + + init(); + + mController->handleCommand( EMPXPbvCmdSetPosition, 0 ); + QVERIFY( mViewWrapper->mProperty == EPbPropertyPosition ); + + mController->handleCommand( EMPXPbvCmdSetVolume, 0 ); + QVERIFY( mViewWrapper->mProperty == EPbPropertyVolume ); + + mController->handleCommand( EMPXPbvCmdPlay, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPlay ); + + mController->handleCommand( EMPXPbvCmdPause, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPause ); + + mController->handleCommand( EMPXPbvCmdPlayPause, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPlayPause ); + + mController->handleCommand( EMPXPbvCmdStop, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdStop ); + + mController->handleCommand( EMPXPbvCmdClose, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdClose ); + + mController->handleCommand( EMPXPbvCmdMute, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdMute ); + + mController->handleCommand( EMPXPbvCmdUnMute, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdUnMute ); + + mController->handleCommand( EMPXPbvCmdChangeAspectRatio, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdChangeAspectRatio ); + + mController->handleCommand( EMPXPbvCmdNaturalAspectRatio, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNaturalAspectRatio ); + + mController->handleCommand( EMPXPbvCmdZoomAspectRatio, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdZoomAspectRatio ); + + mController->handleCommand( EMPXPbvCmdStretchAspectRatio, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdStretchAspectRatio ); + + mController->handleCommand( EMPXPbvCmdSeekForward, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSeekForward ); + + mController->handleCommand( EMPXPbvCmdSeekBackward, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSeekBackward ); + + mController->handleCommand( EMPXPbvCmdEndSeek, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdEndSeek ); + + mController->handleCommand( EMPXPbvCmdNextListItem, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNextListItem ); + + mController->handleCommand( EMPXPbvCmdPreviousListItem, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPreviousListItem ); + + mController->handleCommand( EMPXPbvCmdDecreaseVolume, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdDecreaseVolume ); + + mController->handleCommand( EMPXPbvCmdIncreaseVolume, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdIncreaseVolume ); + + mController->handleCommand( EMPXPbvCmdPosition, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPosition ); + + mController->handleCommand( EMPXPbvCmdSave, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSave ); + + mController->handleCommand( EMPXPbvCmdResetControls, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdResetControls ); + + mController->handleCommand( EMPXPbvCmdShortPressForward, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShortPressForward ); + + mController->handleCommand( EMPXPbvCmdShortPressBackward, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShortPressBackward ); + + mController->handleCommand( EMPXPbvCmdShowFileDetails, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShowFileDetails ); + + mController->handleCommand( EMPXPbvCmdEndOfClip, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdEndOfClip ); + + mController->handleCommand( EMPXPbvCmdCustomPause, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdCustomPause ); + + mController->handleCommand( EMPXPbvCmdCustomPlay, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdCustomPlay ); + + mController->handleCommand( EMPXPbvCmdExit, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdExit ); + + mController->handleCommand( EMPXPbvLaunchDRMDetails, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvLaunchDRMDetails ); + + mController->handleCommand( EMPXPbvSurfaceCreated, 0 ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvSurfaceCreated ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -777,39 +777,51 @@ void TestMPXVideoPlaybackControlsController::testHandleTappedOnScreen() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleTappedOnScreen()") ); - - init(); + + init(); mController->mOrientation = Qt::Horizontal; + connect( this, SIGNAL( commandSignal() ), mController, SLOT( handleTappedOnScreen() ) ); // - // preset variables + // 1. Test full screen view // - mFileDetails->mVideoEnabled = true; mController->mViewMode = EFullScreenView; - + // // playing state // mController->mState = EPbStatePlaying; - mBaseVideoView->mouseReleaseEvent(0); + emit commandSignal(); + QVERIFY( mController->mControlsTimer->isActive() == true ); for ( int i = 0 ; i < mController->mControls.count() ; i++ ) { QVERIFY( mController->mControls[i]->mVisibilityState == mController->mState ); } - + // // pause state // mController->mState = EPbStatePaused; - mBaseVideoView->mouseReleaseEvent(0); + emit commandSignal(); + QVERIFY( mController->mControlsTimer->isActive() == false ); for ( int i = 0 ; i < mController->mControls.count() ; i++ ) { - QVERIFY( mController->mControls[i]->mVisibilityState == mController->mState ); + QVERIFY( mController->mControls[i]->mVisibilityState == mController->mState ); } - - cleanup(); + + + // + // 2. Test details screen view + // + mController->mViewMode = EDetailsView; + + emit commandSignal(); + QVERIFY( mController->mViewWrapper->mCommandId == EMPXPbvCmdPlayPause ); + + disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( handleTappedOnScreen() ) ); + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -819,26 +831,26 @@ void TestMPXVideoPlaybackControlsController::testUpdateVideoRectDone() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testUpdateVideoRectDone()") ); - - init(); - - mController->updateVideoRectDone(); - + + init(); + + mController->updateVideoRectDone(); + // // default is full-screen // - QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdFullScreenViewOpened ); - + QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdFullScreenViewOpened ); + // // validate Details view // mController->mViewMode = EDetailsView; - - mController->updateVideoRectDone(); - - QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdDetailsViewOpened ); - - cleanup(); + + mController->updateVideoRectDone(); + + QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdDetailsViewOpened ); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -848,9 +860,9 @@ void TestMPXVideoPlaybackControlsController::testIsAttachOperation() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testIsAttachOperation()") ); - + // - // get access to XQServiceUtilXtra stub + // get access to XQServiceUtilXtra stub // XQServiceUtilXtra* extraUtil = XQServiceUtilXtra::instance(); @@ -858,47 +870,46 @@ // set service enable // extraUtil->setCurrentService( true ); - + // // initialize controlscontroller // - init(); - + init(); + // // verify 'mIsAttachOperation' flag is enabled // - QVERIFY( mController->mIsAttachOperation == true ); - + QVERIFY( mController->mIsAttachOperation == true ); + // // clean up // - cleanup(); - + cleanup(); + // // set service disable // extraUtil->setCurrentService( false ); - + // // initialize controlscontroller // - init(); - + init(); + // // verify 'mIsAttachOperation' flag is disabled // - QVERIFY( mController->mIsAttachOperation == false ); - + QVERIFY( mController->mIsAttachOperation == false ); + // // clean up // - cleanup(); - + cleanup(); + // // dereference extraUtil count // extraUtil->decreaseReferenceCount(); - } // ------------------------------------------------------------------------------------------------- @@ -909,17 +920,32 @@ { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_skipToNextVideoItem()") ); - init(); - + init(); + connect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToNextVideoItem() ) ); - - emit commandSignal(); - - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNextListItem ); - + + // + // If we are not in full screen view, ignore + // + mViewWrapper->mCommandId = EMPXPbvCmdPosition; + mController->mViewMode = EDetailsView; + + emit commandSignal(); + + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPosition ); + + // + // If we are in full screen view, issue EMPXPbvCmdNextListItem; + // + mController->mViewMode = EFullScreenView; + + emit commandSignal(); + + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNextListItem ); + disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToNextVideoItem() ) ); - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -930,17 +956,32 @@ { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_skipToPreviousVideoItem()") ); - init(); - + init(); + connect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToPreviousVideoItem() ) ); - - emit commandSignal(); - - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPreviousListItem ); - + + // + // If we are not in full screen view, ignore + // + mViewWrapper->mCommandId = EMPXPbvCmdPosition; + mController->mViewMode = EDetailsView; + + emit commandSignal(); + + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPosition ); + + // + // If we are in full screen view, issue EMPXPbvCmdPreviousListItem + // + mController->mViewMode = EFullScreenView; + + emit commandSignal(); + + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPreviousListItem ); + disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToPreviousVideoItem() ) ); - - cleanup(); + + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -952,7 +993,7 @@ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_attachVideo()") ); // - // get access to XQServiceUtilXtra stub to enable XQServiceUtil::isService() method + // get access to XQServiceUtilXtra stub to enable XQServiceUtil::isService() method // XQServiceUtilXtra* extraUtil = XQServiceUtilXtra::instance(); @@ -960,52 +1001,52 @@ // set service enable // extraUtil->setCurrentService( true ); - + // // initialize controlscontroller // - init(); - + init(); + // // verify view closePlaybackView() slot is not yet called // - QVERIFY( mController->mView->mViewClosed == false ); + QVERIFY( mController->mView->mViewClosed == false ); // // connect signal with controller attachVideo() slot // bool res = connect( this, SIGNAL( commandSignal() ), mController, SLOT( attachVideo() ) ); - + // // emit signal, this will in turns invoke videoservices itemSelected() slot // - emit commandSignal(); - + emit commandSignal(); + // // verify view closePlaybackView() slot is called // - QVERIFY( mController->mView->mViewClosed == true ); + QVERIFY( mController->mView->mViewClosed == true ); // // verify videoservices itemSelected() slot is called // - QVERIFY( mController->mVideoServices->mItemSelected == true ); - + QVERIFY( mController->mVideoServices->mItemSelected == true ); + // // disconnect signal // disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( attachVideo() ) ); - + // // clean up // - cleanup(); - + cleanup(); + // // dereference extraUtil count // extraUtil->decreaseReferenceCount(); - + } // ------------------------------------------------------------------------------------------------- @@ -1015,36 +1056,36 @@ void TestMPXVideoPlaybackControlsController::testslot_sendVideo() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_sendVideo()") ); - + // // initialize controlscontroller // - init(); - + init(); + // // connect signal with controller sendVideoo() slot // bool res = connect( this, SIGNAL( commandSignal() ), mController, SLOT( sendVideo() ) ); - + // // emit signal, this will in turns invoke mController sendVideo() slot // - emit commandSignal(); - + emit commandSignal(); + // // verify command EMPXPbvCmdClose has been issued // - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPause ); - + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPause ); + // // disconnect signal // disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( sendVideo() ) ); - + // // clean up // - cleanup(); + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -1054,43 +1095,43 @@ void TestMPXVideoPlaybackControlsController::testslot_handleOrientationChanged() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_handleOrientationChanged()") ); - + // // initialize controlscontroller // - init(); - + init(); + // // connect signal with controller handleOrientationChanged() slot // bool res = connect( this, SIGNAL( commandSignal( Qt::Orientation ) ), mController, SLOT( handleOrientationChanged( Qt::Orientation ) ) ); - + // // emit signal, this will in turns invoke mController handleOrientationChanged() slot // mController->mOrientation = Qt::Vertical; - mController->mState = EPbStatePlaying; + mController->mState = EPbStatePlaying; - emit commandSignal( Qt::Horizontal ); + emit commandSignal( Qt::Horizontal ); - QVERIFY( mController->mOrientation == Qt::Horizontal ); + QVERIFY( mController->mOrientation == Qt::Horizontal ); for ( int i = 0 ; i < mController->mControls.count() ; i++ ) { - QVERIFY( mController->mControls[i]->mVisibilityState == mController->mState ); + QVERIFY( mController->mControls[i]->mVisibilityState == mController->mState ); } // // disconnect signal // - disconnect( this, SIGNAL( commandSignal( Qt::Orientation ) ), + disconnect( this, SIGNAL( commandSignal( Qt::Orientation ) ), mController, SLOT( handleOrientationChanged( Qt::Orientation ) ) ); - + // // clean up // - cleanup(); + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -1100,36 +1141,36 @@ void TestMPXVideoPlaybackControlsController::testslot_handleRNLogoVisibleChanged() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_handleRNLogoVisibleChanged()") ); - + // // initialize controlscontroller // - init(); - + init(); + // // connect signal with controller handleRNLogoVisibleChanged() slot // bool res = connect( this, SIGNAL( commandSignal() ), mController, SLOT( handleRNLogoVisibleChanged() ) ); - + // // emit signal, this will in turns invoke mController handleRNLogoVisibleChanged() slot // - emit commandSignal(); + emit commandSignal(); - QVERIFY( mController->mRNLogoTimer->isActive() ); - QVERIFY( mController->mRNLogoTimer->interval() == KMPXRNLogoTimeOut ); + QVERIFY( mController->mRNLogoTimer->isActive() ); + QVERIFY( mController->mRNLogoTimer->interval() == KMPXRNLogoTimeOut ); // // disconnect signal // - disconnect( this, SIGNAL( commandSignal() ), + disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( handleRNLogoVisibleChanged() ) ); - + // // clean up // - cleanup(); + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -1139,11 +1180,11 @@ void TestMPXVideoPlaybackControlsController::testslot_handleRNLogoTimeout() { MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_handleRNLogoTimeout()") ); - + // // initialize controlscontroller // - init(); + init(); if ( ! mController->mRNLogoTimer ) { @@ -1155,26 +1196,26 @@ // bool res = connect( this, SIGNAL( commandSignal() ), mController, SLOT( handleRNLogoTimeout() ) ); - + // // emit signal, this will in turns invoke mController handleRNLogoTimeout() slot // - emit commandSignal(); + emit commandSignal(); - QVERIFY( ! mController->mRNLogoTimer->isActive() ); - QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated ); - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdRealOneBitmapTimeout ); + QVERIFY( ! mController->mRNLogoTimer->isActive() ); + QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated ); + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdRealOneBitmapTimeout ); // // disconnect signal // - disconnect( this, SIGNAL( commandSignal() ), + disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( handleRNLogoTimeout() ) ); - + // // clean up // - cleanup(); + cleanup(); } // ------------------------------------------------------------------------------------------------- @@ -1183,7 +1224,7 @@ // void TestMPXVideoPlaybackControlsController::testIsRNLogoBitmapVisible() { - MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testIsRNLogoBitmapVisible()")); + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testIsRNLogoBitmapVisible()")); init(); @@ -1202,7 +1243,7 @@ QVERIFY( ! mController->isRNLogoBitmapInControlList() ); - cleanup(); + cleanup(); } // End of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/hbvideobaseplaybackview.h --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/hbvideobaseplaybackview.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/hbvideobaseplaybackview.h Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 2 % +// Version : %version: 3 % @@ -43,8 +43,6 @@ public: HbVideoBasePlaybackView(); virtual ~HbVideoBasePlaybackView(); - - void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ); signals: void tappedOnScreen(); diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/hbvideobaseplaybackview.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/hbvideobaseplaybackview.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/hbvideobaseplaybackview.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 2 % +// Version : %version: 3 % @@ -51,17 +51,6 @@ } // ------------------------------------------------------------------------------------------------- -// HbVideoBasePlaybackView::mouseReleaseEvent -// ------------------------------------------------------------------------------------------------- -// -void HbVideoBasePlaybackView::mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) -{ - MPX_DEBUG(_L("HbVideoBasePlaybackView::mouseReleaseEvent()")); - Q_UNUSED( event ); - emit tappedOnScreen(); -} - -// ------------------------------------------------------------------------------------------------- // HbVideoBasePlaybackView::closePlaybackView() // ------------------------------------------------------------------------------------------------- // diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/inc/testvideoplaybackview.h --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/inc/testvideoplaybackview.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/inc/testvideoplaybackview.h Wed Jun 23 18:14:16 2010 +0300 @@ -1,5 +1,5 @@ /** -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,10 +12,10 @@ * Contributors: * * Description: tester for methods in Video Playback View Plugin -* +* */ -// Version : %version: 6 % +// Version : %version: 7 % #ifndef __TESTVIDEOPLAYBACKVIEW_H__ #define __TESTVIDEOPLAYBACKVIEW_H__ @@ -37,21 +37,21 @@ * will be called before each testfunction is executed. * */ - void init(); - + void init(); + /** * will be called after every testfunction. * */ void cleanup(); - + void setup(); - + private: - + void verifyHandlePluginError( TInt error, bool closeView = true ); - - // test functions for the test framework + + // test functions for the test framework private slots: // the order in which these testXX methods are declared is important @@ -62,8 +62,6 @@ void testIssuePlayCommand(); void testEventFilter(); void testClosePlaybackView(); - void testMousePressEvent(); - void testMouseReleaseEvent(); void testHandlePdlStateChange(); void testHandlePluginError(); void testHandleStoppedStatePrevView(); @@ -73,6 +71,7 @@ void testHandleSoftkeyback(); void testHandleDeactivateView(); void testDoClosePlayer(); + void testGestureEvent(); signals: void commandSignal(); @@ -82,10 +81,7 @@ }; - #endif // __TESTVIDEOPLAYBACKVIEW_H__ // End of file - - diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -1,5 +1,5 @@ /** -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,10 +12,10 @@ * Contributors: * * Description: tester for methods in VideoSortFilterProxyModel -* +* */ -// Version : %version: 9 % +// Version : %version: 10 % #include #include @@ -31,9 +31,12 @@ #include #include "mpxvideoplaybackviewfiledetails.h" +#include "mpxcommonvideoplaybackview.hrh" #include "testvideoplaybackview.h" #include "mpxvideoviewwrapper.h" +#include "hbtapgesture.h" +#include "hbpangesture.h" #define private public #define protected public @@ -43,8 +46,6 @@ #undef private - - // --------------------------------------------------------------------------- // main // --------------------------------------------------------------------------- @@ -53,27 +54,26 @@ { HbApplication app(argc, argv); HbMainWindow window; - + TestVideoPlaybackView tv; char *pass[3]; pass[0] = argv[0]; pass[1] = "-o"; pass[2] = "c:\\data\\TestVideoPlaybackView.txt"; - + int res = QTest::qExec(&tv, 3, pass); - + return res; } - // --------------------------------------------------------------------------- // init // --------------------------------------------------------------------------- // void TestVideoPlaybackView::init() -{ - mVideoView = new HbVideoPlaybackView(); +{ + mVideoView = new HbVideoPlaybackView(); } // --------------------------------------------------------------------------- @@ -96,21 +96,28 @@ mVideoView->handleActivateView(); } - +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandleActivateView() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testHandleActivateView() { - init(); - mVideoView->handleActivateView(); - + init(); + mVideoView->handleActivateView(); + QVERIFY( mVideoView->mVideoMpxWrapper->iMediaRequested == true ); QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mBitRate, 16000 ); QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mTitle, QString("Test Video Title") ); - - cleanup(); + + cleanup(); } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandlePluginError() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testHandlePluginError() -{ +{ // // playback view is closed after displaying these error notes // @@ -122,53 +129,57 @@ verifyHandlePluginError( KErrMMInvalidProtocol ); verifyHandlePluginError( KErrMMInvalidURL ); verifyHandlePluginError( KErrArgument ); - verifyHandlePluginError( KErrSessionClosed ); + verifyHandlePluginError( KErrSessionClosed ); verifyHandlePluginError( KErrTimedOut ); verifyHandlePluginError( KErrNotFound ); - verifyHandlePluginError( KErrMMNotEnoughBandwidth ); + verifyHandlePluginError( KErrMMNotEnoughBandwidth ); verifyHandlePluginError( KErrDisconnected ); - verifyHandlePluginError( KErrMMProxyServer ); + verifyHandlePluginError( KErrMMProxyServer ); verifyHandlePluginError( KErrCouldNotConnect ); verifyHandlePluginError( KErrAbort ); - verifyHandlePluginError( KErrCancel ); + verifyHandlePluginError( KErrCancel ); verifyHandlePluginError( KErrMMDRMNotAuthorized ); verifyHandlePluginError( KErrCANoRights ); verifyHandlePluginError( KErrCANoPermission ); - + // // playback view remains open after displaying these error notes // verifyHandlePluginError( KMPXVideoCallOngoingError, false ); verifyHandlePluginError( KMPXVideoPlayOver2GDuringVoiceCallError, false ); - + // // default error case, playback view is closed after displaying error note // - verifyHandlePluginError( KErrGeneral ); + verifyHandlePluginError( KErrGeneral ); } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testShowDialog() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testShowDialog() -{ +{ // // construct and activate playback view // setup(); - + // // ensure that playback view is currently activated // QVERIFY( ! mVideoView->mTimerForClosingView->isActive() ); - + // // test showDialog() method // mVideoView->showDialog( "test error msg" ); - + // // connect and emit signal for handleClosePopupDialog() slot // connect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) ); - emit commandSignal(); + emit commandSignal(); // // verify that playback view is properly closed @@ -179,40 +190,50 @@ // disconnect signal for handleClosePopupDialog() slot // disconnect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) ); - + // // destruct playback view // - cleanup(); + cleanup(); } - +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testGetWindow() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testGetWindow() -{ +{ setup(); - - QVERIFY( mVideoView->getWindow() != NULL ); - + + QVERIFY( mVideoView->getWindow() != NULL ); + cleanup(); } - +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testIssuePlayCommand() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testIssuePlayCommand() -{ +{ setup(); - - mVideoView->issuePlayCommand(); - + + mVideoView->issuePlayCommand(); + //JAM remove QVERIFY( mVideoView->isEnabled() ); - + cleanup(); } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testEventFilter() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testEventFilter() { setup(); - + // // ensure default foreground is false // @@ -223,29 +244,29 @@ // QEvent* appActivate = new QEvent( QEvent::ApplicationActivate ); QEvent* appDeactivate = new QEvent( QEvent::ApplicationDeactivate ); - + // - // verify the returned value (consumed) of HbVideoBasePlaybackView::event() + // verify the returned value (consumed) of HbVideoBasePlaybackView::event() // for QEvent::ApplicationActivate is false // - QVERIFY( ! mVideoView->eventFilter( NULL, appActivate ) ); - + QVERIFY( ! mVideoView->eventFilter( NULL, appActivate ) ); + // // verify view is in foreground // QCOMPARE( mVideoView->mVideoMpxWrapper->iForeground, 1 ); // - // verify the returned value (consumed) of HbVideoBasePlaybackView::event() + // verify the returned value (consumed) of HbVideoBasePlaybackView::event() // for QEvent::ApplicationDeactivate is false // - QVERIFY( ! mVideoView->eventFilter( NULL, appDeactivate ) ); - + QVERIFY( ! mVideoView->eventFilter( NULL, appDeactivate ) ); + // // verify view is in background // QCOMPARE( mVideoView->mVideoMpxWrapper->iForeground, 0 ); - + // // clean up // @@ -264,207 +285,173 @@ cleanup(); } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testClosePlaybackView() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testClosePlaybackView() { setup(); - + QVERIFY( ! mVideoView->mTimerForClosingView->isActive() ); mVideoView->closePlaybackView(); - + QVERIFY( mVideoView->mTimerForClosingView->isActive() ); cleanup(); } -void TestVideoPlaybackView::testMousePressEvent() -{ - setup(); - - // - // declare QEvent::GraphicsSceneMousePress - // - QGraphicsSceneMouseEvent* event = new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMousePress ); - - // - // set m_accept value to false - // - event->setAccepted( false ); - - // - // simulate QEvent::GraphicsSceneMousePress event - // - mVideoView->mousePressEvent( event ); - - // - // verify event has been accepted - // - QVERIFY( event->isAccepted() ); - - // - // clean up - // - delete event; - event = NULL; - cleanup(); -} - -void TestVideoPlaybackView::testMouseReleaseEvent() -{ - setup(); - - // - // declare QEvent::GraphicsSceneMouseRelease - // - QGraphicsSceneMouseEvent* event = new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMouseRelease ); - - // - // connect to tappedOnScreen() signal and record its emission - // - QSignalSpy spy( mVideoView, SIGNAL(tappedOnScreen()) ); - - // - // ensure signal has not been emitted yet - // - QCOMPARE(spy.count(), 0); - - // - // simulate QEvent::GraphicsSceneMousePress event - // - mVideoView->mouseReleaseEvent( event ); - - // - // ensure signal has been emitted and its emission count is incremented - // - QCOMPARE(spy.count(), 1); - - // - // clean up - // - delete event; - event = NULL; - spy.clear(); - cleanup(); -} - - +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandlePdlStateChange() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testHandlePdlStateChange() { setup(); QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mClipName, QString("testClip.3gp") ); - + mVideoView->handlePdlStateChange( 0 ); - + QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mClipName, QString("testClip.3gp") ); - + + cleanup(); +} + +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandleStoppedStateNoPrevView() +// ------------------------------------------------------------------------------------------------- +// +void TestVideoPlaybackView::testHandleStoppedStateNoPrevView() +{ + setup(); + + QVERIFY( ! mVideoView->mTimerForClosingView->isActive() ); + mVideoView->handleStoppedState(); + + QVERIFY( mVideoView->mTimerForClosingView->isActive() ); + cleanup(); } -void TestVideoPlaybackView::testHandleStoppedStateNoPrevView() -{ +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandleStoppedStatePrevView() +// ------------------------------------------------------------------------------------------------- +// +void TestVideoPlaybackView::testHandleStoppedStatePrevView() +{ setup(); - QVERIFY( ! mVideoView->mTimerForClosingView->isActive() ); mVideoView->handleStoppedState(); - QVERIFY( mVideoView->mTimerForClosingView->isActive() ); + QVERIFY( mVideoView->mTimerForClosingView->isActive() ); - cleanup(); + cleanup(); + } - -void TestVideoPlaybackView::testHandleStoppedStatePrevView() -{ +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandleBackNoPrevView() +// ------------------------------------------------------------------------------------------------- +// +void TestVideoPlaybackView::testHandleBackNoPrevView() +{ setup(); - - mVideoView->handleStoppedState(); - - QVERIFY( mVideoView->mTimerForClosingView->isActive() ); - - cleanup(); - -} -void TestVideoPlaybackView::testHandleBackNoPrevView() -{ - setup(); - QVERIFY( ! mVideoView->mTimerForClosingView->isActive() ); mVideoView->handleBack(); - QVERIFY( mVideoView->mTimerForClosingView->isActive() ); - + QVERIFY( mVideoView->mTimerForClosingView->isActive() ); + cleanup(); - + } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandleBackPrevView() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testHandleBackPrevView() -{ +{ setup(); - + mVideoView->handleBack(); - - QVERIFY( mVideoView->mTimerForClosingView->isActive() ); - + + QVERIFY( mVideoView->mTimerForClosingView->isActive() ); + + cleanup(); +} + +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandleSoftkeyback() +// ------------------------------------------------------------------------------------------------- +// +void TestVideoPlaybackView::testHandleSoftkeyback() +{ + setup(); + + mVideoView->handleSoftkeyBack(); + + QVERIFY( mVideoView->mTimerForClosingView->isActive() ); + cleanup(); } -void TestVideoPlaybackView::testHandleSoftkeyback() -{ - setup(); - - mVideoView->handleSoftkeyBack(); - - QVERIFY( mVideoView->mTimerForClosingView->isActive() ); - - cleanup(); -} - - - +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testDoClosePlayer() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testDoClosePlayer() -{ - // quits app - which can be problematic for the qvptestrunner app +{ + // quits app - which can be problematic for the qvptestrunner app // setup(); -// +// // mVideoView->handleActivateView(); // // mVideoView->doClosePlayer(); -// +// // cleanup(); - + } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testHandleDeactivateView() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::testHandleDeactivateView() -{ +{ setup(); - + mVideoView->handleDeactivateView(); - - QVERIFY( mVideoView->mVideoMpxWrapper == NULL ); - - cleanup(); + + QVERIFY( mVideoView->mVideoMpxWrapper == NULL ); + + cleanup(); } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::verifyHandlePluginError() +// ------------------------------------------------------------------------------------------------- +// void TestVideoPlaybackView::verifyHandlePluginError( TInt error, bool closeView ) -{ +{ // // construct and activate playback view // setup(); - + // // ensure that playback view is currently open // QVERIFY( ! mVideoView->mTimerForClosingView->isActive() ); - + // // test handlePluginError() method // - mVideoView->handlePluginError( error ); - + mVideoView->handlePluginError( error ); + // // close playback view after error note has been launched // @@ -474,33 +461,182 @@ // connect and emit signal for handleClosePopupDialog() slot // connect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) ); - emit commandSignal(); + emit commandSignal(); // // verify that playback view is properly closed // QVERIFY( mVideoView->mTimerForClosingView->isActive() ); - + // // disconnect signal for handleClosePopupDialog() slot // disconnect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) ); } else - { + { // // verify that playback view is still open after error note has been launched // QVERIFY( ! mVideoView->mTimerForClosingView->isActive() ); - } - + } + // // destruct playback view // cleanup(); } +// ------------------------------------------------------------------------------------------------- +// TestVideoPlaybackView::testGestureEvent() +// ------------------------------------------------------------------------------------------------- +// +void TestVideoPlaybackView::testGestureEvent() +{ + setup(); + + // + // 1. Test tap gesture + // + QList list; + HbTapGesture *tapGesture = new HbTapGesture(); + list.append( tapGesture ); + QGestureEvent* event = new QGestureEvent( list ); + + // + // connect to tappedOnScreen() signal and record its emission + // + QSignalSpy spy( mVideoView, SIGNAL( tappedOnScreen() ) ); + + // + // ensure signal has not been emitted yet + // + QCOMPARE( spy.count(), 0 ); + + // + // With GestureStarted + // + tapGesture->mState = Qt::GestureStarted; + mVideoView->gestureEvent( event ); + + // + // ensure signal hasn't been emitted and its emission count is not incremented + // + QCOMPARE( spy.count(), 0 ); + + // + // With GestureFinished + // + tapGesture->mState = Qt::GestureFinished; + mVideoView->gestureEvent( event ); + + // + // ensure signal has been emitted and its emission count is incremented + // + QCOMPARE( spy.count(), 1 ); + + // + // clean up + // + spy.clear(); + + list.clear(); + + if ( tapGesture ) + { + delete tapGesture; + tapGesture = NULL; + } + + if ( event ) + { + delete event; + event = NULL; + } + + // + // 2. Test pan gesture + // + HbPanGesture *panGesture = new HbPanGesture(); + list.append( panGesture ); + event = new QGestureEvent( list ); + + // + // connect to pannedToRight() signal and record its emission + // + QSignalSpy spy1( mVideoView, SIGNAL( pannedToRight() ) ); + + // + // ensure signal has not been emitted yet + // + QCOMPARE( spy1.count(), 0 ); + + // + // Test pan gesture With GestureStarted + // + panGesture->mState = Qt::GestureStarted; + mVideoView->gestureEvent( event ); + + // + // ensure signal has not been emitted yet + // + QCOMPARE( spy1.count(), 0 ); + + // + // Test pan gesture with GestureFinished + // + panGesture->mState = Qt::GestureFinished; + panGesture->mSceneDelta = QPointF( 5, 0 ); + mVideoView->gestureEvent( event ); + + // + // ensure signal has been emitted + // + QCOMPARE( spy1.count(), 1 ); + spy1.clear(); + + // + // Test pan gesture with GestureFinished + // + + // + // connect to pannedToRight() signal and record its emission + // + QSignalSpy spy2( mVideoView, SIGNAL( pannedToLeft() ) ); + + // + // ensure signal has not been emitted yet + // + QCOMPARE( spy2.count(), 0 ); + + panGesture->mState = Qt::GestureFinished; + panGesture->mSceneDelta = QPointF( -5, 0 ); + mVideoView->gestureEvent( event ); + + // + // ensure signal has not been emitted yet + // + QCOMPARE( spy2.count(), 1 ); + + // + // clean up + // + spy2.clear(); + list.clear(); + + if ( panGesture ) + { + delete panGesture; + panGesture = NULL; + } + + if ( event ) + { + delete event; + event = NULL; + } + + cleanup(); +} + // End of file - - - diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/inc/hbpangesture.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/inc/hbpangesture.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of HbPanGesture +* +*/ + +// Version : %version: 1 % + + + +#ifndef HBPANGESTURE_H_ +#define HBPANGESTURE_H_ + +#include + +class HbPanGesture : public QPanGesture +{ + Q_OBJECT + + public: + HbPanGesture(); + virtual ~HbPanGesture(); + Qt::GestureState state(){ return mState; } + QPointF sceneDelta(); + + public: + Qt::GestureState mState; + QPointF mSceneDelta; +}; + +#endif /*HBPANGESTURE_H_*/ + diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/inc/hbtapgesture.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/inc/hbtapgesture.h Wed Jun 23 18:14:16 2010 +0300 @@ -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: Implementation of HbTapGesture +* +*/ + +// Version : %version: 1 % + + + +#ifndef HbTAPGESTURE_H_ +#define HbTAPGESTURE_H_ + +#include + +class HbTapGesture : public QTapGesture +{ + Q_OBJECT + + public: + HbTapGesture(); + virtual ~HbTapGesture(); + Qt::GestureState state(){ return mState; } + + public: + Qt::GestureState mState; +}; + +#endif /*HbTAPGESTURE_H_*/ + diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/inc/mpxvideoviewwrapper.h --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/inc/mpxvideoviewwrapper.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/inc/mpxvideoviewwrapper.h Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 3 % +// Version : %version: 4 % @@ -48,26 +48,26 @@ virtual ~CMPXVideoViewWrapper(); private: - CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView ); + CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView ); void ConstructL(); - + void SetFileDetails(TBool aDefault); public: void HandleCommandL( TInt aCommand ); - + TBool IsLive(); - + TBool IsPlaylist(); - + TBool IsMultiItemPlaylist(); - - void RequestMediaL(); - + + void RequestMediaL(); + void CreateGeneralPlaybackCommandL( int aCmd ); - + void ActivateClosePlayerActiveObject(); - + void IssueVideoAppForegroundCmdL( TBool aForeground ); @@ -78,7 +78,7 @@ QMPXVideoPlaybackViewFileDetails* iFileDetails; TBool iClosePlayerAO; TBool iForeground; - + TInt iCommand; }; #endif // __MPXVIDEOVIEWWRAPPER_H__ diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/hbpangesture.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/hbpangesture.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of HbPanGesture +* +*/ + +// Version : %version: 1 % + + + + +#include "mpxvideo_debug.h" +#include "hbpangesture.h" + +// ------------------------------------------------------------------------------------------------- +// HbPanGesture::HbPanGesture +// ------------------------------------------------------------------------------------------------- +// +HbPanGesture::HbPanGesture() +{ + MPX_ENTER_EXIT(_L("HbPanGesture::HbPanGesture()")); +} + +// ------------------------------------------------------------------------------------------------- +// HbPanGesture::~HbPanGesture +// ------------------------------------------------------------------------------------------------- +// +HbPanGesture::~HbPanGesture() +{ + MPX_DEBUG(_L("HbPanGesture::HbPanGesture") ); +} + +// ------------------------------------------------------------------------------------------------- +// HbPanGesture::sceneDelta +// ------------------------------------------------------------------------------------------------- +// +QPointF HbPanGesture::sceneDelta() +{ + MPX_DEBUG(_L("HbPanGesture::sceneDelta") ); + + return mSceneDelta; +} + +// End of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/hbtapgesture.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/hbtapgesture.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of HbTapGesture +* +*/ + +// Version : %version: 1 % + + + + +#include "mpxvideo_debug.h" +#include "hbtapgesture.h" + +// ------------------------------------------------------------------------------------------------- +// HbTapGesture::HbTapGesture +// ------------------------------------------------------------------------------------------------- +// +HbTapGesture::HbTapGesture() +{ + MPX_ENTER_EXIT(_L("HbTapGesture::HbTapGesture()")); +} + +// ------------------------------------------------------------------------------------------------- +// HbTapGesture::~HbTapGesture +// ------------------------------------------------------------------------------------------------- +// +HbTapGesture::~HbTapGesture() +{ + MPX_DEBUG(_L("HbTapGesture::HbTapGesture") ); +} + +// End of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 6 % +// Version : %version: 7 % @@ -33,7 +33,7 @@ // ------------------------------------------------------------------------------------------------- // CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView ) - : iView( aView ) + : iView( aView ) { } @@ -58,7 +58,7 @@ // void CMPXVideoViewWrapper::ConstructL() { - iMediaRequested = EFalse; + iMediaRequested = EFalse; } // ------------------------------------------------------------------------------------------------- @@ -84,7 +84,7 @@ // TBool CMPXVideoViewWrapper::IsPlaylist() { - return EFalse; + return EFalse; } // ------------------------------------------------------------------------------------------------- @@ -102,21 +102,7 @@ // void CMPXVideoViewWrapper::HandleCommandL( TInt aCommand ) { - switch ( aCommand ) - { - case EMPXPbvCmdNextListItem: - { - SetFileDetails( EFalse ); - break; - } - - case EMPXPbvCmdPreviousListItem: - { - SetFileDetails( ETrue ); - break; - } - } - + iCommand = aCommand; } // ------------------------------------------------------------------------------------------------- @@ -126,12 +112,11 @@ void CMPXVideoViewWrapper::RequestMediaL() { iMediaRequested = ETrue; - + SetFileDetails( ETrue ); - + } - // ------------------------------------------------------------------------------------------------- // CMPXVideoViewWrapper::ActivateClosePlayerActiveObject // ------------------------------------------------------------------------------------------------- @@ -161,64 +146,54 @@ delete iFileDetails; iFileDetails = NULL; } - - iFileDetails = new QMPXVideoPlaybackViewFileDetails(); - - - _LIT(KTestMimeType, "video/3gp"); + + iFileDetails = new QMPXVideoPlaybackViewFileDetails(); + + _LIT(KTestMimeType, "video/3gp"); const QString qMimeType( (QChar*)KTestMimeType().Ptr(), KTestMimeType().Length() ); - iFileDetails->mMimeType = qMimeType; - - + iFileDetails->mMimeType = qMimeType; + _LIT(KTestTitle, "Test Video Title"); const QString qTitle( (QChar*)KTestTitle().Ptr(), KTestTitle().Length() ); - iFileDetails->mTitle = qTitle; - - + iFileDetails->mTitle = qTitle; + _LIT(KTestArtist, "TestArtist"); const QString qArtist( (QChar*)KTestArtist().Ptr(), KTestArtist().Length() ); iFileDetails->mArtist = qArtist; - - + _LIT(KTestDescription, "Test Description"); const QString qDescription( (QChar*)KTestDescription().Ptr(), KTestDescription().Length() ); iFileDetails->mDescription = qDescription; - _LIT(KTestLocation, "Test Location"); const QString qLocation( (QChar*)KTestLocation().Ptr(), KTestLocation().Length() ); iFileDetails->mLocation = qLocation; - _LIT(KTestCopyright, "Test Copyright"); const QString qCopyright( (QChar*)KTestCopyright().Ptr(), KTestCopyright().Length() ); iFileDetails->mCopyright = qCopyright; - _LIT(KTestLanguage, "Test Language"); const QString qLanguage( (QChar*)KTestLanguage().Ptr(), KTestLanguage().Length() ); iFileDetails->mLanguage = qLanguage; - _LIT(KTestKeywords, "Test Keywords"); const QString qKeywords( (QChar*)KTestKeywords().Ptr(), KTestKeywords().Length() ); iFileDetails->mKeywords = qKeywords; - if ( aDefault ) { _LIT(KTestClipName, "testClip.3gp"); const QString qClipname( (QChar*)KTestClipName().Ptr(), KTestClipName().Length() ); - iFileDetails->mClipName = qClipname; + iFileDetails->mClipName = qClipname; } else { _LIT(KTestClipName, "nextClip.3gp"); const QString qClipname( (QChar*)KTestClipName().Ptr(), KTestClipName().Length() ); - iFileDetails->mClipName = qClipname; + iFileDetails->mClipName = qClipname; } - - + iFileDetails->mPlaybackMode = EMPXVideoLocal; iFileDetails->mSeekable = true; iFileDetails->mPausableStream = true; @@ -232,7 +207,7 @@ iFileDetails->mMultiItemPlaylist = false; iFileDetails->mVideoHeight = 320; iFileDetails->mVideoWidth = 240; - iFileDetails->mBitRate = 16000; + iFileDetails->mBitRate = 16000; } // ------------------------------------------------------------------------------------------------- diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/testvideoplaybackview.pro --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/testvideoplaybackview.pro Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/testvideoplaybackview.pro Wed Jun 23 18:14:16 2010 +0300 @@ -14,36 +14,37 @@ # Description: Project file for building Videoplayer components # # -# Version : %version: 7 % +# Version : %version: 8 % TEMPLATE = app TARGET = testvideoplaybackview CONFIG += qtestlib hb qt DEFINES += BUILD_VIDEOPLAYBACK_DLL -DEPENDPATH += . \ - inc \ - src +DEPENDPATH += . inc src stub/src stub/inc -INCLUDEPATH += ../../inc \ - ../../../inc \ +INCLUDEPATH += stub/inc \ + ../../inc \ ../../../../inc \ ../../controlinc \ - $$MW_LAYER_SYSTEMINCLUDE LIBS += -lcone.dll \ -lcommonengine.dll \ -lflogger.dll # Input -HEADERS += stub/inc/mpxvideoviewwrapper.h \ - inc/testvideoplaybackview.h \ +HEADERS += mpxvideoviewwrapper.h \ + testvideoplaybackview.h \ ../../../inc/hbvideobaseplaybackview.h \ ../../../inc/hbvideoplaybackview.h \ - ../../inc/mpxvideoplaybackviewfiledetails.h + mpxvideoplaybackviewfiledetails.h \ + hbtapgesture.h \ + hbpangesture.h -SOURCES += stub/src/mpxvideoviewwrapper.cpp \ - src/testvideoplaybackview.cpp \ - ../../viewsrc/hbvideobaseplaybackview.cpp \ - ../../viewsrc/hbvideoplaybackview.cpp \ - ../../viewsrc/mpxvideoplaybackviewfiledetails.cpp +SOURCES += mpxvideoviewwrapper.cpp \ + testvideoplaybackview.cpp \ + ../../viewsrc/hbvideobaseplaybackview.cpp \ + ../../viewsrc/hbvideoplaybackview.cpp \ + ../../viewsrc/mpxvideoplaybackviewfiledetails.cpp \ + hbtapgesture.cpp \ + hbpangesture.cpp diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp --- a/videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#40 % +// Version : %version: da1mmcf#41 % @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include @@ -66,8 +68,8 @@ // void HbVideoBasePlaybackView::initializeVideoPlaybackView() { - MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::initializeVideoPlaybackView()")); - + MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::initializeVideoPlaybackView()")); + // // Need to set to control full screen including status pane area // @@ -88,9 +90,9 @@ MPX_DEBUG(_L("HbVideoBasePlaybackView::~HbVideoBasePlaybackView()")); if ( mTimerForClosingView ) - { + { disconnect( mTimerForClosingView, SIGNAL( timeout() ), this, SIGNAL( activatePreviousView() ) ); - + if ( mTimerForClosingView->isActive() ) { mTimerForClosingView->stop(); @@ -117,25 +119,25 @@ { MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleActivateView()")); - TRAP_IGNORE( mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) ); + TRAP_IGNORE( mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) ); QCoreApplication::instance()->installEventFilter( this ); // // Request the needed Media from the Playback Plugin // - TRAP_IGNORE( mVideoMpxWrapper->RequestMediaL() ); - + TRAP_IGNORE( mVideoMpxWrapper->RequestMediaL() ); + menu()->close(); // // Landscape orientation - // Workaround: Disable orientation transition effect + // Workaround: Disable orientation transition effect // since orbit couldn't emit the orientationChanged signal with transition effect - // - hbInstance->allMainWindows()[0]->setOrientation( Qt::Horizontal, false ); + // + hbInstance->allMainWindows()[0]->setOrientation( Qt::Horizontal, false ); - mActivated = true; + mActivated = true; } // ------------------------------------------------------------------------------------------------- @@ -146,11 +148,11 @@ { MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleDeactivateView()")); + mActivated = false; + QCoreApplication::instance()->removeEventFilter( this ); - mActivated = false; - - // + // // Close the playback plugin to release all references to previous clip // MPX_TRAPD( err, mVideoMpxWrapper->HandleCommandL( EMPXPbvCmdClose ) ); @@ -216,24 +218,24 @@ } default: { - TRAP_IGNORE( + TRAP_IGNORE( // // TextResolver instance for error resolving. // CTextResolver* textresolver = CTextResolver::NewLC(); - + // // Resolve the error text // TPtrC text; text.Set( textresolver->ResolveErrorString( aError ) ); - + // // convert to QString // const QString qString( (QChar*)text.Ptr(), text.Length() ); - + // // clean up textresolver // @@ -243,7 +245,6 @@ // display error and close playback view // showDialog( qString ); - ); } } @@ -256,39 +257,39 @@ void HbVideoBasePlaybackView::showDialog( const QString& qString, bool closeView ) { MPX_DEBUG(_L("HbVideoBasePlaybackView::showDialog( %s, %d )"), qString.data(), closeView ); - + // - // create pop-up dialog for error notes, + // create pop-up dialog for error notes, // set its position to the middle of the screen // and make sure pop-up dialog gets deleted on close. // QRectF screenRect = hbInstance->allMainWindows()[0]->rect(); - HbNotificationDialog* dlg = new HbNotificationDialog(); + HbNotificationDialog* dlg = new HbNotificationDialog(); dlg->setAttribute( Qt::WA_DeleteOnClose ); - dlg->setMinimumSize( QSizeF(200, 100) ); - dlg->setPreferredPos( QPointF( screenRect.height()/2, screenRect.width()/2 ), + dlg->setMinimumSize( QSizeF(200, 100) ); + dlg->setPreferredPos( QPointF( screenRect.height()/2, screenRect.width()/2 ), HbPopup::Center ); - + if ( closeView ) { // // connect aboutToClose() signal to handleClosePopupDialog() slot so that // when pop-up dialog is closed, playback view is closed also // - connect( dlg, SIGNAL( aboutToClose() ), this, SLOT( handleClosePopupDialog() ) ); + connect( dlg, SIGNAL( aboutToClose() ), this, SLOT( handleClosePopupDialog() ) ); } - + // // convert string to label so text alignment can be set // HbLabel *label = new HbLabel( qString ); label->setAlignment( Qt::AlignCenter ); - + // // set label as content widget and show pop-up dialog // dlg->setContentWidget( label ); - dlg->show(); + dlg->show(); } // ------------------------------------------------------------------------------------------------- @@ -345,7 +346,7 @@ { MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::closePlaybackView()")); - mTimerForClosingView->start( 0 ); + mTimerForClosingView->start( 0 ); } // --------------------------------------------------------------------------- @@ -391,31 +392,6 @@ } // ------------------------------------------------------------------------------------------------- -// HbVideoBasePlaybackView::mousePress -// ------------------------------------------------------------------------------------------------- -// -void HbVideoBasePlaybackView::mousePressEvent( QGraphicsSceneMouseEvent *event ) -{ - // - // Needed for gesture framework - // - event->accept(); -} - -// ------------------------------------------------------------------------------------------------- -// HbVideoBasePlaybackView::mouseReleaseEvent -// ------------------------------------------------------------------------------------------------- -// -void HbVideoBasePlaybackView::mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) -{ - MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::mouseReleaseEvent")); - - Q_UNUSED( event ); - - emit tappedOnScreen(); -} - -// ------------------------------------------------------------------------------------------------- // HbVideoBasePlaybackView::handleClosePopupDialog() // ------------------------------------------------------------------------------------------------- // @@ -426,4 +402,41 @@ handleClosePlaybackView(); } +// ------------------------------------------------------------------------------------------------- +// HbVideoBasePlaybackView::gestureEvent() +// ------------------------------------------------------------------------------------------------- +// +void HbVideoBasePlaybackView::gestureEvent( QGestureEvent* event ) +{ + if ( HbTapGesture * gesture = static_cast( event->gesture( Qt::TapGesture ) ) ) + { + if ( gesture->state() == Qt::GestureFinished && mActivated ) + { + MPX_DEBUG(_L("HbVideoBasePlaybackView::gestureEvent() tapGesture finished") ); + + emit tappedOnScreen(); + } + } + else if ( HbPanGesture* gesture = static_cast( event->gesture( Qt::PanGesture ) ) ) + { + if ( gesture->state() == Qt::GestureFinished && mActivated ) + { + QPointF delta( gesture->sceneDelta() ); + + if ( delta.x() > 0 ) + { + MPX_DEBUG(_L("HbVideoBasePlaybackView::gestureEvent() right") ); + + emit pannedToRight(); + } + else + { + MPX_DEBUG(_L("HbVideoBasePlaybackView::gestureEvent() left") ); + + emit pannedToLeft(); + } + } + } +} + // EOF diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp --- a/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#32 % +// Version : %version: da1mmcf#33 % @@ -90,7 +90,7 @@ { MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ConstructL()")); - iPlaybackUtility = + iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault ); iPlaybackUtility->AddObserverL( *this ); iPlaybackUtility->SetPrimaryClientL(); @@ -98,8 +98,8 @@ // // Create Active Object for closing player // - iCloseAO = CIdle::NewL( CActive::EPriorityStandard ); - + iCloseAO = CIdle::NewL( CActive::EPriorityStandard ); + // // Create Video Playback Display Handler // @@ -195,8 +195,8 @@ void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd, TBool aDoSync ) { MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::CreateGeneralPlaybackCommandL()"), - _L("aCmd = %d, aDoSync, = %d"), aCmd, aDoSync ); - + _L("aCmd = %d, aDoSync, = %d"), aCmd, aDoSync ); + CMPXCommand* cmd = CMPXCommand::NewL(); CleanupStack::PushL( cmd ); @@ -237,7 +237,7 @@ case EMPXPbvCmdClose: { MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdClose")); - + // // closing playback view occurs: // - synchronously (mSyncClose=true) for PDL case (when PDL is supported) @@ -267,7 +267,16 @@ case EMPXPbvCmdPlayPause: { MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPause")); - iPlaybackUtility->CommandL( EPbCmdPlayPause ); + + if ( iPlaybackState == EPbStatePlaying ) + { + CreateGeneralPlaybackCommandL( EPbCmdPause ); + } + else if ( iPlaybackState == EPbStatePaused ) + { + CreateGeneralPlaybackCommandL( EPbCmdPlay ); + } + break; } case EMPXPbvCmdStop: @@ -330,30 +339,46 @@ } case EMPXPbvCmdResetControls: { + MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdResetControls")); + CreateControlsL(); iView->retrievePdlInformation(); break; } case EMPXPbvCmdNextListItem: { + MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNextListItem")); + if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) { iPlaybackUtility->CommandL( EPbCmdNext ); } + else + { + MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem")); + } + break; } - case EMPXPbvCmdPreviousListItem: + case EMPXPbvCmdPreviousListItem: { + MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPreviousListItem")); + if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) { // // the command is being sent twice on purpose - // one EMPXPbvCmdPreviousListItem command only sets the position to 0 + // one EMPXPbvCmdPreviousListItem command only sets the position to 0 // the second cmd actually goes to the previous item in the list // iPlaybackUtility->CommandL( EPbCmdPrevious ); iPlaybackUtility->CommandL( EPbCmdPrevious ); } + else + { + MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem")); + } + break; } case EMPXPbvCmdEndOfClip: @@ -373,10 +398,10 @@ } case EMPXPbvCmdRealOneBitmapTimeout: { - IssuePlayCommandL(); + IssuePlayCommandL(); break; - } + } } } @@ -577,7 +602,7 @@ if ( iUserInputHandler ) { - TRAP_IGNORE(iUserInputHandler->HandleTVOutEventL( tvOutConnected )); + TRAP_IGNORE(iUserInputHandler->HandleTVOutEventL( tvOutConnected )); } if ( iControlsController ) @@ -630,7 +655,7 @@ HandleCommandL( EMPXPbvCmdResetControls ); if ( iFileDetails ) - { + { iFileDetails->clearFileDetails(); } } @@ -656,7 +681,7 @@ } else { - iView->closePlaybackView(); + iView->closePlaybackView(); } break; @@ -859,7 +884,7 @@ { iFileDetails->mDrmProtected = aMedia.ValueTObjectL( KMPXMediaVideoDrmProtected ); } - + // // Description // @@ -869,7 +894,7 @@ const QString qDescription( (QChar*)description.Ptr(), description.Length() ); iFileDetails->mDescription = qDescription; } - + // // Location // @@ -879,7 +904,7 @@ const QString qLocation( (QChar*)location.Ptr(), location.Length() ); iFileDetails->mLocation = qLocation; } - + // // Copyright // @@ -889,7 +914,7 @@ const QString qCopyright( (QChar*)copyright.Ptr(), copyright.Length() ); iFileDetails->mCopyright = qCopyright; } - + // // Language // @@ -899,7 +924,7 @@ const QString qLanguage( (QChar*)language.Ptr(), language.Length() ); iFileDetails->mLanguage = qLanguage; } - + // // Keywords // @@ -909,7 +934,7 @@ const QString qKeywords( (QChar*)keywords.Ptr(), keywords.Length() ); iFileDetails->mKeywords = qKeywords; } - + // // Creation date/time // @@ -917,7 +942,7 @@ { iFileDetails->mCreationTime = aMedia.ValueTObjectL( KMPXMediaVideoCreated ); } - + // // Last Modified date/time // @@ -925,7 +950,7 @@ { iFileDetails->mModificationTime = aMedia.ValueTObjectL( KMPXMediaVideoLastModified ); } - + } // ------------------------------------------------------------------------------------------------- @@ -945,7 +970,7 @@ if ( ! iFileDetails ) { iFileDetails = new QMPXVideoPlaybackViewFileDetails(); - } + } // // Read in the media data @@ -1011,7 +1036,7 @@ // CMPXVideoViewWrapper::HandlePropertyL() // ------------------------------------------------------------------------------------------------- // -void +void CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ) { MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError ); @@ -1198,7 +1223,7 @@ // check if our window is front or not if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone ) { - ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) ); + ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) ); } else { @@ -1222,7 +1247,7 @@ void CMPXVideoViewWrapper::ClosePlaybackViewL() { MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::closePlaybackView()")); - + iView->closePlaybackView(); } @@ -1337,7 +1362,7 @@ iFileDetails = new QMPXVideoPlaybackViewFileDetails(); - TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) ); + TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) ); const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() ); iFileDetails->mClipName = qFilename; @@ -1345,14 +1370,14 @@ iFileDetails->mTvOutConnected = cmd->ValueTObjectL( KMPXMediaVideoTvOutConnected ); - TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); + TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); iFileDetails->mMimeType = qMimeType; // // get playlist information and set mMultiItemPlaylist flag // - TInt numItems = 1; + TInt numItems = 1; MMPXSource* s = iPlaybackUtility->Source(); if ( s ) @@ -1360,7 +1385,7 @@ CMPXCollectionPlaylist* playlist = NULL; MPX_TRAPD( err, playlist = s->PlaylistL() ); - + if ( err == KErrNone && playlist ) { iPlaylistView = ETrue; @@ -1370,7 +1395,7 @@ } iFileDetails->mMultiItemPlaylist = ( numItems > 1 ); - + CleanupStack::PopAndDestroy( cmd ); if ( iControlsController ) @@ -1388,16 +1413,16 @@ // TBool CMPXVideoViewWrapper::IsMultiItemPlaylist() { - + bool multiLinks( false ); - + if ( iFileDetails ) { multiLinks = iFileDetails->mMultiItemPlaylist; } - + MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist() ret %d"), multiLinks ); - + return multiLinks; } @@ -1405,7 +1430,7 @@ // CMPXVideoViewWrapper::UpdateVideoRect() // ------------------------------------------------------------------------------------------------- // -void CMPXVideoViewWrapper::UpdateVideoRect( +void CMPXVideoViewWrapper::UpdateVideoRect( TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect ) { MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()")); @@ -1441,7 +1466,7 @@ // if ( iControlsController ) { - iControlsController->addFileDetails( iFileDetails ); + iControlsController->addFileDetails( iFileDetails ); } if ( iFileDetails->mVideoEnabled ) @@ -1449,21 +1474,21 @@ // // get window size // - RWindow *window = iView->getWindow(); + RWindow *window = iView->getWindow(); TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) ); - + // // get window aspect ratio // if device is in landscape mode, width > height // if device is in portrait mode, width < height // TReal32 width = (TReal32) displayRect.Width(); - TReal32 height = (TReal32) displayRect.Height(); + TReal32 height = (TReal32) displayRect.Height(); TReal32 displayAspectRatio = (width > height)? (width / height) : (height / width); // // get new aspect ratio - TInt newAspectRatio = + TInt newAspectRatio = iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio ); // diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/inc/hbvideobaseplaybackview.h --- a/videoplayback/inc/hbvideobaseplaybackview.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/inc/hbvideobaseplaybackview.h Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#16 % +// Version : %version: da1mmcf#17 % @@ -42,12 +42,14 @@ Q_OBJECT public: - HbVideoBasePlaybackView(); + HbVideoBasePlaybackView(); virtual ~HbVideoBasePlaybackView(); signals: void activatePreviousView(); void tappedOnScreen(); + void pannedToRight(); + void pannedToLeft(); public slots: virtual void closePlaybackView(); @@ -58,18 +60,18 @@ public: virtual void retrievePdlInformation(); - + virtual void handleActivateView(); - + virtual void handleDeactivateView(); virtual void handlePluginError( int aError ); - + /* * Handle transition to the stopped state */ - virtual void handleStoppedState() = 0; - + virtual void handleStoppedState() = 0; + virtual void doClosePlayer(); // @@ -81,14 +83,14 @@ * Handle Download State Change * @param aState new state of the download */ - virtual void handlePdlStateChange( int aState ) = 0; + virtual void handlePdlStateChange( int aState ) = 0; virtual void handleBufferingState(); virtual void issuePlayCommand(); void initializeVideoPlaybackView(); - + void showDialog( const QString& qString, bool closeView = true ); virtual void handleClosePlaybackView(); @@ -97,13 +99,10 @@ bool eventFilter( QObject *object, QEvent *event ); - protected: - - void mousePressEvent( QGraphicsSceneMouseEvent *event ); - void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ); + void gestureEvent( QGestureEvent* event ); protected: // data - CMPXVideoViewWrapper *mVideoMpxWrapper; + CMPXVideoViewWrapper *mVideoMpxWrapper; QTimer *mTimerForClosingView; diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/videohelix/inc/mpxvideoplaybackmode.h --- a/videoplayback/videohelix/inc/mpxvideoplaybackmode.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/videohelix/inc/mpxvideoplaybackmode.h Wed Jun 23 18:14:16 2010 +0300 @@ -16,7 +16,7 @@ */ -// Version : %version: 19 % +// Version : %version: 20 % #ifndef _CMPXVIDEOPLAYBACKMODE_H_ @@ -29,7 +29,7 @@ #include #include "mpxhelixplaybackplugindefs.h" -#ifdef USE_S60_DOWNLOAD_MANAGER +#ifdef USE_S60_DOWNLOAD_MANAGER #include "mpxvideodlmgrif.h" #endif #include "mpxvideo_debug.h" @@ -76,6 +76,8 @@ virtual void OpenFileL( const RFile& aMediaFile ); virtual void HandleSetPosterFrame(); virtual void HandleFrameReady(TInt aError); + virtual TBool SendErrorToView( TInt aError ); + virtual void HandlePauseToPlayTransitionL(); #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API virtual void OpenFile64L( const RFile64& aMediaFile ); @@ -152,7 +154,8 @@ // Methods where video plabkack behavior varies for live streaming media inline virtual TInt GetMode(); virtual void HandlePause(); - virtual void HandleBackground(); + virtual TBool SendErrorToView( TInt aError ); + virtual void HandlePauseToPlayTransitionL(); }; //////////////////////////////////////////////////////////////////////////////// @@ -168,7 +171,7 @@ static CMPXVideoPlaybackMode* NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ); virtual ~CMPXProgressiveDLPlaybackMode(); -#ifdef USE_S60_DOWNLOAD_MANAGER +#ifdef USE_S60_DOWNLOAD_MANAGER inline virtual TInt GetMode(); void ConnectToDownloadL( CMPXCommand& aCmd ); @@ -182,19 +185,19 @@ void OpenFile64L( const RFile64& aMediaFile ); #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API -#endif // USE_S60_DOWNLOAD_MANAGER +#endif // USE_S60_DOWNLOAD_MANAGER private: void ConstructL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ); -#ifdef USE_S60_DOWNLOAD_MANAGER +#ifdef USE_S60_DOWNLOAD_MANAGER private: - CMPXVideoDlMgrIf* iDlMgrIf; // owned -#endif // USE_S60_DOWNLOAD_MANAGER + CMPXVideoDlMgrIf* iDlMgrIf; // owned +#endif // USE_S60_DOWNLOAD_MANAGER }; -#ifdef USE_S60_DOWNLOAD_MANAGER +#ifdef USE_S60_DOWNLOAD_MANAGER inline TInt CMPXProgressiveDLPlaybackMode::GetMode() @@ -209,7 +212,7 @@ return iDlMgrIf->IsDownloadPaused(); } -#endif // USE_S60_DOWNLOAD_MANAGER +#endif // USE_S60_DOWNLOAD_MANAGER // INLINE METHODS diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/videohelix/inc/mpxvideoplaybackstate.h --- a/videoplayback/videohelix/inc/mpxvideoplaybackstate.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/videohelix/inc/mpxvideoplaybackstate.h Wed Jun 23 18:14:16 2010 +0300 @@ -16,7 +16,7 @@ */ -// Version : %version: 19 % +// Version : %version: 20 % #ifndef _CMPXVIDEOPLAYBACKSTATE_H_ @@ -120,6 +120,10 @@ virtual void OpenFile64L( const RFile64& aMediaFile ); #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + void IssuePlayCommand( TMPXVideoPlaybackState aState, + MMPXPlaybackPluginObserver::TEvent aEvent, + TBool aSendEvent = ETrue ); + protected: /* * C++ default constructor @@ -132,10 +136,6 @@ */ void ConstructL(CMPXVideoPlaybackController* aVideoPlaybackCtlr); - void IssuePlayCommand( TMPXVideoPlaybackState aState, - MMPXPlaybackPluginObserver::TEvent aEvent, - TBool aSendEvent = ETrue ); - protected: // // Data @@ -313,9 +313,10 @@ virtual void HandleStop(); virtual void HandleStartSeekL( TBool aForward ); virtual void HandlePlayPause(); - virtual void HandleSetPosterFrame(); + virtual void HandleSetPosterFrame(); virtual void HandleForeground(); virtual void HandleCustomPlay(); + virtual void HandleUnexpectedError( TInt aError ); // general method virtual void HandleSetPositionL( TInt aPosition ); @@ -365,6 +366,7 @@ // general method virtual void HandleSetPositionL(TInt aPosition); virtual void ResolveTimeoutError( TInt aError ); + virtual void HandleUnexpectedError( TInt aError ); inline virtual TMPXVideoPlaybackState GetState(); }; diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/videohelix/src/mpxvideoplaybackmode.cpp --- a/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -12,11 +12,11 @@ * Contributors: * * Description: This class plays local video file - * +* */ -// Version : %version: 32 % +// Version : %version: 33 % // @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include // 3G #include @@ -223,7 +225,7 @@ MPX_TRAPD( err, iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError ) ); } - else if ( iVideoPlaybackCtlr->IsKeyLocked() && + else if ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) { // playback not allowed for the clip having video if keylock is true @@ -234,6 +236,7 @@ playAllowed = ETrue; } } + return playAllowed; } @@ -279,7 +282,6 @@ return networkMode2g; } - // ------------------------------------------------------------------------------------------------ // CMPXVideoPlaybackMode::HandleSetPosterFrame() // ------------------------------------------------------------------------------------------------ @@ -291,10 +293,32 @@ // ------------------------------------------------------------------------------------------------ // CMPXVideoPlaybackMode::HandleSetPosterFrame() // ------------------------------------------------------------------------------------------------ -void CMPXVideoPlaybackMode::HandleFrameReady(TInt /*aError*/) +void CMPXVideoPlaybackMode::HandleFrameReady( TInt /*aError*/ ) +{ + MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleFrameReady()")); +} + +// ------------------------------------------------------------------------------------------------ +// CMPXVideoPlaybackMode::SendErrorToView() +// ------------------------------------------------------------------------------------------------ +TBool CMPXVideoPlaybackMode::SendErrorToView( TInt aError ) { - MPX_DEBUG(_L("CMPXLocalPlaybackMode::HandleFrameReady()")); + MPX_DEBUG(_L("CMPXLocalPlaybackMode::SendErrorToView(%d)"), ETrue); + + return ETrue; } + +// ------------------------------------------------------------------------------------------------ +// CMPXVideoPlaybackMode::HandlePauseToPlayTransitionL() +// ------------------------------------------------------------------------------------------------ +void CMPXVideoPlaybackMode::HandlePauseToPlayTransitionL() +{ + MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::HandlePauseToPlayTransitionL()")); + + iVideoPlaybackCtlr->iState->IssuePlayCommand( EMPXVideoPlaying, + MMPXPlaybackPluginObserver::EPPlaying ); +} + //************************************************************************************************// // CMPXLocalPlaybackMode //************************************************************************************************// @@ -429,7 +453,7 @@ MPX_TRAPD(err, iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError )); } - else if ( iVideoPlaybackCtlr->IsKeyLocked() && + else if ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) { // playback not allowed for the clip having video if keylock is true @@ -490,9 +514,11 @@ } } + //************************************************************************************************// // CMPXLiveStreamingPlaybackMode //************************************************************************************************// + CMPXVideoPlaybackMode* CMPXLiveStreamingPlaybackMode::NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) { @@ -518,38 +544,84 @@ { MPX_ENTER_EXIT(_L("CMPXLiveStreamingPlaybackMode::HandlePause()")); + // + // Send a stop command to the player, but change state to pause + // The view will not close and the play button will be the only active button + // iVideoPlaybackCtlr->iPlayer->Stop(); - iVideoPlaybackCtlr->ChangeState( EMPXVideoStopped ); + iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused ); - iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPStopped, + iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused, 0, KErrNone ); } // ------------------------------------------------------------------------------------------------ -// CMPXLiveStreamingPlaybackMode::HandleBackground() +// CMPXLiveStreamingPlaybackMode::SendErrorToView() // ------------------------------------------------------------------------------------------------ -void CMPXLiveStreamingPlaybackMode::HandleBackground() +TBool CMPXLiveStreamingPlaybackMode::SendErrorToView( TInt aError ) { - MPX_DEBUG(_L("CMPXLiveStreamingPlaybackMode::HandleBackground()")); + TBool retval = ETrue; - if ( iVideoPlaybackCtlr->iAppInForeground ) + if ( aError == KErrSessionClosed ) { - if ( iVideoPlaybackCtlr->IsPhoneCall() || - iVideoPlaybackCtlr->IsVideoCall() || - ( iVideoPlaybackCtlr->IsKeyLocked() && - iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) ) - { - iVideoPlaybackCtlr->iState->HandlePause(); - } + retval = EFalse; } + + MPX_DEBUG(_L("CMPXLiveStreamingPlaybackMode::SendErrorToView(%d)"), retval); + + return retval; +} + +// ------------------------------------------------------------------------------------------------ +// CMPXLiveStreamingPlaybackMode::HandlePauseToPlayTransitionL() +// ------------------------------------------------------------------------------------------------ +void CMPXLiveStreamingPlaybackMode::HandlePauseToPlayTransitionL() +{ + MPX_ENTER_EXIT(_L("CMPXLiveStreamingPlaybackMode::HandlePauseToPlayTransitionL()")); + + // + // For live streaming, the controller must be reinitialized + // Send a state change to Initializing to the view + // + CMPXMessage* msg = CMPXMessage::NewL(); + CleanupStack::PushL( msg ); + + msg->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral ); + msg->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXPlaybackMessage::EStateChanged ); + msg->SetTObjectValueL( KMPXMessageGeneralType, EPbStateInitialising ); + msg->SetTObjectValueL( KMPXMessageGeneralData, 0 ); + + iVideoPlaybackCtlr->iMPXPluginObs->HandlePlaybackMessage( msg, KErrNone ); + + CleanupStack::PopAndDestroy( msg ); + + iVideoPlaybackCtlr->ChangeState( EMPXVideoInitializing ); + + iVideoPlaybackCtlr->iPlayer->Reset(); + + // + // Reinitialize the player with the file handle or url + // + if ( iVideoPlaybackCtlr->iFileHandle.SubSessionHandle() ) + { + iVideoPlaybackCtlr->iPlayer->OpenFileL( iVideoPlaybackCtlr->iFileHandle ); + } +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + else if ( iVideoPlaybackCtlr->iFileHandle64.SubSessionHandle() ) + { + iVideoPlaybackCtlr->iPlayer->OpenFile64L( iVideoPlaybackCtlr->iFileHandle64 ); + } +#endif else { - iVideoPlaybackCtlr->iState->HandlePause(); + iVideoPlaybackCtlr->iPlayer->OpenUrlL( iVideoPlaybackCtlr->iClipName->Des(), + iVideoPlaybackCtlr->iAccessPointId ); } } + //************************************************************************************************// // CMPXProgressiveDLPlaybackMode //************************************************************************************************// @@ -569,12 +641,12 @@ { iVideoPlaybackCtlr = aVideoPlaybackCtlr; -#ifdef USE_S60_DOWNLOAD_MANAGER +#ifdef USE_S60_DOWNLOAD_MANAGER // // Create the Download Mgr Interface // iDlMgrIf = CMPXVideoDlMgrIf::NewL( iVideoPlaybackCtlr ); -#endif // USE_S60_DOWNLOAD_MANAGER +#endif // USE_S60_DOWNLOAD_MANAGER } @@ -582,17 +654,17 @@ { MPX_DEBUG(_L("CMPXProgressiveDLPlaybackMode::~CMPXProgressiveDLPlaybackMode()")); -#ifdef USE_S60_DOWNLOAD_MANAGER +#ifdef USE_S60_DOWNLOAD_MANAGER if ( iDlMgrIf ) { delete iDlMgrIf; iDlMgrIf = NULL; } -#endif // USE_S60_DOWNLOAD_MANAGER +#endif // USE_S60_DOWNLOAD_MANAGER } -#ifdef USE_S60_DOWNLOAD_MANAGER +#ifdef USE_S60_DOWNLOAD_MANAGER // ------------------------------------------------------------------------------------------------ // CMPXProgressiveDLPlaybackMode::ConnectToDownloadL() diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/videohelix/src/mpxvideoplaybackstate.cpp --- a/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -16,7 +16,7 @@ */ -// Version : %version: 44 % +// Version : %version: 45 % // @@ -1371,7 +1371,6 @@ HandlePause(); } - // ------------------------------------------------------------------------------------------------ // CMPXPlayingState::HandleSetPosterFrame() // ------------------------------------------------------------------------------------------------ @@ -1525,7 +1524,7 @@ if ( iVideoPlaybackCtlr->iPlaybackMode->CanPlayNow() ) { - IssuePlayCommand( EMPXVideoPlaying, MMPXPlaybackPluginObserver::EPPlaying ); + MPX_TRAPD( error, iVideoPlaybackCtlr->iPlaybackMode->HandlePauseToPlayTransitionL() ); } } @@ -1641,6 +1640,21 @@ } } +// ------------------------------------------------------------------------------------------------- +// CMPXPausedState::HandleUnexpectedError +// ------------------------------------------------------------------------------------------------- +// +void CMPXPausedState::HandleUnexpectedError( TInt aError ) +{ + MPX_ENTER_EXIT(_L("CMPXPausedState::HandleUnexpectedError()"), + _L("aError = %d"), aError ); + + if ( iVideoPlaybackCtlr->iPlaybackMode->SendErrorToView( aError ) ) + { + MPX_TRAPD( err, SendErrorToViewL( aError ) ); + } +} + // ************************************************************************************************* // // CMPXStoppedState @@ -1728,6 +1742,21 @@ // Don't handle the error. Already in the stopped state } +// ------------------------------------------------------------------------------------------------- +// CMPXStoppedState::HandleUnexpectedError +// ------------------------------------------------------------------------------------------------- +// +void CMPXStoppedState::HandleUnexpectedError( TInt aError ) +{ + MPX_ENTER_EXIT(_L("CMPXStoppedState::HandleUnexpectedError()"), + _L("aError = %d"), aError ); + + if ( iVideoPlaybackCtlr->iPlaybackMode->SendErrorToView( aError ) ) + { + MPX_TRAPD( err, SendErrorToViewL( aError ) ); + } +} + // ************************************************************************************************* // // CMPXBufferingState diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayback/videohelix/src/mpxvideoseeker.cpp --- a/videoplayback/videohelix/src/mpxvideoseeker.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideoseeker.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 9 % +// Version : %version: 10 % // INCLUDE FILES @@ -37,6 +37,7 @@ const TInt KDurationB(180000000); // 180 sec const TInt64 KSpeedAIncrements(2000000); // 2 sec const TInt64 KSpeedBIncrements(4000000); // 4 sec +const TInt64 KSpeedOffset(3000000); // 3 sec #endif // ============================ MEMBER FUNCTIONS =================================================== @@ -311,7 +312,7 @@ } else { - iIncrements = (TInt)( iDuration / 200 ) + 3; + iIncrements = (TInt)( iDuration / 200 ) + KSpeedOffset; } } diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayer.pro --- a/videoplayer.pro Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayer.pro Wed Jun 23 18:14:16 2010 +0300 @@ -18,10 +18,11 @@ TEMPLATE = subdirs CONFIG += ordered symbian: { -BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"videoplayer_plat/group/bld.inf\"" \ - $$LITERAL_HASH"include \"mediasettings/group/bld.inf\"" +BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"videoplayer_plat/group/bld.inf\"" + SUBDIRS += videoplayback SUBDIRS += videoplayerapp SUBDIRS += videocollection +SUBDIRS += mediasettings } \ No newline at end of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/bwins/videoplayerengineu.def --- a/videoplayerapp/bwins/videoplayerengineu.def Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/bwins/videoplayerengineu.def Wed Jun 23 18:14:16 2010 +0300 @@ -1,56 +1,63 @@ EXPORTS ?qt_metacall@QVideoPlayerEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int QVideoPlayerEngine::qt_metacall(enum QMetaObject::Call, int, void * *) ?metaObject@QVideoPlayerEngine@@UBEPBUQMetaObject@@XZ @ 2 NONAME ; struct QMetaObject const * QVideoPlayerEngine::metaObject(void) const - ?tr@QVideoPlayerEngine@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString QVideoPlayerEngine::tr(char const *, char const *, int) - ?qt_metacast@VideoServices@@UAEPAXPBD@Z @ 4 NONAME ; void * VideoServices::qt_metacast(char const *) - ?trUtf8@VideoServices@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString VideoServices::trUtf8(char const *, char const *) - ?itemSelected@VideoServices@@QAEXABVQString@@@Z @ 6 NONAME ; void VideoServices::itemSelected(class QString const &) - ?handleCommand@QVideoPlayerEngine@@QAEXH@Z @ 7 NONAME ; void QVideoPlayerEngine::handleCommand(int) - ??1VideoServices@@EAE@XZ @ 8 NONAME ; VideoServices::~VideoServices(void) - ?titleReady@VideoServices@@IAEXABVQString@@@Z @ 9 NONAME ; void VideoServices::titleReady(class QString const &) - ?staticMetaObject@QVideoPlayerEngine@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const QVideoPlayerEngine::staticMetaObject - ?activated@VideoServices@@IAEXH@Z @ 11 NONAME ; void VideoServices::activated(int) - ?metaObject@VideoServices@@UBEPBUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const * VideoServices::metaObject(void) const - ?disconnectView@QVideoPlayerEngine@@AAEXXZ @ 13 NONAME ; void QVideoPlayerEngine::disconnectView(void) - ??_EVideoServices@@UAE@I@Z @ 14 NONAME ; VideoServices::~VideoServices(unsigned int) - ?setEngine@VideoServices@@AAEXPAVQVideoPlayerEngine@@@Z @ 15 NONAME ; void VideoServices::setEngine(class QVideoPlayerEngine *) - ?decreaseReferenceCount@VideoServices@@QAEXXZ @ 16 NONAME ; void VideoServices::decreaseReferenceCount(void) - ?getStaticMetaObject@VideoServices@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & VideoServices::getStaticMetaObject(void) - ?setEmbedded@QVideoPlayerEngine@@QAEXXZ @ 18 NONAME ; void QVideoPlayerEngine::setEmbedded(void) - ?setCurrentService@VideoServices@@AAEXW4TVideoService@1@@Z @ 19 NONAME ; void VideoServices::setCurrentService(enum VideoServices::TVideoService) - ?trUtf8@QVideoPlayerEngine@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString QVideoPlayerEngine::trUtf8(char const *, char const *, int) - ??0VideoServices@@AAE@PAVQVideoPlayerEngine@@@Z @ 21 NONAME ; VideoServices::VideoServices(class QVideoPlayerEngine *) - ?tr@QVideoPlayerEngine@@SA?AVQString@@PBD0@Z @ 22 NONAME ; class QString QVideoPlayerEngine::tr(char const *, char const *) - ?getStaticMetaObject@QVideoPlayerEngine@@SAABUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const & QVideoPlayerEngine::getStaticMetaObject(void) - ?trUtf8@VideoServices@@SA?AVQString@@PBD0H@Z @ 24 NONAME ; class QString VideoServices::trUtf8(char const *, char const *, int) - ?handleQuit@QVideoPlayerEngine@@AAEXXZ @ 25 NONAME ; void QVideoPlayerEngine::handleQuit(void) - ?staticMetaObject@VideoServices@@2UQMetaObject@@B @ 26 NONAME ; struct QMetaObject const VideoServices::staticMetaObject - ??1QVideoPlayerEngine@@UAE@XZ @ 27 NONAME ; QVideoPlayerEngine::~QVideoPlayerEngine(void) - ?tr@VideoServices@@SA?AVQString@@PBD0H@Z @ 28 NONAME ; class QString VideoServices::tr(char const *, char const *, int) - ?qt_metacast@QVideoPlayerEngine@@UAEPAXPBD@Z @ 29 NONAME ; void * QVideoPlayerEngine::qt_metacast(char const *) - ?activateView@QVideoPlayerEngine@@AAEXW4MpxHbVideoViewType@MpxHbVideoCommon@@@Z @ 30 NONAME ; void QVideoPlayerEngine::activateView(enum MpxHbVideoCommon::MpxHbVideoViewType) - ?playMedia@QVideoPlayerEngine@@QAEXVQString@@@Z @ 31 NONAME ; void QVideoPlayerEngine::playMedia(class QString) - ??0QVideoPlayerEngine@@QAE@_N@Z @ 32 NONAME ; QVideoPlayerEngine::QVideoPlayerEngine(bool) - ?contextTitle@VideoServices@@QBE?AVQString@@XZ @ 33 NONAME ; class QString VideoServices::contextTitle(void) const - ?initialize@QVideoPlayerEngine@@QAEXXZ @ 34 NONAME ; void QVideoPlayerEngine::initialize(void) - ?trUtf8@QVideoPlayerEngine@@SA?AVQString@@PBD0@Z @ 35 NONAME ; class QString QVideoPlayerEngine::trUtf8(char const *, char const *) - ?loadPluginAndCreateView@QVideoPlayerEngine@@AAEXW4MpxHbVideoViewType@MpxHbVideoCommon@@@Z @ 36 NONAME ; void QVideoPlayerEngine::loadPluginAndCreateView(enum MpxHbVideoCommon::MpxHbVideoViewType) - ?currentService@VideoServices@@QAE?AW4TVideoService@1@XZ @ 37 NONAME ; enum VideoServices::TVideoService VideoServices::currentService(void) - ?qt_metacall@VideoServices@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 38 NONAME ; int VideoServices::qt_metacall(enum QMetaObject::Call, int, void * *) - ?mInstance@VideoServices@@0PAV1@A @ 39 NONAME ; class VideoServices * VideoServices::mInstance - ?tr@VideoServices@@SA?AVQString@@PBD0@Z @ 40 NONAME ; class QString VideoServices::tr(char const *, char const *) - ?engine@VideoServices@@AAEPAVQVideoPlayerEngine@@XZ @ 41 NONAME ; class QVideoPlayerEngine * VideoServices::engine(void) - ?connectView@QVideoPlayerEngine@@AAEXXZ @ 42 NONAME ; void QVideoPlayerEngine::connectView(void) - ?instance@VideoServices@@SAPAV1@PAVQVideoPlayerEngine@@@Z @ 43 NONAME ; class VideoServices * VideoServices::instance(class QVideoPlayerEngine *) - ??_EQVideoPlayerEngine@@UAE@I@Z @ 44 NONAME ; QVideoPlayerEngine::~QVideoPlayerEngine(unsigned int) - ?doDelayedLoad@QVideoPlayerEngine@@AAEXXZ @ 45 NONAME ; void QVideoPlayerEngine::doDelayedLoad(void) - ?playMedia@QVideoPlayerEngine@@QAEXVRFile@@@Z @ 46 NONAME ; void QVideoPlayerEngine::playMedia(class RFile) - ?getBrowseCategory@VideoServices@@QBEHXZ @ 47 NONAME ; int VideoServices::getBrowseCategory(void) const - ?browsingEnded@VideoServices@@QAEXXZ @ 48 NONAME ; void VideoServices::browsingEnded(void) - ?createPlayAndDetailsViews@QVideoPlayerEngine@@AAEXXZ @ 49 NONAME ; void QVideoPlayerEngine::createPlayAndDetailsViews(void) - ?setCurrentView@QVideoPlayerEngine@@AAEXXZ @ 50 NONAME ; void QVideoPlayerEngine::setCurrentView(void) - ?sortRole@VideoServices@@QBEHXZ @ 51 NONAME ; int VideoServices::sortRole(void) const - ?isPlayServiceInvoked@QVideoPlayerEngine@@AAE_NXZ @ 52 NONAME ; bool QVideoPlayerEngine::isPlayServiceInvoked(void) - ?shouldActivateCollectionView@QVideoPlayerEngine@@AAE_NXZ @ 53 NONAME ; bool QVideoPlayerEngine::shouldActivateCollectionView(void) - ?shouldExit@QVideoPlayerEngine@@AAE_NXZ @ 54 NONAME ; bool QVideoPlayerEngine::shouldExit(void) + ?instance@VideoActivityState@@SAAAV1@XZ @ 3 NONAME ; class VideoActivityState & VideoActivityState::instance(void) + ?tr@QVideoPlayerEngine@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString QVideoPlayerEngine::tr(char const *, char const *, int) + ?qt_metacast@VideoServices@@UAEPAXPBD@Z @ 5 NONAME ; void * VideoServices::qt_metacast(char const *) + ?getBrowseCategory@VideoServices@@QBEHXZ @ 6 NONAME ; int VideoServices::getBrowseCategory(void) const + ?setCurrentView@QVideoPlayerEngine@@AAEXXZ @ 7 NONAME ; void QVideoPlayerEngine::setCurrentView(void) + ?trUtf8@VideoServices@@SA?AVQString@@PBD0@Z @ 8 NONAME ; class QString VideoServices::trUtf8(char const *, char const *) + ?isPlayServiceInvoked@QVideoPlayerEngine@@AAE_NXZ @ 9 NONAME ; bool QVideoPlayerEngine::isPlayServiceInvoked(void) + ?itemSelected@VideoServices@@QAEXABVQString@@@Z @ 10 NONAME ; void VideoServices::itemSelected(class QString const &) + ?doDelayedLoad@QVideoPlayerEngine@@AAEXXZ @ 11 NONAME ; void QVideoPlayerEngine::doDelayedLoad(void) + ?handleCommand@QVideoPlayerEngine@@QAEXH@Z @ 12 NONAME ; void QVideoPlayerEngine::handleCommand(int) + ??1VideoServices@@EAE@XZ @ 13 NONAME ; VideoServices::~VideoServices(void) + ?titleReady@VideoServices@@IAEXABVQString@@@Z @ 14 NONAME ; void VideoServices::titleReady(class QString const &) + ?staticMetaObject@QVideoPlayerEngine@@2UQMetaObject@@B @ 15 NONAME ; struct QMetaObject const QVideoPlayerEngine::staticMetaObject + ?setActivityData@VideoActivityState@@QAEXABVQVariant@@ABVQString@@@Z @ 16 NONAME ; void VideoActivityState::setActivityData(class QVariant const &, class QString const &) + ??0VideoActivityState@@AAE@XZ @ 17 NONAME ; VideoActivityState::VideoActivityState(void) + ?activated@VideoServices@@IAEXH@Z @ 18 NONAME ; void VideoServices::activated(int) + ?metaObject@VideoServices@@UBEPBUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const * VideoServices::metaObject(void) const + ?disconnectView@QVideoPlayerEngine@@AAEXXZ @ 20 NONAME ; void QVideoPlayerEngine::disconnectView(void) + ??_EVideoActivityState@@UAE@I@Z @ 21 NONAME ; VideoActivityState::~VideoActivityState(unsigned int) + ??_EVideoServices@@UAE@I@Z @ 22 NONAME ; VideoServices::~VideoServices(unsigned int) + ?setEngine@VideoServices@@AAEXPAVQVideoPlayerEngine@@@Z @ 23 NONAME ; void VideoServices::setEngine(class QVideoPlayerEngine *) + ?browsingEnded@VideoServices@@QAEXXZ @ 24 NONAME ; void VideoServices::browsingEnded(void) + ?playMedia@QVideoPlayerEngine@@QAEXVRFile@@@Z @ 25 NONAME ; void QVideoPlayerEngine::playMedia(class RFile) + ?getStaticMetaObject@VideoServices@@SAABUQMetaObject@@XZ @ 26 NONAME ; struct QMetaObject const & VideoServices::getStaticMetaObject(void) + ?decreaseReferenceCount@VideoServices@@QAEXXZ @ 27 NONAME ; void VideoServices::decreaseReferenceCount(void) + ?setEmbedded@QVideoPlayerEngine@@QAEXXZ @ 28 NONAME ; void QVideoPlayerEngine::setEmbedded(void) + ?setCurrentService@VideoServices@@AAEXW4TVideoService@1@@Z @ 29 NONAME ; void VideoServices::setCurrentService(enum VideoServices::TVideoService) + ?trUtf8@QVideoPlayerEngine@@SA?AVQString@@PBD0H@Z @ 30 NONAME ; class QString QVideoPlayerEngine::trUtf8(char const *, char const *, int) + ??0VideoServices@@AAE@PAVQVideoPlayerEngine@@@Z @ 31 NONAME ; VideoServices::VideoServices(class QVideoPlayerEngine *) + ?tr@QVideoPlayerEngine@@SA?AVQString@@PBD0@Z @ 32 NONAME ; class QString QVideoPlayerEngine::tr(char const *, char const *) + ?getStaticMetaObject@QVideoPlayerEngine@@SAABUQMetaObject@@XZ @ 33 NONAME ; struct QMetaObject const & QVideoPlayerEngine::getStaticMetaObject(void) + ?trUtf8@VideoServices@@SA?AVQString@@PBD0H@Z @ 34 NONAME ; class QString VideoServices::trUtf8(char const *, char const *, int) + ??1VideoActivityState@@EAE@XZ @ 35 NONAME ; VideoActivityState::~VideoActivityState(void) + ?createMissingViews@QVideoPlayerEngine@@AAEXXZ @ 36 NONAME ; void QVideoPlayerEngine::createMissingViews(void) + ?handleQuit@QVideoPlayerEngine@@AAEXXZ @ 37 NONAME ; void QVideoPlayerEngine::handleQuit(void) + ?createPlaybackView@QVideoPlayerEngine@@AAEXXZ @ 38 NONAME ; void QVideoPlayerEngine::createPlaybackView(void) + ?sortRole@VideoServices@@QBEHXZ @ 39 NONAME ; int VideoServices::sortRole(void) const + ?staticMetaObject@VideoServices@@2UQMetaObject@@B @ 40 NONAME ; struct QMetaObject const VideoServices::staticMetaObject + ??1QVideoPlayerEngine@@UAE@XZ @ 41 NONAME ; QVideoPlayerEngine::~QVideoPlayerEngine(void) + ?loadPluginAndCreateView@QVideoPlayerEngine@@AAEXW4MpxHbVideoViewType@MpxHbVideoCommon@@@Z @ 42 NONAME ; void QVideoPlayerEngine::loadPluginAndCreateView(enum MpxHbVideoCommon::MpxHbVideoViewType) + ?tr@VideoServices@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString VideoServices::tr(char const *, char const *, int) + ?qt_metacast@QVideoPlayerEngine@@UAEPAXPBD@Z @ 44 NONAME ; void * QVideoPlayerEngine::qt_metacast(char const *) + ?playMedia@QVideoPlayerEngine@@QAEXVQString@@@Z @ 45 NONAME ; void QVideoPlayerEngine::playMedia(class QString) + ?activateView@QVideoPlayerEngine@@AAEXW4MpxHbVideoViewType@MpxHbVideoCommon@@@Z @ 46 NONAME ; void QVideoPlayerEngine::activateView(enum MpxHbVideoCommon::MpxHbVideoViewType) + ??0QVideoPlayerEngine@@QAE@_N@Z @ 47 NONAME ; QVideoPlayerEngine::QVideoPlayerEngine(bool) + ?getActivityData@VideoActivityState@@QAE?BVQVariant@@ABVQString@@@Z @ 48 NONAME ; class QVariant const VideoActivityState::getActivityData(class QString const &) + ?contextTitle@VideoServices@@QBE?AVQString@@XZ @ 49 NONAME ; class QString VideoServices::contextTitle(void) const + ?shouldActivateCollectionView@QVideoPlayerEngine@@AAE_NXZ @ 50 NONAME ; bool QVideoPlayerEngine::shouldActivateCollectionView(void) + ?initialize@QVideoPlayerEngine@@QAEXXZ @ 51 NONAME ; void QVideoPlayerEngine::initialize(void) + ?trUtf8@QVideoPlayerEngine@@SA?AVQString@@PBD0@Z @ 52 NONAME ; class QString QVideoPlayerEngine::trUtf8(char const *, char const *) + ?qt_metacall@VideoServices@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 53 NONAME ; int VideoServices::qt_metacall(enum QMetaObject::Call, int, void * *) + ?currentService@VideoServices@@QAE?AW4TVideoService@1@XZ @ 54 NONAME ; enum VideoServices::TVideoService VideoServices::currentService(void) + ?mInstance@VideoServices@@0PAV1@A @ 55 NONAME ; class VideoServices * VideoServices::mInstance + ?tr@VideoServices@@SA?AVQString@@PBD0@Z @ 56 NONAME ; class QString VideoServices::tr(char const *, char const *) + ?engine@VideoServices@@AAEPAVQVideoPlayerEngine@@XZ @ 57 NONAME ; class QVideoPlayerEngine * VideoServices::engine(void) + ?connectView@QVideoPlayerEngine@@AAEXXZ @ 58 NONAME ; void QVideoPlayerEngine::connectView(void) + ?shouldExit@QVideoPlayerEngine@@AAE_NXZ @ 59 NONAME ; bool QVideoPlayerEngine::shouldExit(void) + ?instance@VideoServices@@SAPAV1@PAVQVideoPlayerEngine@@@Z @ 60 NONAME ; class VideoServices * VideoServices::instance(class QVideoPlayerEngine *) + ??_EQVideoPlayerEngine@@UAE@I@Z @ 61 NONAME ; QVideoPlayerEngine::~QVideoPlayerEngine(unsigned int) diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/eabi/videoplayerengineu.def --- a/videoplayerapp/eabi/videoplayerengineu.def Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/eabi/videoplayerengineu.def Wed Jun 23 18:14:16 2010 +0300 @@ -3,54 +3,65 @@ _ZN13VideoServices11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME _ZN13VideoServices11qt_metacastEPKc @ 3 NONAME _ZN13VideoServices12itemSelectedERK7QString @ 4 NONAME - _ZN13VideoServices14currentServiceEv @ 5 NONAME - _ZN13VideoServices16staticMetaObjectE @ 6 NONAME DATA 16 - _ZN13VideoServices17setCurrentServiceENS_13TVideoServiceE @ 7 NONAME - _ZN13VideoServices19getStaticMetaObjectEv @ 8 NONAME - _ZN13VideoServices22decreaseReferenceCountEv @ 9 NONAME - _ZN13VideoServices6engineEv @ 10 NONAME - _ZN13VideoServices8instanceEP18QVideoPlayerEngine @ 11 NONAME - _ZN13VideoServices9activatedEi @ 12 NONAME - _ZN13VideoServices9mInstanceE @ 13 NONAME DATA 4 - _ZN13VideoServices9setEngineEP18QVideoPlayerEngine @ 14 NONAME - _ZN13VideoServicesC1EP18QVideoPlayerEngine @ 15 NONAME - _ZN13VideoServicesC2EP18QVideoPlayerEngine @ 16 NONAME - _ZN13VideoServicesD0Ev @ 17 NONAME - _ZN13VideoServicesD1Ev @ 18 NONAME - _ZN13VideoServicesD2Ev @ 19 NONAME - _ZN18QVideoPlayerEngine10handleQuitEv @ 20 NONAME - _ZN18QVideoPlayerEngine10initializeEv @ 21 NONAME - _ZN18QVideoPlayerEngine23loadPluginAndCreateViewEN16MpxHbVideoCommon18MpxHbVideoViewTypeE @ 22 NONAME - _ZN18QVideoPlayerEngine11connectViewEv @ 23 NONAME - _ZN18QVideoPlayerEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 24 NONAME - _ZN18QVideoPlayerEngine11qt_metacastEPKc @ 25 NONAME - _ZN18QVideoPlayerEngine11setEmbeddedEv @ 26 NONAME - _ZN18QVideoPlayerEngine12activateViewEN16MpxHbVideoCommon18MpxHbVideoViewTypeE @ 27 NONAME - _ZN18QVideoPlayerEngine13handleCommandEi @ 28 NONAME - _ZN18QVideoPlayerEngine14disconnectViewEv @ 29 NONAME - _ZN18QVideoPlayerEngine16staticMetaObjectE @ 30 NONAME DATA 16 - _ZN18QVideoPlayerEngine19getStaticMetaObjectEv @ 31 NONAME - _ZN18QVideoPlayerEngine9playMediaE7QString @ 32 NONAME - _ZN18QVideoPlayerEngineC1Eb @ 33 NONAME - _ZN18QVideoPlayerEngineC2Eb @ 34 NONAME - _ZN18QVideoPlayerEngineD0Ev @ 35 NONAME - _ZN18QVideoPlayerEngineD1Ev @ 36 NONAME - _ZN18QVideoPlayerEngineD2Ev @ 37 NONAME - _ZNK13VideoServices10metaObjectEv @ 38 NONAME - _ZNK13VideoServices12contextTitleEv @ 39 NONAME - _ZNK18QVideoPlayerEngine10metaObjectEv @ 40 NONAME - _ZTI13VideoServices @ 41 NONAME - _ZTI18QVideoPlayerEngine @ 42 NONAME - _ZTV13VideoServices @ 43 NONAME - _ZTV18QVideoPlayerEngine @ 44 NONAME - _ZN18QVideoPlayerEngine13doDelayedLoadEv @ 45 NONAME - _ZN18QVideoPlayerEngine9playMediaE5RFile @ 46 NONAME - _ZN13VideoServices13browsingEndedEv @ 47 NONAME - _ZNK13VideoServices17getBrowseCategoryEv @ 48 NONAME - _ZN18QVideoPlayerEngine25createPlayAndDetailsViewsEv @ 49 NONAME - _ZN18QVideoPlayerEngine14setCurrentViewEv @ 50 NONAME - _ZNK13VideoServices8sortRoleEv @ 51 NONAME - _ZN18QVideoPlayerEngine20isPlayServiceInvokedEv @ 52 NONAME - _ZN18QVideoPlayerEngine10shouldExitEv @ 53 NONAME - _ZN18QVideoPlayerEngine28shouldActivateCollectionViewEv @ 54 NONAME + _ZN13VideoServices13browsingEndedEv @ 5 NONAME + _ZN13VideoServices14currentServiceEv @ 6 NONAME + _ZN13VideoServices16staticMetaObjectE @ 7 NONAME DATA 16 + _ZN13VideoServices17setCurrentServiceENS_13TVideoServiceE @ 8 NONAME + _ZN13VideoServices19getStaticMetaObjectEv @ 9 NONAME + _ZN13VideoServices22decreaseReferenceCountEv @ 10 NONAME + _ZN13VideoServices6engineEv @ 11 NONAME + _ZN13VideoServices8instanceEP18QVideoPlayerEngine @ 12 NONAME + _ZN13VideoServices9activatedEi @ 13 NONAME + _ZN13VideoServices9mInstanceE @ 14 NONAME DATA 4 + _ZN13VideoServices9setEngineEP18QVideoPlayerEngine @ 15 NONAME + _ZN13VideoServicesC1EP18QVideoPlayerEngine @ 16 NONAME + _ZN13VideoServicesC2EP18QVideoPlayerEngine @ 17 NONAME + _ZN13VideoServicesD0Ev @ 18 NONAME + _ZN13VideoServicesD1Ev @ 19 NONAME + _ZN13VideoServicesD2Ev @ 20 NONAME + _ZN18QVideoPlayerEngine10handleQuitEv @ 21 NONAME + _ZN18QVideoPlayerEngine10initializeEv @ 22 NONAME + _ZN18QVideoPlayerEngine10shouldExitEv @ 23 NONAME + _ZN18QVideoPlayerEngine11connectViewEv @ 24 NONAME + _ZN18QVideoPlayerEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 25 NONAME + _ZN18QVideoPlayerEngine11qt_metacastEPKc @ 26 NONAME + _ZN18QVideoPlayerEngine11setEmbeddedEv @ 27 NONAME + _ZN18QVideoPlayerEngine12activateViewEN16MpxHbVideoCommon18MpxHbVideoViewTypeE @ 28 NONAME + _ZN18QVideoPlayerEngine13doDelayedLoadEv @ 29 NONAME + _ZN18QVideoPlayerEngine13handleCommandEi @ 30 NONAME + _ZN18QVideoPlayerEngine14disconnectViewEv @ 31 NONAME + _ZN18QVideoPlayerEngine14setCurrentViewEv @ 32 NONAME + _ZN18QVideoPlayerEngine16staticMetaObjectE @ 33 NONAME DATA 16 + _ZN18QVideoPlayerEngine18createMissingViewsEv @ 34 NONAME + _ZN18QVideoPlayerEngine18createPlaybackViewEv @ 35 NONAME + _ZN18QVideoPlayerEngine19getStaticMetaObjectEv @ 36 NONAME + _ZN18QVideoPlayerEngine20isPlayServiceInvokedEv @ 37 NONAME + _ZN18QVideoPlayerEngine23loadPluginAndCreateViewEN16MpxHbVideoCommon18MpxHbVideoViewTypeE @ 38 NONAME + _ZN18QVideoPlayerEngine28shouldActivateCollectionViewEv @ 39 NONAME + _ZN18QVideoPlayerEngine9playMediaE5RFile @ 40 NONAME + _ZN18QVideoPlayerEngine9playMediaE7QString @ 41 NONAME + _ZN18QVideoPlayerEngineC1Eb @ 42 NONAME + _ZN18QVideoPlayerEngineC2Eb @ 43 NONAME + _ZN18QVideoPlayerEngineD0Ev @ 44 NONAME + _ZN18QVideoPlayerEngineD1Ev @ 45 NONAME + _ZN18QVideoPlayerEngineD2Ev @ 46 NONAME + _ZN18VideoActivityState15getActivityDataERK7QString @ 47 NONAME + _ZN18VideoActivityState15setActivityDataERK8QVariantRK7QString @ 48 NONAME + _ZN18VideoActivityState8instanceEv @ 49 NONAME + _ZN18VideoActivityStateC1Ev @ 50 NONAME + _ZN18VideoActivityStateC2Ev @ 51 NONAME + _ZN18VideoActivityStateD0Ev @ 52 NONAME + _ZN18VideoActivityStateD1Ev @ 53 NONAME + _ZN18VideoActivityStateD2Ev @ 54 NONAME + _ZNK13VideoServices10metaObjectEv @ 55 NONAME + _ZNK13VideoServices12contextTitleEv @ 56 NONAME + _ZNK13VideoServices17getBrowseCategoryEv @ 57 NONAME + _ZNK13VideoServices8sortRoleEv @ 58 NONAME + _ZNK18QVideoPlayerEngine10metaObjectEv @ 59 NONAME + _ZTI13VideoServices @ 60 NONAME + _ZTI18QVideoPlayerEngine @ 61 NONAME + _ZTI18VideoActivityState @ 62 NONAME + _ZTV13VideoServices @ 63 NONAME + _ZTV18QVideoPlayerEngine @ 64 NONAME + _ZTV18VideoActivityState @ 65 NONAME diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/inc/videoplayerengine.h --- a/videoplayerapp/inc/videoplayerengine.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/inc/videoplayerengine.h Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 14 % +// Version : %version: ou1cpsw#15 % #ifndef VIDEOPLAYERENGINE_H #define VIDEOPLAYERENGINE_H @@ -77,7 +77,9 @@ void doDelayedLoad(); - void createPlayAndDetailsViews(); + void createMissingViews(); + + void createPlaybackView(); void setCurrentView(); diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayer/resources/videos.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayer/resources/videos.docml Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayer/resources/videos.splashml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayer/resources/videos.splashml Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,8 @@ + + + videos.docml + splashView + 0x200211FE + videos + portrait + diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayer/rom/videoplayer.iby --- a/videoplayerapp/videoplayer/rom/videoplayer.iby Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayer/rom/videoplayer.iby Wed Jun 23 18:14:16 2010 +0300 @@ -23,7 +23,9 @@ #include S60_APP_EXE(videoplayer) -data=DATAZ_/PRIVATE/10003A3F/import/APPS/videoplayer_reg.rsc private/10003a3f/import/apps/videoplayer_reg.rsc -data=DATAZ_\install\videoplayer_stub.sis system\install\videoplayer_stub.sis +data=ZPRIVATE\10003A3F\import\APPS\videoplayer_reg.rsc private\10003a3f\import\apps\videoplayer_reg.rsc +data=ZSYSTEM\install\videoplayer_stub.sis system\install\videoplayer_stub.sis +data=ZRESOURCE\hb\splashml\videos.splashml RESOURCE_FILES_DIR\hb\splashml\videos.splashml +data=ZRESOURCE\hb\splashml\videos.docml RESOURCE_FILES_DIR\hb\splashml\videos.docml #endif // __VIDEOPLAYER_IBY__ diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayer/sis/videoplayer_stub.pkg --- a/videoplayerapp/videoplayer/sis/videoplayer_stub.pkg Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayer/sis/videoplayer_stub.pkg Wed Jun 23 18:14:16 2010 +0300 @@ -60,7 +60,7 @@ "" - "z:\sys\bin\videoplayerengine.dll" "" - "z:\sys\bin\videoplayer.exe" "" - "z:\resource\apps\videoplayer.r*" -"" - "z:\private\10003a3f\import\apps\videoplayer_reg.r*" +"" - "z:\private\10003a3f\import\apps\videoplayer_reg.rsc" "" - "z:\resource\qt\translations\videos.qm" diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayer/sis/videoplayer_stub.sis Binary file videoplayerapp/videoplayer/sis/videoplayer_stub.sis has changed diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayer/src/main.cpp --- a/videoplayerapp/videoplayer/src/main.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayer/src/main.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 1 % +// Version : %version: 3 % #include @@ -24,12 +24,14 @@ #include #include #include +#include #include "videoplayerengine.h" +#include "videoactivitystate.h" int main(int argc, char *argv[]) { - HbApplication app(argc, argv); + HbApplication app(argc, argv, Hb::SplashFixedVertical); // Load the translation file. QString lang = QLocale::system().name(); @@ -68,6 +70,12 @@ if (!isService) { app.setApplicationName(hbTrId("txt_videos_title_videos")); + + HbActivityManager *actManager = app.activityManager(); + // save activity data locally + VideoActivityState::instance().setActivityData(actManager->activityData(ACTIVITY_VIDEOPLAYER_MAINVIEW)); + // remove from activitymanager + actManager->removeActivity(ACTIVITY_VIDEOPLAYER_MAINVIEW); } HbMainWindow mainWindow( 0, Hb::WindowFlagTransparent ); diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayer/videoplayer.pro --- a/videoplayerapp/videoplayer/videoplayer.pro Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayer/videoplayer.pro Wed Jun 23 18:14:16 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building Videoplayer components # # -# Version : %version: 1 % +# Version : %version: 2 % TARGET = videoplayer @@ -27,11 +27,15 @@ TARGET.CAPABILITY = ALL -DRM -TCB TARGET.EPOCHEAPSIZE = 0x20000 0x1600000 TARGET.UID3 = 0x200211FE - SKINICON = qtg_large_video_tv.svg + SKINICON = qtg_large_video_tv BLD_INF_RULES.prj_exports += "rom/videoplayer.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videoplayer.iby)" \ "rom/videoplayerresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(videoplayerresources.iby)" \ - "sis/videoplayer_stub.sis /epoc32/data/z/system/install/videoplayer_stub.sis" + "sis/videoplayer_stub.sis /epoc32/data/z/system/install/videoplayer_stub.sis" \ + "resources/videos.docml /epoc32/release/winscw/udeb/z/resource/hb/splashml/videos.docml" \ + "resources/videos.splashml /epoc32/release/winscw/udeb/z/resource/hb/splashml/videos.splashml" \ + "resources/videos.docml /epoc32/data/z/resource/hb/splashml/videos.docml" \ + "resources/videos.splashml /epoc32/data/z/resource/hb/splashml/videos.splashml" \ } # Service provider specific configuration. diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp --- a/videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: ou1cpsw#8 % +// Version : %version: 9 % @@ -567,16 +567,7 @@ if ( aLocalFile ) { - CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( link ); - - if ( mediaType == CMediaRecognizer::EUnidentified ) - { - User::Leave( KErrNotSupported ); - } - else - { - iPlaybackUtility->InitL( link ); - } + iPlaybackUtility->InitL( link ); } else { diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/src/videoactivitystate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayerengine/src/videoactivitystate.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of VideoActivityState +* +*/ + +// Version : %version: 1 % + +#include "videoactivitystate.h" +#include "mpxvideo_debug.h" + +// ------------------------------------------------------------------------------------------------- +// instance() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState& VideoActivityState::instance() +{ + MPX_ENTER_EXIT(_L("VideoActivityState::instance()")); + + static VideoActivityState _staticWrapper; + return _staticWrapper; +} + +// ------------------------------------------------------------------------------------------------- +// VideoActivityState() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState::VideoActivityState() +{ + // NOP +} + +// ------------------------------------------------------------------------------------------------- +// ~VideoActivityState() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState::~VideoActivityState() +{ + MPX_ENTER_EXIT(_L("VideoActivityState::~VideoActivityState()")); + mActivityData.clear(); + +} + +// ------------------------------------------------------------------------------------------------- +// setActivityData() +// ------------------------------------------------------------------------------------------------- +// +void VideoActivityState::setActivityData(const QVariant& data, const QString& dataKey) +{ + MPX_ENTER_EXIT(_L("VideoActivityState::setActivityData()")); + if(dataKey.length()) + { + // setting particular dataitem + mActivityData[dataKey] = data; + } + else + { + // overwriting all data + mActivityData.clear(); + mActivityData = data.toHash(); + } +} + +// ------------------------------------------------------------------------------------------------- +// getActivityData() +// ------------------------------------------------------------------------------------------------- +// +const QVariant VideoActivityState::getActivityData(const QString& dataKey) +{ + MPX_ENTER_EXIT(_L("VideoActivityState::getData()")); + if(dataKey.length()) + { + return mActivityData[dataKey]; + } + else + { + return QVariant::fromValue(mActivityData); + } +} +// End of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/src/videoplayerengine.cpp --- a/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#31 % +// Version : %version: 33 % #include @@ -25,8 +25,11 @@ #include #include #include +#include +#include #include "videoplayerengine.h" +#include "videoactivitystate.h" #include "mpxvideoplaybackwrapper.h" #include "videoservices.h" #include "mpxvideo_debug.h" @@ -67,16 +70,22 @@ if ( mCollectionViewPlugin ) { mCollectionViewPlugin->destroyView(); + delete mCollectionViewPlugin; + mCollectionViewPlugin = 0; } if ( mPlaybackViewPlugin ) { mPlaybackViewPlugin->destroyView(); + delete mPlaybackViewPlugin; + mPlaybackViewPlugin = 0; } if ( mFileDetailsViewPlugin ) { mFileDetailsViewPlugin->destroyView(); + delete mFileDetailsViewPlugin; + mFileDetailsViewPlugin = 0; } delete mPlaybackWrapper; @@ -110,31 +119,44 @@ SLOT( handleCommand( int ) ) ); } - // - // Get VideoServices instance - // - if ( mIsService && ! mVideoServices ) - { - mVideoServices = VideoServices::instance(this); - connect( mVideoServices, SIGNAL(activated(int)), this, SLOT(handleCommand(int))); - } - QList impls; XQPluginLoader::listImplementations("org.nokia.mmdt.MpxViewPlugin/1.0", impls); - - if ( isPlayServiceInvoked() ) + + if ( mIsService ) { - createPlayAndDetailsViews(); + if(!mVideoServices) + { + mVideoServices = VideoServices::instance(this); + connect( mVideoServices, SIGNAL(activated(int)), this, SLOT(handleCommand(int))); + } + if ( isPlayServiceInvoked() ) + { + createPlaybackView(); + } + else + { + loadPluginAndCreateView( MpxHbVideoCommon::CollectionView ); + + // Browse service will activate view once the category to be opened is informed from highway + // since the category is not known at this point, we do not activate view for it here + if(!(XQServiceUtil::interfaceName().contains("IVideoBrowse"))) + { + activateView( MpxHbVideoCommon::CollectionView ); + } + } } else { - loadPluginAndCreateView( MpxHbVideoCommon::CollectionView ); - - if((mIsService && !(XQServiceUtil::interfaceName().contains("IVideoBrowse"))) || !mIsService) + // check latest plugin type from activity manager data and create + activate it + // CollectionView (default) and playbackview are the ones that are accepted + MpxHbVideoCommon::MpxHbVideoViewType viewType = MpxHbVideoCommon::CollectionView; + int typeGotten = VideoActivityState::instance().getActivityData(VideoActivityData::KEY_VIEWPLUGIN_TYPE).toInt(); + if(typeGotten == MpxHbVideoCommon::CollectionView || typeGotten == MpxHbVideoCommon::PlaybackView) { - //Browse service will activate view once the category to be opened is informed from highway - activateView( MpxHbVideoCommon::CollectionView ); + viewType = MpxHbVideoCommon::MpxHbVideoViewType(typeGotten); } + loadPluginAndCreateView( viewType ); + activateView( viewType ); } } @@ -198,36 +220,47 @@ { MPX_ENTER_EXIT(_L("QVideoPlayerEngine::doDelayedLoad()")); - createPlayAndDetailsViews(); + createMissingViews(); mDelayedLoadDone = true; } // ------------------------------------------------------------------------------------------------- -// createPlayAndDetailsViews() +// createPlaybackView() // ------------------------------------------------------------------------------------------------- // -void QVideoPlayerEngine::createPlayAndDetailsViews() +void QVideoPlayerEngine::createPlaybackView() { - MPX_ENTER_EXIT(_L("QVideoPlayerEngine::createPlayAndDetailsViews()")); + mPlaybackWrapper->lateInit(); + + if ( ! mPlaybackViewPlugin ) + { + loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); + } +} + +// ------------------------------------------------------------------------------------------------- +// createMissingViews() +// ------------------------------------------------------------------------------------------------- +// +void QVideoPlayerEngine::createMissingViews() +{ + MPX_ENTER_EXIT(_L("QVideoPlayerEngine::createMissingViews()")); // // delayed initialization of some uiengine member variables // to help application startup time & improve playback start time // - mPlaybackWrapper->lateInit(); - - if ( ! mPlaybackViewPlugin ) - { - loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); - } + createPlaybackView(); - // details view need not be created for playback via serviceFW - if ( ! mIsPlayService && - ! mFileDetailsViewPlugin ) + if(!mFileDetailsViewPlugin) { loadPluginAndCreateView( MpxHbVideoCommon::VideoDetailsView ); } + if(!mCollectionViewPlugin) + { + loadPluginAndCreateView( MpxHbVideoCommon::CollectionView ); + } } @@ -420,7 +453,38 @@ void QVideoPlayerEngine::handleQuit() { MPX_ENTER_EXIT(_L("QVideoPlayerEngine::handleQuit()")); - + + if(!mIsService) + { + VideoActivityState &localActivity(VideoActivityState::instance()); + + QVariant data = QVariant(); + HbActivityManager *actManager = qobject_cast(qApp)->activityManager(); + + // + // get and save recent view type: either playback or collection view plugins are currently used. + // activity will not be saved from the details plugin + // + int viewType = MpxHbVideoCommon::CollectionView; + if(mCurrentViewPlugin == mPlaybackViewPlugin) + { + viewType = MpxHbVideoCommon::PlaybackView; + } + data = viewType; + localActivity.setActivityData(data, VideoActivityData::KEY_VIEWPLUGIN_TYPE); + + // + // deactivate is the final point for current plugin to save it's activity data into + // VideoActivityState before they are saved to to activity manager + // + mCurrentViewPlugin->deactivateView(); + + // save data to activity manager + actManager->addActivity(ACTIVITY_VIDEOPLAYER_MAINVIEW, + localActivity.getActivityData(), + QVariantHash()); + } + delete this; } diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/inc/testvideoplayerengine.h --- a/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/inc/testvideoplayerengine.h Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/inc/testvideoplayerengine.h Wed Jun 23 18:14:16 2010 +0300 @@ -23,7 +23,7 @@ // - how to setup construction to fail for testing purposes -// Version : %version: % +// Version : %version: 8 % #ifndef __TESTVIDEOPLAYERENGINE_H__ #define __TESTVIDEOPLAYERENGINE_H__ @@ -31,6 +31,7 @@ // INCLUDES #include +#include class MpxViewPlugin; class QMpxVideoPlaybackWrapper; @@ -80,6 +81,9 @@ void testPlayMedia(); void testSetEmbedded(); + + void testInitWithActivityData(); + void testHandleQuitWihtActivityData(); // called after last test case executed void cleanupTestCase(); @@ -91,7 +95,7 @@ private: - QVideoPlayerEngine* mTestObject; + QPointer mTestObject; MpxViewPlugin* mCurrentViewPlugin; MpxViewPlugin* mPlaybackViewPlugin; diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/src/testvideoplayerengine.cpp --- a/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/src/testvideoplayerengine.cpp Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/src/testvideoplayerengine.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#13 % +// Version : %version: 14 % // INCLUDES #include @@ -36,6 +36,7 @@ #include "stub/inc/mpxviewpluginqt.h" #include "stub/inc/videoservices.h" #include "stub/inc/xqpluginloader.h" +#include "stub/inc/videoactivitystate.h" #include "../stub/inc/mpxvideoplaybackwrapper.h" #include "mpxvideo_debug.h" @@ -79,8 +80,10 @@ XQPluginLoader::cleanup(); - delete mTestObject; - mTestObject = 0; + if(!mTestObject.isNull()) + { + delete mTestObject; + } } @@ -116,8 +119,10 @@ mFileDetailsViewPlugin = 0; mVideoServices = 0; - delete mTestObject; - mTestObject = 0; + if(!mTestObject.isNull()) + { + delete mTestObject; + } } @@ -128,7 +133,7 @@ //Test object creation and deletion init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -152,7 +157,7 @@ //Test object creation and deletion init(true); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -174,7 +179,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); QVERIFY(mTestObject->mCollectionViewPlugin == 0); @@ -209,7 +214,7 @@ init(true); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); QVERIFY(mTestObject->mCollectionViewPlugin == 0); @@ -243,7 +248,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); QVERIFY(mTestObject->mCollectionViewPlugin == 0); @@ -286,7 +291,7 @@ init(true); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); QVERIFY(mTestObject->mCollectionViewPlugin == 0); @@ -332,7 +337,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -363,7 +368,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -445,7 +450,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -537,7 +542,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -628,7 +633,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -726,7 +731,7 @@ init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); QVERIFY(mTestObject->mCurrentViewPlugin == 0); QVERIFY(mTestObject->mPlaybackViewPlugin == 0); @@ -819,12 +824,16 @@ // 1. test with a string init(); + QVERIFY(!mTestObject.isNull()); + mTestObject->playMedia( QString("c:\\data\\videos\\test.3gp")); QVERIFY(mTestObject); cleanup(); // 2. test with a file handle init(); + QVERIFY(!mTestObject.isNull()); + XQSharableFile sf; if ( sf.open("C:\\data\\videos\\test.3gp") ) { @@ -843,6 +852,8 @@ // 3. test with a filename init(); + QVERIFY(!mTestObject.isNull()); + QFile qfile("C:\\data\\videos\\test.3gp"); mTestObject->playMedia( qfile.fileName() ); QVERIFY(mTestObject); @@ -855,12 +866,131 @@ MPX_DEBUG(_L("TestVideoServices::testSetEmbedded()")); init(); - QVERIFY(mTestObject); + QVERIFY(!mTestObject.isNull()); mTestObject->setEmbedded(); QVERIFY( mTestObject->mEmbedded == true ); cleanup(); } +void TestVideoPlayerEngine::testInitWithActivityData() +{ + MPX_DEBUG(_L("TestVideoServices::testInitialize()")); + + init(); + QVERIFY(!mTestObject.isNull()); + + mTestObject->initialize(); + + // by default, colleciton view plugin is activated + QVERIFY(mTestObject); + QVERIFY(mTestObject->mCurrentViewPlugin); + QVERIFY(mTestObject->mPlaybackViewPlugin == 0); + QVERIFY(mTestObject->mCollectionViewPlugin); + QVERIFY(mTestObject->mFileDetailsViewPlugin == 0); + QVERIFY(mTestObject->mPlaybackWrapper); + QVERIFY(mTestObject->mCurrentViewPlugin->activated()); + QVERIFY(mTestObject->mCollectionViewPlugin->activated()); + + cleanup(); + init(); + QVERIFY(!mTestObject.isNull()); + + QVariant data = int(MpxHbVideoCommon::PlaybackView); + // playback plugin + VideoActivityState::instance().setActivityData(data, VideoActivityData::KEY_VIEWPLUGIN_TYPE); + mTestObject->initialize(); + QVERIFY(mTestObject); + QVERIFY(mTestObject->mCurrentViewPlugin); + QVERIFY(mTestObject->mPlaybackViewPlugin); + QVERIFY(mTestObject->mCollectionViewPlugin == 0); + QVERIFY(mTestObject->mFileDetailsViewPlugin == 0); + QVERIFY(mTestObject->mPlaybackWrapper); + QVERIFY(mTestObject->mCurrentViewPlugin->activated()); + QVERIFY(mTestObject->mPlaybackViewPlugin->activated()); + + cleanup(); + init(); + QVERIFY(!mTestObject.isNull()); + + // only collection view and playback view are accepted, so all other cases + // ends up into default: collectionview + data = int(MpxHbVideoCommon::VideoDetailsView); + VideoActivityState::instance().setActivityData(data, VideoActivityData::KEY_VIEWPLUGIN_TYPE); + mTestObject->initialize(); + QVERIFY(mTestObject); + QVERIFY(mTestObject->mCurrentViewPlugin); + QVERIFY(mTestObject->mPlaybackViewPlugin == 0); + QVERIFY(mTestObject->mCollectionViewPlugin); + QVERIFY(mTestObject->mFileDetailsViewPlugin == 0); + QVERIFY(mTestObject->mPlaybackWrapper); + QVERIFY(mTestObject->mCurrentViewPlugin->activated()); + QVERIFY(mTestObject->mCollectionViewPlugin->activated()); + + cleanup(); + +} + +void TestVideoPlayerEngine::testHandleQuitWihtActivityData() +{ + // we make sure that engine saves correct plugin type before exit + // using VideoActivityState since value is saved there before actually + // being save to activitymanager + + init(); + QVERIFY(!mTestObject.isNull()); + connect(this, SIGNAL(aboutToQuit()), mTestObject, SLOT(handleQuit())); + + mTestObject->initialize(); + VideoActivityState::mAllDataGetCount = 0; + + emit aboutToQuit(); + + QVariant data = QVariant(); + data = VideoActivityState::instance().getActivityData(VideoActivityData::KEY_VIEWPLUGIN_TYPE); + QVERIFY(data.isValid()); + QVERIFY(data.toInt() == MpxHbVideoCommon::CollectionView); + QVERIFY(VideoActivityState::mAllDataGetCount == 1); + + cleanup(); + init(); + QVERIFY(!mTestObject.isNull()); + connect(this, SIGNAL(aboutToQuit()), mTestObject, SLOT(handleQuit())); + + data = int(MpxHbVideoCommon::PlaybackView); + VideoActivityState::instance().setActivityData(data, VideoActivityData::KEY_VIEWPLUGIN_TYPE); + mTestObject->initialize(); + VideoActivityState::mAllDataGetCount = 0; + + emit aboutToQuit(); + + data = QVariant(); + data = VideoActivityState::instance().getActivityData(VideoActivityData::KEY_VIEWPLUGIN_TYPE); + QVERIFY(data.isValid()); + QVERIFY(data.toInt() == MpxHbVideoCommon::PlaybackView); + QVERIFY(VideoActivityState::mAllDataGetCount == 1); + + cleanup(); + init(); + QVERIFY(!mTestObject.isNull()); + connect(this, SIGNAL(aboutToQuit()), mTestObject, SLOT(handleQuit())); + + data = int(MpxHbVideoCommon::VideoDetailsView); + VideoActivityState::instance().setActivityData(data, VideoActivityData::KEY_VIEWPLUGIN_TYPE); + mTestObject->initialize(); + VideoActivityState::mAllDataGetCount = 0; + + emit aboutToQuit(); + + data = QVariant(); + data = VideoActivityState::instance().getActivityData(VideoActivityData::KEY_VIEWPLUGIN_TYPE); + QVERIFY(data.isValid()); + QVERIFY(data.toInt() == MpxHbVideoCommon::CollectionView); + QVERIFY(VideoActivityState::mAllDataGetCount == 1); + + cleanup(); +} + + void TestVideoPlayerEngine::cleanupTestCase() { MPX_DEBUG(_L("TestVideoServices::cleanupTestCase()")); diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoactivitystate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoactivitystate.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VideoActivityState stub class definition +* +*/ + +// Version : %version: 1 % + +#ifndef __VIDEOACTIVITYSTATE_H__ +#define __VIDEOACTIVITYSTATE_H__ + +#include +#include +#include "videoplayerappexport.h" + +// videoplayer activity id +static const QString ACTIVITY_VIDEOPLAYER_MAINVIEW = "VideosMainView"; + + +namespace VideoActivityData +{ + // consts to be used as key values + // plugin type (int): collectionplugin or videoplaybackplugin + static const QString KEY_VIEWPLUGIN_TYPE = "_VideoActivity_viewplugin_type_"; + +} + +/** + * Class is used as a stub for testing activity saving from videoplayerengine + * + */ +class VIDEOPLAYERAPP_DLL_EXPORT VideoActivityState +{ + +public: + + /** + * method returns a static instance of this class + */ + static VideoActivityState &instance(); + + /** + * Method clears all activity data. + */ + void clearActivityData(); + + /** + * Sets activity data. If dataKey is not defined, all activity data + * will be overwritten by a provided data. + * + * @param data Data to save + * @param dataKey Key indicating dataitem. If empty, all data will be overwritten by provided data + */ + void setActivityData(const QVariant& data, const QString& dataKey = QString("")); + + /** + * Get activity data. If dataKey is not defined, all activity data + * will be returned. If item corresponding provided dataKey is not found, + * method returns empty QVariant. + * + * @param dataKey Key indicating dataitem client wants. If empty, all data will be returned + * + * @return QVariant + */ + const QVariant getActivityData(const QString& dataKey = QString("")); + + static int mAllDataGetCount; + +private: + + /** + * private default contructor + */ + VideoActivityState(); + + /** + * copy contructor definition + */ + VideoActivityState(const VideoActivityState& other); + + /** + * Private destructor. + * + */ + virtual ~VideoActivityState(); + +private: + + /** + * locally saved activity data + */ + QHash mActivityData; + +}; + +#endif //__VIDEOACTIVITYSTATE_H__ diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/xqserviceutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/xqserviceutil.h Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,33 @@ +/** +* 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: XQServiceUtil STUB class definition +* +*/ + +// Version : %version: 1 % + +#ifndef XQSERVICEUTIL_H +#define XQSERVICEUTIL_H + +#include +#include + +namespace XQServiceUtil +{ + static void toBackground( bool value ); + static QString interfaceName(); +} + + +#endif diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoactivitystate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoactivitystate.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stub implementation of VideoActivityState +* +*/ + +// Version : %version: 1 % + +#include "videoactivitystate.h" +#include "mpxvideo_debug.h" + +int VideoActivityState::mAllDataGetCount = 0; + +// ------------------------------------------------------------------------------------------------- +// instance() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState& VideoActivityState::instance() +{ + MPX_ENTER_EXIT(_L("VideoActivityState::instance()")); + + static VideoActivityState _staticWrapper; + return _staticWrapper; +} + +// ------------------------------------------------------------------------------------------------- +// VideoActivityState() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState::VideoActivityState() +{ + // NOP +} + +// ------------------------------------------------------------------------------------------------- +// ~VideoActivityState() +// ------------------------------------------------------------------------------------------------- +// +VideoActivityState::~VideoActivityState() +{ + MPX_ENTER_EXIT(_L("VideoActivityState::~VideoActivityState()")); + mActivityData.clear(); + +} + +// ------------------------------------------------------------------------------------------------- +// clearActivityData() +// ------------------------------------------------------------------------------------------------- +// +void VideoActivityState::clearActivityData() +{ + MPX_ENTER_EXIT(_L("VideoActivityState::clearActivityData()")); + mActivityData.clear(); +} + +// ------------------------------------------------------------------------------------------------- +// setActivityData() +// ------------------------------------------------------------------------------------------------- +// +void VideoActivityState::setActivityData(const QVariant& data, const QString& dataKey) +{ + MPX_ENTER_EXIT(_L("VideoActivityState::setActivityData()")); + if(dataKey.length()) + { + // setting particular dataitem + mActivityData[dataKey] = data; + } + else + { + // overwriting all data + mActivityData.clear(); + mActivityData = data.toHash(); + } +} + +// ------------------------------------------------------------------------------------------------- +// getActivityData() +// ------------------------------------------------------------------------------------------------- +// +const QVariant VideoActivityState::getActivityData(const QString& dataKey) +{ + MPX_ENTER_EXIT(_L("VideoActivityState::getData()")); + if(dataKey.length()) + { + return mActivityData[dataKey]; + } + else + { + mAllDataGetCount++; + return QVariant::fromValue(mActivityData); + } +} + + +// End of file diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/xqserviceutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/xqserviceutil.cpp Wed Jun 23 18:14:16 2010 +0300 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XQServiceUtil stub impl +* +*/ + +#include "xqserviceutil.h" +#include "mpxvideo_debug.h" + + +// ---------------------------------------------------------------------------- +// XQServiceUtil::toBackground() +// ---------------------------------------------------------------------------- +// +void XQServiceUtil::toBackground( bool value ) +{ + MPX_DEBUG(_L("XQServiceUtil::toBackground( %d )"), value ); +} + +// ---------------------------------------------------------------------------- +// XQServiceUtil::isEmbedded() +// ---------------------------------------------------------------------------- +// +QString XQServiceUtil::interfaceName() +{ + MPX_DEBUG(_L("XQServiceUtil::interfaceName()")); + + return "IVideoView"; +} + diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/testvideoplayerengine.pro --- a/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/testvideoplayerengine.pro Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/testvideoplayerengine.pro Wed Jun 23 18:14:16 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building Videoplayer components # # -# Version : %version: da1mmcf#11 % +# Version : %version: da1mmcf#13 % TEMPLATE = app @@ -24,7 +24,6 @@ DEPENDPATH += inc src stub/src stub/inc INCLUDEPATH +=stub/inc \ - $$MW_LAYER_SYSTEMINCLUDE \ ../../../../inc CONFIG += qtestlib hb qt @@ -34,6 +33,7 @@ # Input HEADERS += mpxvideoplaybackwrapper.h \ + xqserviceutil.h \ mpxviewpluginqt.h \ testviewplugin.h \ xqpluginloader.h \ @@ -45,9 +45,11 @@ videoserviceplay.h \ videoserviceview.h \ hbview.h \ + videoactivitystate.h \ ../../../../inc/videoplayerengine.h SOURCES += mpxvideoplaybackwrapper.cpp \ + xqserviceutil.cpp \ testviewplugin.cpp \ xqpluginloader.cpp \ hbinstance.cpp \ @@ -56,4 +58,5 @@ videoserviceurifetch.cpp \ videoserviceplay.cpp \ videoserviceview.cpp \ + videoactivitystate.cpp \ ../../src/videoplayerengine.cpp diff -r c48470be1ba7 -r adbe7d5ba2f5 videoplayerapp/videoplayerengine/videoplayerengine.pro --- a/videoplayerapp/videoplayerengine/videoplayerengine.pro Fri Jun 11 13:39:54 2010 +0300 +++ b/videoplayerapp/videoplayerengine/videoplayerengine.pro Wed Jun 23 18:14:16 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building Videoplayer components # # -# Version : %version: da1mmcf#24 % +# Version : %version: 26 % TEMPLATE = lib @@ -48,7 +48,6 @@ -lxqservice.dll \ -lxqserviceutil.dll \ -lflogger.dll \ - -lefsrv.dll DEPENDPATH += ../../inc ../inc inc VPATH += src @@ -60,7 +59,8 @@ videoserviceplay.h \ videoserviceurifetch.h \ videoserviceview.h \ - videoservicebrowse.h + videoservicebrowse.h \ + videoactivitystate.h SOURCES += videoplayerengine.cpp \ mpxvideoplaybackwrapper.cpp \ @@ -69,5 +69,6 @@ videoserviceplay.cpp \ videoserviceurifetch.cpp \ videoserviceview.cpp \ - videoservicebrowse.cpp + videoservicebrowse.cpp \ + videoactivitystate.cpp