--- a/layers.sysdef.xml Fri Sep 03 12:37:43 2010 +0300
+++ b/layers.sysdef.xml Mon Sep 20 18:25:37 2010 +0300
@@ -29,7 +29,6 @@
<unit unitID="vado.testvideodeleteworker" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker" proFile="testvideodeleteworker.pro" name="unittest.testvideodeleteworker"/>
<unit unitID="vado.testvideomodel" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideomodel" proFile="testvideomodel.pro" name="unittest.testvideomodel"/>
<unit unitID="vado.testvideomodel_p" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideomodel_p" proFile="testvideomodel_p.pro" name="unittest.testvideomodel_p"/>
- <unit unitID="vado.testvideosortfilterproxymodel" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel" proFile="testvideosortfilterproxymodel.pro" name="unittest.testvideosortfilterproxymodel"/>
<unit unitID="vado.testvideothumbnaildata" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata" proFile="testvideothumbnaildata.pro" name="unittest.testvideothumbnaildata"/>
<unit unitID="vado.testvideothumbnaildata_p" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p" proFile="testvideothumbnaildata_p.pro" name="unittest.testvideothumbnaildata_p"/>
<unit unitID="vado.testvideothumbnailfetcher" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher" proFile="testvideothumbnailfetcher.pro" name="unittest.testvideothumbnailfetcher"/>
--- a/mediasettings/mediasettingsengine/group/MPSettROPModel.mmp Fri Sep 03 12:37:43 2010 +0300
+++ b/mediasettings/mediasettingsengine/group/MPSettROPModel.mmp Mon Sep 20 18:25:37 2010 +0300
@@ -14,11 +14,7 @@
* Description: Makefile for Media Settings ROP Model*
*/
-
-
-// Version : %version: 7 %
-
-
+// Version : %version: 9 %
#include <data_caging_paths.hrh>
#include <platform_paths.hrh>
@@ -27,7 +23,7 @@
TARGETTYPE PLUGIN
UID 0x10009D8D 0x101F857B
VENDORID VID_DEFAULT
-//VERSION 11.6
+VERSION 10.0
SOURCEPATH ../src
SOURCE MPSettingsModelForROP.cpp
@@ -66,4 +62,4 @@
LIBRARY centralrepository.lib
LIBRARY commsdat.lib
-//end of file
+// End of File
--- a/mediasettings/videosettingsplugin/videosettingsplugin.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/mediasettings/videosettingsplugin/videosettingsplugin.pro Mon Sep 20 18:25:37 2010 +0300
@@ -24,6 +24,7 @@
TARGET.CAPABILITY = CAP_GENERAL_DLL
BLD_INF_RULES.prj_exports += "rom/videosettingsplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videosettingsplugin.iby)"
MMP_RULES += SMPSAFE
+ VERSION = 10.0
}
LIBS += -lcpframework \
--- a/package_definition.xml Fri Sep 03 12:37:43 2010 +0300
+++ b/package_definition.xml Mon Sep 20 18:25:37 2010 +0300
@@ -20,60 +20,140 @@
<component id="videocollectionwrapper" filter="s60" name="Video Collection Wrapper" introduced="^4">
<unit bldFile="videocollection/videocollectionwrapper" qt:proFile="videocollectionwrapper.pro"/>
</component>
- <!-- <component id="videocollectionwrapper_test" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4"> -->
+ <component id="testvideocollectionclient" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
<!--Can only have one unit. Need to split into separate component or #include from a common file-->
- <!-- <meta rel="testbuild">
- <group name="vado.101_videocollection_qt.tsrc"/>
- </meta>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideocollectionclient" qt:proFile="testvideocollectionclient.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener" qt:proFile="testvideocollectionlistener.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p" qt:proFile="testvideocollectionwrapper_p.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideodatacontainer" qt:proFile="testvideodatacontainer.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideodeleteworker" qt:proFile="testvideodeleteworker.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideomodel" qt:proFile="testvideomodel.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideomodel_p" qt:proFile="testvideomodel_p.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel" qt:proFile="testvideosortfilterproxymodel.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata" qt:proFile="testvideothumbnaildata.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p" qt:proFile="testvideothumbnaildata_p.pro"/>
- <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher" qt:proFile="testvideothumbnailfetcher.pro"/>
- </component> -->
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideocollectionclient" qt:proFile="testvideocollectionclient.pro"/>
+ </component>
+ <component id="testvideocollectionlistener" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener" qt:proFile="testvideocollectionlistener.pro"/>
+ </component>
+ <component id="testvideocollectionwrapper_p" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p" qt:proFile="testvideocollectionwrapper_p.pro"/>
+ </component>
+ <component id="testvideodatacontainer" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideodatacontainer" qt:proFile="testvideodatacontainer.pro"/>
+ </component>
+ <component id="testvideodeleteworker" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideodeleteworker" qt:proFile="testvideodeleteworker.pro"/>
+ </component>
+ <component id="testvideomodel" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideomodel" qt:proFile="testvideomodel.pro"/>
+ </component>
+ <component id="testvideomodel_p" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideomodel_p" qt:proFile="testvideomodel_p.pro"/>
+ </component>
+<!-- <component id="testvideosortfilterproxymodel" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel" qt:proFile="testvideosortfilterproxymodel.pro"/>
+ </component> -->
+ <component id="testvideothumbnaildata" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata" qt:proFile="testvideothumbnaildata.pro"/>
+ </component>
+ <component id="testvideothumbnaildata_p" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p" qt:proFile="testvideothumbnaildata_p.pro"/>
+ </component>
+ <component id="testvideothumbnailfetcher" filter="s60,test,qt_unit_test" name="Video Collection Wrapper Tests" introduced="^4">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher" qt:proFile="testvideothumbnailfetcher.pro"/>
+ </component>
<component id="videocollectionview" filter="s60" name="Video Collection View" introduced="^4">
<unit bldFile="videocollection/videocollectionview" qt:proFile="videocollectionview.pro"/>
</component>
- <!-- <component id="videocollectionview_test" filter="s60,test,qt_unit_test" name="Video Collection View Tests"> -->
+ <component id="testcollectionview" filter="s60,test,qt_unit_test" name="Video Collection View Tests">
<!--Can only have one unit. Need to split into separate components or #include from a common file-->
- <!-- <meta rel="testbuild">
- <group name="vado.101_videocollection_qt.tsrc"/>
- </meta>
- <unit bldFile="videocollection/videocollectionview/tsrc/testcollectionview" qt:proFile="testcollectionview.pro"/>
- <unit bldFile="videocollection/videocollectionview/tsrc/testhintwidget" qt:proFile="testhintwidget.pro"/>
- <unit bldFile="videocollection/videocollectionview/tsrc/testlistview" qt:proFile="testlistview.pro"/>
- <unit bldFile="videocollection/videocollectionview/tsrc/testlistwidget" qt:proFile="testlistwidget.pro"/>
- <unit bldFile="videocollection/videocollectionview/tsrc/testvideocollectionuiloader" qt:proFile="testvideocollectionuiloader.pro"/>
- <unit bldFile="videocollection/videocollectionview/tsrc/testvideocollectionviewutils" qt:proFile="testvideocollectionviewutils.pro"/>
- <unit bldFile="videocollection/videocollectionview/tsrc/testvideolistselectiondialog" qt:proFile="testvideolistselectiondialog.pro"/>
- </component> -->
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionview/tsrc/testcollectionview" qt:proFile="testcollectionview.pro"/>
+ </component>
+ <component id="testhintwidget" filter="s60,test,qt_unit_test" name="Video Collection View Tests">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionview/tsrc/testhintwidget" qt:proFile="testhintwidget.pro"/>
+ </component>
+ <component id="testlistview" filter="s60,test,qt_unit_test" name="Video Collection View Tests">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionview/tsrc/testlistview" qt:proFile="testlistview.pro"/>
+ </component>
+ <component id="testlistwidget" filter="s60,test,qt_unit_test" name="Video Collection View Tests">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionview/tsrc/testlistwidget" qt:proFile="testlistwidget.pro"/>
+ </component>
+ <component id="testvideocollectionuiloader" filter="s60,test,qt_unit_test" name="Video Collection View Tests">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionview/tsrc/testvideocollectionuiloader" qt:proFile="testvideocollectionuiloader.pro"/>
+ </component>
+ <component id="testvideocollectionviewutils" filter="s60,test,qt_unit_test" name="Video Collection View Tests">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionview/tsrc/testvideocollectionviewutils" qt:proFile="testvideocollectionviewutils.pro"/>
+ </component>
+ <component id="testvideolistselectiondialog" filter="s60,test,qt_unit_test" name="Video Collection View Tests">
+ <meta rel="testbuild">
+ <group name="vado.101_videocollection_qt.tsrc"/>
+ </meta>
+ <unit bldFile="videocollection/videocollectionview/tsrc/testvideolistselectiondialog" qt:proFile="testvideolistselectiondialog.pro"/>
+ </component>
<component id="videofiledetailsview" filter="s60" name="Video File Details View" introduced="^4">
<unit bldFile="videocollection/videofiledetailsview" qt:proFile="videofiledetailsview.pro"/>
</component>
- </collection>
- <collection id="mediasettings" name="Media Settings" level="support">
+ </collection>
+ <collection id="mediasettings" name="Media Settings" level="support">
<component id="mediasettingsengine" filter="s60" name="Media Settings Engine">
<unit bldFile="mediasettings/mediasettingsengine/group"/>
</component>
<component id="videosettingsplugin" filter="s60" name="Video Settings Plugin" class="plugin">
<unit bldFile="mediasettings/videosettingsplugin" qt:proFile="videosettingsplugin.pro"/>
</component>
- </collection>
- <collection id="videoplayerapp" name="Video Player App" level="apps">
+ </collection>
+ <collection id="videoplayerapp" name="Video Player App" level="apps">
<component id="videoplayerengine" name="Video Player Engine" filter="s60" introduced="^4">
<unit bldFile="videoplayerapp/videoplayerengine" qt:proFile="videoplayerengine.pro"/>
</component>
<component id="hbvideoplayer" filter="s60" name="Video Player" introduced="^4">
<unit bldFile="videoplayerapp/videoplayer" qt:proFile="videoplayer.pro"/>
</component>
- </collection>
- <collection id="videoplayback" name="Video Playback Plugins" level="plugin">
+ </collection>
+ <collection id="videoplayback" name="Video Playback Plugins" level="plugin">
<component id="videoplaybackview" filter="s60" name="Video Playback View" class="plugin" introduced="^4">
<unit bldFile="videoplayback/videoplaybackview" qt:proFile="videoplaybackview.pro"/>
</component>
@@ -93,3 +173,4 @@
+
Binary file videocollection/mpxmyvideoscollection/conf/videoscollection.confml has changed
--- a/videocollection/mpxmyvideoscollection/group/vcxmyvideoscollectionplugin.mmp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/group/vcxmyvideoscollectionplugin.mmp Mon Sep 20 18:25:37 2010 +0300
@@ -14,8 +14,6 @@
* Description: My Videos mpx collection plugin project specification*
*/
-
-
#include <bldvariant.hrh>
#include <data_caging_paths.hrh>
#include <platform_paths.hrh>
@@ -27,6 +25,7 @@
VENDORID VID_DEFAULT
//CAPABILITY CAP_ECOM_PLUGIN
CAPABILITY All -TCB
+VERSION 10.0
SOURCEPATH ../src
SOURCE vcxmyvideoscollectionpluginproxy.cpp
@@ -73,3 +72,5 @@
LIBRARY charconv.lib
LIBRARY centralrepository.lib
LIBRARY PlatformEnv.lib
+
+// End of File
--- a/videocollection/tsrc/stubs/inc/hbaction.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/hbaction.h Mon Sep 20 18:25:37 2010 +0300
@@ -116,6 +116,7 @@
mTriggeredCount++;
QAction::trigger();
}
+
public: // data
@@ -143,7 +144,7 @@
* menu
*/
HbMenu* mMenu;
-
+
};
#endif
--- a/videocollection/tsrc/stubs/inc/hbdialog.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/hbdialog.h Mon Sep 20 18:25:37 2010 +0300
@@ -21,11 +21,13 @@
#include <QObject>
#include <qsize.h>
#include "hbwidget.h"
+#include "hbpopup.h"
class QGraphicsItem;
class QGraphicsWidget;
class HbAction;
-class HbDialog : public HbWidget
+
+class HbDialog : public HbPopup
{
Q_OBJECT
@@ -37,22 +39,7 @@
void finished(HbAction*);
public:
-
- enum DefaultTimeout
- {
- NoTimeout,
- ConfirmationNoteTimeout,
- StandardTimeout,
- ContextMenuTimeout,
- };
- enum DismissPolicy
- {
- NoDismiss = 0,
- TapInside = 1,
- TapOutside = 2,
- TapAnywhere = TapInside | TapOutside
- };
/**
* contructor
@@ -75,6 +62,19 @@
public:
/**
+ * stub show -method
+ */
+ virtual void show()
+ {
+ // NOP
+ }
+
+ virtual void setAttribute(Qt::WidgetAttribute attr)
+ {
+ Q_UNUSED(attr);
+ }
+
+ /**
* sets mDismissPolicy
*/
void setDismissPolicy(HbDialog::DismissPolicy dismissPolicy);
--- a/videocollection/tsrc/stubs/inc/hbmenu.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/hbmenu.h Mon Sep 20 18:25:37 2010 +0300
@@ -19,36 +19,13 @@
#ifndef HBMENU_H
#define HBMENU_H
-#include <hbwidget.h>
+#include "hbwidget.h"
+#include "hbpopup.h"
class QGraphicsItem;
class QPointF;
class HbAction;
-class HbPopup
-{
-public:
- enum Placement
- {
- TopLeftCorner,
- TopRightCorner,
- BottomLeftCorner,
- BottomRightCorner,
- TopEdgeCenter,
- RightEdgeCenter,
- BottomEdgeCenter,
- LeftEdgeCenter,
- Center
- };
-
- enum DismissPolicy
- {
- NoDismiss = 0,
- TapInside = 1,
- TapOutside = 2,
- TapAnywhere = TapInside | TapOutside
- };
-};
class HbMenu: public HbWidget
{
--- a/videocollection/tsrc/stubs/inc/hbmessagebox.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/hbmessagebox.h Mon Sep 20 18:25:37 2010 +0300
@@ -21,13 +21,14 @@
#include <qobject.h>
#include <qstring.h>
+#include "hbdialog.h"
#include "hbaction.h"
class QGraphicsWidget;
class QGraphicsScene;
class QGraphicsItem;
-class HbMessageBox : public QObject
+class HbMessageBox : public HbDialog
{
Q_OBJECT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbpopup.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: hbpopup stub
+*
+*/
+
+#ifndef HBPOPUP_H
+#define HBPOPUP_H
+
+#include "hbwidget.h"
+
+class HbPopup : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ HbPopup(QGraphicsItem *parent = 0) : HbWidget(parent){}
+
+ enum Placement
+ {
+ TopLeftCorner,
+ TopRightCorner,
+ BottomLeftCorner,
+ BottomRightCorner,
+ TopEdgeCenter,
+ RightEdgeCenter,
+ BottomEdgeCenter,
+ LeftEdgeCenter,
+ Center
+ };
+
+ enum DismissPolicy
+ {
+ NoDismiss = 0,
+ TapInside = 1,
+ TapOutside = 2,
+ TapAnywhere = TapInside | TapOutside
+ };
+ enum DefaultTimeout
+ {
+ NoTimeout,
+ ConfirmationNoteTimeout,
+ StandardTimeout,
+ ContextMenuTimeout,
+ };
+
+
+};
+
+#endif
+
--- a/videocollection/tsrc/stubs/inc/hbwidget.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/hbwidget.h Mon Sep 20 18:25:37 2010 +0300
@@ -22,10 +22,6 @@
#include <hbnamespace.h>
#include <hbglobal.h>
- /**
- * counter to make sure alloc dealloc match
- */
-
class HbWidget : public QGraphicsWidget
{
--- a/videocollection/tsrc/stubs/inc/videocollectionuiloaderdata.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/videocollectionuiloaderdata.h Mon Sep 20 18:25:37 2010 +0300
@@ -20,6 +20,7 @@
#include <qstringlist.h>
#include <qmap.h>
+#include "videocollectionuiloader.h"
class VideoCollectionUiLoaderData
{
@@ -31,6 +32,7 @@
mFindFailureNameList.clear();
mMenuActions.clear();
mLastLoadPhasedData = -1;
+ mAddDataCallCount = 0;
}
public: // data
@@ -39,6 +41,7 @@
static QStringList mFindFailureNameList;
static QMap<VideoCollectionUiLoader::ActionIds, HbAction*> mMenuActions;
static int mLastLoadPhasedData;
+ static int mAddDataCallCount;
};
#endif /* VIDEOCOLLECTIONUILOADERDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videolisttoolbardata.h Mon Sep 20 18:25:37 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: stub hbstackedwidget
+*
+*/
+
+#ifndef VIDEOLISTVIEWDATA_H
+#define VIDEOLISTVIEWDATA_H
+
+#include <e32std.h>
+#include <mpxitemid.h>
+
+#include "videocollectioncommon.h"
+
+class VideoListToolbarData
+{
+public: // methods
+ static void reset()
+ {
+ mViewStateChangedCount = 0;
+ mViewStateChangedLevel = VideoCollectionCommon::ELevelInvalid;
+ mViewStateChangedNoVideos = false;
+ mViewStateChangedModelReady = false;
+ }
+
+public: // data
+ static int mViewStateChangedCount;
+ static VideoCollectionCommon::TCollectionLevels mViewStateChangedLevel;
+ static bool mViewStateChangedNoVideos;
+ static bool mViewStateChangedModelReady;
+};
+
+#endif /* VIDEOLISTVIEWDATA_H */
--- a/videocollection/tsrc/stubs/inc/videolistviewdata.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/videolistviewdata.h Mon Sep 20 18:25:37 2010 +0300
@@ -21,6 +21,8 @@
#include <e32std.h>
#include <mpxitemid.h>
+#include "videolistwidget.h"
+
class VideoListViewData
{
public: // methods
@@ -31,14 +33,16 @@
mDeactivateViewCount = 0;
mBackCount = 0;
mActivatedItemId = TMPXItemId::InvalidId();
+ mCurrentListWidget = 0;
}
public: // data
static int mInitializeViewCount;
static int mActivateViewCount;
static int mDeactivateViewCount;
- static int mBackCount;
+ static int mBackCount;
static TMPXItemId mActivatedItemId;
+ static VideoListWidget *mCurrentListWidget;
};
#endif /* VIDEOLISTVIEWDATA_H */
--- a/videocollection/tsrc/stubs/src/hbdialog.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/src/hbdialog.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -27,7 +27,7 @@
int HbDialog::openAmount = 0;
HbDialog::HbDialog(QGraphicsItem *parent) :
-HbWidget(parent),
+HbPopup(parent),
mHeadingWidget(0),
mContentWidget(0),
mTimeout(NoTimeout),
--- a/videocollection/tsrc/stubs/src/hbmessagebox.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/src/hbmessagebox.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -30,9 +30,9 @@
int HbMessageBoxData::mOpenCallCount = 0;
int HbMessageBoxData::mShowCallCount = 0;
-HbMessageBox::HbMessageBox(MessageBoxType type, QGraphicsItem *parent)
+HbMessageBox::HbMessageBox(MessageBoxType type, QGraphicsItem *parent) :
+ HbDialog(parent)
{
- Q_UNUSED(parent);
HbMessageBoxData::mType = type;
HbAction *action = new HbAction();
--- a/videocollection/tsrc/stubs/src/videocollectionuiloader.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videocollectionuiloader.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -37,10 +37,12 @@
QStringList VideoCollectionUiLoaderData::mFindFailureNameList;
QMap<VideoCollectionUiLoader::ActionIds, HbAction*> VideoCollectionUiLoaderData::mMenuActions;
int VideoCollectionUiLoaderData::mLastLoadPhasedData = -1;
+int VideoCollectionUiLoaderData::mAddDataCallCount = 0;
VideoCollectionUiLoader::VideoCollectionUiLoader():
HbDocumentLoader(),
mTimerId(0),
+ mSortGroup(0),
mIsService(0)
{
// not stubbed
@@ -60,6 +62,7 @@
QObject *receiver,
const char *slot)
{
+ VideoCollectionUiLoaderData::mAddDataCallCount++;
Q_UNUSED(params);
Q_UNUSED(receiver);
Q_UNUSED(slot);
@@ -190,18 +193,22 @@
else if(name == DOCML_NAME_SORT_BY_DATE)
{
VideoCollectionUiLoaderData::mMenuActions[EActionSortByDate] = qobject_cast<HbAction*>(object);
+ VideoCollectionUiLoaderData::mMenuActions[EActionSortByDate]->setCheckable(true);
}
else if(name == DOCML_NAME_SORT_BY_NAME)
{
VideoCollectionUiLoaderData::mMenuActions[EActionSortByName] = qobject_cast<HbAction*>(object);
+ VideoCollectionUiLoaderData::mMenuActions[EActionSortByName]->setCheckable(true);
}
else if(name == DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS)
{
VideoCollectionUiLoaderData::mMenuActions[EACtionSortByItemCount] = qobject_cast<HbAction*>(object);
+ VideoCollectionUiLoaderData::mMenuActions[EACtionSortByItemCount]->setCheckable(true);
}
else if(name == DOCML_NAME_SORT_BY_SIZE)
{
VideoCollectionUiLoaderData::mMenuActions[EActionSortBySize] = qobject_cast<HbAction*>(object);
+ VideoCollectionUiLoaderData::mMenuActions[EActionSortBySize]->setCheckable(true);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videolistmenu.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videolist view class source code
+*
+*/
+
+// Version : %version: 1 %
+
+// INCLUDE FILES
+
+#include "videolistmenu.h"
+#include "videolistview.h"
+#include "videocollectionuiloader.h"
+#include "videocollectionviewutils.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListMenu::VideoListMenu(VideoCollectionUiLoader *uiLoader, VideoListView* parent)
+ : QObject(parent)
+ , mUiUtils(VideoCollectionViewUtils::instance())
+{
+ Q_UNUSED(uiLoader);
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListMenu::~VideoListMenu()
+{
+}
+
+// ---------------------------------------------------------------------------
+// initializeView()
+// ---------------------------------------------------------------------------
+//
+int VideoListMenu::initializeMenu()
+{
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// showAction()
+// ---------------------------------------------------------------------------
+//
+void VideoListMenu::showAction(bool show, const QString &name)
+{
+ Q_UNUSED(show);
+ Q_UNUSED(name);
+}
+
+// ---------------------------------------------------------------------------
+// startSorting()
+// ---------------------------------------------------------------------------
+//
+void VideoListMenu::startSorting()
+{
+}
+
+// ---------------------------------------------------------------------------
+// doSorting()
+// ---------------------------------------------------------------------------
+//
+void VideoListMenu::doSorting(int role)
+{
+ Q_UNUSED(role);
+}
+
+// -------------------------------------------------------------------------------------------------
+// deleteItemsSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::deleteItemsSlot()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// createCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::createCollectionSlot()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// addVideosToCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::addVideosToCollectionSlot()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// aboutToShowMainMenuSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::aboutToShowMainMenuSlot()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// prepareBrowseServiceMenu
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::prepareBrowseServiceMenu()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// objectReadySlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::objectReadySlot(QObject *object, const QString &name)
+{
+ Q_UNUSED(object);
+ Q_UNUSED(name);
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videolisttoolbar.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoListToolbar class source code
+*
+*/
+
+// Version : %version: 1 %
+
+// INCLUDE FILES
+#include <qactiongroup.h>
+#include <hbaction.h>
+
+#include "videolisttoolbar.h"
+#include "videolisttoolbardata.h"
+#include "videolistview.h"
+#include "videocollectionuiloader.h"
+#include "videocollectioncommon.h"
+#include "videocollectionviewutils.h"
+
+int VideoListToolbarData::mViewStateChangedCount(0);
+VideoCollectionCommon::TCollectionLevels VideoListToolbarData::mViewStateChangedLevel(
+ VideoCollectionCommon::ELevelInvalid);
+bool VideoListToolbarData::mViewStateChangedNoVideos(false);
+bool VideoListToolbarData::mViewStateChangedModelReady(false);
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListToolbar::VideoListToolbar(VideoCollectionUiLoader* uiLoader, VideoListView* parent)
+ : QObject(parent)
+ , mUiUtils(VideoCollectionViewUtils::instance())
+{
+ Q_UNUSED(uiLoader);
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListToolbar::~VideoListToolbar()
+{
+}
+
+// ---------------------------------------------------------------------------
+// initialize()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::initialize()
+{
+}
+
+// ---------------------------------------------------------------------------
+// viewStateChanged()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::viewStateChanged(
+ VideoCollectionCommon::TCollectionLevels currentLevel,
+ bool noVideos, bool modelReady)
+{
+ VideoListToolbarData::mViewStateChangedCount++;
+ VideoListToolbarData::mViewStateChangedLevel = currentLevel;
+ VideoListToolbarData::mViewStateChangedNoVideos = noVideos;
+ VideoListToolbarData::mViewStateChangedModelReady = modelReady;
+}
+
+// ---------------------------------------------------------------------------
+// createToolbarActions()
+// Creates toolbar actions and toolbar icons
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::createToolbarActions()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createOperatorServicesToolbar()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::createOperatorServicesToolbarActions()
+{
+}
+
+// ---------------------------------------------------------------------------
+// loadOperatorService()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey)
+{
+ Q_UNUSED(titleKey);
+ Q_UNUSED(iconKey);
+ Q_UNUSED(uriKey);
+ Q_UNUSED(uidKey);
+}
+
+// ---------------------------------------------------------------------------
+// openOperatorServiceSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::openOperatorServiceSlot()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// addVideosToCollectionSlot()
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListToolbar::addVideosToCollectionSlot()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// removeVideosFromCollectionSlot()
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListToolbar::removeVideosFromCollectionSlot()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createAction()
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListToolbar::createAction(QString icon,
+ QActionGroup* actionGroup, const char *slot)
+{
+ Q_UNUSED(icon);
+ Q_UNUSED(actionGroup);
+ Q_UNUSED(slot);
+
+ return 0;
+}
+
+// End of file
--- a/videocollection/tsrc/stubs/src/videolistview.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videolistview.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -16,6 +16,7 @@
*/
#include "videolistview.h"
+#include "videolistwidget.h"
#include "videocollectionviewutils.h"
#include "videocollectionwrapper.h"
@@ -26,6 +27,7 @@
int VideoListViewData::mDeactivateViewCount = 0;
int VideoListViewData::mInitializeViewCount = 0;
TMPXItemId VideoListViewData::mActivatedItemId = TMPXItemId::InvalidId();
+VideoListWidget* VideoListViewData::mCurrentListWidget = 0;
VideoListView::VideoListView(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
HbView(parent),
@@ -34,11 +36,7 @@
mUiLoader(uiLoader),
mModelReady(false),
mVideoServices(0),
-mCurrentList(0),
-mToolbarViewsActionGroup(0),
-mToolbarCollectionActionGroup(0),
-mToolbarServiceExtension(0)
-
+mCurrentList(0)
{
// not stubbed
}
@@ -112,29 +110,13 @@
return 0;
}
-void VideoListView::createOperatorServicesToolbar()
-{
- // not stubbed
-}
-
-void VideoListView::loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey)
+VideoListWidget *VideoListView::getCurrentList()
{
- // not stubbed
- Q_UNUSED(titleKey);
- Q_UNUSED(iconKey);
- Q_UNUSED(uriKey);
- Q_UNUSED(uidKey);
-}
-
-HbAction* VideoListView::createAction(QString icon,
- QActionGroup* actionGroup,
- const char *slot)
-{
- Q_UNUSED(icon);
- Q_UNUSED(actionGroup);
- Q_UNUSED(slot);
- // not stubbed
- return 0;
+ if(VideoListViewData::mCurrentListWidget)
+ {
+ return VideoListViewData::mCurrentListWidget;
+ }
+ return mCurrentList;
}
void VideoListView::showHint(bool show)
@@ -154,13 +136,6 @@
// not stubbed
}
-void VideoListView::showAction(bool show, const QString &name)
-{
- Q_UNUSED(show);
- Q_UNUSED(name);
- // not stubbed
-}
-
void VideoListView::openAllVideosViewSlot()
{
// not stubbed
@@ -171,16 +146,6 @@
// not stubbed
}
-void VideoListView::openOperatorServiceSlot()
-{
- // not stubbed
-}
-
-void VideoListView::startSorting()
-{
- // not stubbed
-}
-
void VideoListView::aboutToChangeOrientationSlot()
{
// not stubbed
@@ -192,36 +157,6 @@
// not stubbed
}
-void VideoListView::deleteItemsSlot()
-{
- // not stubbed
-}
-
-void VideoListView::createCollectionSlot()
-{
- // not stubbed
-}
-
-void VideoListView::addVideosToCollectionSlot()
-{
- // not stubbed
-}
-
-void VideoListView::removeVideosFromCollectionSlot()
-{
- // not stubbed
-}
-
-void VideoListView::aboutToShowMainMenuSlot()
-{
- // not stubbed
-}
-
-void VideoListView::prepareBrowseServiceMenu()
-{
- // not stubbed
-}
-
void VideoListView::handleAsyncStatusSlot(int statusCode, QVariant &additional)
{
Q_UNUSED(statusCode);
@@ -246,19 +181,20 @@
// not stubbed
}
-void VideoListView::doSorting(int value)
-{
- Q_UNUSED(value);
-}
-
void VideoListView::doDelayedsSlot()
{
// not stubbed
}
-void VideoListView::debugNotImplementedYet()
+
+void VideoListView::toolbarActionsChanged(QList<QAction*> newActions)
{
- // not stubbed
+ Q_UNUSED(newActions);
+}
+
+void VideoListView::toolbarExtensionChanged(HbToolBarExtension* newExtension)
+{
+ Q_UNUSED(newExtension);
}
// end of file
--- a/videocollection/tsrc/stubs/stubs.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/tsrc/stubs/stubs.pro Mon Sep 20 18:25:37 2010 +0300
@@ -36,6 +36,7 @@
inc/xqserviceproviderstub.h \
inc/xqsettingsmanagerstub.h \
inc/testobjectstore.h \
+ inc/hbpopup.h \
inc/hbabstractitemview.h \
inc/hbdocumentloader.h \
inc/hbaction.h \
@@ -75,6 +76,7 @@
inc/videohintwidgetdata.h \
inc/videolistwidgetdata.h \
inc/videolistviewdata.h \
+ inc/videolisttoolbardata.h \
inc/videoplayerappexport.h \
inc/videoproxymodeldata.h \
inc/videothumbnailtestdata.h \
@@ -90,6 +92,8 @@
../../videocollectionview/inc/videolistselectiondialog.h \
../../videocollectionview/inc/videolistwidget.h \
../../videocollectionview/inc/videolistview.h \
+ ../../videocollectionview/inc/videolistmenu.h \
+ ../../videocollectionview/inc/videolisttoolbar.h \
../../videocollectionwrapper/inc/videolistdatamodel.h \
../../videocollectionwrapper/inc/videocollectionwrapper.h \
../../videocollectionwrapper/inc/videoproxymodelgeneric.h \
@@ -132,6 +136,8 @@
src/videolistselectiondialog.cpp \
src/videolistwidget.cpp \
src/videolistview.cpp \
+ src/videolistmenu.cpp \
+ src/videolisttoolbar.cpp \
src/videolistdatamodel.cpp \
src/videocollectionwrapper.cpp \
src/videoproxymodelgeneric.cpp \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolistmenu.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoListMenu class definition
+*
+*/
+
+#ifndef VIDEOLISTMENU_H
+#define VIDEOLISTMENU_H
+
+#include <qobject.h>
+#include <qmap.h>
+#include <hbaction.h>
+
+class TMPXItemId;
+class VideoListView;
+class VideoCollectionViewUtils;
+class VideoProxyModelGeneric;
+class VideoCollectionUiLoader;
+class VideoListSelectionDialog;
+class VideoServices;
+
+/**
+ * Class handles the menu for VideoListView.
+ */
+class VideoListMenu : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ * @param uiLoader VideoCollectionUiLoader instance
+ * @param parent VideoListView parent
+ */
+ VideoListMenu(VideoCollectionUiLoader* uiLoader, VideoListView* parent);
+
+ /**
+ * Destructor.
+ *
+ */
+ ~VideoListMenu();
+
+ /**
+ * Creates and initializes menu and connects signals
+ *
+ * @return 0 if ok, < 0 if initialisation fails
+ */
+ int initializeMenu();
+
+private:
+
+ /**
+ * Shows or hides a menu action.
+ */
+ void showAction(bool show, const QString &name);
+
+private slots:
+
+ /**
+ * Slot is connected into main menus sort -items
+ * Method checks sorting role based on active menu item and initiates sorting
+ *
+ */
+ void startSorting();
+
+ /**
+ * Method checks the sorting role and starts sorting
+ *
+ */
+ void doSorting(int role);
+
+ /**
+ * Slot is connected into main menus "delete items" (delete...) signal
+ *
+ * Calls ui utils to show multiple delete dialog for current widget
+ *
+ */
+ void deleteItemsSlot();
+
+ /**
+ * Slot is connected into main menus "Create new collection..." signal
+ * Shows a selection dialog for creating a new collection
+ *
+ */
+ void createCollectionSlot();
+
+ /**
+ * Slot is connected into toolbar's "Add videos" signal
+ *
+ */
+ void addVideosToCollectionSlot();
+
+ /**
+ * Slot is connected into main menus aboutToShow -signal
+ *
+ */
+ void aboutToShowMainMenuSlot();
+
+ /**
+ * Prepare menu when videos used through browsing service.
+ */
+ void prepareBrowseServiceMenu();
+
+ /**
+ * Slot which is called when an object has been loaded.
+ */
+ void objectReadySlot(QObject *object, const QString &name);
+
+private:
+
+ /**
+ * Reference to video collection view utils
+ */
+ VideoCollectionViewUtils &mUiUtils;
+
+ /**
+ * Pointer to the XML UI (DocML) loader, not owned
+ */
+ VideoCollectionUiLoader* mUiLoader;
+
+ /**
+ * Pointer to VideoListView.
+ * Not own.
+ */
+ VideoListView* mListView;
+
+ /**
+ * Pointer to videoservices instance
+ * if exists, app has started as service
+ */
+ VideoServices* mVideoServices;
+
+ /**
+ * Sorting roles mapped to appropriate actions.
+ */
+ QMap<HbAction*, int> mSortingRoles;
+
+};
+
+#endif // VIDEOLISTMENU_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolisttoolbar.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoListToolbar class definition
+*
+*/
+
+#ifndef VIDEOLISTTOOLBAR_H
+#define VIDEOLISTTOOLBAR_H
+
+#include <qobject.h>
+#include <hbaction.h>
+#include <videocollectioncommon.h>
+#include <videocollectionviewutils.h>
+
+class QActionGroup;
+class QAction;
+class HbToolBarExtension;
+class VideoServices;
+class VideoOperatorService;
+class VideoCollectionUiLoader;
+class VideoListView;
+
+/**
+ * Class controls the visible toolbar actions.
+ */
+class VideoListToolbar: public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ */
+ VideoListToolbar(VideoCollectionUiLoader* uiLoader, VideoListView* parent);
+
+ /**
+ * Destructor.
+ */
+ ~VideoListToolbar();
+
+ /**
+ * Creates needed internal variables. Should be called before this class is used.
+ * Note that the service information should be set in the VideoCollectionViewUtils
+ * before this is called for correct operation.
+ */
+ void initialize();
+
+signals:
+
+ /**
+ * Emitted when actions for toolbar have been changed.
+ */
+ void actionsChanged(QList<QAction*> actions);
+
+ /**
+ * Emitted when need changes to toolbar extension.
+ */
+ void toolbarExtensionChanged(HbToolBarExtension* extension);
+
+ /**
+ * Emitted when all videos action is triggered.
+ */
+ void allVideosActionTriggered();
+
+ /**
+ * Emitted when collection view action is triggered.
+ */
+ void collectionViewActionTriggered();
+
+public slots:
+
+ /**
+ * Should be called, whenever state of the view changes, that
+ * could affect the toolbar actions.
+ *
+ * @param currentLevel current view level.
+ * @param noVideos if list has videos or not.
+ * @param modelReady if the model is ready or not.
+ */
+ void viewStateChanged(VideoCollectionCommon::TCollectionLevels currentLevel,
+ bool noVideos, bool modelReady);
+
+ /**
+ * Launches the first operator service from the operator service list.
+ */
+ void openOperatorServiceSlot();
+
+ /**
+ * Slot is connected into "Add videos" signal
+ *
+ */
+ void addVideosToCollectionSlot();
+
+ /**
+ * Slot is connected into "remove videos" signal
+ */
+ void removeVideosFromCollectionSlot();
+
+private:
+
+ /**
+ * Creates actions for toolbar.
+ */
+ void createToolbarActions();
+
+ /**
+ * Loads video services from central respository and creates toolbar buttons for them.
+ */
+ void createOperatorServicesToolbarActions();
+
+ /**
+ * Loads video service from Central Repository and stores it into member array.
+ *
+ * @param titleKey CenRep key for service title.
+ * @param iconKey CenRep key for icon resource.
+ * @param uriKey CenRep key for service URI.
+ * @param uidKey CenRep key for service application UID.
+ */
+ void loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey);
+
+ /**
+ * Creates action with given parameters. createActionGroup() must be called successfully
+ * before using this method.
+ *
+ * @param tooltip Tooltip text for the action.
+ * @param icon Filepath for the icon file.
+ * @param actionGroup Actiongroup for created action.
+ * @param slot Slot for the triggered signal of the action.
+ * @return HbAction pointer if creation ok, otherwise 0
+ */
+ HbAction* createAction(QString icon, QActionGroup* actionGroup, const char *slot);
+
+private:
+
+ /**
+ * Actions ids used in tool bar
+ */
+ enum TViewActionIds
+ {
+ ETBActionAllVideos = 10,
+ ETBActionCollections = 11,
+ ETBActionServices = 12,
+ ETBActionAddVideos = 13,
+ ETBActionRemoveVideos = 14
+ };
+
+ /**
+ * Holds the current level state.
+ */
+ VideoCollectionCommon::TCollectionLevels mCurrentLevel;
+
+ /**
+ * Reference to video collection view utils
+ */
+ VideoCollectionViewUtils &mUiUtils;
+
+ /**
+ * Pointer to the XML UI (DocML) loader.
+ * Not owned
+ */
+ VideoCollectionUiLoader* mUiLoader;
+
+ /**
+ * Pointer to parent VideoListView.
+ * Not own.
+ */
+ VideoListView* mListView;
+
+ /**
+ * Pointer to videoservices instance
+ * if exists, app has started as service
+ */
+ VideoServices* mVideoServices;
+
+ /**
+ * Action group for the toolbar.
+ */
+ QActionGroup* mToolbarViewsActionGroup;
+
+ /**
+ * Action group for the toolbar.
+ */
+ QActionGroup* mToolbarCollectionActionGroup;
+
+ /**
+ * Map containing toolbar actions
+ */
+ QMap<TViewActionIds, HbAction*> mToolbarActions;
+
+ /**
+ * Actions for different view states
+ */
+ QHash<VideoCollectionCommon::TCollectionLevels, QList<QAction*> > mViewStateActions;
+
+ /**
+ * Toolbar extension for operator services when there's more than
+ * one of them.
+ */
+ HbToolBarExtension *mToolbarServiceExtension;
+
+ /**
+ * List of operator services.
+ */
+ QList<VideoOperatorService *> mVideoOperatorServices;
+};
+
+#endif // VIDEOLISTTOOLBAR_H
--- a/videocollection/videocollectionview/inc/videolistview.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionview/inc/videolistview.h Mon Sep 20 18:25:37 2010 +0300
@@ -20,27 +20,21 @@
#include <hbview.h>
#include <qnamespace.h>
-#include <qabstractitemmodel.h>
#include <hbaction.h>
#include "videohintwidget.h"
class QGraphicsItem;
+class QVariant;
+class HbToolBarExtension;
+class TMPXItemId;
class VideoListWidget;
-class QActionGroup;
-class QVariant;
class VideoCollectionViewUtils;
-class VideoProxyModelGeneric;
class VideoCollectionWrapper;
-class HbStackedWidget;
class VideoCollectionUiLoader;
-class HbGroupBox;
-class VideoListSelectionDialog;
-class HbMenu;
class VideoServices;
-class TMPXItemId;
-class HbToolBarExtension;
-class VideoOperatorService;
+class VideoListToolbar;
+class VideoListMenu;
/**
* Class acts as an container for widgets that are used to display different
@@ -98,6 +92,14 @@
*
*/
void back();
+
+ /**
+ * Returns pointer to currently active VideoListWidget. Null if no
+ * active widget yet.
+ *
+ * @return Currently active VideoListWidget, or null if no widget active.
+ */
+ VideoListWidget* getCurrentList();
signals:
@@ -170,64 +172,6 @@
void openCollectionViewSlot();
/**
- * Slot is connected into hint widget's button's clicked signal.
- *
- * Activates first operator service.
- *
- */
- void openOperatorServiceSlot();
-
- /**
- * Slot is connected into main menus sort -items
- * Method checks sorting role based on active menu item and initiates sorting
- *
- */
- void startSorting();
-
- /**
- * Method checks the sorting role and starts sorting
- *
- */
- void doSorting(int role);
-
- /**
- * Slot is connected into main menus "delete items" (delete...) signal
- *
- * Calls ui utils to show multiple delete dialog for current widget
- *
- */
- void deleteItemsSlot();
-
- /**
- * Slot is connected into main menus "Create new collection..." signal
- * Shows a selection dialog for creating a new collection
- *
- */
- void createCollectionSlot();
-
- /**
- * Slot is connected into toolbar's "Add videos" signal
- *
- */
- void addVideosToCollectionSlot();
-
- /**
- * Slot is connected into toolbar's "remove videos" signal
- */
- void removeVideosFromCollectionSlot();
-
- /**
- * Slot is connected into main menus aboutToShow -signal
- *
- */
- void aboutToShowMainMenuSlot();
-
- /**
- * Prepare menu when videos used through browsing service.
- */
- void prepareBrowseServiceMenu();
-
- /**
* Slot is connected into hbInstance's primary window's
* aboutToChangeOrientation -signal. This is called when
* orientation is to be change.
@@ -268,13 +212,16 @@
*/
void objectReadySlot(QObject *object, const QString &name);
- // TODO: following can be removed after all implementation ready
/**
- * Slot is connected into item signals that are not yet implemented.
- * Slot shows "Not yet implemented" note
+ * Slot which is called when actions in toolbar needs to be changed.
*/
- void debugNotImplementedYet();
-
+ void toolbarActionsChanged(QList<QAction*> newActions);
+
+ /**
+ * Slot which is called when toolbar extension needs to be changed.
+ */
+ void toolbarExtensionChanged(HbToolBarExtension* newExtension);
+
private:
/**
* Convenience method that modelReadySlot and albumListReadySlot calls.
@@ -296,33 +243,6 @@
int createToolbar();
/**
- * Loads video services from central respository and creates toolbar buttons for them.
- */
- void createOperatorServicesToolbar();
-
- /**
- * Loads video service from Central Repository and stores it into member array.
- *
- * @param titleKey CenRep key for service title.
- * @param iconKey CenRep key for icon resource.
- * @param uriKey CenRep key for service URI.
- * @param uidKey CenRep key for service application UID.
- */
- void loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey);
-
- /**
- * Creates action with given parameters. createActionGroup() must be called successfully
- * before using this method.
- *
- * @param tooltip Tooltip text for the action.
- * @param icon Filepath for the icon file.
- * @param actionGroup Actiongroup for created action.
- * @param slot Slot for the triggered signal of the action.
- * @return HbAction pointer if creation ok, otherwise 0
- */
- HbAction* createAction(QString icon, QActionGroup* actionGroup, const char *slot);
-
- /**
* Shows or hides the hint. Only shows the hint if model does not have any
* items.
*
@@ -341,11 +261,6 @@
void updateSubLabel();
/**
- * Shows or hides a menu action.
- */
- void showAction(bool show, const QString &name);
-
- /**
* Activates all videos or collections -list.
*
* @return int 0 ok
@@ -365,18 +280,6 @@
private:
/**
- * Actions ids used in main menu and tool bar
- */
- enum TViewActionIds
- {
- ETBActionAllVideos = 10,
- ETBActionCollections = 11,
- ETBActionServices = 12,
- ETBActionAddVideos = 13,
- ETBActionRemoveVideos = 14
- };
-
- /**
* Reference to video collection view utils
*/
VideoCollectionViewUtils &mUiUtils;
@@ -392,6 +295,16 @@
VideoCollectionUiLoader* mUiLoader;
/**
+ * Toolbar handler.
+ */
+ VideoListToolbar* mToolbar;
+
+ /**
+ * Menu handler.
+ */
+ VideoListMenu* mMenu;
+
+ /**
* Boolean for knowing when the model is ready.
*/
bool mModelReady;
@@ -418,40 +331,10 @@
VideoListWidget* mCurrentList;
/**
- * Action group for the toolbar.
- */
- QActionGroup* mToolbarViewsActionGroup;
-
- /**
- * Action group for the toolbar.
- */
- QActionGroup* mToolbarCollectionActionGroup;
-
- /**
- * Map containing toolbar actions
- */
- QMap<TViewActionIds, HbAction*> mToolbarActions;
-
- /**
- * Sorting roles mapped to appropriate actions.
- */
- QMap<HbAction*, int> mSortingRoles;
-
- /**
* String containing the name of the currently open collection
*/
QString mCollectionName;
- /**
- * Toolbar extension for operator services when there's more than
- * one of them.
- */
- HbToolBarExtension *mToolbarServiceExtension;
-
- /**
- * List of operator services.
- */
- QList<VideoOperatorService *> mVideoOperatorServices;
};
#endif // VIDEOLISTVIEW_H
--- a/videocollection/videocollectionview/src/videocollectionviewutils.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionviewutils.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 51 %
+// Version : %version: 52 %
// INCLUDE FILES
#include <hbglobal.h>
@@ -464,23 +464,26 @@
if(msg.count() > 0)
{
+ HbDialog *note = 0;
if(error)
{
- HbMessageBox *messageBox = new HbMessageBox(msg, HbMessageBox::MessageTypeWarning);
- messageBox->setAttribute(Qt::WA_DeleteOnClose);
- messageBox->setObjectName(VIEW_UTILS_OBJECT_NAME_MESSAGE_BOX_WARNING);
- messageBox->show();
+ note = new HbMessageBox(msg, HbMessageBox::MessageTypeWarning);
+ qobject_cast<HbMessageBox*>(note)->setStandardButtons( HbMessageBox::NoButton );
+ note->setObjectName(VIEW_UTILS_OBJECT_NAME_MESSAGE_BOX_WARNING);
}
else
{
- HbNotificationDialog *infoNote = new HbNotificationDialog();
- infoNote->setAttribute(Qt::WA_DeleteOnClose);
+ note = new HbNotificationDialog();
+
// only title can be two rows for HbNotificationDialog
- infoNote->setTitleTextWrapping(Hb::TextWordWrap);
- infoNote->setTitle(msg);
- infoNote->setObjectName(VIEW_UTILS_OBJECT_NAME_STATUS_MSG);
- infoNote->show();
+ qobject_cast<HbNotificationDialog*>(note)->setTitleTextWrapping(Hb::TextWordWrap);
+ qobject_cast<HbNotificationDialog*>(note)->setTitle(msg);
+ note->setObjectName(VIEW_UTILS_OBJECT_NAME_STATUS_MSG);
}
+ note->setAttribute(Qt::WA_DeleteOnClose);
+ note->setDismissPolicy(HbPopup::TapAnywhere);
+ note->setTimeout(HbPopup::StandardTimeout);
+ note->show();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolistmenu.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,546 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videolist view class source code
+*
+*/
+
+// Version : %version: 1 %
+
+// INCLUDE FILES
+
+#include <hbmenu.h>
+
+#include "videolistmenu.h"
+#include "videolistselectiondialog.h"
+#include "videocollectionviewutils.h"
+#include "videolistwidget.h"
+#include "videolistview.h"
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+#include "videocollectionuiloader.h"
+#include "videocollectiontrace.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListMenu::VideoListMenu(VideoCollectionUiLoader *uiLoader, VideoListView* parent)
+ : QObject(parent)
+ , mUiUtils(VideoCollectionViewUtils::instance())
+ , mUiLoader(uiLoader)
+ , mListView(parent)
+ , mVideoServices(0)
+{
+ FUNC_LOG;
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListMenu::~VideoListMenu()
+{
+ FUNC_LOG;
+
+ mSortingRoles.clear();
+
+ if(mVideoServices)
+ {
+ mVideoServices->decreaseReferenceCount();
+ mVideoServices = 0;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// initializeView()
+// ---------------------------------------------------------------------------
+//
+int VideoListMenu::initializeMenu()
+{
+ FUNC_LOG;
+ if(!mUiLoader)
+ {
+ return -1;
+ }
+
+ if (mUiUtils.isService())
+ {
+ INFO("VideoListMenu::initializeMenu() initializing service.");
+ if (!mVideoServices)
+ {
+ mVideoServices = VideoServices::instance();
+ }
+
+ }
+
+ // start loading objects and widgets
+ QList<VideoCollectionUiLoaderParam> params;
+
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_OPTIONS_MENU,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ true,
+ VideoCollectionUiLoaderParam::LoadPhasePrimary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_ADD_TO_COLLECTION,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ false,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_CREATE_COLLECTION,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ false,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_DELETE_MULTIPLE,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ false,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_SORT_MENU,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ true,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_SORT_BY_DATE,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ false,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_SORT_BY_NAME,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ false,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ false,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+ params.append(VideoCollectionUiLoaderParam(
+ DOCML_NAME_SORT_BY_SIZE,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ false,
+ VideoCollectionUiLoaderParam::LoadPhaseSecondary));
+
+ mUiLoader->addData(params,
+ this,
+ SLOT(objectReadySlot(QObject*, const QString&)));
+
+ params.clear();
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// showAction()
+// ---------------------------------------------------------------------------
+//
+void VideoListMenu::showAction(bool show, const QString &name)
+{
+ FUNC_LOG;
+ HbAction *action = mUiLoader->findObject<HbAction>(name);
+ if (!action)
+ {
+ // must be menu widget
+ HbMenu *menu = mUiLoader->findWidget<HbMenu>(name);
+ if (menu)
+ {
+ action = menu->menuAction();
+ }
+ }
+
+ // hide or show action
+ if (action)
+ {
+ action->setVisible(show);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// startSorting()
+// ---------------------------------------------------------------------------
+//
+void VideoListMenu::startSorting()
+{
+ FUNC_LOG;
+
+ HbMenu *optionsMenu =
+ mUiLoader->findWidget<HbMenu>(
+ DOCML_NAME_OPTIONS_MENU);
+
+ VideoListWidget* currentList = mListView->getCurrentList();
+
+ if (optionsMenu && currentList)
+ {
+ // get sorting role from active action
+ HbAction* action = optionsMenu->activeAction();
+ HbMenu* sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ if(action == sortMenu->menuAction()) // make sure that active action is the sort menu.
+ {
+ HbAction* action = sortMenu->activeAction();
+ if(action)
+ {
+ doSorting(mSortingRoles[action]);
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// doSorting()
+// ---------------------------------------------------------------------------
+//
+void VideoListMenu::doSorting(int role)
+{
+ FUNC_LOG;
+
+ VideoListWidget* currentList = mListView->getCurrentList();
+
+ if(!currentList || !currentList->getModel())
+ {
+ // no list or model, cannot sort
+ return;
+ }
+ // sort model
+ Qt::SortOrder order(Qt::AscendingOrder);
+ VideoProxyModelGeneric *model = currentList->getModel();
+ if(model->sortRole() == role && model->sortOrder() == Qt::AscendingOrder)
+ {
+ order = Qt::DescendingOrder;
+ }
+ model->doSorting(role, order);
+
+ // for video related sorting, all videos list and collection content
+ // list, sorting orders are same all the time
+ VideoListWidget *anotherVideosList = 0;
+ VideoCollectionCommon::TCollectionLevels level = currentList->getLevel();
+ if (level == VideoCollectionCommon::ELevelDefaultColl ||
+ level == VideoCollectionCommon::ELevelAlbum)
+ {
+ anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ }
+ else if(level == VideoCollectionCommon::ELevelVideos)
+ {
+ anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
+ }
+ if(anotherVideosList && anotherVideosList->getModel())
+ {
+ anotherVideosList->getModel()->doSorting(role, order);
+ }
+
+ // save sorting values only if the application is not started as a service
+ if (!mVideoServices)
+ {
+ // save sorting values
+ mUiUtils.saveSortingValues(role, order, currentList->getLevel());
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// deleteItemsSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::deleteItemsSlot()
+{
+ FUNC_LOG;
+
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+
+ if (dialog)
+ {
+ TMPXItemId collectionId = mListView->getCurrentList()->getModel()->getOpenItem();
+ dialog->setupContent(VideoListSelectionDialog::EDeleteVideos, collectionId);
+ dialog->exec();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// createCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::createCollectionSlot()
+{
+ FUNC_LOG;
+
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+
+ if (!dialog)
+ {
+ // fatal: no selection dialog
+ return;
+ }
+
+ dialog->setupContent(VideoListSelectionDialog::ECreateCollection, TMPXItemId::InvalidId());
+ dialog->exec();
+}
+
+// -------------------------------------------------------------------------------------------------
+// addVideosToCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::addVideosToCollectionSlot()
+{
+ FUNC_LOG;
+
+ VideoListWidget* currentList = mListView->getCurrentList();
+
+ if(!currentList || !currentList->getModel())
+ {
+ return;
+ }
+
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+
+ if (!dialog)
+ {
+ // fatal: no selection dialog
+ return;
+ }
+
+ TMPXItemId collectionId = currentList->getModel()->getOpenItem();
+ dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId);
+ dialog->exec();
+}
+
+// -------------------------------------------------------------------------------------------------
+// aboutToShowMainMenuSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::aboutToShowMainMenuSlot()
+{
+ if (mVideoServices &&
+ mVideoServices->currentService() == VideoServices::EBrowse)
+ {
+ prepareBrowseServiceMenu();
+ return;
+ }
+
+ VideoListWidget* currentList = mListView->getCurrentList();
+
+ if (!currentList)
+ {
+ return;
+ }
+
+ // hide all actions by default
+ showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
+ showAction(false, DOCML_NAME_CREATE_COLLECTION);
+ showAction(false, DOCML_NAME_DELETE_MULTIPLE);
+ showAction(false, DOCML_NAME_SORT_BY_DATE);
+ showAction(false, DOCML_NAME_SORT_BY_NAME);
+ showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ showAction(false, DOCML_NAME_SORT_BY_SIZE);
+ showAction(false, DOCML_NAME_SORT_MENU);
+
+ // Create collection action is shown even when there's no videos.
+ if(currentList->getLevel() == VideoCollectionCommon::ELevelCategory && !mVideoServices)
+ {
+ showAction(true, DOCML_NAME_CREATE_COLLECTION);
+ }
+
+ // No other actions shown if there's no videos.
+ VideoProxyModelGeneric *model = currentList->getModel();
+ if (!model || !model->rowCount())
+ {
+ return;
+ }
+
+ // get current sorting values
+ int role;
+ Qt::SortOrder order;
+ model->getSorting(role, order);
+
+ if(currentList->getLevel() == VideoCollectionCommon::ELevelVideos)
+ {
+ showAction(true, DOCML_NAME_SORT_MENU);
+ showAction(true, DOCML_NAME_SORT_BY_DATE);
+ showAction(true, DOCML_NAME_SORT_BY_NAME);
+ showAction(true, DOCML_NAME_SORT_BY_SIZE);
+
+ HbAction* action = mSortingRoles.key(role);
+ if (action)
+ {
+ action->setChecked(true);
+ }
+
+ if (!mVideoServices)
+ {
+ showAction(true, DOCML_NAME_ADD_TO_COLLECTION);
+ showAction(true, DOCML_NAME_DELETE_MULTIPLE);
+ }
+ }
+ else if(currentList->getLevel() == VideoCollectionCommon::ELevelCategory)
+ {
+ showAction(true, DOCML_NAME_SORT_MENU);
+ showAction(true, DOCML_NAME_SORT_BY_NAME);
+ showAction(true, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+
+ HbAction* action = mSortingRoles.key(role);
+ if (action)
+ {
+ action->setChecked(true);
+ }
+ }
+ else if(currentList->getLevel() == VideoCollectionCommon::ELevelDefaultColl ||
+ currentList->getLevel() == VideoCollectionCommon::ELevelAlbum)
+ {
+ showAction(true, DOCML_NAME_SORT_MENU);
+ showAction(true, DOCML_NAME_SORT_BY_DATE);
+ showAction(true, DOCML_NAME_SORT_BY_NAME);
+ showAction(true, DOCML_NAME_SORT_BY_SIZE);
+
+ HbAction* action = mSortingRoles.key(role);
+ if (action)
+ {
+ action->setChecked(true);
+ }
+
+ if (!mVideoServices)
+ {
+ showAction(true, DOCML_NAME_DELETE_MULTIPLE);
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// prepareBrowseServiceMenu
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::prepareBrowseServiceMenu()
+{
+ VideoListWidget* currentList = mListView->getCurrentList();
+
+ if (!currentList)
+ {
+ return;
+ }
+
+ // hide all actions by default
+ showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
+ showAction(false, DOCML_NAME_CREATE_COLLECTION);
+ showAction(false, DOCML_NAME_DELETE_MULTIPLE);
+ showAction(false, DOCML_NAME_SORT_BY_DATE);
+ showAction(false, DOCML_NAME_SORT_BY_NAME);
+ showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ showAction(false, DOCML_NAME_SORT_BY_SIZE);
+ showAction(false, DOCML_NAME_SORT_MENU);
+
+ VideoProxyModelGeneric *model = currentList->getModel();
+ if (!model || !model->rowCount())
+ {
+ return;
+ }
+
+ // show delete action
+ showAction(true, DOCML_NAME_DELETE_MULTIPLE);
+
+ // show sort actions
+ showAction(true, DOCML_NAME_SORT_MENU);
+ showAction(true, DOCML_NAME_SORT_BY_DATE);
+ showAction(true, DOCML_NAME_SORT_BY_NAME);
+ showAction(true, DOCML_NAME_SORT_BY_SIZE);
+
+ // set current sort action selected
+ int role;
+ Qt::SortOrder order;
+ model->getSorting(role, order);
+ HbAction* action = mSortingRoles.key(role);
+ if (action)
+ {
+ action->setChecked(true);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// objectReadySlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListMenu::objectReadySlot(QObject *object, const QString &name)
+{
+ FUNC_LOG;
+
+ if (name.compare(DOCML_NAME_OPTIONS_MENU) == 0)
+ {
+ connect(
+ object, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot()));
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_DATE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[action] = VideoCollectionCommon::KeyDateTime;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_NAME) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[action] = VideoCollectionCommon::KeyTitle;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[action] = VideoCollectionCommon::KeyNumberOfItems;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_SIZE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[action] = VideoCollectionCommon::KeySizeValue;
+ }
+ }
+ else if (name.compare(DOCML_NAME_ADD_TO_COLLECTION) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(addVideosToCollectionSlot()));
+ }
+ }
+ else if (name.compare(DOCML_NAME_CREATE_COLLECTION) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(createCollectionSlot()));
+ }
+ }
+ else if (name.compare(DOCML_NAME_DELETE_MULTIPLE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(deleteItemsSlot()));
+ }
+ }
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolisttoolbar.cpp Mon Sep 20 18:25:37 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: VideoListToolbar class source code
+*
+*/
+
+// Version : %version: 1.1.2 %
+
+// INCLUDE FILES
+#include <qactiongroup.h>
+#include <hbaction.h>
+#include <hbtoolbarextension.h>
+#include <vcxmyvideosdefs.h>
+
+#include "videolisttoolbar.h"
+#include "videoservices.h"
+#include "videooperatorservice.h"
+#include "videocollectioncenrepdefs.h"
+#include "videocollectiontrace.h"
+#include "videolistview.h"
+#include "videocollectionuiloader.h"
+#include "videolistwidget.h"
+#include "videoproxymodelgeneric.h"
+#include "videolistselectiondialog.h"
+
+// Object names.
+const char* const LIST_VIEW_OBJECT_NAME_TOOLBAR_EXTENSION = "vc::ListViewToolbarExtension";
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListToolbar::VideoListToolbar(VideoCollectionUiLoader* uiLoader, VideoListView* parent)
+ : QObject(parent)
+ , mCurrentLevel(VideoCollectionCommon::ELevelInvalid)
+ , mUiUtils(VideoCollectionViewUtils::instance())
+ , mUiLoader(uiLoader)
+ , mListView(parent)
+ , mVideoServices(0)
+ , mToolbarViewsActionGroup(0)
+ , mToolbarCollectionActionGroup(0)
+ , mToolbarServiceExtension(0)
+{
+ FUNC_LOG;
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListToolbar::~VideoListToolbar()
+{
+ FUNC_LOG;
+
+ emit actionsChanged(mViewStateActions[VideoCollectionCommon::ELevelInvalid]);
+
+ mToolbarActions.clear();
+
+ delete mToolbarServiceExtension;
+ mToolbarServiceExtension = 0;
+
+ if(mVideoServices)
+ {
+ mVideoServices->decreaseReferenceCount();
+ mVideoServices = 0;
+ }
+
+ QList<VideoOperatorService *>::const_iterator iter = mVideoOperatorServices.constBegin();
+ while(iter != mVideoOperatorServices.constEnd())
+ {
+ delete *iter;
+ iter++;
+ }
+ mVideoOperatorServices.clear();
+}
+
+// ---------------------------------------------------------------------------
+// initialize()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::initialize()
+{
+ if (mUiUtils.isService())
+ {
+ INFO("VideoListToolbar::initialize() initializing service.");
+ if (!mVideoServices)
+ {
+ mVideoServices = VideoServices::instance();
+ }
+
+ }
+ else if(mVideoServices)
+ {
+ mVideoServices->decreaseReferenceCount();
+ mVideoServices = 0;
+ }
+
+ createToolbarActions();
+}
+
+// ---------------------------------------------------------------------------
+// viewStateChanged()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::viewStateChanged(
+ VideoCollectionCommon::TCollectionLevels currentLevel,
+ bool noVideos, bool modelReady)
+{
+ if(!mToolbarViewsActionGroup || !mToolbarCollectionActionGroup)
+ {
+ // not initialized yet.
+ return;
+ }
+
+ if(currentLevel != mCurrentLevel)
+ {
+ QList<QAction*> newActions = mViewStateActions[currentLevel];
+ QList<QAction*> oldActions = mViewStateActions[mCurrentLevel];
+
+ mCurrentLevel = currentLevel;
+
+ if(newActions != oldActions)
+ {
+ emit actionsChanged(newActions);
+
+ if(mToolbarServiceExtension &&
+ (mCurrentLevel == VideoCollectionCommon::ELevelCategory ||
+ mCurrentLevel == VideoCollectionCommon::ELevelVideos))
+ {
+ emit toolbarExtensionChanged(mToolbarServiceExtension);
+ }
+ // note don't need to clear the toolbar extension actions, as the
+ // actionsChanged signal should clear all previous actions.
+ }
+
+ if(mCurrentLevel == VideoCollectionCommon::ELevelVideos &&
+ !mToolbarActions[ETBActionAllVideos]->isChecked())
+ {
+ mToolbarActions[ETBActionAllVideos]->setChecked(true);
+ }
+ else if(mCurrentLevel == VideoCollectionCommon::ELevelCategory &&
+ !mToolbarActions[ETBActionCollections]->isChecked())
+ {
+ mToolbarActions[ETBActionCollections]->setChecked(true);
+ }
+ }
+ if(!mVideoServices)
+ {
+ if(modelReady)
+ {
+
+ mToolbarActions[ETBActionAddVideos]->setVisible(true);
+ mToolbarActions[ETBActionRemoveVideos]->setVisible(!noVideos);
+
+ }
+ else
+ {
+ mToolbarActions[ETBActionAddVideos]->setVisible(false);
+ mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// createToolbarActions()
+// Creates toolbar actions and toolbar icons
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::createToolbarActions()
+{
+ FUNC_LOG;
+
+ // Create actiongroup and add all actions to it. This ensures that only one is
+ // active at certain moment.
+ if(!mToolbarViewsActionGroup && !mToolbarCollectionActionGroup)
+ {
+ mToolbarViewsActionGroup = new QActionGroup(this);
+ mToolbarCollectionActionGroup = new QActionGroup(this);
+
+ // create toolbar item actions
+
+ // All Videos tab
+ mToolbarActions[ETBActionAllVideos] = createAction("qtg_mono_video",
+ mToolbarViewsActionGroup, SIGNAL(allVideosActionTriggered()));
+
+ // Collections tab
+ mToolbarActions[ETBActionCollections] = createAction("qtg_mono_video_collection",
+ mToolbarViewsActionGroup, SIGNAL(collectionViewActionTriggered()));
+
+ if (!mVideoServices)
+ {
+ // Create services button or toolbar extension depending how many operator
+ // services are configured.
+ createOperatorServicesToolbarActions();
+
+ // Add Videos tab
+ mToolbarActions[ETBActionAddVideos] =
+ createAction("qtg_mono_add_to_video_collection",
+ mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot()));
+
+ // Remove Videos tab
+ mToolbarActions[ETBActionRemoveVideos] =
+ createAction("qtg_mono_remove_from_video_collection",
+ mToolbarCollectionActionGroup, SLOT(removeVideosFromCollectionSlot()));
+ }
+
+ // Collection view actions are not checkable
+ mToolbarActions[ETBActionAllVideos]->setCheckable(true);
+ mToolbarActions[ETBActionCollections]->setCheckable(true);
+
+ if(!mVideoServices && mToolbarActions[ETBActionServices])
+ {
+ mToolbarActions[ETBActionServices]->setCheckable(false);
+ }
+
+ mViewStateActions[VideoCollectionCommon::ELevelCategory] = mToolbarViewsActionGroup->actions();
+ mViewStateActions[VideoCollectionCommon::ELevelVideos] = mToolbarViewsActionGroup->actions();
+ if(!mVideoServices)
+ {
+ mViewStateActions[VideoCollectionCommon::ELevelAlbum] = mToolbarCollectionActionGroup->actions();
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// createOperatorServicesToolbar()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::createOperatorServicesToolbarActions()
+{
+ FUNC_LOG;
+ if(mVideoOperatorServices.count() > 0)
+ {
+ return;
+ }
+
+ // Load services.
+
+ loadOperatorService(KVideoCollectionViewCenrepServiceItem1Title, KVideoCollectionViewCenrepServiceItem1ToolbarIconPath,
+ KVideoCollectionViewCenrepServiceItem1Url, KVideoCollectionViewCenrepServiceItem1Uid);
+
+ loadOperatorService(KVideoCollectionViewCenrepServiceItem2Title, KVideoCollectionViewCenrepServiceItem2ToolbarIconPath,
+ KVideoCollectionViewCenrepServiceItem2Url, KVideoCollectionViewCenrepServiceItem2Uid);
+
+ loadOperatorService(KVideoCollectionViewCenrepServiceItem3Title, KVideoCollectionViewCenrepServiceItem3ToolbarIconPath,
+ KVideoCollectionViewCenrepServiceItem3Url, KVideoCollectionViewCenrepServiceItem3Uid);
+
+ loadOperatorService(KVideoCollectionViewCenrepServiceItem4Title, KVideoCollectionViewCenrepServiceItem4ToolbarIconPath,
+ KVideoCollectionViewCenrepServiceItem4Url, KVideoCollectionViewCenrepServiceItem4Uid);
+
+ loadOperatorService(KVideoCollectionViewCenrepServiceItem5Title, KVideoCollectionViewCenrepServiceItem5ToolbarIconPath,
+ KVideoCollectionViewCenrepServiceItem5Url, KVideoCollectionViewCenrepServiceItem5Uid);
+
+ loadOperatorService(KVideoCollectionViewCenrepServiceItem6Title, KVideoCollectionViewCenrepServiceItem6ToolbarIconPath,
+ KVideoCollectionViewCenrepServiceItem6Url, KVideoCollectionViewCenrepServiceItem6Uid);
+
+ // Create toolbar extension when there's multiple services.
+ if(mVideoOperatorServices.count() > 1 && !mToolbarServiceExtension)
+ {
+ mToolbarServiceExtension = new HbToolBarExtension();
+ mToolbarServiceExtension->setObjectName(LIST_VIEW_OBJECT_NAME_TOOLBAR_EXTENSION);
+
+ QList<VideoOperatorService *>::const_iterator iter = mVideoOperatorServices.constBegin();
+ while(iter != mVideoOperatorServices.constEnd())
+ {
+ HbIcon icon((*iter)->iconResource());
+ HbAction *action = mToolbarServiceExtension->addAction(icon, (*iter)->title(),
+ (*iter), SLOT(launchService()));
+ action->setObjectName((*iter)->title());
+ iter++;
+ }
+ }
+
+ // Add toolbar button when there's only one service.
+ if(mVideoOperatorServices.count() == 1)
+ {
+ VideoOperatorService *service = mVideoOperatorServices[0];
+ mToolbarActions[ETBActionServices] = createAction(service->iconResource(),
+ mToolbarViewsActionGroup, 0 /*do not connect to any slot*/);
+ connect(mToolbarActions[ETBActionServices], SIGNAL(triggered()), service, SLOT(launchService()));
+ }
+}
+
+// ---------------------------------------------------------------------------
+// loadOperatorService()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey)
+{
+ FUNC_LOG;
+ VideoOperatorService *service = new VideoOperatorService();
+ if(service->load(titleKey, iconKey, uriKey, uidKey))
+ {
+ mVideoOperatorServices.append(service);
+ }
+ else
+ {
+ // Load failed, delete service data.
+ delete service;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// openOperatorServiceSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListToolbar::openOperatorServiceSlot()
+{
+ FUNC_LOG;
+
+ if(mVideoOperatorServices.count() > 0)
+ {
+ mVideoOperatorServices[0]->launchService();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// addVideosToCollectionSlot()
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListToolbar::addVideosToCollectionSlot()
+{
+ FUNC_LOG;
+
+ VideoListWidget* currentList = mListView->getCurrentList();
+
+ if(!currentList || !currentList->getModel())
+ {
+ return;
+ }
+
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+ if (!dialog)
+ {
+ // fatal: no selection dialog
+ return;
+ }
+
+ // do not proceed in case it already have same amount
+ // of videos than all videos view.
+ VideoListWidget *allVideos = mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_VIDEOLISTWIDGET);
+ if(allVideos && allVideos->getModel())
+ {
+ int count = allVideos->getModel()->rowCount();
+ if(count == currentList->getModel()->rowCount())
+ {
+ if(count)
+ {
+ QVariant emptyAdditional;
+ mUiUtils.showStatusMsgSlot(
+ VideoCollectionCommon::statusAllVideosAlreadyInCollection,
+ emptyAdditional);
+ }
+ return;
+ }
+ }
+
+ TMPXItemId collectionId = currentList->getModel()->getOpenItem();
+ dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId);
+ dialog->exec();
+}
+
+// -------------------------------------------------------------------------------------------------
+// removeVideosFromCollectionSlot()
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListToolbar::removeVideosFromCollectionSlot()
+{
+ FUNC_LOG;
+
+ VideoListWidget* currentList = mListView->getCurrentList();
+
+ if(!currentList || !currentList->getModel())
+ {
+ return;
+ }
+
+ // not allowed if for some reason current widget
+ // is all videos or collection or there are no items
+ if(currentList->getLevel() != VideoCollectionCommon::ELevelAlbum ||
+ !currentList->getModel()->rowCount())
+ {
+ return;
+ }
+
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+ if (!dialog)
+ {
+ ERROR(-1, "VideoListView::removeVideosFromCollectionSlot() failed to load selection dialog.");
+ return;
+ }
+
+ TMPXItemId collectionId = currentList->getModel()->getOpenItem();
+ if(collectionId != TMPXItemId::InvalidId() && collectionId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ dialog->setupContent(VideoListSelectionDialog::ERemoveFromCollection, collectionId);
+ dialog->exec();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// createAction()
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListToolbar::createAction(QString icon,
+ QActionGroup* actionGroup, const char *slot)
+{
+ FUNC_LOG;
+ HbAction* action = new HbAction(actionGroup);
+
+ HbIcon hbIcon(icon);
+ action->setIcon(hbIcon);
+
+ if(slot)
+ {
+ if(!connect(action, SIGNAL(triggered()), this, slot)) {
+ // actiongroup deletion deletes this also.
+ // return 0 tells that there was a problem in creation to caller.
+ delete action;
+ return 0;
+ }
+ }
+
+ return action;
+}
+
+// End of file
--- a/videocollection/videocollectionview/src/videolistview.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionview/src/videolistview.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,62 +15,52 @@
*
*/
-// Version : %version: 113.1.8 %
+// Version : %version: 113.1.13 %
// INCLUDE FILES
-#include <qactiongroup.h>
#include <hbinstance.h>
#include <hbmainwindow.h>
-#include <hbmessagebox.h>
-#include <hbstackedwidget.h>
-#include <hbstackedlayout.h>
-#include <hblistwidget.h>
#include <hbtoolbar.h>
#include <hbaction.h>
#include <hbmenu.h>
#include <hbgroupbox.h>
-#include <hbpushbutton.h>
-#include <hbinputdialog.h>
#include <hbparameterlengthlimiter.h>
#include <hbtoolbarextension.h>
+#include <xqaiwdecl.h>
#include <vcxmyvideosdefs.h>
#include "videoservices.h"
-#include "videolistselectiondialog.h"
#include "videocollectionviewutils.h"
#include "videolistwidget.h"
#include "videohintwidget.h"
#include "videolistview.h"
+#include "videolisttoolbar.h"
+#include "videolistmenu.h"
#include "videocollectioncommon.h"
#include "videocollectionwrapper.h"
#include "videoproxymodelgeneric.h"
#include "videocollectionuiloader.h"
-#include "mpxhbvideocommondefs.h"
-#include "videooperatorservice.h"
-#include "videocollectioncenrepdefs.h"
#include "videocollectiontrace.h"
// Object names.
const char* const LIST_VIEW_OBJECT_NAME_OPTIONS_MENU = "vc::ListViewOptionsMenu";
-const char* const LIST_VIEW_OBJECT_NAME_TOOLBAR_EXTENSION = "vc::ListViewToolbarExtension";
// ---------------------------------------------------------------------------
// Constructor
// ---------------------------------------------------------------------------
//
VideoListView::VideoListView( VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent )
- : HbView( parent )
- , mUiUtils( VideoCollectionViewUtils::instance() )
- , mWrapper( VideoCollectionWrapper::instance() )
- , mUiLoader( uiLoader )
- , mModelReady( false )
- , mViewReady( false )
- , mHintLevel( VideoHintWidget::AllVideos )
- , mVideoServices( 0 )
- , mCurrentList( 0 )
- , mToolbarViewsActionGroup( 0 )
- , mToolbarCollectionActionGroup( 0 )
- , mToolbarServiceExtension( 0 )
+ : HbView(parent)
+ , mUiUtils(VideoCollectionViewUtils::instance())
+ , mWrapper(VideoCollectionWrapper::instance())
+ , mUiLoader(uiLoader)
+ , mToolbar(0)
+ , mMenu(0)
+ , mModelReady(false)
+ , mViewReady(false)
+ , mHintLevel(VideoHintWidget::AllVideos)
+ , mVideoServices(0)
+ , mCurrentList(0)
{
FUNC_LOG;
}
@@ -85,25 +75,11 @@
toolBar()->clearActions();
- mToolbarActions.clear();
- mSortingRoles.clear();
-
- delete mToolbarServiceExtension;
- mToolbarServiceExtension = 0;
-
if(mVideoServices)
{
mVideoServices->decreaseReferenceCount();
mVideoServices = 0;
}
-
- QList<VideoOperatorService *>::const_iterator iter = mVideoOperatorServices.constBegin();
- while(iter != mVideoOperatorServices.constEnd())
- {
- delete *iter;
- iter++;
- }
- mVideoOperatorServices.clear();
}
// ---------------------------------------------------------------------------
@@ -179,59 +155,14 @@
DOCML_VIDEOCOLLECTIONVIEW_FILE,
DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST,
true,
- collectionContentListPhase));
+ collectionContentListPhase));
params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_OPTIONS_MENU,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- true,
- VideoCollectionUiLoaderParam::LoadPhasePrimary));
- params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_ADD_TO_COLLECTION,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- false,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_CREATE_COLLECTION,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- false,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_DELETE_MULTIPLE,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- false,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
DOCML_NAME_VC_HEADINGBANNER,
DOCML_VIDEOCOLLECTIONVIEW_FILE,
true,
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_SORT_MENU,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- true,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_SORT_BY_DATE,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- false,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_SORT_BY_NAME,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- false,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- false,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
- DOCML_NAME_SORT_BY_SIZE,
- DOCML_VIDEOCOLLECTIONVIEW_FILE,
- false,
- VideoCollectionUiLoaderParam::LoadPhaseSecondary));
- params.append(VideoCollectionUiLoaderParam(
DOCML_NAME_DIALOG,
DOCML_VIDEOSELECTIONDIALOG_FILE,
true,
@@ -257,8 +188,20 @@
mUiLoader->addData(params,
this,
SLOT(objectReadySlot(QObject*, const QString&)));
+ params.clear();
+
+ if(!mMenu)
+ {
+ mMenu = new VideoListMenu(mUiLoader, this);
+ int err = mMenu->initializeMenu();
+ if(err)
+ {
+ cleanup();
+ return -1;
+ }
+ }
+
mUiLoader->loadPhase(VideoCollectionUiLoaderParam::LoadPhasePrimary);
- params.clear();
// fetch current list right away for main views
// for default and user defined collections, currentList
@@ -483,6 +426,17 @@
}
// ---------------------------------------------------------------------------
+// getCurrentList()
+// ---------------------------------------------------------------------------
+//
+VideoListWidget* VideoListView::getCurrentList()
+{
+ FUNC_LOG;
+
+ return mCurrentList;
+}
+
+// ---------------------------------------------------------------------------
// modelReady()
// ---------------------------------------------------------------------------
//
@@ -513,226 +467,70 @@
void VideoListView::cleanup()
{
FUNC_LOG;
- delete mToolbarViewsActionGroup;
- mToolbarViewsActionGroup = 0;
-
- delete mToolbarCollectionActionGroup;
- mToolbarCollectionActionGroup = 0;
-
+
+ delete mToolbar;
+ mToolbar = 0;
+
mCurrentList = 0;
}
// ---------------------------------------------------------------------------
// createToolbar()
-// Creates toolbar, toolbar actions and toolbar icons
+// Creates toolbar
// ---------------------------------------------------------------------------
//
int VideoListView::createToolbar()
{
FUNC_LOG;
- // Create actiongroup and add all actions to it. This ensures that only one is
- // active at certain moment.
- if(!mToolbarViewsActionGroup && !mToolbarCollectionActionGroup)
+ // creates VideoListToolbar and HbToolbar
+ if(!mToolbar)
{
- mToolbarViewsActionGroup = new QActionGroup(this);
- mToolbarCollectionActionGroup = new QActionGroup(this);
-
- // create toolbar item actions
-
- // All Videos tab
- mToolbarActions[ETBActionAllVideos] = createAction("qtg_mono_video",
- mToolbarViewsActionGroup, SLOT(openAllVideosViewSlot()));
-
- // Collections tab
- mToolbarActions[ETBActionCollections] = createAction("qtg_mono_video_collection",
- mToolbarViewsActionGroup, SLOT(openCollectionViewSlot()));
-
- if (!mVideoServices)
- {
- // Create services button or toolbar extension depending how many operator
- // services are configured.
- createOperatorServicesToolbar();
-
- // Add Videos tab
- mToolbarActions[ETBActionAddVideos] =
- createAction("qtg_mono_add_to_video_collection",
- mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot()));
-
- // Remove Videos tab
- mToolbarActions[ETBActionRemoveVideos] =
- createAction("qtg_mono_remove_from_video_collection",
- mToolbarCollectionActionGroup, SLOT(removeVideosFromCollectionSlot()));
- }
+ mToolbar = new VideoListToolbar(mUiLoader, this);
HbToolBar *bar = toolBar(); // First call to toolBar() creates the object, so on failure it could return 0.
-
- if( !bar
- || !mToolbarActions[ETBActionAllVideos]
- || !mToolbarActions[ETBActionCollections]
- || ( !mVideoServices && (!mToolbarActions[ETBActionAddVideos]
- || !mToolbarActions[ETBActionRemoveVideos])))
+
+ if(!bar || !mToolbar ||
+ !connect(
+ mToolbar, SIGNAL(actionsChanged(QList<QAction*>)),
+ this, SLOT(toolbarActionsChanged(QList<QAction*>))) ||
+ !connect(
+ mToolbar, SIGNAL(toolbarExtensionChanged(HbToolBarExtension*)),
+ this, SLOT(toolbarExtensionChanged(HbToolBarExtension*))) ||
+ !connect(
+ mToolbar, SIGNAL(allVideosActionTriggered()),
+ this, SLOT(openAllVideosViewSlot())) ||
+ !connect(
+ mToolbar, SIGNAL(collectionViewActionTriggered()),
+ this, SLOT(openCollectionViewSlot())))
{
- ERROR(-1, "VideoListView::createToolbar() failed to create all actions or the toolbar.");
- delete mToolbarActions[ETBActionAllVideos];
- delete mToolbarActions[ETBActionCollections];
- delete mToolbarActions[ETBActionAddVideos];
- delete mToolbarActions[ETBActionRemoveVideos];
- return -1;
- }
-
- // Collection view actions are not checkable
- mToolbarActions[ETBActionAllVideos]->setCheckable(true);
- mToolbarActions[ETBActionCollections]->setCheckable(true);
-
- if(!mVideoServices && mToolbarActions[ETBActionServices])
- {
- mToolbarActions[ETBActionServices]->setCheckable(false);
- }
- VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos;
- if(mCurrentList)
- {
- level = mCurrentList->getLevel();
+ ERROR(-1, "VideoListView::createToolbar() failed to create all the toolbar.");
+ delete mToolbar;
+ mToolbar = 0;
+ return -1;
}
- if(level == VideoCollectionCommon::ELevelCategory)
- {
- mToolbarActions[ETBActionCollections]->setChecked(true);
- bar->addActions(mToolbarViewsActionGroup->actions());
- }
- else if(level == VideoCollectionCommon::ELevelVideos )
- {
- mToolbarActions[ETBActionAllVideos]->setChecked(true);
- bar->addActions(mToolbarViewsActionGroup->actions());
- }
- else if(level == VideoCollectionCommon::ELevelAlbum)
+
+ mToolbar->initialize();
+ mToolbar->viewStateChanged(mCurrentList->getLevel(), true, false);
+
+ // make sure that the hint widget's button is connected, and connected only once.
+ QObject *hintButton =
+ mUiLoader->findObject<QObject>(
+ DOCML_NAME_HINT_BUTTON, false);
+
+ if(hintButton)
{
- bar->addActions(mToolbarCollectionActionGroup->actions());
- if(!mModelReady)
- {
- // if model not ready yet toolbuttons should not be
- // visible, after model responds visibility will be updated
- mToolbarActions[ETBActionAddVideos]->setVisible(false);
- mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
- }
+ connect(hintButton, SIGNAL(clicked(bool)),
+ mToolbar, SLOT(openOperatorServiceSlot()),
+ Qt::UniqueConnection);
}
-
- if(mToolbarServiceExtension && (level == VideoCollectionCommon::ELevelCategory
- || level == VideoCollectionCommon::ELevelVideos))
- {
- HbAction *action = bar->addExtension(mToolbarServiceExtension);
- HbIcon icon("qtg_mono_video_services");
- action->setIcon(icon);
- }
+ // note that if hintButton is not found, then it's connected in objectReadySlot.
}
return 0;
}
// ---------------------------------------------------------------------------
-// createOperatorServicesToolbar()
-// ---------------------------------------------------------------------------
-//
-void VideoListView::createOperatorServicesToolbar()
-{
- FUNC_LOG;
- if(mVideoOperatorServices.count() > 0)
- {
- return;
- }
-
- // Load services.
-
- loadOperatorService(KVideoCollectionViewCenrepServiceItem1Title, KVideoCollectionViewCenrepServiceItem1ToolbarIconPath,
- KVideoCollectionViewCenrepServiceItem1Url, KVideoCollectionViewCenrepServiceItem1Uid);
-
- loadOperatorService(KVideoCollectionViewCenrepServiceItem2Title, KVideoCollectionViewCenrepServiceItem2ToolbarIconPath,
- KVideoCollectionViewCenrepServiceItem2Url, KVideoCollectionViewCenrepServiceItem2Uid);
-
- loadOperatorService(KVideoCollectionViewCenrepServiceItem3Title, KVideoCollectionViewCenrepServiceItem3ToolbarIconPath,
- KVideoCollectionViewCenrepServiceItem3Url, KVideoCollectionViewCenrepServiceItem3Uid);
-
- loadOperatorService(KVideoCollectionViewCenrepServiceItem4Title, KVideoCollectionViewCenrepServiceItem4ToolbarIconPath,
- KVideoCollectionViewCenrepServiceItem4Url, KVideoCollectionViewCenrepServiceItem4Uid);
-
- loadOperatorService(KVideoCollectionViewCenrepServiceItem5Title, KVideoCollectionViewCenrepServiceItem5ToolbarIconPath,
- KVideoCollectionViewCenrepServiceItem5Url, KVideoCollectionViewCenrepServiceItem5Uid);
-
- loadOperatorService(KVideoCollectionViewCenrepServiceItem6Title, KVideoCollectionViewCenrepServiceItem6ToolbarIconPath,
- KVideoCollectionViewCenrepServiceItem6Url, KVideoCollectionViewCenrepServiceItem6Uid);
-
- // Create toolbar extension when there's multiple services.
- if(mVideoOperatorServices.count() > 1 && !mToolbarServiceExtension)
- {
- mToolbarServiceExtension = new HbToolBarExtension();
- mToolbarServiceExtension->setObjectName(LIST_VIEW_OBJECT_NAME_TOOLBAR_EXTENSION);
-
- QList<VideoOperatorService *>::const_iterator iter = mVideoOperatorServices.constBegin();
- while(iter != mVideoOperatorServices.constEnd())
- {
- HbIcon icon((*iter)->iconResource());
- HbAction *action = mToolbarServiceExtension->addAction(icon, (*iter)->title(),
- (*iter), SLOT(launchService()));
- action->setObjectName((*iter)->title());
- iter++;
- }
- }
-
- // Add toolbar button when there's only one service.
- if(mVideoOperatorServices.count() == 1)
- {
- VideoOperatorService *service = mVideoOperatorServices[0];
- mToolbarActions[ETBActionServices] = createAction(service->iconResource(),
- mToolbarViewsActionGroup, 0 /*do not connect to any slot*/);
- connect(mToolbarActions[ETBActionServices], SIGNAL(triggered()), service, SLOT(launchService()));
- }
-}
-
-// ---------------------------------------------------------------------------
-// loadOperatorService()
-// ---------------------------------------------------------------------------
-//
-void VideoListView::loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey)
-{
- FUNC_LOG;
- VideoOperatorService *service = new VideoOperatorService();
- if(service->load(titleKey, iconKey, uriKey, uidKey))
- {
- mVideoOperatorServices.append(service);
- }
- else
- {
- // Load failed, delete service data.
- delete service;
- }
-}
-
-// ---------------------------------------------------------------------------
-// createAction()
-// ---------------------------------------------------------------------------
-//
-HbAction* VideoListView::createAction(QString icon,
- QActionGroup* actionGroup, const char *slot)
-{
- FUNC_LOG;
- HbAction* action = new HbAction(actionGroup);
-
- HbIcon hbIcon(icon);
- action->setIcon(hbIcon);
-
- if(slot)
- {
- if(!connect(action, SIGNAL(triggered()), this, slot)) {
- // actiongroup deletion deletes this also.
- // return 0 tells that there was a problem in creation to caller.
- delete action;
- return 0;
- }
- }
-
- return action;
-}
-
-// ---------------------------------------------------------------------------
// showHint
// ---------------------------------------------------------------------------
//
@@ -778,19 +576,8 @@
}
}
- if (mToolbarViewsActionGroup && mToolbarCollectionActionGroup && !mVideoServices)
- {
- mToolbarActions[ETBActionAddVideos]->setVisible(true);
- if (show)
- {
- mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
- }
- else if(mToolbarActions[ETBActionRemoveVideos]->isVisible() == false)
- {
- mToolbarActions[ETBActionRemoveVideos]->setVisible(true);
- }
- }
-
+ mToolbar->viewStateChanged(mCurrentList->getLevel(), show, mModelReady);
+
// prepare sublabel
HbGroupBox *subLabel =
mUiLoader->findWidget<HbGroupBox>(
@@ -848,12 +635,12 @@
// hint widget is shown instead
if (itemCount)
{
- subLabel->setHeading(hbTrId("txt_videos_subtitle_ln_videos", itemCount));
+ subLabel->setHeading(hbTrId("txt_videos_subtitle_all_videos_ln", itemCount));
}
}
else if (mCurrentList->getLevel() == VideoCollectionCommon::ELevelCategory)
{
- subLabel->setHeading(hbTrId("txt_videos_subtitle_ln_collections", itemCount));
+ subLabel->setHeading(hbTrId("txt_videos_subtitle_collections_ln", itemCount));
}
else
{
@@ -865,31 +652,6 @@
}
// ---------------------------------------------------------------------------
-// showAction()
-// ---------------------------------------------------------------------------
-//
-void VideoListView::showAction(bool show, const QString &name)
-{
- FUNC_LOG;
- HbAction *action = mUiLoader->findObject<HbAction>(name);
- if (!action)
- {
- // must be menu widget
- HbMenu *menu = mUiLoader->findWidget<HbMenu>(name);
- if (menu)
- {
- action = menu->menuAction();
- }
- }
-
- // hide or show action
- if (action)
- {
- action->setVisible(show);
- }
-}
-
-// ---------------------------------------------------------------------------
// activateMainView()
// ---------------------------------------------------------------------------
//
@@ -972,11 +734,11 @@
{
// TODO: service sorting roles needs to be defined somewhere
int sortRole = mVideoServices->sortRole();
- if(sortRole == 2)
+ if(sortRole == XQService::SortTitle)
{
sortRole = VideoCollectionCommon::KeyTitle;
}
- else if(sortRole == 3)
+ else if(sortRole == XQService::SortSize)
{
sortRole = VideoCollectionCommon::KeySizeValue;
}
@@ -1049,93 +811,6 @@
}
}
-// ---------------------------------------------------------------------------
-// openOperatorServiceSlot()
-// ---------------------------------------------------------------------------
-//
-void VideoListView::openOperatorServiceSlot()
-{
- FUNC_LOG;
-
- if(mVideoOperatorServices.count() > 0)
- {
- mVideoOperatorServices[0]->launchService();
- }
-}
-
-// ---------------------------------------------------------------------------
-// startSorting()
-// ---------------------------------------------------------------------------
-//
-void VideoListView::startSorting()
-{
- FUNC_LOG;
- HbMenu *optionsMenu =
- mUiLoader->findWidget<HbMenu>(
- DOCML_NAME_OPTIONS_MENU);
- if (optionsMenu && mCurrentList)
- {
- // get sorting role from active action
- HbAction* action = optionsMenu->activeAction();
- HbMenu* sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
- if(action == sortMenu->menuAction()) // make sure that active action is the sort menu.
- {
- HbAction* action = sortMenu->activeAction();
- if(action)
- {
- doSorting(mSortingRoles[action]);
- }
- }
- }
-}
-
-// ---------------------------------------------------------------------------
-// doSorting()
-// ---------------------------------------------------------------------------
-//
-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);
- VideoProxyModelGeneric *model = mCurrentList->getModel();
- if(model->sortRole() == role && model->sortOrder() == Qt::AscendingOrder)
- {
- order = Qt::DescendingOrder;
- }
- model->doSorting(role, order);
-
- // for video related sorting, all videos list and collection content
- // list, sorting orders are same all the time
- VideoListWidget *anotherVideosList = 0;
- VideoCollectionCommon::TCollectionLevels level = mCurrentList->getLevel();
- if (level == VideoCollectionCommon::ELevelDefaultColl ||
- level == VideoCollectionCommon::ELevelAlbum)
- {
- anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
- }
- else if(level == VideoCollectionCommon::ELevelVideos)
- {
- anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
- }
- if(anotherVideosList && anotherVideosList->getModel())
- {
- anotherVideosList->getModel()->doSorting(role, order);
- }
-
- // save sorting values only if the application is not started as a service
- if (!mVideoServices)
- {
- // save sorting values
- mUiUtils.saveSortingValues(role, order, mCurrentList->getLevel());
- }
-}
-
// -------------------------------------------------------------------------------------------------
// aboutToChangeOrientationSlot()
// hide all items in the window during orientation change
@@ -1163,280 +838,6 @@
}
// -------------------------------------------------------------------------------------------------
-// deleteItemsSlot
-// -------------------------------------------------------------------------------------------------
-//
-void VideoListView::deleteItemsSlot()
-{
- FUNC_LOG;
-
- VideoListSelectionDialog *dialog =
- mUiLoader->findWidget<VideoListSelectionDialog>(
- DOCML_NAME_DIALOG);
- if (dialog)
- {
- TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem();
- dialog->setupContent(VideoListSelectionDialog::EDeleteVideos, collectionId);
- dialog->exec();
- }
-}
-
-// -------------------------------------------------------------------------------------------------
-// createCollectionSlot
-// -------------------------------------------------------------------------------------------------
-//
-void VideoListView::createCollectionSlot()
-{
- FUNC_LOG;
-
- VideoListSelectionDialog *dialog =
- mUiLoader->findWidget<VideoListSelectionDialog>(
- DOCML_NAME_DIALOG);
- if (!dialog)
- {
- // fatal: no selection dialog
- return;
- }
-
- dialog->setupContent(VideoListSelectionDialog::ECreateCollection, TMPXItemId::InvalidId());
- dialog->exec();
-}
-
-// -------------------------------------------------------------------------------------------------
-// addVideosToCollectionSlot
-// -------------------------------------------------------------------------------------------------
-//
-void VideoListView::addVideosToCollectionSlot()
-{
- FUNC_LOG;
- if(!mCurrentList || !mCurrentList->getModel())
- {
- return;
- }
-
- VideoListSelectionDialog *dialog =
- mUiLoader->findWidget<VideoListSelectionDialog>(
- DOCML_NAME_DIALOG);
- if (!dialog)
- {
- // fatal: no selection dialog
- return;
- }
- if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum)
- {
- // album is opened, do not proceed in case it already have same amount
- // of videos than all videos view.
- VideoListWidget *allVideos = mUiLoader->findWidget<VideoListWidget>(
- DOCML_NAME_VC_VIDEOLISTWIDGET);
- if(allVideos && allVideos->getModel())
- {
- int count = allVideos->getModel()->rowCount();
- if(count == mCurrentList->getModel()->rowCount())
- {
- if(count)
- {
- QVariant emptyAdditional;
- mUiUtils.showStatusMsgSlot(
- VideoCollectionCommon::statusAllVideosAlreadyInCollection,
- emptyAdditional);
- }
- return;
- }
- }
- }
- TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem();
- dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId);
- dialog->exec();
-}
-
-// -------------------------------------------------------------------------------------------------
-// removeVideosFromCollectionSlot
-// -------------------------------------------------------------------------------------------------
-//
-void VideoListView::removeVideosFromCollectionSlot()
-{
- FUNC_LOG;
- 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())
- {
- return;
- }
-
- VideoListSelectionDialog *dialog =
- mUiLoader->findWidget<VideoListSelectionDialog>(
- DOCML_NAME_DIALOG);
- if (!dialog)
- {
- ERROR(-1, "VideoListView::removeVideosFromCollectionSlot() failed to load selection dialog.");
- return;
- }
- TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem();
- if(collectionId != TMPXItemId::InvalidId() && collectionId.iId2 != KVcxMvcMediaTypeVideo)
- {
- dialog->setupContent(VideoListSelectionDialog::ERemoveFromCollection, collectionId);
- dialog->exec();
- }
-}
-
-// -------------------------------------------------------------------------------------------------
-// aboutToShowMainMenuSlot
-// -------------------------------------------------------------------------------------------------
-//
-void VideoListView::aboutToShowMainMenuSlot()
-{
- if (mVideoServices &&
- mVideoServices->currentService() == VideoServices::EBrowse)
- {
- prepareBrowseServiceMenu();
- return;
- }
-
- if (!mCurrentList ||
- !mToolbarViewsActionGroup ||
- !mToolbarCollectionActionGroup)
- {
- return;
- }
-
- // hide all actions by default
- showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
- showAction(false, DOCML_NAME_CREATE_COLLECTION);
- showAction(false, DOCML_NAME_DELETE_MULTIPLE);
- showAction(false, DOCML_NAME_SORT_BY_DATE);
- showAction(false, DOCML_NAME_SORT_BY_NAME);
- showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
- showAction(false, DOCML_NAME_SORT_BY_SIZE);
- showAction(false, DOCML_NAME_SORT_MENU);
-
- HbAction *firstAction = (HbAction*)(toolBar()->actions().first());
-
- bool isCollectionsView = mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] &&
- firstAction == mToolbarActions[ETBActionAllVideos];
-
- // Create collection action is shown even when there's no videos.
- if(isCollectionsView && !mVideoServices)
- {
- showAction(true, DOCML_NAME_CREATE_COLLECTION);
- }
-
- // No other actions shown if there's no videos.
- VideoProxyModelGeneric *model = mCurrentList->getModel();
- if (!model || !model->rowCount())
- {
- return;
- }
-
- // get current sorting values
- int role;
- Qt::SortOrder order;
- model->getSorting(role, order);
-
- if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionAllVideos] &&
- firstAction == mToolbarActions[ETBActionAllVideos])
- {
- showAction(true, DOCML_NAME_SORT_MENU);
- showAction(true, DOCML_NAME_SORT_BY_DATE);
- showAction(true, DOCML_NAME_SORT_BY_NAME);
- showAction(true, DOCML_NAME_SORT_BY_SIZE);
-
- HbAction* action = mSortingRoles.key(role);
- if (action)
- {
- action->setChecked(true);
- }
-
- if (!mVideoServices)
- {
- showAction(true, DOCML_NAME_ADD_TO_COLLECTION);
- showAction(true, DOCML_NAME_DELETE_MULTIPLE);
- }
- }
- else if(isCollectionsView)
- {
- showAction(true, DOCML_NAME_SORT_MENU);
- showAction(true, DOCML_NAME_SORT_BY_NAME);
- showAction(true, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
-
- HbAction* action = mSortingRoles.key(role);
- if (action)
- {
- action->setChecked(true);
- }
- }
- else if(firstAction != mToolbarActions[ETBActionAllVideos])
- {
- showAction(true, DOCML_NAME_SORT_MENU);
- showAction(true, DOCML_NAME_SORT_BY_DATE);
- showAction(true, DOCML_NAME_SORT_BY_NAME);
- showAction(true, DOCML_NAME_SORT_BY_SIZE);
-
- HbAction* action = mSortingRoles.key(role);
- if (action)
- {
- action->setChecked(true);
- }
-
- if (!mVideoServices)
- {
- showAction(true, DOCML_NAME_DELETE_MULTIPLE);
- }
- }
-}
-
-// -------------------------------------------------------------------------------------------------
-// prepareBrowseServiceMenu
-// -------------------------------------------------------------------------------------------------
-//
-void VideoListView::prepareBrowseServiceMenu()
-{
- if (!mCurrentList)
- {
- return;
- }
-
- // hide all actions by default
- showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
- showAction(false, DOCML_NAME_CREATE_COLLECTION);
- showAction(false, DOCML_NAME_DELETE_MULTIPLE);
- showAction(false, DOCML_NAME_SORT_BY_DATE);
- showAction(false, DOCML_NAME_SORT_BY_NAME);
- showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
- showAction(false, DOCML_NAME_SORT_BY_SIZE);
- showAction(false, DOCML_NAME_SORT_MENU);
-
- VideoProxyModelGeneric *model = mCurrentList->getModel();
- if (!model || !model->rowCount())
- {
- return;
- }
-
- // show delete action
- showAction(true, DOCML_NAME_DELETE_MULTIPLE);
-
- // show sort actions
- showAction(true, DOCML_NAME_SORT_MENU);
- showAction(true, DOCML_NAME_SORT_BY_DATE);
- showAction(true, DOCML_NAME_SORT_BY_NAME);
- showAction(true, DOCML_NAME_SORT_BY_SIZE);
-
- // set current sort action selected
- int role;
- Qt::SortOrder order;
- model->getSorting(role, order);
- HbAction* action = mSortingRoles.key(role);
- if (action)
- {
- action->setChecked(true);
- }
-}
-
-// -------------------------------------------------------------------------------------------------
// handleAsyncStatusSlot
// -------------------------------------------------------------------------------------------------
//
@@ -1518,47 +919,23 @@
// update hint widget for correct content
mModelReady = model->rowCount() > 0;
setHintLevel(VideoHintWidget::Collection);
-
- if(mToolbarCollectionActionGroup)
+
+ if(mToolbar)
{
- // update toolbar for albums, default categories don't have one. Neither does services.
- toolBar()->clearActions();
- if(!mVideoServices && level == VideoCollectionCommon::ELevelAlbum &&
- mToolbarActions.contains(ETBActionCollections))
- {
- mToolbarActions[ETBActionCollections]->setChecked(false);
- toolBar()->addActions(mToolbarCollectionActionGroup->actions());
- setItemVisible(Hb::ToolBarItem, true);
- }
- else
- {
- setItemVisible(Hb::ToolBarItem, false);
- }
+ // if toolbar not yet created, it means that we're activating
+ // for the startup, toolbar will be updated during modelReady()
+ mToolbar->viewStateChanged(level, false, mModelReady);
}
+
// restore animations for collection content widget
collectionContentWidget->setEnabledAnimations(animationState);
}
else
{
- // clear actions to make sure there is no wrong toolbar in case main
- // toolbar actiongroup actiongroup is missing
- toolBar()->clearActions();
// open collection view
- openCollectionViewSlot();
- // update toolbar
- if(mToolbarViewsActionGroup && mToolbarActions.contains(ETBActionCollections))
- {
- toolBar()->addActions(mToolbarViewsActionGroup->actions());
- mToolbarActions[ETBActionCollections]->setChecked(true);
- setItemVisible(Hb::ToolBarItem, true);
-
- if(mToolbarServiceExtension)
- {
- HbAction *action = toolBar()->addExtension(mToolbarServiceExtension);
- HbIcon icon("qtg_mono_video_services");
- action->setIcon(icon);
- }
- }
+ openCollectionViewSlot();
+
+ mToolbar->viewStateChanged(VideoCollectionCommon::ELevelCategory, false, mModelReady);
}
if(!mVideoServices)
{
@@ -1609,82 +986,45 @@
qobject_cast<VideoListWidget*>(object)->doDelayedsSlot();
}
}
- else if (name.compare(DOCML_NAME_OPTIONS_MENU) == 0)
- {
- connect(
- object, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot()));
- }
else if (name.compare(DOCML_NAME_HINT_BUTTON) == 0)
{
- connect(object, SIGNAL(clicked(bool)), this, SLOT(openOperatorServiceSlot()));
- }
- else if (name.compare(DOCML_NAME_SORT_BY_DATE) == 0)
- {
- HbAction *action = qobject_cast<HbAction*>(object);
- if (action)
- {
- connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
- mSortingRoles[action] = VideoCollectionCommon::KeyDateTime;
- }
- }
- else if (name.compare(DOCML_NAME_SORT_BY_NAME) == 0)
- {
- HbAction *action = qobject_cast<HbAction*>(object);
- if (action)
- {
- connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
- mSortingRoles[action] = VideoCollectionCommon::KeyTitle;
- }
- }
- else if (name.compare(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS) == 0)
- {
- HbAction *action = qobject_cast<HbAction*>(object);
- if (action)
- {
- connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
- mSortingRoles[action] = VideoCollectionCommon::KeyNumberOfItems;
- }
- }
- else if (name.compare(DOCML_NAME_SORT_BY_SIZE) == 0)
- {
- HbAction *action = qobject_cast<HbAction*>(object);
- if (action)
- {
- connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
- mSortingRoles[action] = VideoCollectionCommon::KeySizeValue;
- }
- }
- else if (name.compare(DOCML_NAME_ADD_TO_COLLECTION) == 0)
- {
- HbAction *action = qobject_cast<HbAction*>(object);
- if (action)
- {
- connect(action, SIGNAL(triggered()), this, SLOT(addVideosToCollectionSlot()));
- }
- }
- else if (name.compare(DOCML_NAME_CREATE_COLLECTION) == 0)
- {
- HbAction *action = qobject_cast<HbAction*>(object);
- if (action)
- {
- connect(action, SIGNAL(triggered()), this, SLOT(createCollectionSlot()));
- }
- }
- else if (name.compare(DOCML_NAME_DELETE_MULTIPLE) == 0)
- {
- HbAction *action = qobject_cast<HbAction*>(object);
- if (action)
- {
- connect(action, SIGNAL(triggered()), this, SLOT(deleteItemsSlot()));
- }
+ connect(object, SIGNAL(clicked(bool)), mToolbar, SLOT(openOperatorServiceSlot()));
}
}
-// Just for testing, remove this
-void VideoListView::debugNotImplementedYet()
+// -------------------------------------------------------------------------------------------------
+// toolbarActionsChanged
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::toolbarActionsChanged(QList<QAction*> newActions)
{
- FUNC_LOG;
- HbMessageBox::information(tr("Not implemented yet"));
+ HbToolBar* bar = toolBar();
+
+ bar->clearActions();
+
+ if(newActions.count() > 0)
+ {
+ bar->addActions(newActions);
+ setItemVisible(Hb::ToolBarItem, true);
+ }
+ else
+ {
+ setItemVisible(Hb::ToolBarItem, false);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// toolbarExtensionChanged
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::toolbarExtensionChanged(HbToolBarExtension* newExtension)
+{
+ if(newExtension)
+ {
+ HbAction *action = toolBar()->addExtension(newExtension);
+ HbIcon icon("qtg_mono_video_services");
+ action->setIcon(icon);
+ }
}
// End of file
--- a/videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -36,6 +36,8 @@
#include "videocollectionuiloaderdata.h"
#include "videoservicebrowsedata.h"
#include "videolistviewdata.h"
+#include "videocollectionviewutils.h"
+#include "videocollectionviewutilsdata.h"
#define private public
#include "videocollectionviewplugin.h"
@@ -216,6 +218,8 @@
init();
serviceUtil->setCurrentService(true);
videoServices->mCurrentService = VideoServices::EBrowse;
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
VideoServiceBrowseData::mBrowseCategory = KVcxMvcCategoryIdCaptured;
mTestView->activateView();
QCOMPARE(VideoListViewData::mActivateViewCount, 1);
@@ -228,6 +232,8 @@
// -downloads category
init();
serviceUtil->setCurrentService(true);
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
videoServices->mCurrentService = VideoServices::EBrowse;
VideoServiceBrowseData::mBrowseCategory = KVcxMvcCategoryIdDownloads;
mTestView->activateView();
@@ -240,6 +246,8 @@
// -uri fetch service
init();
serviceUtil->setCurrentService(true);
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
videoServices->mCurrentService = VideoServices::EUriFetcher;
mTestView->activateView();
QCOMPARE(VideoListViewData::mActivateViewCount, 1);
@@ -249,6 +257,8 @@
// final cleanup
serviceUtil->decreaseReferenceCount();
videoServices->decreaseReferenceCount();
+ VideoCollectionViewUtilsData::mIsServiceValue = false;
+ VideoCollectionViewUtils::instance().setIsService();
}
// ---------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistmenu/inc/testlistmenu.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,119 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoListView
+*
+*/
+
+#ifndef __TESTLISTMENU_H__
+#define __TESTLISTMENU_H__
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class VideoListMenu;
+class VideoCollectionUiLoader;
+class VideoListView;
+class VideoListWidget;
+class VideoProxyModelGeneric;
+class VideoListDataModel;
+
+class TestListMenu : public QObject
+{
+ Q_OBJECT
+
+ // Test functions for the test framework.
+
+ /**
+ * Default init
+ */
+ void init();
+
+ int visibleMenuActions();
+
+ void setVisibilityForMenuActions(bool visibility);
+
+private slots:
+
+ /**
+ * Will be called after every test function.
+ */
+ void cleanup();
+
+ /**
+ * Tests testInitializeMenu.
+ */
+ void testInitializeMenu();
+
+ /**
+ * Tests testStartSorting.
+ */
+ void testStartSorting();
+
+ /**
+ * Tests deleteItemsSlot
+ */
+ void testDeleteItemsSlot();
+
+ /**
+ * Tests createCollectionSlot
+ */
+ void testCreateCollectionSlot();
+
+ /**
+ * Tests addVideosToCollectionSlot
+ */
+ void testAddVideosToCollectionSlot();
+
+ /**
+ * Tests aboutToShowMainMenuSlot
+ */
+ void testAboutToShowMainMenuSlot();
+
+ /**
+ * Tests prepareBrowseServiceMenu
+ */
+ void testPrepareBrowseServiceMenu();
+
+ /**
+ * Tests objectReadySlot
+ */
+ void testObjectReadySlot();
+
+signals:
+
+ void testSignal();
+ void testSignal2();
+
+ void testObjectReadySignal(QObject*, const QString);
+
+private:
+
+ VideoListMenu *mTestObject;
+
+ VideoCollectionUiLoader* mUiLoader;
+
+ VideoListView *mListView;
+
+ VideoListWidget *mListWidget;
+
+ VideoProxyModelGeneric *mModel;
+
+ VideoListDataModel *mDataModel;
+};
+
+
+#endif // __TESTLISTMENU_H__
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistmenu/src/testlistmenu.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,663 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoListView
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qdebug.h>
+#include <xqserviceutil.h>
+#include <QtTest/QtTest>
+#include "hbapplication.h"
+#include "hbinstance.h"
+#include "hbmenu.h"
+#include "hbmenudata.h"
+#include "hbtoolbar.h"
+#include "hbaction.h"
+#include "hbstackedwidget.h"
+#include "hbgroupbox.h"
+#include "hbdocumentloader.h"
+#include "hbview.h"
+#include "hblistview.h"
+#include <videocollectioncommon.h>
+#include <qhash.h>
+#include <qmap.h>
+
+#include "testlistmenu.h"
+
+#define private public
+#include "videolistmenu.h"
+#include "videolistwidget.h"
+#include "videolistview.h"
+#include "videoproxymodelgeneric.h"
+#undef private
+
+#include "videolistwidgetdata.h"
+#include "videocollectionuiloaderdata.h"
+#include "videoproxymodeldata.h"
+#include "videolistselectiondialog.h"
+#include "videolistselectiondialogdata.h"
+#include "videocollectionviewutils.h"
+#include "videocollectionviewutilsdata.h"
+#include "videocollectioncommon.h"
+#include "videocollectionuiloader.h"
+#include "videolistdatamodel.h"
+#include "videolistdatamodeldata.h"
+#include "videocollectiontrace.h"
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+ hbInstance->mWindowses.append(&window);
+
+ TestListMenu tv;
+
+ int res;
+ if(argc > 1)
+ {
+ res = QTest::qExec(&tv, argc, argv);
+ }
+ else
+ {
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testlistmenu.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::init()
+{
+ mUiLoader = new VideoCollectionUiLoader();
+ mUiLoader->reset();
+
+ bool ok(false);
+ mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
+ if (!ok)
+ {
+ return;
+ }
+
+ mListView = mUiLoader->findWidget<VideoListView>( DOCML_NAME_VIEW );
+ QVERIFY(mListView);
+
+ mDataModel = new VideoListDataModel();
+
+ mModel = new VideoProxyModelGeneric();
+ mModel->setSourceModel(mDataModel);
+
+ mListWidget = new VideoListWidget(mUiLoader, 0);
+ mListWidget->initialize(*mModel, false, VideoCollectionCommon::ELevelVideos);
+
+ mListView->mCurrentList = mListWidget;
+
+ mTestObject = new VideoListMenu(mUiLoader, mListView);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::cleanup()
+{
+ delete mUiLoader;
+ mUiLoader = 0;
+
+ delete mListWidget;
+ mListWidget = 0;
+
+ delete mModel;
+ mModel = 0;
+
+ mListView = 0;
+
+ disconnect();
+
+ VideoListWidgetData::reset();
+ VideoProxyModelData::reset();
+ VideoCollectionViewUtilsData::reset();
+ HbDocumentLoader::cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testInitializeMenu
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::testInitializeMenu()
+{
+ // Good case
+ init();
+ QVERIFY(mTestObject->initializeMenu() == 0);
+ QVERIFY(VideoCollectionUiLoaderData::mAddDataCallCount == 1);
+ cleanup();
+
+ // Test null ui loader.
+ mTestObject = new VideoListMenu(0, 0);
+ QVERIFY(mTestObject->initializeMenu() == -1);
+ QVERIFY(VideoCollectionUiLoaderData::mAddDataCallCount == 0);
+ cleanup();
+
+ // Is service
+ init();
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
+ QVERIFY(mTestObject->initializeMenu() == 0);
+ QVERIFY(VideoCollectionUiLoaderData::mAddDataCallCount == 1);
+ // Call again, now mVideoServices is set already.
+ QVERIFY(mTestObject->initializeMenu() == 0);
+ QVERIFY(VideoCollectionUiLoaderData::mAddDataCallCount == 2);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testInitializeMenu
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::testStartSorting()
+{
+ HbAction *action(0);
+ HbMenu *sortMenu(0);
+ HbMenu *optionsMenu(0);
+ HbAction *sortMenuAction = new HbAction("test");
+
+ init();
+
+ // No current list.
+ connect(this, SIGNAL(testSignal()), mTestObject, SLOT(startSorting()));
+ mListView->mCurrentList = 0;
+ emit testSignal();
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
+ mListView->mCurrentList = mListWidget;
+
+ // Action is not sort menu
+ action = mUiLoader->findObject<HbAction>(DOCML_NAME_DELETE_MULTIPLE);
+ optionsMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
+ sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ QVERIFY(action != 0);
+ optionsMenu->setActiveAction(action);
+ sortMenuAction->setMenu(sortMenu);
+ HbMenuData::mMenuAction = sortMenuAction;
+ emit testSignal();
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
+
+ // Sort menu has no active action.
+ action = mUiLoader->findObject<HbAction>(DOCML_NAME_DELETE_MULTIPLE);
+ optionsMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
+ sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ QVERIFY(action != 0);
+ optionsMenu->setActiveAction(action);
+ sortMenuAction->setMenu(sortMenu);
+ HbMenuData::mMenuAction = action;
+ sortMenu->setActiveAction(0);
+ emit testSignal();
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
+
+ // Good cases
+
+ cleanup();
+
+ TMPXItemId invalidId = TMPXItemId::InvalidId();
+
+ init();
+ mListView->activateView(invalidId);
+ sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ sortMenuAction->setMenu(sortMenu);
+ HbMenuData::mMenuAction = sortMenuAction;
+ VideoProxyModelGeneric* model = mListView->mCurrentList->getModel();
+ QVERIFY(action != 0);
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(sortMenuAction);
+ HbAction *sortAction = mUiLoader->findObject<HbAction>(DOCML_NAME_SORT_BY_NAME);
+ QVERIFY(sortAction != 0);
+ sortMenu->setActiveAction(sortAction);
+ model->setSortRole(1);
+ connect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_DATE), DOCML_NAME_SORT_BY_DATE);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NAME), DOCML_NAME_SORT_BY_NAME);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS), DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_SIZE), DOCML_NAME_SORT_BY_SIZE);
+ disconnect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+
+ connect(this, SIGNAL(testSignal()), mTestObject, SLOT(startSorting()));
+
+ // No model.
+ mListView->mCurrentList->mModel = 0;
+ emit testSignal();
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
+
+ // First ok case.
+ mListView->mCurrentList->mModel = mModel;
+ emit testSignal();
+
+ // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
+
+ VideoProxyModelData::mDoSortingCallCount = 0;
+ // emit test signal again, with same parameters. Sorting should be switched to
+ // descending order.
+ emit testSignal();
+ // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::DescendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
+
+ VideoProxyModelData::mDoSortingCallCount = 0;
+ // on third emit, sorting should be switched back to ascending
+ emit testSignal();
+ // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
+
+ // test that after changing the sort role, the order is also switched to ascending.
+ model->doSorting(model->sortRole(), Qt::DescendingOrder);
+ sortAction = mUiLoader->findObject<HbAction>(DOCML_NAME_SORT_BY_DATE);
+ QVERIFY(sortAction != 0);
+ sortMenu->setActiveAction(sortAction);
+ VideoProxyModelData::mDoSortingCallCount = 0;
+ emit testSignal();
+ // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
+ cleanup();
+
+ // start sorting slot:
+ // -is service
+ init();
+ connect(this, SIGNAL(testSignal()), mTestObject, SLOT(startSorting()));
+ sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ sortMenuAction->setMenu(sortMenu);
+ HbMenuData::mMenuAction = sortMenuAction;
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(sortMenuAction);
+ sortAction = mUiLoader->findObject<HbAction>(DOCML_NAME_SORT_BY_NAME);
+ QVERIFY(sortAction != 0);
+ sortMenu->setActiveAction(sortAction);
+ mTestObject->mVideoServices = VideoServices::instance();
+ int sortRole = VideoCollectionViewUtilsData::mVideoSortRole;
+ emit testSignal();
+ QCOMPARE(sortRole, VideoCollectionViewUtilsData::mVideoSortRole);
+ cleanup();
+}
+
+/**
+ * Tests testDeleteItemsSlot
+ */
+void TestListMenu::testDeleteItemsSlot()
+{
+ init();
+ connect( this, SIGNAL(testSignal()), mTestObject, SLOT(deleteItemsSlot()) );
+
+ // dialog loading fails
+ VideoCollectionUiLoaderData::mFailDialogLoad = true;
+ emit testSignal();
+ QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 0);
+
+ // selection dialog exists
+ VideoCollectionUiLoaderData::mFailDialogLoad = false;
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(2, 3);
+ emit testSignal();
+ QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 1);
+ QCOMPARE(VideoListSelectionDialogData::mSelectionType, (int)VideoListSelectionDialog::EDeleteVideos);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
+
+ // test second successful activation.
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(3, 2);
+ emit testSignal();
+ QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 2);
+ QCOMPARE(VideoListSelectionDialogData::mSelectionType, (int)VideoListSelectionDialog::EDeleteVideos);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testCreateCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::testCreateCollectionSlot()
+{
+ init();
+ QVERIFY(connect(this, SIGNAL(testSignal()), mTestObject, SLOT(createCollectionSlot())));
+
+ // dialog finding fails
+ VideoCollectionUiLoaderData::mFailDialogLoad = true;
+ emit testSignal();
+ 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()), mTestObject, SLOT(createCollectionSlot()));
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testAddVideosToCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::testAddVideosToCollectionSlot()
+{
+ init();
+ QVERIFY(connect(this, SIGNAL(testSignal()), mTestObject, SLOT(addVideosToCollectionSlot())));
+
+ // No current list.
+ mListView->mCurrentList = 0;
+ emit testSignal();
+ QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 0);
+ mListView->mCurrentList = mListWidget;
+
+ // Current list has no model.
+ mListView->mCurrentList->mModel = 0;
+ emit testSignal();
+ QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 0);
+ mListView->mCurrentList->mModel = mModel;
+
+ // dialog finding fails
+ VideoCollectionUiLoaderData::mFailDialogLoad = true;
+ emit testSignal();
+ 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::EAddToCollection);
+ QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 1);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testAboutToShowMainMenuSlot
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::testAboutToShowMainMenuSlot()
+{
+ init();
+
+ VideoServices *videoServices = VideoServices::instance();
+
+ // Setup menu objects.
+ connect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_OPTIONS_MENU), DOCML_NAME_OPTIONS_MENU);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_DATE), DOCML_NAME_SORT_BY_DATE);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NAME), DOCML_NAME_SORT_BY_NAME);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS), DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_ADD_TO_COLLECTION), DOCML_NAME_ADD_TO_COLLECTION);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_CREATE_COLLECTION), DOCML_NAME_CREATE_COLLECTION);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_DELETE_MULTIPLE), DOCML_NAME_DELETE_MULTIPLE);
+ disconnect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+
+ // No current list.
+ setVisibilityForMenuActions(false);
+ VideoListDataModelData::setRowCount(*mDataModel, 5);
+ QVERIFY(connect(this, SIGNAL(testSignal()), mTestObject, SLOT(aboutToShowMainMenuSlot())));
+ mListView->mCurrentList = 0;
+ emit testSignal();
+ int visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+
+ // No model, current list is category
+ mListView->mCurrentList = mListWidget;
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
+ mListWidget->mModel = 0;
+ setVisibilityForMenuActions(true);
+ VideoListDataModelData::setRowCount(*mDataModel, 0);
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 1);
+
+ // No model, current list is not category
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
+ mListWidget->mModel = 0;
+ setVisibilityForMenuActions(true);
+ VideoListDataModelData::setRowCount(*mDataModel, 0);
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+
+ // Empty model.
+ mListView->mCurrentList->mModel = mModel;
+ setVisibilityForMenuActions(true);
+ VideoListDataModelData::setRowCount(*mDataModel, 0);
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+
+ VideoProxyModelData::mSortRole = VideoCollectionCommon::KeyDateTime;
+ VideoProxyModelData::mSortOrder = Qt::AscendingOrder;
+
+ // Level videos
+ VideoListDataModelData::setRowCount(*mDataModel, 10);
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
+ mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->setChecked(false);
+ mTestObject->mVideoServices = 0;
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 5);
+ QVERIFY(mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->isChecked());
+
+ // Level videos and is service.
+ VideoListDataModelData::setRowCount(*mDataModel, 10);
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
+ mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->setChecked(false);
+ mTestObject->mVideoServices = videoServices;
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 3);
+ QVERIFY(mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->isChecked());
+
+ // Level category
+ VideoListDataModelData::setRowCount(*mDataModel, 10);
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
+ mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->setChecked(false);
+ mTestObject->mVideoServices = 0;
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 3);
+ QVERIFY(mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->isChecked());
+
+ // Level ELevelDefaultColl
+ VideoListDataModelData::setRowCount(*mDataModel, 10);
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelDefaultColl;
+ mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->setChecked(false);
+ mTestObject->mVideoServices = 0;
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 4);
+ QVERIFY(mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->isChecked());
+
+ // Level ELevelDefaultColl and is service
+ VideoListDataModelData::setRowCount(*mDataModel, 10);
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelDefaultColl;
+ mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->setChecked(false);
+ mTestObject->mVideoServices = videoServices;
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 3);
+ QVERIFY(mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->isChecked());
+
+ VideoProxyModelData::mSortRole = VideoCollectionCommon::KeyDateTime;
+ VideoProxyModelData::mSortOrder = Qt::AscendingOrder;
+ // Level ELevelAlbum
+ VideoListDataModelData::setRowCount(*mDataModel, 10);
+ mListWidget->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
+ mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->setChecked(false);
+ mTestObject->mVideoServices = 0;
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 4);
+ QVERIFY(mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->isChecked());
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testPrepareBrowseServiceMenu
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::testPrepareBrowseServiceMenu()
+{
+ init();
+
+ VideoServices *videoServices = VideoServices::instance();
+ videoServices->mCurrentService = VideoServices::EBrowse;
+ mTestObject->mVideoServices = videoServices;
+
+ // Setup menu objects.
+ connect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)),
+ mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_OPTIONS_MENU), DOCML_NAME_OPTIONS_MENU);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_DATE), DOCML_NAME_SORT_BY_DATE);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NAME), DOCML_NAME_SORT_BY_NAME);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS), DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_ADD_TO_COLLECTION), DOCML_NAME_ADD_TO_COLLECTION);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_CREATE_COLLECTION), DOCML_NAME_CREATE_COLLECTION);
+ emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_DELETE_MULTIPLE), DOCML_NAME_DELETE_MULTIPLE);
+
+ disconnect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+
+ // No current list.
+ setVisibilityForMenuActions(false);
+ VideoListDataModelData::setRowCount(*mDataModel, 5);
+ QVERIFY(connect(this, SIGNAL(testSignal()), mTestObject, SLOT(aboutToShowMainMenuSlot())));
+ mListView->mCurrentList = 0;
+ emit testSignal();
+ int visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+
+ // No model
+ mListView->mCurrentList = mListWidget;
+ mListWidget->mModel = 0;
+ setVisibilityForMenuActions(true);
+ VideoListDataModelData::setRowCount(*mDataModel, 0);
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+
+ // Empty model.
+ mListView->mCurrentList->mModel = mModel;
+ setVisibilityForMenuActions(true);
+ VideoListDataModelData::setRowCount(*mDataModel, 0);
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+
+ VideoProxyModelData::mSortRole = VideoCollectionCommon::KeyDateTime;
+ VideoProxyModelData::mSortOrder = Qt::AscendingOrder;
+
+ // Good case.
+ mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->setChecked(false);
+ setVisibilityForMenuActions(true);
+ VideoListDataModelData::setRowCount(*mDataModel, 10);
+ emit testSignal();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 4);
+ QVERIFY(mTestObject->mSortingRoles.key(VideoCollectionCommon::KeyDateTime)->isChecked());
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testObjectReadySlot
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::testObjectReadySlot()
+{
+ init();
+
+ // Ok cases have been tested earlier.
+ connect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)),
+ mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+
+ // Null objects, qobject cast fails and sorting roles array should be empty.
+ emit testObjectReadySignal(0, "notknown");
+ emit testObjectReadySignal(0, DOCML_NAME_SORT_BY_DATE);
+ emit testObjectReadySignal(0, DOCML_NAME_SORT_BY_NAME);
+ emit testObjectReadySignal(0, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ emit testObjectReadySignal(0, DOCML_NAME_SORT_BY_SIZE);
+ emit testObjectReadySignal(0, DOCML_NAME_ADD_TO_COLLECTION);
+ emit testObjectReadySignal(0, DOCML_NAME_CREATE_COLLECTION);
+ emit testObjectReadySignal(0, DOCML_NAME_DELETE_MULTIPLE);
+ QCOMPARE(mTestObject->mSortingRoles.count(), 0);
+
+ disconnect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestObject, SLOT(objectReadySlot(QObject*, const QString)));
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// visibleMenuActions
+// ---------------------------------------------------------------------------
+//
+int TestListMenu::visibleMenuActions()
+{
+ int visibleActions(0);
+ VideoCollectionUiLoader::ActionIds key;
+ HbAction *action(0);
+ foreach (key, VideoCollectionUiLoaderData::mMenuActions.keys())
+ {
+ action = dynamic_cast<HbAction*>(VideoCollectionUiLoaderData::mMenuActions[key]);
+ if (action && action->isVisible())
+ {
+ visibleActions++;
+ }
+ }
+ return visibleActions;
+}
+
+// ---------------------------------------------------------------------------
+// setVisibilityForMenuActions
+// ---------------------------------------------------------------------------
+//
+void TestListMenu::setVisibilityForMenuActions(bool visible)
+{
+ VideoCollectionUiLoader::ActionIds key;
+ HbAction *action(0);
+ foreach (key, VideoCollectionUiLoaderData::mMenuActions.keys())
+ {
+ action = dynamic_cast<HbAction*>(VideoCollectionUiLoaderData::mMenuActions[key]);
+ if (action)
+ {
+ action->setVisible(visible);
+ }
+ }
+}
+
+// End of file.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistmenu/testlistmenu.pro Mon Sep 20 18:25:37 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:
+#
+
+TEMPLATE = app
+
+TARGET =
+
+DEPENDPATH += . \
+ inc \
+ src \
+ ../../../tsrc/stubs
+
+INCLUDEPATH += . \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stubbed headers are taken first
+ ../../../inc \
+ ../../../videocollectionview/inc \
+ ../../../videocollectionwrapper/inc \
+ ../../../../inc \
+
+HEADERS += inc/testlistmenu.h \
+ \ # headers needed in test
+ ../../../videocollectionview/inc/videolistmenu.h \
+
+SOURCES += src/testlistmenu.cpp \
+ \ # sources needed in test
+ ../../../videocollectionview/src/videolistmenu.cpp \
+
+TESTEDCLASS = videolistmenu
+include(../../../tsrc/stubs/stubs.pro)
+
+RESOURCES += ../../data/videocollectionview.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlisttoolbar/inc/testlisttoolbar.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,161 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoListToolbar
+*
+*/
+
+#ifndef __TESTLISTTOOLBAR_H__
+#define __TESTLISTTOOLBAR_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include <qlist.h>
+
+class VideoListToolbar;
+class VideoListView;
+class VideoCollectionUiLoader;
+class VideoProxyModelGeneric;
+class QAction;
+class HbToolBarExtension;
+
+class TestListToolbar : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+ /**
+ * called automatically before anything else when test starts
+ */
+ void initTestCase();
+
+ /**
+ * will be called automatically before each testfunction is executed.
+ */
+ void init();
+
+ /**
+ * will be called automatically after every testfunction.
+ */
+ void cleanup();
+
+ /**
+ * will be called automatically after testing ends
+ */
+ void cleanupTestCase();
+
+ /**
+ * Tests initializing normal toolbar
+ */
+ void testInitialize();
+
+ /**
+ * Test initializing service
+ */
+ void testInitializeService();
+
+ /**
+ * Test viewStateChanged -slot,
+ * No service extension, stand alone
+ */
+ void testViewStateChanged();
+
+ /**
+ * Test viewStateChanged -slot,
+ * service application
+ */
+ void testViewStateChangedService();
+
+ /**
+ * Test viewStateChanged -slot,
+ * with service extension, stand alone
+ */
+ void testViewStateChangedWithServiceExt();
+
+
+ /**
+ * Tests openoperatorServiceSlot
+ */
+ void testOpenOperatorServiceSlot();
+
+ /**
+ * Tests addVideosToCollectionSlot
+ */
+ void testAddVideosToCollectionSlot();
+
+ /**
+ * Tests removeVideosFromCollectionSlot
+ */
+ void testRemoveVideosFromCollectionSlot();
+
+private slots:
+
+ /**
+ * slot can be conected to VideoListToolbar::actionsChanged signal,
+ * will save provided qlist into mLastChangedActions
+ */
+ void testActionsChangedSlot(QList<QAction*>);
+
+ /**
+ * slot can be conected to VideoListToolbar::toolbarExtensionChanged signal,
+ * will save provided HbToolBarExtension into
+ */
+ void testToolbarExtensionChangedSlot(HbToolBarExtension*);
+
+private:
+
+ /**
+ * sets provided row count to provided model
+ */
+ void setRowCount(int count, VideoProxyModelGeneric *model);
+
+ /**
+ * object under test
+ */
+ VideoListToolbar *mTestObject;
+
+ /**
+ * stub listview
+ */
+ VideoListView *mStubListView;
+
+ /**
+ * stub -uiloader
+ */
+ VideoCollectionUiLoader *mStubUiLoader;
+
+ /**
+ * generic model
+ */
+ VideoProxyModelGeneric *mStubModel;
+
+ /**
+ * actions provided to testActionsChangedSlot will be saved here
+ */
+ QList<QAction*> mLastChangedActions;
+
+ /**
+ * extension provided to testToolbarExtensionChangedSlot will
+ * be saved here
+ */
+ HbToolBarExtension* mLastChangedExtension;
+
+};
+
+
+#endif // __TESTCOLLECTIONVIEW_H__
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlisttoolbar/src/testlisttoolbar.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,753 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoListToolbar
+*
+*/
+
+// Version : %version: 2 %
+
+#include <hbapplication.h>
+#include <qlist.h>
+#include <hbaction.h>
+#include <videocollectioncommon.h>
+#include <vcxmyvideosdefs.h>
+
+#include "testlisttoolbar.h"
+#include "videolistview.h"
+#include "videocollectionuiloader.h"
+#include "videocollectionuiloaderdata.h"
+#include "videolistview.h"
+#include "videolistviewdata.h"
+#include "videooperatorservice.h"
+#include "videooperatorservicedata.h"
+#include "videoservices.h"
+#include "videocollectionviewutils.h"
+#include "videocollectionviewutilsdata.h"
+#include "videoproxymodeldata.h"
+#include "videolistdatamodeldata.h"
+#include "videolistselectiondialog.h"
+#include "videolistselectiondialogdata.h"
+#include "videocollectionwrapper.h"
+
+#define private public
+#include "videolisttoolbar.h"
+#undef private
+
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ TestListToolbar tv;
+
+ int res;
+ if(argc > 1)
+ {
+ res = QTest::qExec(&tv, argc, argv);
+ }
+ else
+ {
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testlisttoolbar.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// setRowCount
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::setRowCount(int count, VideoProxyModelGeneric *model)
+{
+ if (model)
+ {
+ VideoListDataModel *sourceModel =
+ qobject_cast<VideoListDataModel*>(
+ model->sourceModel());
+ if(sourceModel)
+ {
+ VideoListDataModelData::setRowCount(*sourceModel, count);
+ }
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// initTestCase
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::initTestCase()
+{
+ mTestObject = 0;
+ mStubListView = 0;
+ mStubUiLoader = 0;
+ mStubModel = 0;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::init()
+{
+ if(!mStubUiLoader)
+ {
+ mStubUiLoader = new VideoCollectionUiLoader();
+ }
+ if(!mStubListView)
+ {
+ mStubListView = new VideoListView(mStubUiLoader);
+ }
+ if(!mTestObject)
+ {
+ mTestObject = new VideoListToolbar(mStubUiLoader, mStubListView);
+ }
+ if(!mStubModel)
+ {
+ mStubModel = VideoCollectionWrapper::instance().getAllVideosModel();
+ }
+ // by default, we run as stand alone
+ VideoCollectionViewUtilsData::mIsServiceValue = false;
+ VideoCollectionViewUtils::instance().setIsService();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+
+ delete mStubListView;
+ mStubListView = 0;
+
+ delete mStubUiLoader;
+ mStubUiLoader = 0;
+
+ mStubModel = 0;
+
+ mLastChangedActions.clear();
+
+ mLastChangedExtension = 0;
+}
+
+// ---------------------------------------------------------------------------
+// cleanupTestCase
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::cleanupTestCase()
+{
+ delete mTestObject;
+ mTestObject = 0;
+
+ delete mStubListView;
+ mStubListView = 0;
+
+ delete mStubUiLoader;
+ mStubUiLoader = 0;
+
+ if( VideoListViewData::mCurrentListWidget)
+ {
+ delete VideoListViewData::mCurrentListWidget;
+ VideoListViewData::mCurrentListWidget = 0;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testActionsChangedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testActionsChangedSlot(QList<QAction*> actions)
+{
+ mLastChangedActions.clear();
+ mLastChangedActions = actions;
+}
+
+// ---------------------------------------------------------------------------
+// testToolbarExtensionChangedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testToolbarExtensionChangedSlot(HbToolBarExtension* extension)
+{
+ mLastChangedExtension = 0;
+ mLastChangedExtension = extension;
+}
+
+// ---------------------------------------------------------------------------
+// testInitialize
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testInitialize()
+{
+
+ mTestObject->initialize();
+ // not a service, no service extensions
+ QVERIFY( mTestObject->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarCollectionActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mTestObject->mVideoOperatorServices.count());
+
+ cleanup();
+ init();
+
+ VideoOperatorServiceData::mTitles.append("TestTitle");
+ VideoOperatorServiceData::mUris.append("TestURI");
+ VideoOperatorServiceData::mIcons.append("TestIcon");
+ // not a service, one service extension
+ mTestObject->initialize();
+ QVERIFY( mTestObject->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarCollectionActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( !mTestObject->mToolbarServiceExtension);
+ QVERIFY( mTestObject->mVideoOperatorServices.count() == 1);
+
+ cleanup();
+ init();
+
+ VideoOperatorServiceData::mTitles.append("TestTitle");
+ VideoOperatorServiceData::mTitles.append("TestTitle2");
+ VideoOperatorServiceData::mUris.append("TestURI");
+ VideoOperatorServiceData::mUris.append("TestURI2");
+ VideoOperatorServiceData::mIcons.append("TestIcon");
+ VideoOperatorServiceData::mIcons.append("TestIcon2");
+ // not a service, multiple service extensions
+ mTestObject->initialize();
+ QVERIFY( mTestObject->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarCollectionActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( mTestObject->mToolbarServiceExtension);
+ QVERIFY( mTestObject->mVideoOperatorServices.count() == 2);
+
+ // second call, no change
+ mTestObject->initialize();
+ QVERIFY( mTestObject->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarCollectionActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( mTestObject->mToolbarServiceExtension);
+ QVERIFY( mTestObject->mVideoOperatorServices.count() == 2);
+
+ cleanup();
+ init();
+ VideoOperatorServiceData::mTitles.append("TestTitle");
+ VideoOperatorServiceData::mUris.append("TestURI");
+ VideoOperatorServiceData::mIcons.append("TestIcon");
+ // for coverity: plain initialization, service for one service allready gotten
+ VideoOperatorService *tmp = new VideoOperatorService();
+ mTestObject->mVideoOperatorServices.append(tmp);
+ mTestObject->initialize();
+ QVERIFY( mTestObject->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarCollectionActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ // service toolbutton is not created
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( !mTestObject->mToolbarServiceExtension);
+ QVERIFY( mTestObject->mVideoOperatorServices.count() == 1);
+ VideoOperatorServiceData::reset();
+}
+
+// ---------------------------------------------------------------------------
+// InitializeService
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testInitializeService()
+{
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
+ // service object does not exists yet
+ mTestObject->initialize();
+ QVERIFY( mTestObject->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarCollectionActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mTestObject->mVideoOperatorServices.count());
+
+ // service object exist
+ cleanup();
+ init();
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
+
+ mTestObject->mVideoServices = VideoServices::instance();
+ mTestObject->initialize();
+ QVERIFY( mTestObject->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarCollectionActionGroup != 0 );
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mTestObject->mVideoOperatorServices.count());
+
+ VideoCollectionViewUtilsData::mIsServiceValue = false;
+ VideoCollectionViewUtils::instance().setIsService();
+}
+
+// ---------------------------------------------------------------------------
+// testViewStateChanged
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testViewStateChanged()
+{
+ connect(mTestObject, SIGNAL(actionsChanged(QList<QAction*>)), this, SLOT(testActionsChangedSlot(QList<QAction*>)));
+ connect(mTestObject, SIGNAL(toolbarExtensionChanged(HbToolBarExtension*)), this, SLOT(testToolbarExtensionChangedSlot(HbToolBarExtension*)));
+
+ // not initialized
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelVideos, false, true);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+
+ mTestObject->initialize();
+
+ // not a service, level is ELevelCategory
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelCategory, false, true);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY(mLastChangedActions.count() == 2);
+
+ // not a service, level is ELevelDefaultColl
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelDefaultColl, false, true);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( !mLastChangedActions.count());
+
+ // not a service, level is ELevelVideos
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelVideos, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY(mLastChangedActions.count() == 2);
+
+ // not a service, level is ELevelAlbum, model ready
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelAlbum, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]->isVisible());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]->isVisible());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( mLastChangedActions.count() == 2);
+
+ // change level, otherwise signals are not emitted
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelVideos, false, true);
+
+ // not a service, level is ELevelAlbum, model not ready
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelAlbum, true, false);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]->isVisible());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]->isVisible());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( mLastChangedActions.count() == 2);
+
+ // not a service, level is not anything above
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelInvalid, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( !mLastChangedActions.count());
+
+ disconnect(mTestObject, SIGNAL(actionsChanged(QList<QAction*>)), this, SLOT(testActionsChangedSlot(QList<QAction*>)));
+ disconnect(mTestObject, SIGNAL(toolbarExtensionChanged(HbToolBarExtension*)), this, SLOT(testToolbarExtensionChangedSlot(HbToolBarExtension*)));
+
+}
+
+// ---------------------------------------------------------------------------
+// testViewStateChangedService
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testViewStateChangedService()
+{
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
+ connect(mTestObject, SIGNAL(actionsChanged(QList<QAction*>)), this, SLOT(testActionsChangedSlot(QList<QAction*>)));
+ connect(mTestObject, SIGNAL(toolbarExtensionChanged(HbToolBarExtension*)), this, SLOT(testToolbarExtensionChangedSlot(HbToolBarExtension*)));
+
+ mTestObject->initialize();
+
+ // service, level is ELevelCategory
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelCategory, false, true);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY(mLastChangedActions.count() == 2);
+
+ // service, level is ELevelDefaultColl
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelDefaultColl, false, true);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( !mLastChangedActions.count());
+
+ // service, level is ELevelVideos
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelVideos, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY(mLastChangedActions.count() == 2);
+
+ // service, level is ELevelAlbum model ready
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelAlbum, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( !mLastChangedActions.count());
+
+ // change level, otherwise not all signal are emitted
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelVideos, false, true);
+
+ // service, level is ELevelAlbum model not ready
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelAlbum, false, false);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( !mLastChangedActions.count());
+
+ disconnect(mTestObject, SIGNAL(actionsChanged(QList<QAction*>)), this, SLOT(testActionsChangedSlot(QList<QAction*>)));
+ disconnect(mTestObject, SIGNAL(toolbarExtensionChanged(HbToolBarExtension*)), this, SLOT(testToolbarExtensionChangedSlot(HbToolBarExtension*)));
+}
+
+// ---------------------------------------------------------------------------
+// testViewStateChangedWithServiceExt
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testViewStateChangedWithServiceExt()
+{
+ connect(mTestObject, SIGNAL(actionsChanged(QList<QAction*>)), this, SLOT(testActionsChangedSlot(QList<QAction*>)));
+ connect(mTestObject, SIGNAL(toolbarExtensionChanged(HbToolBarExtension*)), this, SLOT(testToolbarExtensionChangedSlot(HbToolBarExtension*)));
+
+ VideoOperatorServiceData::mTitles.append("TestTitle");
+ VideoOperatorServiceData::mTitles.append("TestTitle2");
+ VideoOperatorServiceData::mUris.append("TestURI");
+ VideoOperatorServiceData::mUris.append("TestURI2");
+ VideoOperatorServiceData::mIcons.append("TestIcon");
+ VideoOperatorServiceData::mIcons.append("TestIcon2");
+
+ mTestObject->initialize();
+
+ // not a service, level is ELevelCategory
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelCategory, false, true);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( mLastChangedExtension);
+ QVERIFY(mLastChangedActions.count() == 2);
+
+ mLastChangedExtension = 0;
+
+ // not a service, level is ELevelDefaultColl
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelDefaultColl, false, true);
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( !mLastChangedActions.count());
+
+ // not a service, level is ELevelVideos
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelVideos, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( mLastChangedExtension);
+ QVERIFY(mLastChangedActions.count() == 2);
+
+ mLastChangedExtension = 0;
+ // not a service, level is ELevelAlbum, model ready
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelAlbum, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]->isVisible());
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]->isVisible());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( mLastChangedActions.count() == 2);
+
+ // need to change level to make sure signals are emitted correctly
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelVideos, false, true);
+ mLastChangedExtension = 0;
+
+ // not a service, level is ELevelAlbum, model not ready
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelAlbum, true, false);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionAddVideos]->isVisible());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionRemoveVideos]->isVisible());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( mLastChangedActions.count() == 2);
+
+ // not a service, level is not anything above
+ mTestObject->viewStateChanged(VideoCollectionCommon::ELevelInvalid, false, true);
+ QVERIFY( mTestObject->mToolbarActions[VideoListToolbar::ETBActionAllVideos]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionCollections]->isChecked());
+ QVERIFY( !mTestObject->mToolbarActions[VideoListToolbar::ETBActionServices]);
+ QVERIFY( !mLastChangedExtension);
+ QVERIFY( !mLastChangedActions.count());
+
+ disconnect(mTestObject, SIGNAL(actionsChanged(QList<QAction*>)), this, SLOT(testActionsChangedSlot(QList<QAction*>)));
+ disconnect(mTestObject, SIGNAL(toolbarExtensionChanged(HbToolBarExtension*)), this, SLOT(testToolbarExtensionChangedSlot(HbToolBarExtension*)));
+}
+
+
+
+
+// ---------------------------------------------------------------------------
+// testOpenOperatorServiceSlot
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testOpenOperatorServiceSlot()
+{
+ mTestObject->initialize();
+ // no operator services
+ mTestObject->openOperatorServiceSlot();
+ QVERIFY(VideoOperatorServiceData::mLaunchServiceCallCount == 0);
+
+ cleanup();
+ init();
+ VideoOperatorServiceData::mTitles.append("TestTitle");
+ VideoOperatorServiceData::mUris.append("TestURI");
+ VideoOperatorServiceData::mIcons.append("TestIcon");
+ mTestObject->initialize();
+ // more than zero operator services
+ mTestObject->openOperatorServiceSlot();
+ QVERIFY(VideoOperatorServiceData::mLaunchServiceCallCount == 1);
+}
+
+// ---------------------------------------------------------------------------
+// testAddVideosToCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testAddVideosToCollectionSlot()
+{
+
+ TMPXItemId invalidId = TMPXItemId::InvalidId();
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(0, 2);
+
+ mStubModel = VideoCollectionWrapper::instance().getCollectionContentModel();
+
+ // no list widget
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+ QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+
+ VideoListViewData::mCurrentListWidget = new VideoListWidget(mStubUiLoader);
+
+ // no model in widget
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+ QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+
+ // model exist.
+ VideoListViewData::mCurrentListWidget->initialize(*mStubModel, false, VideoCollectionCommon::ELevelAlbum);
+
+ // Selection dialog widget loading fails.
+ VideoCollectionUiLoaderData::mFindFailure = true;
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+ QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+ VideoCollectionUiLoaderData::mFindFailure = false;
+
+ // cannot load DOCML_NAME_VC_VIDEOLISTWIDGET
+ VideoCollectionUiLoaderData::mFindFailureNameList.append(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
+ QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+ VideoListSelectionDialogData::reset();
+ VideoCollectionViewUtilsData::reset();
+ VideoCollectionUiLoaderData::reset();
+
+ VideoListWidget *allVideos = mStubUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_VIDEOLISTWIDGET);
+ // loads DOCML_NAME_VC_VIDEOLISTWIDGET but is has no model
+ VideoProxyModelGeneric *tmp = allVideos->getModel();
+ VideoProxyModelGeneric *nullModel = 0;
+ allVideos->initialize(*nullModel, false, VideoCollectionCommon::ELevelVideos);
+ VideoCollectionUiLoaderData::mFindFailureNameList.removeAll(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
+ QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+ VideoListSelectionDialogData::reset();
+ VideoCollectionViewUtilsData::reset();
+ VideoCollectionUiLoaderData::reset();
+ allVideos->initialize(*tmp, false, VideoCollectionCommon::ELevelVideos);
+
+ // loads DOCML_NAME_VC_VIDEOLISTWIDGET, it has model, both have zero videos
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount );
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+ QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+
+ // loads DOCML_NAME_VC_VIDEOLISTWIDGET, it has model, both have same amount, more that zero videos
+ setRowCount(3, tmp);
+ setRowCount(3, mStubModel);
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount );
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+ QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusAllVideosAlreadyInCollection);
+ VideoListSelectionDialogData::reset();
+ VideoCollectionViewUtilsData::reset();
+ VideoCollectionUiLoaderData::reset();
+
+
+ // loads DOCML_NAME_VC_VIDEOLISTWIDGET, it has model, different amount, more that zero videos
+ // clear tmp model's source model to get row count zero
+ VideoListDataModel *tmpSourceModel =
+ qobject_cast<VideoListDataModel*>(
+ tmp->sourceModel());
+ tmp->setSourceModel(0);
+ mTestObject->addVideosToCollectionSlot();
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
+ QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+ // need to restore source model. Otherwise allvideos -proxymodel used in other cases does not work correctly
+ tmp->setSourceModel(tmpSourceModel);
+
+}
+
+// ---------------------------------------------------------------------------
+// testRemoveVideosFromCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void TestListToolbar::testRemoveVideosFromCollectionSlot()
+{
+ if( VideoListViewData::mCurrentListWidget)
+ {
+ delete VideoListViewData::mCurrentListWidget;
+ VideoListViewData::mCurrentListWidget = 0;
+ }
+ // no current list
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount );
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+ VideoListViewData::mCurrentListWidget = new VideoListWidget(mStubUiLoader);
+
+ // no model in widget
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+
+ // has model, level different than ELevelAlbum
+ VideoListViewData::mCurrentListWidget->initialize(*mStubModel, false, VideoCollectionCommon::ELevelVideos);
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+
+ // has model, level is ELEvelAlbum, rowcount == 0
+ setRowCount(0, mStubModel);
+ VideoListViewData::mCurrentListWidget->initialize(*mStubModel, false, VideoCollectionCommon::ELevelAlbum);
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+
+ // has model, level is ELevelAlbum, rowcount > 0, dialog loading fails
+ setRowCount(5, mStubModel);
+ VideoCollectionUiLoaderData::mFindFailure = true;
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+ VideoCollectionUiLoaderData::mFindFailure = false;
+
+ // has model, level is ELevelAlbum, rowcount > 0, dialog loading succeeds,
+ // opened item is TMPXItemId::InvalidId()
+ VideoProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+
+ // has model, level is ELevelAlbum, rowcount > 0, dialog loading succeeds,
+ // opened items iId2 != KVcxMvcMediaTypeAlbum
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(1,KVcxMvcMediaTypeCategory);
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(!VideoListSelectionDialogData::mMultiSelectionLaunchCount);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
+
+ // succeed case
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(1,KVcxMvcMediaTypeAlbum);
+ mTestObject->removeVideosFromCollectionSlot();
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::ERemoveFromCollection);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId );
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlisttoolbar/testlisttoolbar.pro Mon Sep 20 18:25:37 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:
+#
+
+TEMPLATE = app
+
+TARGET =
+
+DEPENDPATH += . \
+ inc \
+ src \
+ ../../../tsrc/stubs
+
+INCLUDEPATH += . \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stubbed headers are taken first
+ ../../../inc \
+ ../../../videocollectionview/inc \
+ ../../../videocollectionwrapper/inc \
+ ../../../../inc \
+
+HEADERS += inc/testlisttoolbar.h \
+ \ # headers needed in test
+ ../../../videocollectionview/inc/videolisttoolbar.h \
+
+SOURCES += src/testlisttoolbar.cpp \
+ \ # sources needed in test
+ ../../../videocollectionview/src/videolisttoolbar.cpp \
+
+TESTEDCLASS = videolisttoolbar
+include(../../../tsrc/stubs/stubs.pro)
+
+RESOURCES += ../../data/videocollectionview.qrc
--- a/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Mon Sep 20 18:25:37 2010 +0300
@@ -30,6 +30,7 @@
class VideoCollectionWrapper;
class VideoCollectionUiLoader;
class VideoListWidget;
+class HbToolBarExtension;
class TestListView : public QObject
{
@@ -75,14 +76,9 @@
void testInitializeView();
/**
- * Tests menus.
- */
- void testMenus();
-
- /**
* Tests createAction.
*/
- void testCreateAction();
+ void testCreateToolbar();
/**
* Tests activatView.
@@ -110,16 +106,6 @@
void testAlbumListReadySlot();
/**
- * Tests deleteItemsSlot.
- */
- void testDeleteItemsSlot();
-
- /**
- * Tests aboutToShowMainMenuSlot.
- */
- void testAboutToShowMainMenuSlot();
-
- /**
* Tests handleStatusSlot.
*/
void testHandleStatusSlot();
@@ -135,16 +121,6 @@
void testOpenCollectionViewSlot();
/**
- * Tests openOperatorServiceSlot.
- */
- void testOpenOperatorServiceSlot();
-
- /**
- * Tests startSortingSlot.
- */
- void testStartSortingSlot();
-
- /**
* Tests view when orientation changes.
*/
void testOrientationSlots();
@@ -183,27 +159,17 @@
* Tests orientationChangedSlot
*/
void testOrientationChangedSlot();
-
- /**
- * Tests createCollectionSlot
- */
- void testCreateCollectionSlot();
/**
- * Tests addVideosToCollectionSlot
+ * Tests toolbarActionsChanged
*/
- void testAddVideosToCollectionSlot();
+ void testToolbarActionsChanged();
/**
- * Tests removeVideosFromCollectionSlot
+ * Tests toolbarExtensionChanged
*/
- void testRemoveVideosFromCollectionSlot();
-
- /**
- * Tests createOperatorServicesToolbar
- */
- void testCreateOperatorServicesToolbar();
-
+ void testToolbarExtensionChanged();
+
signals:
// Signals needed in tests.
@@ -229,6 +195,10 @@
void testSignal(const HbEffect::EffectStatus &status);
+ void testSignal(QList<QAction*>);
+
+ void testSignal(HbToolBarExtension*);
+
private:
VideoCollectionUiLoader* mUiLoader;
--- a/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 55 %
+// Version : %version: 58 %
#define private public
#include "videoservices.h"
@@ -40,6 +40,7 @@
#include "hbview.h"
#include "hblistview.h"
#include "hbinputdialog.h"
+#include "hbtoolbarextension.h"
#include <qactiongroup.h>
#include <videocollectioncommon.h>
#include <qhash.h>
@@ -62,6 +63,7 @@
#include "videoproxymodeldata.h"
#include "videocollectionuiloaderdata.h"
#include "videolistdatamodeldata.h"
+#include "videolisttoolbardata.h"
#include "xqserviceutilxtra.h"
#include "videooperatorservicedata.h"
#include "videooperatorservice.h"
@@ -275,7 +277,8 @@
mTestView->mUiLoader = tmp;
// service flag is false and mVideoServices is != 0
- XQServiceUtilXtra::service = false;
+ VideoCollectionViewUtilsData::mIsServiceValue = false;
+ VideoCollectionViewUtils::instance().setIsService();
VideoServices *tmpService = VideoServices::instance();
mTestView->mVideoServices = tmpService;
QVERIFY( mTestView->initializeView() == 0 );
@@ -284,160 +287,28 @@
// service flag is true, mVideoServices is 0
mTestView->mVideoServices = 0;
- XQServiceUtilXtra::service = true;
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
QVERIFY( mTestView->initializeView() == 0 );
QVERIFY( mTestView->mVideoServices != 0 );
- XQServiceUtilXtra::service = false;
+ VideoCollectionViewUtilsData::mIsServiceValue = false;
+ VideoCollectionViewUtils::instance().setIsService();
cleanup();
}
// ---------------------------------------------------------------------------
-// testMenus
+// Slot: test createToolbar
// ---------------------------------------------------------------------------
//
-void TestListView::testMenus()
+void TestListView::testCreateToolbar()
{
init();
-
- TMPXItemId tmpId = TMPXItemId::InvalidId();
- mTestView->activateView(tmpId);
-
- HbAction* action = 0;
- QList<QAction*> tbActions = mTestView->toolBar()->actions();
- QList<QAction*> tbGroupActions;
- QList<QAction*> tbGroupActions2;
-
- // All videos is open for default, verify.
- QVERIFY( mTestView->mToolbarViewsActionGroup != 0 );
- QVERIFY( mTestView->mToolbarCollectionActionGroup != 0 );
- tbGroupActions = mTestView->mToolbarViewsActionGroup->actions();
- tbGroupActions2 = mTestView->mToolbarCollectionActionGroup->actions();
- QCOMPARE( mTestView->mToolbarActions.count(), 5 );
- QCOMPARE( tbActions.count(), 3 );
- QCOMPARE( tbGroupActions.count(), 3 );
- QCOMPARE( tbGroupActions2.count(), 2 );
- QVERIFY( tbGroupActions.at(0)->isChecked() ); // First is checked.
- QCOMPARE( VideoOperatorServiceData::mLoadCallCount, 6);
-
- // Verify checkable and visible toolbar actions.
- HbAction* allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
- HbAction* collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
- HbAction* servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
- HbAction* addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
- HbAction* removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
- QVERIFY( allVideosAction != 0 );
- QVERIFY( allVideosAction->isCheckable() );
- QVERIFY( allVideosAction->isVisible() );
- QVERIFY( tbActions.at(0) == tbGroupActions.at(0) );
-
- QVERIFY( collectionsAction != 0 );
- QVERIFY( collectionsAction->isCheckable() );
- QVERIFY( collectionsAction->isVisible() );
- QVERIFY( tbActions.at(1) == tbGroupActions.at(1) );
-
- QVERIFY( servicesAction != 0 );
- QVERIFY( !servicesAction->isCheckable() );
- QVERIFY( servicesAction->isVisible() );
- QVERIFY( tbActions.at(2) == tbGroupActions.at(2) );
-
- QVERIFY( addVideosAction != 0 );
- QVERIFY( !addVideosAction->isCheckable() );
- QVERIFY( tbActions.at(0) != tbGroupActions2.at(0) );
-
- QVERIFY( removeVideosAction != 0 );
- QVERIFY( !removeVideosAction->isCheckable() );
- QVERIFY( tbActions.at(1) != tbGroupActions2.at(1) );
-
- // Open collections.
- action = dynamic_cast<HbAction*>(tbGroupActions.at(1));
- QVERIFY( action );
- action->setChecked(false);
- action->QAction::trigger();
-
- // Verify.
- QVERIFY( mTestView->mToolbarViewsActionGroup );
- tbGroupActions = mTestView->mToolbarViewsActionGroup->actions();
- QCOMPARE( mTestView->mToolbarActions.count(), 5 );
- QCOMPARE( tbGroupActions.count(), 3 );
- QCOMPARE( tbGroupActions2.count(), 2 );
- QVERIFY( tbGroupActions.at(1)->isChecked() ); // 2nd is checked.
-
- // Verify checkable and visible toolbar actions.
- allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
- collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
- servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
- addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
- removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
- QVERIFY( allVideosAction != 0 );
- QVERIFY( allVideosAction->isCheckable() );
- QVERIFY( allVideosAction->isVisible() );
- QVERIFY( tbActions.at(0) == tbGroupActions.at(0) );
-
- QVERIFY( collectionsAction != 0 );
- QVERIFY( collectionsAction->isCheckable() );
- QVERIFY( collectionsAction->isVisible() );
- QVERIFY( tbActions.at(1) == tbGroupActions.at(1) );
-
- QVERIFY( servicesAction != 0 );
- QVERIFY( !servicesAction->isCheckable() );
- QVERIFY( servicesAction->isVisible() );
- QVERIFY( tbActions.at(2) == tbGroupActions.at(2) );
-
- QVERIFY( addVideosAction != 0 );
- QVERIFY( !addVideosAction->isCheckable() );
- QVERIFY( tbActions.at(0) != tbGroupActions2.at(0) );
-
- QVERIFY( removeVideosAction != 0 );
- QVERIFY( !removeVideosAction->isCheckable() );
- QVERIFY( tbActions.at(1) != tbGroupActions2.at(1) );
-
+ // TODO
cleanup();
}
// ---------------------------------------------------------------------------
-// Slot: test create toolbar
-// ---------------------------------------------------------------------------
-//
-void TestListView::testCreateAction()
-{
- init();
- TMPXItemId tmpId = TMPXItemId::InvalidId();
- mTestView->activateView(tmpId);
-
- QVERIFY(mTestView->mToolbarViewsActionGroup != 0);
-
- QList<QAction*> actions = mTestView->mToolbarViewsActionGroup->actions();
- actions.append(mTestView->mToolbarCollectionActionGroup->actions());
- QCOMPARE(actions.count(), 5);
-
- QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
-
- HbAction* allVideos = static_cast<HbAction*>(actions.at(0));
- QVERIFY( allVideos->isCheckable() );
- QCOMPARE( allVideos->icon().iconName(), QString("qtg_mono_video") );
- QVERIFY( allVideos->isChecked() );
-
- HbAction* collections = static_cast<HbAction*>(actions.at(1));
- QVERIFY( collections->isCheckable() );
- QCOMPARE( collections->icon().iconName(), QString("qtg_mono_video_collection") );
-
- HbAction* services = static_cast<HbAction*>(actions.at(2));
- QVERIFY( !services->isCheckable() );
- QCOMPARE( services->icon().iconName(), QString("qtg_mono_ovistore") );
-
- HbAction* addVideos = static_cast<HbAction*>(actions.at(3));
- QVERIFY( !addVideos->isCheckable() );
- QCOMPARE( addVideos->icon().iconName(), QString("qtg_mono_add_to_video_collection") );
-
- HbAction* removeVideos = static_cast<HbAction*>(actions.at(4));
- QVERIFY( !removeVideos->isCheckable() );
- QCOMPARE( removeVideos->icon().iconName(), QString("qtg_mono_remove_from_video_collection") );
-
- cleanup();
-}
-
-// ---------------------------------------------------------------------------
// Slot: test activate view
// ---------------------------------------------------------------------------
//
@@ -561,6 +432,8 @@
VideoServices *videoServices = VideoServices::instance(0);
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 0;
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
VideoListWidgetData::reset();
VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
@@ -588,6 +461,8 @@
videoServices = VideoServices::instance(0);
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 1;
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
VideoListWidgetData::reset();
VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
@@ -615,6 +490,8 @@
videoServices = VideoServices::instance(0);
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 2;
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
VideoListWidgetData::reset();
VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
@@ -642,6 +519,8 @@
videoServices = VideoServices::instance(0);
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 3;
+ VideoCollectionViewUtilsData::mIsServiceValue = true;
+ VideoCollectionViewUtils::instance().setIsService();
VideoListWidgetData::reset();
VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
@@ -658,6 +537,8 @@
cleanup();
serviceUtilXtra->decreaseReferenceCount();
videoServices->decreaseReferenceCount();
+ VideoCollectionViewUtilsData::mIsServiceValue = false;
+ VideoCollectionViewUtils::instance().setIsService();
}
// ---------------------------------------------------------------------------
@@ -729,13 +610,10 @@
videoListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
QVERIFY( videoListWidget );
-
- QList<QAction*> actions = mTestView->mToolbarViewsActionGroup->actions();
- HbAction* action = static_cast<HbAction*>(actions.at(0));
-
- // action wont emit if it's already checked.
- action->setChecked(false);
- action->trigger();
+
+ connect(this, SIGNAL(testSignal()), mTestView, SLOT(openAllVideosViewSlot()));
+
+ emit testSignal();
QCOMPARE( mTestView->mCurrentList, videoListWidget );
mTestView->mCurrentList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONWIDGET);
@@ -743,15 +621,15 @@
VideoListWidgetData::mActivateCount = 0;
videoListWidget->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
- // action wont emit if it's already checked.
- action->setChecked(false);
- action->trigger();
+ emit testSignal();
QCOMPARE( mTestView->mCurrentList, videoListWidget );
QCOMPARE( mTestView->mCurrentList->mCurrentLevel, VideoCollectionCommon::ELevelVideos );
QVERIFY( VideoListWidgetData::mActive == true );
QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
QCOMPARE( VideoListWidgetData::mDeactivateCount, 1 );
-
+
+ disconnect(this, SIGNAL(testSignal()));
+
cleanup();
}
@@ -767,15 +645,12 @@
init();
mTestView->activateView(invalidId);
- QList<QAction*> actions = mTestView->mToolbarViewsActionGroup->actions();
- HbAction* action = static_cast<HbAction*>(actions.at(1));
+ connect(this, SIGNAL(testSignal()), mTestView, SLOT(openCollectionViewSlot()));
collectionWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONWIDGET);
QVERIFY(collectionWidget);
- // action wont emit if it's already checked.
- action->setChecked(false);
- action->trigger();
+ emit testSignal();
QCOMPARE(mTestView->mCurrentList, collectionWidget);
mTestView->mCurrentList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
@@ -784,9 +659,7 @@
VideoListWidgetData::mDeactivateCount = 0;
collectionWidget->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
- // action wont emit if it's already checked.
- action->setChecked(false);
- action->trigger();
+ emit testSignal();
QCOMPARE(mTestView->mCurrentList, collectionWidget);
QCOMPARE( mTestView->mCurrentList->mCurrentLevel, VideoCollectionCommon::ELevelCategory );
QVERIFY( VideoListWidgetData::mActive == true );
@@ -795,153 +668,6 @@
cleanup();
}
-// ---------------------------------------------------------------------------
-// Slot: test open operator service slot
-// ---------------------------------------------------------------------------
-//
-void TestListView::testOpenOperatorServiceSlot()
-{
- init();
- TMPXItemId tmpId = TMPXItemId::InvalidId();
- mTestView->activateView(tmpId);
- VideoOperatorServiceData::mLaunchServiceCallCount = 0;
- connect(this, SIGNAL(testSignal2()), mTestView, SLOT(openOperatorServiceSlot()));
- emit testSignal2();
- QCOMPARE(VideoOperatorServiceData::mLaunchServiceCallCount, 1);
- cleanup();
-
- init();
- VideoOperatorServiceData::mLaunchServiceCallCount = 0;
- connect(this, SIGNAL(testSignal2()), mTestView, SLOT(openOperatorServiceSlot()));
- emit testSignal2();
- QCOMPARE(VideoOperatorServiceData::mLaunchServiceCallCount, 0);
- cleanup();
-}
-
-// ---------------------------------------------------------------------------
-// testStartSorting
-// ---------------------------------------------------------------------------
-//
-void TestListView::testStartSortingSlot()
-{
- HbAction *action(0);
- HbMenu *sortMenu(0);
- HbAction *sortMenuAction = new HbAction("test");
-
- // View is not initialized.
- init(false);
- connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
- emit testSignal(0);
- QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
- QCOMPARE(VideoProxyModelData::mSortRole, -1);
- cleanup();
-
- // View is not activated.
- init();
- connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
- emit testSignal(0);
- QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
- QCOMPARE(VideoProxyModelData::mSortRole, -1);
- cleanup();
-
- TMPXItemId invalidId = TMPXItemId::InvalidId();
- // Active action is not sort by.
- init();
- mTestView->activateView(invalidId);
- action = mUiLoader->findObject<HbAction>(DOCML_NAME_DELETE_MULTIPLE);
- QVERIFY(action != 0);
- mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(action);
- sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
- sortMenuAction->setMenu(sortMenu);
- HbMenuData::mMenuAction = sortMenuAction;
- connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
- emit testSignal(0);
- QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
- QCOMPARE(VideoProxyModelData::mSortRole, -1);
- cleanup();
-
- // Good cases.
- init();
- mTestView->activateView(invalidId);
- sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
- sortMenuAction->setMenu(sortMenu);
- HbMenuData::mMenuAction = sortMenuAction;
- VideoProxyModelGeneric* model = mTestView->mCurrentList->getModel();
- QVERIFY(action != 0);
- mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(sortMenuAction);
- HbAction* sortAction = mUiLoader->findObject<HbAction>(DOCML_NAME_SORT_BY_NAME);
- QVERIFY(sortAction != 0);
- sortMenu->setActiveAction(sortAction);
- model->setSortRole(1);
- connect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestView, SLOT(objectReadySlot(QObject*, const QString)));
- emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_DATE), DOCML_NAME_SORT_BY_DATE);
- emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NAME), DOCML_NAME_SORT_BY_NAME);
- emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS), DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
- emit testObjectReadySignal(mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_SIZE), DOCML_NAME_SORT_BY_SIZE);
- disconnect(this, SIGNAL(testObjectReadySignal(QObject*, const QString)), mTestView, SLOT(objectReadySlot(QObject*, const QString)));
-
- connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
- emit testSignal(0);
- // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
- QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoProxyModelData::mSortAsync);
-
- VideoProxyModelData::mDoSortingCallCount = 0;
- // emit test signal again, with same parameters. Sorting should be switched to
- // descending order.
- emit testSignal(0);
- // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
- QCOMPARE(VideoProxyModelData::mSortOrder, Qt::DescendingOrder);
- QVERIFY(VideoProxyModelData::mSortAsync);
-
- VideoProxyModelData::mDoSortingCallCount = 0;
- // on third emit, sorting should be switched back to ascending
- emit testSignal(0);
- // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
- QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoProxyModelData::mSortAsync);
-
- // test that after changing the sort role, the order is also switched to ascending.
- model->doSorting(model->sortRole(), Qt::DescendingOrder);
- sortAction = mUiLoader->findObject<HbAction>(DOCML_NAME_SORT_BY_DATE);
- QVERIFY(sortAction != 0);
- sortMenu->setActiveAction(sortAction);
- VideoProxyModelData::mDoSortingCallCount = 0;
- emit testSignal(0);
- // since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
- QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoProxyModelData::mSortAsync);
- cleanup();
-
- // start sorting slot:
- // -is service
- init(false);
- connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
- sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
- sortMenuAction->setMenu(sortMenu);
- HbMenuData::mMenuAction = sortMenuAction;
- mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(sortMenuAction);
- sortAction = mUiLoader->findObject<HbAction>(DOCML_NAME_SORT_BY_NAME);
- QVERIFY(sortAction != 0);
- sortMenu->setActiveAction(sortAction);
- XQServiceUtilXtra *serviceUtilXtra = XQServiceUtilXtra::instance();
- serviceUtilXtra->setCurrentService(true);
- QCOMPARE(mTestView->initializeView(), 0);
- QCOMPARE(mTestView->activateView(invalidId), 0);
- int sortRole = VideoCollectionViewUtilsData::mVideoSortRole;
- emit testSignal(0);
- QCOMPARE(sortRole, VideoCollectionViewUtilsData::mVideoSortRole);
- serviceUtilXtra->decreaseReferenceCount();
- cleanup();
-}
// ---------------------------------------------------------------------------
// Slot: test orientation related slots
@@ -1030,199 +756,6 @@
}
// ---------------------------------------------------------------------------
-// testDeleteItemsSlot
-// ---------------------------------------------------------------------------
-//
-void TestListView::testDeleteItemsSlot()
-{
- init();
- connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
-
- ////////////
- // dialog loading fails
- ////////////
- VideoCollectionUiLoaderData::mFailDialogLoad = true;
- emit testSignal();
- QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 0);
-
- ////////////
- // selection dialog exists
- ////////////
- VideoCollectionUiLoaderData::mFailDialogLoad = false;
- VideoProxyModelData::mOpenedItemId = TMPXItemId(2, 3);
- emit testSignal();
- QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 1);
- QCOMPARE(VideoListSelectionDialogData::mSelectionType, (int)VideoListSelectionDialog::EDeleteVideos);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
-
- ////////////
- // test second successful activation.
- ////////////
- VideoProxyModelData::mOpenedItemId = TMPXItemId(3, 2);
- emit testSignal();
- QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 2);
- QCOMPARE(VideoListSelectionDialogData::mSelectionType, (int)VideoListSelectionDialog::EDeleteVideos);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
-
- cleanup();
-}
-
-// ---------------------------------------------------------------------------
-// testAboutToShowMainMenuSlot
-// ---------------------------------------------------------------------------
-//
-void TestListView::testAboutToShowMainMenuSlot()
-{
- XQServiceUtilXtra *serviceUtil = XQServiceUtilXtra::instance();
- VideoServices *videoServices = VideoServices::instance();
-
- // View is not initialized.
- init(false);
- connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(aboutToShowMainMenuSlot()) );
- emit testSignal(0);
- cleanup();
-
- HbAction *action(0);
- TMPXItemId invalidId = TMPXItemId::InvalidId();
- // Collections is triggered from toolbar.
- init();
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- setRowCount(1);
- action = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
- QVERIFY(action != 0);
- action->setChecked(false);
- action->trigger();
- emit testSignal();
- int visible = visibleMenuActions();
- QCOMPARE(visible, 3);
- cleanup();
-
- // All videos is triggered from toolbar.
- init();
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- setRowCount(1);
- action = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
- QVERIFY(action != 0);
- action->setChecked(false);
- action->trigger();
- emit testSignal();
- visible = visibleMenuActions();
- QCOMPARE(visible, 5);
- cleanup();
-
- // Add videos action is visible.
- init();
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- mTestView->toolBar()->clearActions();
- mTestView->toolBar()->addActions( mTestView->mToolbarCollectionActionGroup->actions() );
- setRowCount(1);
- QVERIFY(action != 0);
- emit testSignal();
- visible = visibleMenuActions();
- QCOMPARE(visible, 4);
- cleanup();
-
- // All videos is active and model has no items.
- init();
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- setRowCount(0);
- action = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
- QVERIFY(action != 0);
- action->setChecked(false);
- action->trigger();
- emit testSignal();
- visible = visibleMenuActions();
- QCOMPARE(visible, 0);
- cleanup();
-
- // Collections is active and model has no items.
- init();
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- setRowCount(0);
- action = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
- QVERIFY(action != 0);
- action->setChecked(false);
- action->trigger();
- emit testSignal();
- visible = visibleMenuActions();
- QCOMPARE(visible, 1);
- cleanup();
-
- // Album is open and model has no items.
- init();
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- setRowCount(0);
- emit testSignal();
- visible = visibleMenuActions();
- QCOMPARE(visible, 0);
- cleanup();
-
- // Toolbar action group is null
- init();
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- setRowCount(1);
- QActionGroup* actionGroup = mTestView->mToolbarViewsActionGroup;
- mTestView->mToolbarViewsActionGroup = NULL;
- emit testSignal();
- mTestView->mToolbarViewsActionGroup = actionGroup;
- cleanup();
-
- // about to show main menu:
- // -is service
- // -current service is browse
- // -no current list
- serviceUtil->setCurrentService(true);
- videoServices->mCurrentService = VideoServices::EBrowse;
- init(true);
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- emit testSignal();
- visible = visibleMenuActions();
- QCOMPARE(visible, 0);
- cleanup();
-
- // about to show main menu:
- // -is service
- // -current service is browse
- // -no items
- serviceUtil->setCurrentService(true);
- videoServices->mCurrentService = VideoServices::EBrowse;
- init(true);
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- emit testSignal();
- visible = visibleMenuActions();
- QCOMPARE(visible, 0);
- cleanup();
-
- // about to show main menu:
- // -is service
- // -current service is browse
- serviceUtil->setCurrentService(true);
- videoServices->mCurrentService = VideoServices::EBrowse;
- init(true);
- connect(this, SIGNAL(testSignal()), mTestView, SLOT(aboutToShowMainMenuSlot()));
- mTestView->activateView(invalidId);
- setRowCount(3, mTestView->mCurrentList->getModel());
- emit testSignal();
- QVERIFY(isActionVisible(DOCML_NAME_DELETE_MULTIPLE));
- QVERIFY(isActionVisible(DOCML_NAME_SORT_BY_DATE));
- QVERIFY(isActionVisible(DOCML_NAME_SORT_BY_NAME));
- QVERIFY(isActionVisible(DOCML_NAME_SORT_BY_SIZE));
- cleanup();
-
- // final cleanup
- serviceUtil->decreaseReferenceCount();
- videoServices->decreaseReferenceCount();
-}
-
-// ---------------------------------------------------------------------------
// testHandleErrorSlot
// ---------------------------------------------------------------------------
//
@@ -1334,19 +867,22 @@
collectionContent = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
// Collection opened with default collection.
+ VideoListToolbarData::reset();
itemId = TMPXItemId(1,1);
listWidgetActivateCount = VideoListWidgetData::mActivateCount;
emit testCollectionOpenedSignal(true, testString, itemId);
QVERIFY(VideoListWidgetData::mActivateCount == listWidgetActivateCount + 1);
QVERIFY(mTestView->mCurrentList == collectionContent);
QVERIFY(mTestView->mCurrentList->getLevel() == VideoCollectionCommon::ELevelDefaultColl );
- QVERIFY(!HbView::mSetItemVisibleLast);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 1);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelDefaultColl);
// returning collection widget
emit testCollectionOpenedSignal(false, testString, itemId);
QVERIFY(mTestView->mCurrentList != collectionContent);
QVERIFY(mTestView->mCurrentList->getLevel() == VideoCollectionCommon::ELevelCategory );
- QVERIFY(HbView::mSetItemVisibleLast);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 2);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelCategory);
// Collection opened with album.
itemId = TMPXItemId(1,2);
@@ -1355,17 +891,16 @@
QVERIFY(VideoListWidgetData::mActivateCount == listWidgetActivateCount + 1);
QVERIFY(mTestView->mCurrentList == collectionContent);
QVERIFY(mTestView->mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum );
- QVERIFY(HbView::mSetItemVisibleLast);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 3);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelAlbum);
- // returning collection widget (no mToolbarViewsActionGroup for coverage)
+ // returning collection widget
HbView::mSetItemVisibleLast = false;
- QActionGroup *tmpActionGroup = mTestView->mToolbarViewsActionGroup;
- mTestView->mToolbarViewsActionGroup = 0;
emit testCollectionOpenedSignal(false, testString, itemId);
QVERIFY(mTestView->mCurrentList != collectionContent);
QVERIFY(mTestView->mCurrentList->getLevel() == VideoCollectionCommon::ELevelCategory );
- QVERIFY(!HbView::mSetItemVisibleLast);
- mTestView->mToolbarViewsActionGroup = tmpActionGroup;
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 4);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelCategory);
// service
VideoServices *tmpService = VideoServices::instance();
@@ -1376,16 +911,15 @@
QVERIFY(VideoListWidgetData::mActivateCount == listWidgetActivateCount + 1);
QVERIFY(mTestView->mCurrentList == collectionContent);
QVERIFY(mTestView->mCurrentList->getLevel() == VideoCollectionCommon::ELevelDefaultColl );
- QVERIFY(!HbView::mSetItemVisibleLast);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 5);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelDefaultColl);
- // returning collection widget (no mToolbarServiceExtension for coverage)
- HbToolBarExtension *tmpExtension = mTestView->mToolbarServiceExtension;
- mTestView->mToolbarServiceExtension = 0;
+ // returning collection widget
emit testCollectionOpenedSignal(false, testString, itemId);
QVERIFY(mTestView->mCurrentList != collectionContent);
QVERIFY(mTestView->mCurrentList->getLevel() == VideoCollectionCommon::ELevelCategory );
- QVERIFY(HbView::mSetItemVisibleLast);
- mTestView->mToolbarServiceExtension = tmpExtension;
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 6);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelCategory);
cleanup();
}
@@ -1413,11 +947,11 @@
mTestView->mCurrentList = videoListWidget;
emit testLayoutChangedSignal();
- QCOMPARE( label->heading(), QString("txt_videos_subtitle_ln_videos") );
+ QCOMPARE( label->heading(), QString("txt_videos_subtitle_all_videos_ln") );
mTestView->mCurrentList = collectionWidget;
emit testLayoutChangedSignal();
- QCOMPARE( label->heading(), QString("txt_videos_subtitle_ln_collections") );
+ QCOMPARE( label->heading(), QString("txt_videos_subtitle_collections_ln") );
mTestView->mCurrentList = collectionContentWidget;
emit testLayoutChangedSignal();
@@ -1500,45 +1034,32 @@
////////
// toolbar setup
mTestView->activateView(invalidId);
- mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->setVisible(true);
+ mTestView->mModelReady = true;
+ VideoListToolbarData::reset();
- // mToolbarViewsActionGroup is null
- QActionGroup *tmp = mTestView->mToolbarViewsActionGroup;
- mTestView->mToolbarViewsActionGroup = 0;
- emit testLayoutChangedSignal();
- QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible());
- mTestView->mToolbarViewsActionGroup = tmp;
+ // show -flag is true, currentlist level = VideoCollectionCommon::ELevelAlbum
+ mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelAlbum);
+ emit testLayoutChangedSignal();
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 1);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelAlbum);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedNoVideos, true);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedModelReady, true);
- // mToolbarCollectionActionGroup is null
- tmp = mTestView->mToolbarCollectionActionGroup;
- mTestView->mToolbarCollectionActionGroup = 0;
- emit testLayoutChangedSignal();
- QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible());
- mTestView->mToolbarCollectionActionGroup = tmp;
-
- // mVideoServices exists
- VideoServices *tmpService = VideoServices::instance();
- mTestView->mVideoServices = tmpService;
- emit testLayoutChangedSignal();
- QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible());
- mTestView->mVideoServices = 0;
- tmpService->decreaseReferenceCount();
-
- // show -flag is true, currentlist level != VideoCollectionCommon::ELevelDefaultColl
- mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelAlbum);
- emit testLayoutChangedSignal();
- QVERIFY(!mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible());
-
- mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->setVisible(true);
// show -flag is true, currentlist level == VideoCollectionCommon::ELevelDefaultColl
mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelDefaultColl);
emit testLayoutChangedSignal();
- QVERIFY(!mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible());
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 2);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelDefaultColl);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedNoVideos, true);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedModelReady, true);
// show -flag is false
setRowCount(1);
emit testLayoutChangedSignal();
- QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible());
+ QCOMPARE(VideoListToolbarData::mViewStateChangedCount, 3);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedLevel, VideoCollectionCommon::ELevelDefaultColl);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedNoVideos, false);
+ QCOMPARE(VideoListToolbarData::mViewStateChangedModelReady, true);
///////
// sub label
@@ -1649,240 +1170,53 @@
}
// ---------------------------------------------------------------------------
-// testCreateCollectionSlot
-// ---------------------------------------------------------------------------
-//
-void TestListView::testCreateCollectionSlot()
-{
- init(false);
- QVERIFY(connect(this, SIGNAL(testSignal()), mTestView, SLOT(createCollectionSlot())));
-
- // dialog finding fails
- VideoCollectionUiLoaderData::mFailDialogLoad = true;
- emit testSignal();
- 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();
-}
-
-// ---------------------------------------------------------------------------
-// testAddVideosToCollectionSlot
+// testToolbarActionsChanged
// ---------------------------------------------------------------------------
//
-void TestListView::testAddVideosToCollectionSlot()
+void TestListView::testToolbarActionsChanged()
{
- init(false);
- QVERIFY(connect(this, SIGNAL(testSignal()), mTestView, SLOT(addVideosToCollectionSlot())));
-
- TMPXItemId invalidId = TMPXItemId::InvalidId();
- VideoProxyModelData::mOpenedItemId = TMPXItemId(0, 2);
-
- // Not initalized, no mCurrentList
- emit testSignal();
- QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
- QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
-
- QVERIFY(mTestView->initializeView() == 0);
- mTestView->activateView(invalidId);
+ init();
+ TMPXItemId id = TMPXItemId::InvalidId();
+ mTestView->activateView(id);
- // Selection dialog widget loading fails.
- VideoCollectionUiLoaderData::mFindFailure = true;
- emit testSignal();
- QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
- QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
-
- // Current level is not album
- VideoListSelectionDialogData::reset();
- VideoCollectionViewUtilsData::reset();
- VideoCollectionUiLoaderData::mFindFailure = false;
- mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
- emit testSignal();
- QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
- QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
-
- // Current level is album, video list widget load fails.
- VideoListSelectionDialogData::reset();
- VideoCollectionViewUtilsData::reset();
- VideoCollectionUiLoaderData::reset();
- HbDocumentLoader::mVideoListWidgetFailure = true;
- mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
- emit testSignal();
- QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
- QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+ connect(this, SIGNAL(testSignal(QList<QAction*>)), mTestView, SLOT(toolbarActionsChanged(QList<QAction*>)));
- // Current level is album, but model is empty.
- HbDocumentLoader::mVideoListWidgetFailure = false;
- VideoListSelectionDialogData::reset();
- VideoCollectionViewUtilsData::reset();
- VideoCollectionUiLoaderData::reset();
- mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
- emit testSignal();
- QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
- QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
-
- // Current level is album, all videos are in the album
- VideoListSelectionDialogData::reset();
- VideoListDataModelData::reset();
- VideoCollectionViewUtilsData::reset();
- mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
- VideoListWidget *allVideos = mUiLoader->findWidget<VideoListWidget>(
- DOCML_NAME_VC_VIDEOLISTWIDGET);
- QVERIFY(allVideos);
- setRowCount(3, allVideos->mModel);
- emit testSignal();
- QVERIFY(VideoListSelectionDialogData::mSelectionType == -1);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
- QVERIFY(VideoCollectionViewUtilsData::mLastError ==
- VideoCollectionCommon::statusAllVideosAlreadyInCollection);
+ QList<QAction*> actions;
+ actions.append(new QAction(mTestView));
+ actions.append(new QAction(mTestView));
- // Current level is album, all videos are not in the album
- VideoListSelectionDialogData::reset();
- VideoCollectionViewUtilsData::reset();
- VideoListDataModelData::reset();
- QVERIFY(allVideos);
- setRowCount(3, allVideos->mModel);
- // Must have different model than selection dialog has. Otherwise Qt optimizes rowCount calls
- // to source model and VideoListDataModelData::mRowCountDecrement doesn't work.
- QVERIFY(mTestView->initializeView() == 0);
- QVERIFY(connect(this, SIGNAL(testSignal2()), mTestView, SLOT(openCollectionViewSlot())));
- emit testSignal2();
- disconnect(this, SIGNAL(testSignal2()), mTestView, SLOT(openCollectionViewSlot()));
- mTestView->activateView(invalidId);
- VideoListDataModelData::mRowCountDecrement = 1;
- mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
- setRowCount(1);
- emit testSignal();
- QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
- QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
+ emit testSignal(actions);
+ QCOMPARE(mTestView->toolBar()->actions().count(), 2);
+ QVERIFY(HbView::mSetItemVisibleLast);
+ QCOMPARE(mTestView->toolBar()->actions(), actions);
- disconnect(this, SIGNAL(testSignal()), mTestView, SLOT(addVideosToCollectionSlot()));
+ emit testSignal(QList<QAction*>());
+ QCOMPARE(mTestView->toolBar()->actions().count(), 0);
+ QVERIFY(HbView::mSetItemVisibleLast == false);
cleanup();
}
// ---------------------------------------------------------------------------
-// testRemoveVideosFromCollectionSlot
+// testToolbarExtensionChanged
// ---------------------------------------------------------------------------
//
-void TestListView::testRemoveVideosFromCollectionSlot()
+void TestListView::testToolbarExtensionChanged()
{
- VideoListSelectionDialogData::reset();
- VideoCollectionViewUtilsData::reset();
- VideoCollectionUiLoaderData::reset();
- HbDocumentLoader::mVideoListWidgetFailure = false;
-
- init(false);
-
- QVERIFY(connect(this, SIGNAL(testSignal()), mTestView, SLOT(removeVideosFromCollectionSlot())));
-
- // Not initialized, no current list
- emit testSignal();
-
- TMPXItemId invalidId = TMPXItemId::InvalidId();
-
- QVERIFY(mTestView->initializeView() == 0);
- mTestView->activateView(invalidId);
- setRowCount(1);
+ init();
+ TMPXItemId id = TMPXItemId::InvalidId();
+ mTestView->activateView(id);
- // Wrong level.
- mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
- emit testSignal();
-
- // No items in model.
- mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelDefaultColl;
- emit testSignal();
-
- // Fail to load selection dialog.
- VideoCollectionUiLoaderData::mFindFailure = true;
- emit testSignal();
+ connect(this, SIGNAL(testSignal(HbToolBarExtension*)), mTestView, SLOT(toolbarExtensionChanged(HbToolBarExtension*)));
- // Open item is invalid
- VideoCollectionUiLoaderData::mFindFailure = false;
- VideoProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
- emit testSignal();
+ // should not crash, no other verification possible.
+ emit testSignal(0);
- // Open item is video!
- VideoProxyModelData::mOpenedItemId = TMPXItemId(0, KVcxMvcMediaTypeVideo);
- emit testSignal();
-
- // Good case.
- VideoProxyModelData::mOpenedItemId = TMPXItemId(0, KVcxMvcMediaTypeAlbum);
- emit testSignal();
-
- disconnect(this, SIGNAL(testSignal()), mTestView, SLOT(removeVideosFromCollectionSlot()));
+ HbToolBarExtension* extension = new HbToolBarExtension(mTestView);
+ emit testSignal(extension);
+ QCOMPARE(mTestView->toolBar()->mAddExtensionCallCount, 1);
cleanup();
}
-// ---------------------------------------------------------------------------
-// testCreateOperatorServicesToolbar
-// ---------------------------------------------------------------------------
-//
-void TestListView::testCreateOperatorServicesToolbar()
-{
- // Only one service.
- init();
- HbToolBarExtension::mAddActionCallCount = 0;
- VideoOperatorServiceData::mIcons.clear();
- VideoOperatorServiceData::mUris.clear();
- VideoOperatorServiceData::mIcons.append("qtg_mono_ovistore");
- VideoOperatorServiceData::mUris.append("testuri");
- QCOMPARE(mTestView->mVideoOperatorServices.count(), 0);
- TMPXItemId tmpId = TMPXItemId::InvalidId();
- mTestView->activateView(tmpId);
- QCOMPARE(mTestView->mVideoOperatorServices.count(), 1);
- QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionServices] != 0);
- QVERIFY(mTestView->mToolbarServiceExtension == 0);
- QCOMPARE(HbToolBarExtension::mAddActionCallCount, 0);
- cleanup();
-
- // Multiple, 3, services
- init();
- HbToolBarExtension::mAddActionCallCount = 0;
- VideoOperatorServiceData::mIcons.clear();
- VideoOperatorServiceData::mUris.clear();
- VideoOperatorServiceData::mIcons.append("qtg_mono_ovistore");
- VideoOperatorServiceData::mUris.append("testuri");
- VideoOperatorServiceData::mIcons.append("qtg_mono_ovistore2");
- VideoOperatorServiceData::mUris.append("testuri2");
- VideoOperatorServiceData::mIcons.append("qtg_mono_ovistore3");
- VideoOperatorServiceData::mUris.append("testuri3");
- QCOMPARE(mTestView->mVideoOperatorServices.count(), 0);
- tmpId = TMPXItemId::InvalidId();
- mTestView->activateView(tmpId);
- QCOMPARE(mTestView->mVideoOperatorServices.count(), 3);
- QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionServices] == 0);
- QVERIFY(mTestView->mToolbarServiceExtension != 0);
- QCOMPARE(HbToolBarExtension::mAddActionCallCount, 3);
- cleanup();
-
- // Services already loaded.
- init();
- VideoOperatorServiceData::mIcons.clear();
- VideoOperatorServiceData::mUris.clear();
- VideoOperatorServiceData::mIcons.append("qtg_mono_ovistore");
- VideoOperatorServiceData::mUris.append("testuri");
- mTestView->mVideoOperatorServices.append(new VideoOperatorService());
- mTestView->activateView(tmpId);
- QCOMPARE(mTestView->mVideoOperatorServices.count(), 1);
- QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionServices] == 0);
- QVERIFY(mTestView->mToolbarServiceExtension == 0);
- cleanup();
-
-}
-
// End of file
--- a/videocollection/videocollectionview/videocollectionview.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionview/videocollectionview.pro Mon Sep 20 18:25:37 2010 +0300
@@ -31,6 +31,7 @@
# to enable resource access from Qt
TARGET.EPOCALLOWDLLDATA = 1
+ VERSION = 10.0
}
# mpx view plugin definitions:
@@ -54,6 +55,8 @@
# Input
HEADERS += inc/videocollectionviewplugin.h \
inc/videolistview.h \
+ inc/videolisttoolbar.h \
+ inc/videolistmenu.h \
inc/videolistwidget.h \
inc/videohintwidget.h \
inc/videocollectionviewutils.h \
@@ -65,6 +68,8 @@
SOURCES += src/videocollectionviewplugin.cpp \
src/videolistview.cpp \
+ src/videolisttoolbar.cpp \
+ src/videolistmenu.cpp \
src/videolistwidget.cpp \
src/videohintwidget.cpp \
src/videocollectionviewutils.cpp \
--- a/videocollection/videocollectionwrapper/src/videocollectionutils.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videocollectionutils.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,11 +15,12 @@
*
*/
-// Version : %version: 15 %
+// Version : %version: 16 %
// INCLUDE FILES
#include <qobject.h>
#include <QTime>
+#include <HbStringUtil>
#include <hbglobal.h>
#include <hbextendedlocale.h>
@@ -68,20 +69,20 @@
quint32 minutes = length / secondsInMinute % secondsInMinute;
quint32 seconds = length % secondsInMinute;
- QString hrs(QString::number(hours));
+ QString hrs(HbStringUtil::convertDigits(QString::number(hours)));
if(hours < 10)
{
- hrs.prepend(QString::number(0));
+ hrs.prepend(HbStringUtil::convertDigits(QString::number(0)));
}
- QString mins(QString::number(minutes));
+ QString mins(HbStringUtil::convertDigits(QString::number(minutes)));
if(minutes < 10)
{
- mins.prepend(QString::number(0));
+ mins.prepend(HbStringUtil::convertDigits(QString::number(0)));
}
- QString secs(QString::number(seconds));
+ QString secs(HbStringUtil::convertDigits(QString::number(seconds)));
if(seconds < 10)
{
- secs.prepend(QString::number(0));
+ secs.prepend(HbStringUtil::convertDigits(QString::number(0)));
}
QString lengthStr(hbTrId( "txt_videos_list_l1l2l3" ).arg( hrs ).arg( mins ).arg( secs ));
--- a/videocollection/videocollectionwrapper/src/videolistdatamodel.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videolistdatamodel.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,11 +15,12 @@
*
*/
-// Version : %version: 52.1.2 %
+// Version : %version: 52.1.3 %
// INCLUDE FILES
#include <hbglobal.h>
#include <vcxmyvideosdefs.h>
+#include <HbStringUtil>
#include "videolistdatamodel.h"
#include "videolistdatamodel_p.h"
@@ -293,20 +294,20 @@
total = total % secondsInMinute;
int second = total;
- QString hrs(QString::number(hour));
+ QString hrs(HbStringUtil::convertDigits(QString::number(hour)));
if(hour < 10)
{
- hrs.prepend(QString::number(0));
+ hrs.prepend(HbStringUtil::convertDigits(QString::number(0)));
}
- QString mins(QString::number(minutes));
+ QString mins(HbStringUtil::convertDigits(QString::number(minutes)));
if(minutes < 10)
{
- mins.prepend(QString::number(0));
+ mins.prepend(HbStringUtil::convertDigits(QString::number(0)));
}
- QString secs(QString::number(second));
+ QString secs(HbStringUtil::convertDigits(QString::number(second)));
if(second < 10)
{
- secs.prepend(QString::number(0));
+ secs.prepend(HbStringUtil::convertDigits(QString::number(0)));
}
const char* loc = "txt_videos_dblist_captured_val_l1_l2_gb";
@@ -329,7 +330,8 @@
loc = "txt_videos_dblist_captured_val_l1_l2_kb";
}
- detailStr = hbTrId(loc).arg(hrs).arg(mins).arg(secs).arg(QString::number(dispSize));
+ detailStr = hbTrId(loc).arg(hrs).arg(mins).arg(secs).arg(
+ HbStringUtil::convertDigits(QString::number(dispSize)));
return detailStr;
}
--- a/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/videoproxymodelgeneric.h Mon Sep 20 18:25:37 2010 +0300
@@ -45,6 +45,16 @@
*/
virtual ~VideoProxyModelGeneric();
+ /**
+ * Initializes model. Sets the given sourceModel as source model
+ * for this proxy model.
+ *
+ * @param sourceModel the source model
+ *
+ * @return int 0 if initialization was ok.
+ */
+ virtual int initialize(VideoListDataModel *sourceModel);
+
public:
/**
@@ -104,6 +114,27 @@
*/
virtual const VideoListDataModel *sourceModel() const;
+ /**
+ * sets item id filter used in generic proxy model
+ * while filtering rows.
+ *
+ * If provided filterValue -flag is true, we filter off items that
+ * do not exist in container indicated as itemId.
+ * If false, filtering works other way around.
+ *
+ *
+ * @param filterValue item id used as filter
+ * @param filterValue
+ */
+ virtual void setGenericIdFilter(const TMPXItemId &itemId, bool filterValue);
+
+ /**
+ * Set album in use and invalidates filtering.
+ *
+ * @param albumId album id
+ */
+ virtual void setAlbumInUse(const TMPXItemId &albumId);
+
public:
static int mOpenItemCallCount;
static int mGetOpenItemCallCount;
--- a/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/videoproxymodelgeneric.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -60,6 +60,15 @@
}
// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::initialize
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::initialize(VideoListDataModel *sourceModel)
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
// VideoProxyModelGeneric::openItem
// -----------------------------------------------------------------------------
//
@@ -134,9 +143,33 @@
mProcessSortingCallCount++;
}
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::sourceModel
+// -----------------------------------------------------------------------------
+//
const VideoListDataModel *VideoProxyModelGeneric::sourceModel() const
{
return mModel;
}
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setGenericIdFilter
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue)
+{
+ Q_UNUSED(itemId);
+ Q_UNUSED(filterValue);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setAlbumInUse
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setAlbumInUse(const TMPXItemId &albumId)
+{
+ Q_UNUSED(albumId);
+}
+
+
// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/videoproxymodelgeneric.h Mon Sep 20 18:25:37 2010 +0300
@@ -47,6 +47,16 @@
*/
virtual ~VideoProxyModelGeneric();
+ /**
+ * Initializes model. Sets the given sourceModel as source model
+ * for this proxy model.
+ *
+ * @param sourceModel the source model
+ *
+ * @return int 0 if initialization was ok.
+ */
+ virtual int initialize(VideoListDataModel *sourceModel);
+
public:
/**
@@ -106,6 +116,27 @@
*/
virtual const VideoListDataModel *sourceModel() const;
+ /**
+ * sets item id filter used in generic proxy model
+ * while filtering rows.
+ *
+ * If provided filterValue -flag is true, we filter off items that
+ * do not exist in container indicated as itemId.
+ * If false, filtering works other way around.
+ *
+ *
+ * @param filterValue item id used as filter
+ * @param filterValue
+ */
+ virtual void setGenericIdFilter(const TMPXItemId &itemId, bool filterValue);
+
+ /**
+ * Set album in use and invalidates filtering.
+ *
+ * @param albumId album id
+ */
+ virtual void setAlbumInUse(const TMPXItemId &albumId);
+
public:
static int mOpenItemCallCount;
static int mGetOpenItemCallCount;
--- a/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/videoproxymodelgeneric.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -63,6 +63,15 @@
}
// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::initialize
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::initialize(VideoListDataModel *sourceModel)
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
// VideoProxyModelGeneric::openItem
// -----------------------------------------------------------------------------
//
@@ -137,9 +146,32 @@
mProcessSortingCallCount++;
}
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::sourceModel
+// -----------------------------------------------------------------------------
+//
const VideoListDataModel *VideoProxyModelGeneric::sourceModel() const
{
return mModel;
}
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setGenericIdFilter
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue)
+{
+ Q_UNUSED(itemId);
+ Q_UNUSED(filterValue);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setAlbumInUse
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setAlbumInUse(const TMPXItemId &albumId)
+{
+ Q_UNUSED(albumId);
+}
+
// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/videoproxymodelgeneric.h Mon Sep 20 18:25:37 2010 +0300
@@ -45,6 +45,16 @@
*/
virtual ~VideoProxyModelGeneric();
+ /**
+ * Initializes model. Sets the given sourceModel as source model
+ * for this proxy model.
+ *
+ * @param sourceModel the source model
+ *
+ * @return int 0 if initialization was ok.
+ */
+ virtual int initialize(VideoListDataModel *sourceModel);
+
public:
/**
@@ -105,6 +115,27 @@
virtual const VideoListDataModel *sourceModel() const;
/**
+ * sets item id filter used in generic proxy model
+ * while filtering rows.
+ *
+ * If provided filterValue -flag is true, we filter off items that
+ * do not exist in container indicated as itemId.
+ * If false, filtering works other way around.
+ *
+ *
+ * @param filterValue item id used as filter
+ * @param filterValue
+ */
+ virtual void setGenericIdFilter(const TMPXItemId &itemId, bool filterValue);
+
+ /**
+ * Set album in use and invalidates filtering.
+ *
+ * @param albumId album id
+ */
+ virtual void setAlbumInUse(const TMPXItemId &albumId);
+
+ /**
* Stub method.
*/
void invalidateFilter();
--- a/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/videoproxymodelgeneric.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -67,6 +67,15 @@
}
// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::initialize
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::initialize(VideoListDataModel *sourceModel)
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
// VideoProxyModelGeneric::openItem
// -----------------------------------------------------------------------------
//
@@ -151,6 +160,25 @@
}
// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setGenericIdFilter
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue)
+{
+ Q_UNUSED(itemId);
+ Q_UNUSED(filterValue);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setAlbumInUse
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setAlbumInUse(const TMPXItemId &albumId)
+{
+ Q_UNUSED(albumId);
+}
+
+// -----------------------------------------------------------------------------
// VideoProxyModelGeneric::processSorting
// -----------------------------------------------------------------------------
//
--- a/videocollection/videocollectionwrapper/videocollectionwrapper.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videocollectionwrapper/videocollectionwrapper.pro Mon Sep 20 18:25:37 2010 +0300
@@ -32,6 +32,7 @@
"DEFFILE ../bwins/videocollectionwrapper.def" \
"$${LITERAL_HASH}endif"
MMP_RULES += defBlock SMPSAFE
+ VERSION = 10.0
}
DEPENDPATH += . inc src
--- a/videocollection/videofiledetailsview/videofiledetailsview.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videocollection/videofiledetailsview/videofiledetailsview.pro Mon Sep 20 18:25:37 2010 +0300
@@ -24,6 +24,7 @@
TARGET.CAPABILITY = ALL -TCB -DRM
TARGET.EPOCALLOWDLLDATA = 1
MMP_RULES += SMPSAFE
+ VERSION = 10.0
}
# mpx view plugin definitions:
@@ -66,4 +67,3 @@
-lvideoplayerengine.dll \
-lshareui.dll \
-lflogger.dll
-
--- a/videoplayback/inc/videobaseplaybackview.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/inc/videobaseplaybackview.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#21 %
+// Version : %version: 22 %
@@ -93,7 +93,7 @@
void initializeVideoPlaybackView();
- void showDialog( const QString& string, bool closeView = true );
+ void showDialog( const QString& string, bool closeView = true, bool isError = true );
virtual void handleClosePlaybackView();
Binary file videoplayback/videohelix/conf/mpxvideopbplugins.confml has changed
--- a/videoplayback/videohelix/group/mpxvideohelixplayback.mmp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videohelix/group/mpxvideohelixplayback.mmp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 19 %
+// Version : %version: ou1cpsw#20 %
@@ -30,6 +30,7 @@
VENDORID VID_DEFAULT
CAPABILITY CAP_ECOM_PLUGIN
+VERSION 10.0
SOURCEPATH ../src
SOURCE mpxvideohelixplayback.cpp
--- a/videoplayback/videoplaybackview/controlinc/videoplaybackfullscreencontrol.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlinc/videoplaybackfullscreencontrol.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#10 %
+// Version : %version: da1mmcf#11 %
@@ -104,6 +104,8 @@
HbWidget *mControl;
TVideoPlaybackControls mControlIndex;
TUint mProperties;
+
+ bool mVisible;
};
#endif /*VIDEOPLAYBACKFULLSCREENCONTROL_H_*/
--- a/videoplayback/videoplaybackview/controlinc/videoplaybackstatuspanecontrol.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlinc/videoplaybackstatuspanecontrol.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 11 %
+// Version : %version: 12 %
@@ -38,9 +38,9 @@
Q_OBJECT
public:
- VideoPlaybackStatusPaneControl( VideoPlaybackControlsController* controller,
+ VideoPlaybackStatusPaneControl( VideoPlaybackControlsController* controller,
TVideoPlaybackControls index,
- HbWidget* widget,
+ HbWidget* widget,
TUint controlproperties );
virtual ~VideoPlaybackStatusPaneControl();
@@ -71,7 +71,6 @@
void openFullScreenView();
private:
- bool mVisible;
HbAction *mActionBack;
HbLabel *mTitleLabel;
HbGroupBox *mTitleGroupBox;
--- a/videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolbar.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolbar.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
@@ -143,16 +143,12 @@
void VideoPlaybackControlBar::setVisibleToControlBar( bool visible )
{
MPX_ENTER_EXIT(_L("VideoPlaybackControlBar::setVisibleToControlBar()"),
- _L("visible = %d, current visibility = %d"), visible, isVisible() );
+ _L("visible = %d"), visible );
- if ( visible != isVisible() )
- {
- setVisible( visible );
- mToolBar->setVisible( visible );
- }
+ setVisible( visible );
+ mToolBar->setVisible( visible );
}
-
// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::durationChanged()
// -------------------------------------------------------------------------------------------------
--- a/videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolconfiguration.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolconfiguration.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#24 %
+// Version : %version: da1mmcf#25 %
@@ -74,13 +74,15 @@
// streaming, add branding animation control to show while initializing
//
addControlToList( EBufferingAnimation );
+
+ emit controlListUpdated();
}
else if ( mControlsController->shouldShowRNLogo() )
{
addControlToList( ERealLogoBitmap );
+
+ emit controlListUpdated();
}
-
- emit controlListUpdated();
}
// -------------------------------------------------------------------------------------------------
@@ -121,6 +123,8 @@
deleteControlFromList( EFileDetailsWidget );
deleteControlFromList( EIndicatorBitmap );
+ emit controlListUpdated();
+
break;
}
case EControlCmdDetailsViewOpened:
@@ -132,8 +136,9 @@
deleteControlFromList( EIndicatorBitmap );
addControlToList( EDetailsViewPlaybackWindow );
+ addControlToList( EFileDetailsWidget );
- addControlToList( EFileDetailsWidget );
+ emit controlListUpdated();
break;
}
@@ -149,6 +154,8 @@
addControlToList( EIndicatorBitmap );
addControlToList( EFileDetailsWidget );
+ emit controlListUpdated();
+
break;
}
case EControlCmdRemoveRNLogo:
@@ -157,6 +164,8 @@
deleteControlFromList( ERealLogoBitmap );
+ emit controlListUpdated();
+
break;
}
case EControlCmdSurfaceAttached:
@@ -184,8 +193,6 @@
break;
}
}
-
- emit controlListUpdated();
}
// -------------------------------------------------------------------------------------------------
--- a/videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolscontroller.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolscontroller.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#51 %
+// Version : %version: da1mmcf#54 %
@@ -27,7 +27,6 @@
#include <QTimer>
#include <thumbnailmanager_qt.h>
-#include <xqserviceutil.h>
#include <hblabel.h>
#include <hbvolumesliderpopup.h>
@@ -77,9 +76,11 @@
, mViewTransitionIsGoingOn( false )
, mIsAttachOperation( false )
, mFileDetailsAdded( false )
+ , mShowControlsWhenInHorizontal( false )
, mThumbNailState( EThumbNailEmpty )
, mState( EPbStateNotInitialised )
, mViewMode( EFullScreenView )
+ , mShareUi( NULL )
{
MPX_ENTER_EXIT(_L("VideoPlaybackControlsController::VideoPlaybackControlsController()"));
@@ -164,7 +165,7 @@
//
// if videoplayback is in service mode, create a videoservices instance
//
- if ( XQServiceUtil::isService() && ! mVideoServices )
+ if ( isService() && ! mVideoServices )
{
//
// obtain VideoServices instance
@@ -282,6 +283,12 @@
mVideoServices->decreaseReferenceCount();
mVideoServices = 0;
}
+
+ if( mShareUi )
+ {
+ delete mShareUi;
+ mShareUi = NULL;
+ }
}
// -------------------------------------------------------------------------------------------------
@@ -301,18 +308,7 @@
mControlsConfig->updateControlsWithFileDetails();
- //
- // for audio-only clips and tv-out, default view is flip view
- //
- if ( ! details->mVideoEnabled )
- {
- changeViewMode( EAudioOnlyView, false );
- }
-
- if ( details->mTvOutConnected )
- {
- handleEvent( EControlCmdTvOutConnected );
- }
+ evaluateAndChangeViewMode();
//
// Dimmed the volume control if it is video only
@@ -411,14 +407,18 @@
{
MPX_DEBUG(_L(" [EControlCmdTvOutConnected]"));
- handleTvOutEvent( true, event );
+ mFileDetails->mTvOutConnected = true;
+ evaluateAndChangeViewMode();
+
break;
}
case EControlCmdTvOutDisconnected:
{
MPX_DEBUG(_L(" [EControlCmdTvOutDisConnected]"));
- handleTvOutEvent( false, event );
+ mFileDetails->mTvOutConnected = false;
+ evaluateAndChangeViewMode();
+
break;
}
case EControlCmdHandleErrors:
@@ -465,9 +465,33 @@
switch ( newState )
{
case EPbStatePlaying:
- case EPbStateInitialising:
+ {
+ if ( mViewMode == EFullScreenView )
+ {
+ hideAllControls();
+ }
+ else
+ {
+ showControls();
+ }
+
+ updateState();
+
+ break;
+ }
case EPbStateBuffering:
+ {
+ if ( mFileDetails->mPlaybackMode != EMPXVideoLocal )
+ {
+ showControls();
+ }
+
+ updateState();
+
+ break;
+ }
case EPbStatePaused:
+ case EPbStateInitialising:
case EPbStateNotInitialised:
case EPbStatePluginSeeking:
{
@@ -594,13 +618,17 @@
//
// Buffering animation icon
//
+ mLoader->load( KPLAYBACKVIEW_DOCML, "BufferingAnimation", &ok );
+ MPX_DEBUG(_L(" EBufferingAnimation load BufferingAnimation ok = %d"), ok);
+
QGraphicsWidget *widget = mLoader->findWidget( QString( "bufferingIcon" ) );
+
HbLabel *bufferingAnim = qobject_cast<HbLabel*>( widget );
control = new VideoPlaybackFullScreenControl( this,
- controlIndex,
- bufferingAnim,
- properties );
+ controlIndex,
+ bufferingAnim,
+ properties );
mControls.append( control );
break;
@@ -611,9 +639,9 @@
// Status key (signal + title + back key)
//
control = new VideoPlaybackStatusPaneControl( this,
- controlIndex,
- NULL,
- properties );
+ controlIndex,
+ NULL,
+ properties );
mControls.append( control );
break;
@@ -629,9 +657,9 @@
controlBar->initialize();
control = new VideoPlaybackFullScreenControl( this,
- controlIndex,
- controlBar,
- properties );
+ controlIndex,
+ controlBar,
+ properties );
mControls.append( control );
break;
@@ -643,36 +671,56 @@
qobject_cast<VideoPlaybackFileDetailsWidget*>( widget );
control = new VideoPlaybackFullScreenControl( this,
- controlIndex,
- fileDetails,
- properties );
+ controlIndex,
+ fileDetails,
+ properties );
mControls.append( control );
break;
}
case EIndicatorBitmap:
{
+ bool ok = true;
+
QGraphicsWidget *widget = mLoader->findWidget( QString( "bitmapLayout" ) );
+
+ if ( widget == NULL )
+ {
+ mLoader->load( KPLAYBACKVIEW_DOCML, "IndicatorBitmaps", &ok );
+ widget = mLoader->findWidget( QString( "bitmapLayout" ) );
+
+ MPX_DEBUG(_L(" EIndicatorBitmap load IndicatorBitmaps ok = %d"), ok);
+ }
+
+ widget = mLoader->findWidget( QString( "bitmapLayout" ) );
+
HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
setDefaultBitmap();
+
control = new VideoPlaybackFullScreenControl( this,
- controlIndex,
- bitmapWidget,
- properties );
+ controlIndex,
+ bitmapWidget,
+ properties );
mControls.append( control );
break;
}
case ERealLogoBitmap:
{
+ bool ok = false;
+
+ mLoader->load( KPLAYBACKVIEW_DOCML, "RNBitmap", &ok );
+ MPX_DEBUG(_L(" ERealLogoBitmap load RNBitmap ok = %d"), ok);
+
QGraphicsWidget *widget = mLoader->findWidget( QString( "rnLogoBitmap" ) );
+
HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
control = new VideoPlaybackFullScreenControl( this,
- controlIndex,
- bitmapWidget,
- properties );
+ controlIndex,
+ bitmapWidget,
+ properties );
mControls.append( control );
connect( bitmapWidget, SIGNAL( visibleChanged() ),
@@ -688,9 +736,9 @@
detailsPlaybackWindow->initialize();
control = new VideoPlaybackFullScreenControl( this,
- controlIndex,
- detailsPlaybackWindow,
- properties );
+ controlIndex,
+ detailsPlaybackWindow,
+ properties );
mControls.append( control );
break;
@@ -805,11 +853,18 @@
resetDisappearingTimers( ETimerReset );
- if ( ! mViewTransitionIsGoingOn && mOrientation == Qt::Horizontal )
+ if ( ! mViewTransitionIsGoingOn )
{
- for ( int i = 0 ; i < mControls.count() ; i++ )
+ if ( mOrientation == Qt::Horizontal )
{
- mControls[i]->setVisibility( mState );
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ mControls[i]->setVisibility( mState );
+ }
+ }
+ else
+ {
+ mShowControlsWhenInHorizontal = true;
}
}
}
@@ -1161,86 +1216,68 @@
}
// -------------------------------------------------------------------------------------------------
-// VideoPlaybackControlsController::handleTvOutEvent
-// -------------------------------------------------------------------------------------------------
-//
-void VideoPlaybackControlsController::handleTvOutEvent(
- bool connected, TVideoPlaybackControlCommandIds event )
-{
- Q_UNUSED( event );
-
- MPX_DEBUG(_L("VideoPlaybackControlsController::handleTvOutEvent()"));
-
- mFileDetails->mTvOutConnected = connected;
-
- setDefaultBitmap();
-
- if ( mFileDetails->mTvOutConnected )
- {
- generateThumbNail();
- }
-
- //
- // Change the view.
- // If Tv-out is connected, go to AudioOnlyView.
- // If not, go back to default view.
- //
- TPlaybackViewMode viewMode = EFullScreenView;
-
- if ( mFileDetails->mTvOutConnected || ! mFileDetails->mVideoEnabled )
- {
- viewMode = EAudioOnlyView;
- }
-
- changeViewMode( viewMode, false );
-}
-
-// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlsController::changeViewMode
// -------------------------------------------------------------------------------------------------
//
-void VideoPlaybackControlsController::changeViewMode(
+void VideoPlaybackControlsController::evaluateAndChangeViewMode(
TPlaybackViewMode viewMode, bool transitionEffect )
{
MPX_DEBUG(_L("VideoPlaybackControlsController::changeViewMode( %d, %d )"),
viewMode, transitionEffect );
- if ( viewMode != mViewMode )
+ switch ( viewMode )
{
- switch ( viewMode )
+ case EFullScreenView:
+ case EDetailsView:
{
- case EFullScreenView:
- case EDetailsView:
+ if ( mFileDetails->mVideoEnabled &&
+ ! mFileDetails->mTvOutConnected )
{
- if ( mFileDetails->mVideoEnabled && ! mFileDetails->mTvOutConnected )
+ if ( viewMode != mViewMode )
{
mViewMode = viewMode;
- //
- // Hack to clean up the screen before transition. We may not need it in NGA env
- //
- hideAllControls();
-
updateVideoRect( transitionEffect );
}
break;
}
- case EAudioOnlyView:
+ //
+ // Internal fall-through
+ // If it is not possible to change the mode to full screen/details
+ // coz of tvout or audio only clip
+ // then open audio only view instead
+ //
+ }
+ case EAudioOnlyView:
+ {
+ //
+ // If there is any event changed within audio only view,
+ // update bitmap to show current status
+ //
+ if ( ! mFileDetails->mVideoEnabled || mFileDetails->mTvOutConnected )
{
- if ( ! mFileDetails->mVideoEnabled || mFileDetails->mTvOutConnected )
+ if ( mViewMode == EAudioOnlyView )
{
- mViewMode = viewMode;
+ setDefaultBitmap();
+ }
+ else
+ {
+ mViewMode = EAudioOnlyView;
mControlsConfig->updateControlList( EControlCmdAudionOnlyViewOpened );
+
+ if ( mFileDetails->mTvOutConnected )
+ {
+ generateThumbNail();
+ }
}
-
- break;
}
- default:
- {
- break;
- }
+ break;
+ }
+ default:
+ {
+ break;
}
}
}
@@ -1436,8 +1473,6 @@
mThumbNailState = EThumbNailNotAvailable;
}
- setDefaultBitmap();
-
disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) );
}
@@ -1475,10 +1510,14 @@
//
// send video to shareUI
//
- ShareUi dlg;
+ if( ! mShareUi )
+ {
+ mShareUi = new ShareUi();
+ }
+
QStringList fileList;
fileList.append( mFileDetails->mClipName );
- dlg.send( fileList, true );
+ mShareUi->send( fileList, true );
}
// -------------------------------------------------------------------------------------------------
@@ -1566,9 +1605,12 @@
Qt::Orientation oldOrientaiton = mOrientation;
mOrientation = orientation;
- if ( oldOrientaiton == Qt::Vertical && orientation == Qt::Horizontal )
+ if ( oldOrientaiton == Qt::Vertical &&
+ orientation == Qt::Horizontal &&
+ mShowControlsWhenInHorizontal )
{
showControls();
+ mShowControlsWhenInHorizontal = false;
}
}
@@ -1583,7 +1625,7 @@
bool showRNLogo = false;
if ( mFileDetails->mRNFormat &&
- !mViewWrapper->IsResumingPlaybackAfterTermination() )
+ ! mViewWrapper->IsResumingPlaybackAfterTermination() )
{
showRNLogo = true;
}
--- a/videoplayback/videoplaybackview/controlsrc/videoplaybackfiledetailswidget.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlsrc/videoplaybackfiledetailswidget.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 28 %
+// Version : %version: 29 %
#include <QDir>
@@ -102,8 +102,28 @@
// Description
//
addItemToListWidget(
- hbTrId( "txt_videos_list_description" ), details->mDescription );
-
+ hbTrId( "txt_videos_list_description" ), details->mDescription );
+
+ //
+ // File name & File path
+ //
+ // prevent exposure of private paths and show only :
+ // (a) for standalone video player not when is launched from another app
+ // (b) for local playback ony not for streaming video
+ //
+ if ( !mController->isService() )
+ {
+ QFileInfo fileInfo( details->mClipName );
+
+ // File name
+ QString filename = fileInfo.completeBaseName();
+ addItemToListWidget( hbTrId( "txt_videos_list_file_name" ), filename );
+
+ // File path
+ QString path = fileInfo.absoluteFilePath();
+ addItemToListWidget( hbTrId( "txt_videos_list_file_path" ), path );
+ }
+
//
// Duration
//
--- a/videoplayback/videoplaybackview/controlsrc/videoplaybackfullscreencontrol.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlsrc/videoplaybackfullscreencontrol.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#11 %
+// Version : %version: da1mmcf#12 %
@@ -42,6 +42,7 @@
, mControl( widget )
, mControlIndex( index )
, mProperties( controlproperties )
+ , mVisible( false )
{
MPX_ENTER_EXIT(_L("VideoPlaybackFullScreenControl::VideoPlaybackFullScreenControl()"));
@@ -63,17 +64,22 @@
//
void VideoPlaybackFullScreenControl::setVisible( bool visible )
{
- switch ( mControlIndex )
+ if( mVisible != visible )
{
- case EControlBar:
+ mVisible = visible;
+
+ switch ( mControlIndex )
{
- static_cast<VideoPlaybackControlBar*>(mControl)->setVisibleToControlBar( visible );
- break;
- }
- default:
- {
- mControl->setVisible( visible );
- break;
+ case EControlBar:
+ {
+ static_cast<VideoPlaybackControlBar*>(mControl)->setVisibleToControlBar( visible );
+ break;
+ }
+ default:
+ {
+ mControl->setVisible( visible );
+ break;
+ }
}
}
}
--- a/videoplayback/videoplaybackview/controlsrc/videoplaybackstatuspanecontrol.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlsrc/videoplaybackstatuspanecontrol.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 22 %
+// Version : %version: 23 %
@@ -101,33 +101,36 @@
{
MPX_DEBUG(_L("VideoPlaybackStatusPaneControl::setVisible visible = %d"), visible);
- mVisible = visible;
-
- if ( mVisible )
+ if ( mVisible != visible )
{
- mController->view()->setTitleBarVisible( true );
- mController->view()->setStatusBarVisible( true );
+ mVisible = visible;
+
+ if ( mVisible )
+ {
+ mController->view()->setTitleBarVisible( true );
+ mController->view()->setStatusBarVisible( true );
- if ( mController->viewMode() == EFullScreenView ||
- mController->viewMode() == EDetailsView )
+ if ( mController->viewMode() == EFullScreenView ||
+ mController->viewMode() == EDetailsView )
+ {
+ if ( mTitleLayout )
+ {
+ mTitleLayout->setVisible( true );
+ }
+ }
+ }
+ else
{
+ mController->view()->menu()->close();
+ mController->view()->setTitleBarVisible( false );
+ mController->view()->setStatusBarVisible( false );
+
if ( mTitleLayout )
{
- mTitleLayout->setVisible( true );
+ mTitleLayout->setVisible( false );
}
}
}
- else
- {
- mController->view()->menu()->close();
- mController->view()->setTitleBarVisible( false );
- mController->view()->setStatusBarVisible( false );
-
- if ( mTitleLayout )
- {
- mTitleLayout->setVisible( false );
- }
- }
}
// -------------------------------------------------------------------------------------------------
@@ -320,7 +323,7 @@
{
MPX_DEBUG(_L("VideoPlaybackStatusPaneControl::openFullScreenView()"));
- mController->changeViewMode( EFullScreenView );
+ mController->evaluateAndChangeViewMode( EFullScreenView, true );
}
// End of file
--- a/videoplayback/videoplaybackview/controlsrc/videoplaybacktoolbar.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/controlsrc/videoplaybacktoolbar.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 12 %
+// Version : %version: 13 %
@@ -658,7 +658,7 @@
if ( viewMode == EFullScreenView )
{
- mController->changeViewMode( EDetailsView );
+ mController->evaluateAndChangeViewMode( EDetailsView, true );
}
}
--- a/videoplayback/videoplaybackview/inc/videoplaybackcontrolscontroller.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/inc/videoplaybackcontrolscontroller.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#25 %
+// Version : %version: da1mmcf#28 %
@@ -26,6 +26,7 @@
#include <QObject>
#include <QPixmap>
+#include <xqserviceutil.h>
#include <mpxplaybackframeworkdefs.h>
#include "mpxvideo_debug.h"
@@ -47,7 +48,7 @@
class VideoPlaybackControlsController;
class VideoPlaybackControlConfiguration;
class VideoServices;
-
+class ShareUi;
// DATA TYPES
@@ -145,7 +146,8 @@
inline TPlaybackViewMode viewMode();
- void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+ void evaluateAndChangeViewMode(
+ TPlaybackViewMode viewMode = EFullScreenView, bool transitionEffect = false );
inline bool isAttachOperation();
@@ -154,6 +156,8 @@
bool isRNLogoBitmapInControlList();
bool shouldShowRNLogo();
+
+ inline bool isService();
private:
/**
@@ -241,12 +245,6 @@
*/
bool isSoftKeyVisible();
- /**
- * Handle tvout connected/disconnected event
- */
- void handleTvOutEvent( bool connected,
- TVideoPlaybackControlCommandIds event );
-
void updateVideoRect( bool transitionEffect = true );
void showVolumeControls();
@@ -284,7 +282,7 @@
CMPXVideoViewWrapper *mViewWrapper;
VideoPlaybackViewFileDetails *mFileDetails;
- QList<VideoPlaybackFullScreenControl*> mControls;
+ QList<VideoPlaybackFullScreenControl*> mControls;
VideoPlaybackControlPolicy *mControlsPolicy;
VideoPlaybackControlConfiguration *mControlsConfig;
@@ -301,12 +299,15 @@
bool mViewTransitionIsGoingOn;
bool mIsAttachOperation;
bool mFileDetailsAdded;
+ bool mShowControlsWhenInHorizontal;
TThumbNailState mThumbNailState;
TMPXPlaybackState mState;
TPlaybackViewMode mViewMode;
Qt::Orientation mOrientation;
+
+ ShareUi *mShareUi;
};
// INLINE METHODS
@@ -399,6 +400,20 @@
return mFileDetailsAdded;
}
+
+// -------------------------------------------------------------------------------------------------
+// VideoPlaybackControlsController::isService
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool VideoPlaybackControlsController::isService()
+{
+ MPX_DEBUG(_L("VideoPlaybackControlsController::isService()"));
+
+ return XQServiceUtil::isService();
+}
+
+
#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
// End of File
--- a/videoplayback/videoplaybackview/resources/videoplaybackview.docml Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/resources/videoplaybackview.docml Mon Sep 20 18:25:37 2010 +0300
@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<hbdocument version="1.1">
<widget name="content" type="HbWidget">
- <widget name="bufferingIcon" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName="preroll_anim" name="icon"/>
- <real name="z" value="6"/>
- <sizehint height="10.44776un" type="PREFERRED" width="10.44776un"/>
- <bool name="visible" value="FALSE"/>
- </widget>
+ <widget name="bufferingIcon" type="HbLabel"/>
+ <widget name="rnLogoBitmap" type="HbLabel"/>
<widget name="titleLayout" type="HbWidget">
<widget name="title" type="HbLabel">
<enums name="alignment" value="AlignLeft|AlignVCenter|AlignLeading"/>
@@ -39,13 +34,13 @@
<enums name="minMaxTextAlignment" value="AlignVCenter|AlignHCenter"/>
<string name="minText"/>
<real name="z" value="1"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="1"/>
+ <sizehint height="5.97015un" type="PREFERRED" width="95.52239un"/>
<enums name="orientation" value="Horizontal"/>
<integer name="sliderValue" value="30"/>
<string name="maxText"/>
<string name="textAlignment" value="AlignBottom"/>
<bool name="textVisible" value="FALSE"/>
- <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="1"/>
- <sizehint height="5.97015un" type="PREFERRED" width="95.52239un"/>
</widget>
<real name="z" value="1"/>
<sizehint height="23.8806un" type="PREFERRED" width="95.52239un"/>
@@ -64,40 +59,6 @@
<linearitem itemname="fileDetails" spacing="0px"/>
</layout>
</widget>
- <widget name="bitmapLayout" type="HbWidget">
- <widget name="audioOnlyBitmap" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName="qtg_large_just_audio" name="icon"/>
- <bool name="visible" value="FALSE"/>
- </widget>
- <widget name="partialAudioOnlyBitmap" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName="qtg_large_corrupted" name="icon"/>
- <bool name="visible" value="FALSE"/>
- </widget>
- <widget name="realAudioOnlyBitmap" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName="qtg_large_realplayer" name="icon"/>
- <bool name="visible" value="FALSE"/>
- </widget>
- <widget name="tvOutBitmap" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName="qtg_large_tv_out" name="icon"/>
- <bool name="visible" value="FALSE"/>
- </widget>
- <real name="z" value="5"/>
- <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
- <sizehint height="28.80597un" type="PREFERRED" width="47.7612un"/>
- <sizehint height="2.68657un" type="MINIMUM" width="2.68657un"/>
- <sizehint height="2307732.46823un" type="MAXIMUM" width="2307732.46823un"/>
- <bool name="visible" value="FALSE"/>
- <layout type="stacked">
- <stackitem itemname="audioOnlyBitmap"/>
- <stackitem itemname="partialAudioOnlyBitmap"/>
- <stackitem itemname="realAudioOnlyBitmap"/>
- <stackitem itemname="tvOutBitmap"/>
- </layout>
- </widget>
<widget name="detailsPlaybackWindow" type="HbWidget">
<widget name="small_transparentWindow" type="HbTransparentWindow">
<widget name="detailsViewPlayButton" type="HbPushButton">
@@ -143,12 +104,6 @@
<linearitem itemname="attachShareButton"/>
</layout>
</widget>
- <widget name="rnLogoBitmap" type="HbLabel">
- <icon iconName="qtg_large_realplayer" name="icon"/>
- <real name="z" value="7"/>
- <sizehint height="29.85075un" type="PREFERRED" width="29.85075un"/>
- <bool name="visible" value="FALSE"/>
- </widget>
<size height="var(hb-param-screen-short-edge)" name="size" width="var(hb-param-screen-long-edge)"/>
<real name="z" value="1"/>
<rect height="var(hb-param-screen-short-edge)" name="geometry" width="var(hb-param-screen-long-edge)" x="0un" y="0un"/>
@@ -156,6 +111,8 @@
<layout type="anchor">
<anchoritem dst="bufferingIcon" dstEdge="CENTERH" spacing="0un" src="" srcEdge="CENTERH"/>
<anchoritem dst="bufferingIcon" dstEdge="CENTERV" spacing="0un" src="" srcEdge="CENTERV"/>
+ <anchoritem dst="rnLogoBitmap" dstEdge="CENTERH" spacing="0un" src="" srcEdge="CENTERH"/>
+ <anchoritem dst="rnLogoBitmap" dstEdge="CENTERV" spacing="0un" src="" srcEdge="CENTERV"/>
<anchoritem dst="titleLayout" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
<anchoritem dst="titleLayout" dstEdge="TOP" spacing="9.40299un" src="" srcEdge="TOP"/>
<anchoritem dst="titleLayout" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
@@ -172,19 +129,102 @@
<anchoritem dst="detailsPlaybackWindow" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
<anchoritem dst="detailsPlaybackWindow" dstEdge="RIGHT" spacing="0un" src="" srcEdge="CENTERH"/>
<anchoritem dst="detailsPlaybackWindow" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
- <anchoritem dst="bitmapLayout" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
- <anchoritem dst="bitmapLayout" dstEdge="TOP" spacing="0un" src="titleLayout" srcEdge="TOP"/>
- <anchoritem dst="bitmapLayout" dstEdge="RIGHT" spacing="0un" src="" srcEdge="CENTERH"/>
- <anchoritem dst="bitmapLayout" dstEdge="BOTTOM" spacing="0un" src="controlBarLayout" srcEdge="TOP"/>
<anchoritem dst="fileDetailsLayout" dstEdge="LEFT" spacing="0un" src="" srcEdge="CENTERH"/>
<anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="0un" src="titleLayout" srcEdge="BOTTOM"/>
<anchoritem dst="fileDetailsLayout" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
<anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
- <anchoritem dst="rnLogoBitmap" dstEdge="CENTERH" spacing="0un" src="" srcEdge="CENTERH"/>
- <anchoritem dst="rnLogoBitmap" dstEdge="CENTERV" spacing="0un" src="" srcEdge="CENTERV"/>
</layout>
</widget>
- <metadata activeUIState="Common ui state" display="NHD-3.2-inch_landscape" unit="un">
+ <section name="BufferingAnimation">
+ <widget name="content" type="HbWidget">
+ <widget name="bufferingIcon" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName="preroll_anim" name="icon"/>
+ <real name="z" value="6"/>
+ <sizehint height="10.44776un" type="PREFERRED" width="10.44776un"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </widget>
+ </section>
+ <section name="RNBitmap">
+ <widget name="content" type="HbWidget">
+ <widget name="rnLogoBitmap" type="HbLabel">
+ <icon iconName="qtg_large_realplayer" name="icon"/>
+ <real name="z" value="7"/>
+ <sizehint height="29.85075un" type="PREFERRED" width="29.85075un"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </widget>
+ </section>
+ <section name="IndicatorBitmaps">
+ <widget name="content" type="HbWidget">
+ <widget name="bitmapLayout" type="HbWidget">
+ <widget name="audioOnlyBitmap" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName="qtg_large_just_audio" name="icon"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="partialAudioOnlyBitmap" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName="qtg_large_corrupted" name="icon"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="realAudioOnlyBitmap" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName="qtg_large_realplayer" name="icon"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="tvOutBitmap" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName="qtg_large_tv_out" name="icon"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <real name="z" value="5"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <sizehint height="28.80597un" type="PREFERRED" width="47.7612un"/>
+ <sizehint height="2.68657un" type="MINIMUM" width="2.68657un"/>
+ <sizehint height="2307732.46823un" type="MAXIMUM" width="2307732.46823un"/>
+ <bool name="visible" value="FALSE"/>
+ <layout type="stacked">
+ <stackitem itemname="audioOnlyBitmap"/>
+ <stackitem itemname="partialAudioOnlyBitmap"/>
+ <stackitem itemname="realAudioOnlyBitmap"/>
+ <stackitem itemname="tvOutBitmap"/>
+ </layout>
+ </widget>
+ <layout type="anchor">
+ <anchoritem dst="bufferingIcon" dstEdge="CENTERH" spacing="0un" src="" srcEdge="CENTERH"/>
+ <anchoritem dst="bufferingIcon" dstEdge="CENTERV" spacing="0un" src="" srcEdge="CENTERV"/>
+ <anchoritem dst="rnLogoBitmap" dstEdge="CENTERH" spacing="0un" src="" srcEdge="CENTERH"/>
+ <anchoritem dst="rnLogoBitmap" dstEdge="CENTERV" spacing="0un" src="" srcEdge="CENTERV"/>
+ <anchoritem dst="titleLayout" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="titleLayout" dstEdge="TOP" spacing="9.40299un" src="" srcEdge="TOP"/>
+ <anchoritem dst="titleLayout" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="titleLayout" dstEdge="BOTTOM" spacing="14.32836un" src="" srcEdge="TOP"/>
+ <anchoritem dst="transparentWindow" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="transparentWindow" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+ <anchoritem dst="transparentWindow" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="transparentWindow" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="controlBarLayout" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="controlBarLayout" dstEdge="TOP" spacing="-14.92537un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="controlBarLayout" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="controlBarLayout" dstEdge="BOTTOM" spacing="-8.95522un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="detailsPlaybackWindow" dstEdge="TOP" spacing="0un" src="titleLayout" srcEdge="BOTTOM"/>
+ <anchoritem dst="detailsPlaybackWindow" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="detailsPlaybackWindow" dstEdge="RIGHT" spacing="0un" src="" srcEdge="CENTERH"/>
+ <anchoritem dst="detailsPlaybackWindow" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="bitmapLayout" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="bitmapLayout" dstEdge="TOP" spacing="0un" src="titleLayout" srcEdge="TOP"/>
+ <anchoritem dst="bitmapLayout" dstEdge="RIGHT" spacing="0un" src="" srcEdge="CENTERH"/>
+ <anchoritem dst="bitmapLayout" dstEdge="BOTTOM" spacing="0un" src="controlBarLayout" srcEdge="TOP"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="LEFT" spacing="0un" src="" srcEdge="CENTERH"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="0un" src="titleLayout" srcEdge="BOTTOM"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ </section>
+ <metadata activeUIState="a" display="NHD-3.2-inch_landscape" unit="un">
<resource location="videoplaybackview.qrc"/>
<uistate name="Common ui state" sections="#common"/>
</metadata>
--- a/videoplayback/videoplaybackview/tsrc/testcontrolconfiguration/src/testcontrolconfiguration.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testcontrolconfiguration/src/testcontrolconfiguration.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 6 %
+// Version : %version: 7 %
#include <hbapplication.h>
#include <hbinstance.h>
@@ -37,9 +37,9 @@
#undef private
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------------------------------------------
// main
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
int main(int argc, char *argv[])
{
@@ -60,18 +60,18 @@
return res;
}
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// init
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
void TestControlConfiguration::init()
{
MPX_ENTER_EXIT(_L("TestControlConfiguration::init()"));
}
-// ---------------------------------------------------------------------------
-// init
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
+// setup
+// -------------------------------------------------------------------------------------------------
//
void TestControlConfiguration::setup()
{
@@ -84,9 +84,9 @@
mControlConfig = new VideoPlaybackControlConfiguration( mControlsController );
}
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// cleanup
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
void TestControlConfiguration::cleanup()
{
@@ -111,9 +111,9 @@
}
}
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// testControlList
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
void TestControlConfiguration::testControlList()
{
@@ -121,6 +121,9 @@
setup();
+ QSignalSpy spy( mControlConfig, SIGNAL( controlListUpdated() ) );
+ QCOMPARE( spy.count(), 0 );
+
//
// Streaming case
//
@@ -133,12 +136,12 @@
QVERIFY( ! controlsList.contains( ERealLogoBitmap ) );
QVERIFY( controlsList.contains( EBufferingAnimation ) );
- cleanup();
+ QCOMPARE( spy.count(), 1 );
//
// local + RN
//
- setup();
+ mControlConfig->mControlsList.clear();
mFileDetails->mPlaybackMode = EMPXVideoLocal;
mFileDetails->mRNFormat = true;
@@ -150,12 +153,12 @@
QVERIFY( controlsList.contains( ERealLogoBitmap ) );
QVERIFY( ! controlsList.contains( EBufferingAnimation ) );
- cleanup();
+ QCOMPARE( spy.count(), 2 );
//
// local + non RN
//
- setup();
+ mControlConfig->mControlsList.clear();
mFileDetails->mPlaybackMode = EMPXVideoLocal;
mFileDetails->mRNFormat = false;
@@ -166,13 +169,16 @@
QVERIFY( controlsList.contains( EStatusPane ) );
QVERIFY( ! controlsList.contains( ERealLogoBitmap ) );
QVERIFY( ! controlsList.contains( EBufferingAnimation ) );
+ QCOMPARE( spy.count(), 2 );
+
+ spy.clear();
cleanup();
}
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// testUpdateControlsWithFileDetails
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
void TestControlConfiguration::testUpdateControlsWithFileDetails()
{
@@ -181,43 +187,34 @@
setup();
mControlConfig->createControlList();
- //
- // 1. test with mVideoEnabled = false
- //
- mControlsController->mFileDetails->mVideoEnabled = false;
+ QSignalSpy spy( mControlConfig, SIGNAL( controlListUpdated() ) );
+ QCOMPARE( spy.count(), 0 );
mControlConfig->updateControlsWithFileDetails();
QList<TVideoPlaybackControls> controlsList = mControlConfig->controlList();
QVERIFY( controlsList.contains( EControlBar ) );
-
- //
- // 2. test with mVideoEnabled = true
- //
- mControlsController->mFileDetails->mVideoEnabled = false;
+ QCOMPARE( spy.count(), 1 );
- mControlConfig->updateControlsWithFileDetails();
-
- QVERIFY( controlsList.contains( EControlBar ) );
-
- QGraphicsWidget *widget =
- mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
-
- QVERIFY( widget->isVisible() );
+ spy.clear();
cleanup();
}
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// testUpdateControlList
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
void TestControlConfiguration::testUpdateControlList()
{
MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlList()"));
setup();
+
+ QSignalSpy spy( mControlConfig, SIGNAL( controlListUpdated() ) );
+ QCOMPARE( spy.count(), 0 );
+
mControlConfig->createControlList();
QGraphicsWidget *widget =
@@ -232,6 +229,7 @@
QVERIFY( controlsList.contains( EFileDetailsWidget ) );
QVERIFY( controlsList.contains( EDetailsViewPlaybackWindow ) );
QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );
+ QCOMPARE( spy.count(), 1 );
//
// 2-1. Test for Fullscreen View
@@ -244,6 +242,7 @@
QVERIFY( ! controlsList.contains( EFileDetailsWidget ) );
QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) );
QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );
+ QCOMPARE( spy.count(), 2 );
//
// 2-2. Test for Fullscreen View
@@ -256,6 +255,7 @@
QVERIFY( ! controlsList.contains( EFileDetailsWidget ) );
QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) );
QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );
+ QCOMPARE( spy.count(), 3 );
//
// 3. Test for Audio Only View
@@ -267,6 +267,7 @@
QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) );
QVERIFY( controlsList.contains( EIndicatorBitmap ) );
QVERIFY( controlsList.contains( EFileDetailsWidget ) );
+ QCOMPARE( spy.count(), 4 );
//
// 4. RN log gets removed
@@ -275,6 +276,7 @@
controlsList = mControlConfig->controlList();
QVERIFY( ! controlsList.contains( ERealLogoBitmap ) );
+ QCOMPARE( spy.count(), 5 );
//
// 5. Surface attached
@@ -283,6 +285,7 @@
controlsList = mControlConfig->controlList();
QVERIFY( widget->isVisible() );
+ QCOMPARE( spy.count(), 5 );
//
// 6. Surface detached
@@ -291,6 +294,10 @@
controlsList = mControlConfig->controlList();
QVERIFY( ! widget->isVisible() );
+ QCOMPARE( spy.count(), 5 );
+
+ spy.clear();
+
cleanup();
}
--- a/videoplayback/videoplaybackview/tsrc/testcontrolconfiguration/stub/inc/videoplaybackcontrolscontroller.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testcontrolconfiguration/stub/inc/videoplaybackcontrolscontroller.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 4 %
+// Version : %version: 5 %
@@ -69,9 +69,12 @@
* Initialize controller
*/
void initializeController();
-
+
bool shouldShowRNLogo();
+ public slots:
+ void controlsListUpdated();
+
public:
VideoPlaybackViewFileDetails *mFileDetails;
--- a/videoplayback/videoplaybackview/tsrc/testcontrolconfiguration/stub/src/videoplaybackcontrolscontroller.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testcontrolconfiguration/stub/src/videoplaybackcontrolscontroller.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 5 %
+// Version : %version: 6 %
@@ -36,7 +36,7 @@
//
VideoPlaybackControlsController::VideoPlaybackControlsController(
VideoPlaybackViewFileDetails *details )
- : mFileDetails( details )
+ : mFileDetails( details )
{
initializeController();
}
@@ -47,7 +47,7 @@
//
void VideoPlaybackControlsController::initializeController()
{
- mLoader = new VideoPlaybackDocumentLoader();
+ mLoader = new VideoPlaybackDocumentLoader();
}
// -------------------------------------------------------------------------------------------------
@@ -70,7 +70,7 @@
// -------------------------------------------------------------------------------------------------
//
VideoPlaybackDocumentLoader* VideoPlaybackControlsController::layoutLoader()
-{
+{
return mLoader;
}
@@ -83,4 +83,12 @@
return mFileDetails->mRNFormat ;
}
+// -------------------------------------------------------------------------------------------------
+// VideoPlaybackControlsController::controlsListUpdated
+// -------------------------------------------------------------------------------------------------
+//
+void VideoPlaybackControlsController::controlsListUpdated()
+{
+}
+
// End of File
--- a/videoplayback/videoplaybackview/tsrc/testcontrolscontroller/src/testcontrolscontroller.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testcontrolscontroller/src/testcontrolscontroller.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 15 %
+// Version : %version: 17 %
#include <e32err.h>
#include <w32std.h>
@@ -352,25 +352,64 @@
mController->mOrientation = Qt::Horizontal;
- if ( value == EPbStateInitialised &&
- ( mController->mFileDetails->mPlaybackMode == EMPXVideoStreaming ||
- mController->mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming ) )
- {
- QVERIFY( mController->mControlsConfig->mState == EControlCmdPluginInitialized );
- }
- else if ( value == EPbStatePlaying || value == EPbStateInitialising ||
- value == EPbStateBuffering || value == EPbStatePaused ||
- value == EPbStateNotInitialised )
+ switch( value )
{
- for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ case EPbStatePlaying:
{
- QVERIFY( mController->mControls[i]->mState == value );
- QVERIFY( mController->mControls[i]->mVisibilityState == value );
+ bool visible = true;
+
+ if ( mController->mViewMode == EFullScreenView )
+ {
+ visible = false;
+ }
+
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mVisible == visible );
+ QVERIFY( mController->mControls[i]->mState == value );
+ }
+
+ break;
}
- }
- else
- {
- QVERIFY( mController->mState == value );
+ case EPbStateBuffering:
+ {
+ if ( mFileDetails->mPlaybackMode == EMPXVideoLocal )
+ {
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mState == value );
+ }
+ }
+ else
+ {
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mState == value );
+ QVERIFY( mController->mControls[i]->mVisible == true );
+ QVERIFY( mController->mControls[i]->mVisibilityState == value );
+ }
+ }
+
+ break;
+ }
+ case EPbStatePaused:
+ case EPbStateInitialising:
+ case EPbStateNotInitialised:
+ case EPbStatePluginSeeking:
+ {
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mState == value );
+ QVERIFY( mController->mControls[i]->mVisibilityState == value );
+ }
+ break;
+ }
+ default:
+ {
+ QVERIFY( mController->mState == value );
+
+ break;
+ }
}
}
@@ -513,23 +552,27 @@
init();
//
- // TV-Out Connected, value = true, EMPXVideoLocal
+ // TV-Out Connected, EMPXVideoLocal
//
- mController->handleEvent( EControlCmdTvOutConnected, true );
+ mController->mThumbNailState = EThumbNailEmpty;
+ mController->mViewMode = EFullScreenView;
+
+ mController->handleEvent( EControlCmdTvOutConnected );
+
verifyHandleEventTvOutResult( true, true );
+ QVERIFY( mController->mViewMode == EAudioOnlyView );
//
- // TV-Out Connected, value = false, EMPXVideoLocal
- //
- mController->handleEvent( EControlCmdTvOutConnected, false );
- verifyHandleEventTvOutResult( true, false );
-
- //
- // TV-Out Connected, value = false, non-EMPXVideoLocal
+ // TV-Out Connected, non-EMPXVideoLocal
//
mController->mFileDetails->mPlaybackMode = EMPXVideoStreaming;
+ mController->mThumbNailState = EThumbNailEmpty;
+ mController->mViewMode = EDetailsView;
+
mController->handleEvent( EControlCmdTvOutConnected, false );
+
verifyHandleEventTvOutResult( true, false );
+ QVERIFY( mController->mViewMode == EAudioOnlyView );
cleanup();
}
@@ -585,17 +628,6 @@
QVERIFY( mController->mThumbnailManager->mQuality == ThumbnailManager::OptimizeForPerformance );
QVERIFY( mController->mViewTransitionIsGoingOn == false );
}
- else if ( mController->mFileDetails->mVideoEnabled )
- {
- QVERIFY( mController->mViewTransitionIsGoingOn == true );
- QVERIFY( mController->mViewMode == EFullScreenView );
- }
- else if ( ! mController->mFileDetails->mVideoEnabled )
- {
- QVERIFY( mController->mViewTransitionIsGoingOn == false );
- QVERIFY( mController->mViewMode == EAudioOnlyView );
- }
-
}
// -------------------------------------------------------------------------------------------------
@@ -609,16 +641,24 @@
init();
//
- // TV-Out Disconnected, value = true
+ // TV-Out Disconnected, move to full screen view
//
- mController->handleEvent( EControlCmdTvOutDisconnected, true );
+ mController->mViewMode = EAudioOnlyView;
+ mFileDetails->mVideoEnabled = true;
+ mController->handleEvent( EControlCmdTvOutDisconnected );
+
verifyHandleEventTvOutResult( false, true );
+ QVERIFY( mController->mViewMode == EFullScreenView );
//
- // TV-Out Disconnected, value = false
+ // TV-Out Disconnected, move to audio only view
//
- mController->handleEvent( EControlCmdTvOutDisconnected, false );
- verifyHandleEventTvOutResult( false, false );
+ mController->mViewMode = EAudioOnlyView;
+ mFileDetails->mVideoEnabled = false;
+ mController->handleEvent( EControlCmdTvOutDisconnected );
+
+ verifyHandleEventTvOutResult( false, true );
+ QVERIFY( mController->mViewMode == EAudioOnlyView );
cleanup();
}
@@ -1121,7 +1161,7 @@
init();
//
- // connect signal with controller sendVideoo() slot
+ // connect signal with controller sendVideo() slot
//
bool res = connect( this, SIGNAL( commandSignal() ), mController, SLOT( sendVideo() ) );
@@ -1129,6 +1169,11 @@
// emit signal, this will in turns invoke mController sendVideo() slot
//
emit commandSignal();
+
+ //
+ // emit again.
+ //
+ emit commandSignal();
//
// disconnect signal
--- a/videoplayback/videoplaybackview/tsrc/testcontrolscontroller/stub/src/videoplaybackfullscreencontrol.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testcontrolscontroller/stub/src/videoplaybackfullscreencontrol.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 5 %
+// Version : %version: 6 %
@@ -84,6 +84,7 @@
MPX_DEBUG(_L("VideoPlaybackFullScreenControl::setVisibility(%d)"), state);
mVisibilityState = state;
+ setVisible( true );
}
// -------------------------------------------------------------------------------------------------
--- a/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/inc/testfiledetailswidget.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/inc/testfiledetailswidget.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 3 %
+// Version : %version: 4 %
#ifndef __TESTFILEDETAILSWIDGET_H__
#define __TESTFILEDETAILSWIDGET_H__
@@ -65,6 +65,9 @@
void testFormat();
void testBitrate();
void testFolder();
+ void testFilename();
+ void testFilePath();
+
private:
void verifyResult( QString primaryText,
--- a/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/src/testfiledetailswidget.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/src/testfiledetailswidget.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 6 %
+// Version : %version: 7 %
#include <QDateTime>
@@ -608,4 +608,54 @@
return dateTimeString;
}
+// ---------------------------------------------------------------------------
+// testFilename
+// ---------------------------------------------------------------------------
+//
+void TestFileDetailsWidget::testFilename()
+{
+ MPX_ENTER_EXIT(_L("TestFileDetailsWidget::testFilename()"));
+
+ init();
+
+ VideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ details->mPlaybackMode = EMPXVideoLocal;
+ details->mClipName = KFILEPATH;
+
+ mController->mViewMode = EDetailsView;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "File name", true, "sample1" );
+
+ cleanup();
+}
+
+
+// ---------------------------------------------------------------------------
+// testFilePath
+// ---------------------------------------------------------------------------
+//
+void TestFileDetailsWidget::testFilePath()
+{
+ MPX_ENTER_EXIT(_L("TestFileDetailsWidget::testFilePath()"));
+
+ init();
+
+ VideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ details->mPlaybackMode = EMPXVideoLocal;
+ details->mClipName = KFILEPATH;
+
+ mController->mViewMode = EDetailsView;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "File path", true, "C:/sample1.wav" );
+
+ cleanup();
+
+}
+
// End of file
--- a/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/stub/inc/videoplaybackcontrolscontroller.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/stub/inc/videoplaybackcontrolscontroller.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 3 %
+// Version : %version: 4 %
@@ -98,6 +98,8 @@
TPlaybackViewMode viewMode();
void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ bool isService();
public:
VideoPlaybackViewFileDetails *mFileDetails;
--- a/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/stub/src/hbglobal.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/stub/src/hbglobal.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 4 %
+// Version : %version: 5 %
@@ -117,6 +117,14 @@
{
loc = "%L1x%L2";
}
+ else if ( string == "txt_videos_list_file_path" )
+ {
+ loc = "File path";
+ }
+ else if ( string == "txt_videos_list_file_name" )
+ {
+ loc = "File name";
+ }
return loc;
}
--- a/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/stub/src/videoplaybackcontrolscontroller.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testfiledetailswidget/stub/src/videoplaybackcontrolscontroller.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 3 %
+// Version : %version: 4 %
@@ -86,4 +86,15 @@
mTimerAction = timerAction;
}
+
+// -------------------------------------------------------------------------------------------------
+// VideoPlaybackControlsController::isService()
+// -------------------------------------------------------------------------------------------------
+//
+bool VideoPlaybackControlsController::isService()
+{
+ MPX_DEBUG(_L("VideoPlaybackControlsController::isService()"));
+
+ return false;
+}
// End of File
--- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/src/testmpxvideoviewwrapper.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 17 %
+// Version : %version: 18 %
#include <e32err.h>
#include <w32std.h>
@@ -49,9 +49,9 @@
#undef protected
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// main
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
int main(int argc, char *argv[])
{
@@ -70,23 +70,27 @@
return res;
}
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// init
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
void TestMPXVideoViewWrapper::init()
{
mBaseVideoView = new VideoBasePlaybackView();
TRAPD( err, mVideoViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView ) );
+ TRAP( err, mVideoViewWrapper->ActivateL() );
+
QVERIFY( err == KErrNone );
}
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
// cleanup
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
void TestMPXVideoViewWrapper::cleanup()
{
+ mVideoViewWrapper->Deactivate();
+
if ( mVideoViewWrapper )
{
delete mVideoViewWrapper;
--- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxplaybackutility.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxplaybackutility.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 3 %
+// Version : %version: 4 %
#ifndef CMPXPLAYBACKUTILITY_H
#define CMPXPLAYBACKUTILITY_H
@@ -61,6 +61,7 @@
virtual void Close() = 0;
virtual void SetPrimaryClientL() = 0;
virtual void SetL( TMPXPlaybackProperty aProperty,TInt aValue ) = 0;
+ virtual void CancelRequest() = 0;
public:
TMPXPlaybackState iState;
@@ -111,6 +112,8 @@
MMPXPlaybackCallback& aCallback );
void SetPrimaryClientL();
+
+ void CancelRequest();
};
#endif // CMPXPLAYBACKUTILITY_H
--- a/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxplaybackutility.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxplaybackutility.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -217,5 +217,13 @@
{
}
+// -------------------------------------------------------------------------------------------------
+// set primary client
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::CancelRequest()
+{
+}
+
// End of file
--- a/videoplayback/videoplaybackview/tsrc/teststatuspanecontrol/stub/inc/videoplaybackcontrolscontroller.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/teststatuspanecontrol/stub/inc/videoplaybackcontrolscontroller.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 5 %
+// Version : %version: 6 %
@@ -97,7 +97,7 @@
inline bool isFileDetailsAdded();
- void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+ void evaluateAndChangeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
TPlaybackViewMode viewMode();
--- a/videoplayback/videoplaybackview/tsrc/teststatuspanecontrol/stub/src/videoplaybackcontrolscontroller.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/teststatuspanecontrol/stub/src/videoplaybackcontrolscontroller.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 5 %
+// Version : %version: 6 %
@@ -42,7 +42,7 @@
VideoBasePlaybackView *view,
VideoPlaybackViewFileDetails *details )
: mView( view )
- , mFileDetails( details )
+ , mFileDetails( details )
{
initializeController();
}
@@ -53,7 +53,7 @@
//
void VideoPlaybackControlsController::initializeController()
{
- mLoader = new VideoPlaybackDocumentLoader();
+ mLoader = new VideoPlaybackDocumentLoader();
}
// -------------------------------------------------------------------------------------------------
@@ -81,14 +81,14 @@
}
// -------------------------------------------------------------------------------------------------
-// VideoPlaybackControlsController::changeViewMode
+// VideoPlaybackControlsController::evaluateAndChangeViewMode
// -------------------------------------------------------------------------------------------------
//
-void VideoPlaybackControlsController::changeViewMode(
+void VideoPlaybackControlsController::evaluateAndChangeViewMode(
TPlaybackViewMode viewMode, bool transitionEffect )
{
- MPX_DEBUG(_L("VideoPlaybackControlsController::changeViewMode()"));
-
+ MPX_DEBUG(_L("VideoPlaybackControlsController::evaluateAndChangeViewMode()"));
+
Q_UNUSED( transitionEffect );
mViewMode = viewMode;
}
--- a/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 14 %
+// Version : %version: ou1cpsw#16 %
#include <e32err.h>
#include <w32std.h>
@@ -31,6 +31,10 @@
#include <qgraphicssceneevent>
#include <QDebug>
+#include "hbdialog.h"
+#include "hbmessagebox.h"
+#include "hbnotificationdialog.h"
+
#include "videoplaybackviewfiledetails.h"
#include "mpxcommonvideoplaybackview.hrh"
@@ -107,7 +111,8 @@
init();
mVideoView->handleActivateView();
- QVERIFY( mVideoView->mVideoMpxWrapper->iMediaRequested == true );
+ QVERIFY( mVideoView->mVideoMpxWrapper->iMediaRequested );
+ QVERIFY( mVideoView->mVideoMpxWrapper->iActivated );
QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mBitRate, 16000 );
QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mTitle, QString("Test Video Title") );
@@ -166,33 +171,64 @@
// construct and activate playback view
//
setup();
-
+
+ HbMessageBox::mMessageBConstructCount = 0;
+ HbNotificationDialog::mNotifConstructCount = 0;
//
// ensure that playback view is currently activated
//
QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
//
- // test showDialog() method
+ // test showDialog() method using default arguments
//
mVideoView->showDialog( "test error msg" );
-
- //
- // connect and emit signal for handleClosePopupDialog() slot
- //
- connect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
- emit commandSignal();
-
- //
- // verify that playback view is properly closed
- //
+
+ QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
+ QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+ mVideoView->handleActivateView();
+ HbMessageBox::mMessageBConstructCount = 0;
+ HbNotificationDialog::mNotifConstructCount = 0;
+ mVideoView->mTimerForClosingView->stop();
+
//
- // disconnect signal for handleClosePopupDialog() slot
+ // test showDialog() method, error, no closing
+ //
+ mVideoView->showDialog( "test error msg", false );
+
+ QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
+ QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
+ QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
+
+ HbMessageBox::mMessageBConstructCount = 0;
+ HbNotificationDialog::mNotifConstructCount = 0;
+
+ //
+ // test showDialog() method, nofitification, closing
//
- disconnect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
+ mVideoView->showDialog( "test error msg", true, false );
+
+ QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
+ QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
+ QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+
+ mVideoView->handleActivateView();
+ HbMessageBox::mMessageBConstructCount = 0;
+ HbNotificationDialog::mNotifConstructCount = 0;
+ mVideoView->mTimerForClosingView->stop();
+
+ //
+ // test showDialog() method, nofitification, not closing
+ //
+ mVideoView->showDialog( "test error msg", false, false );
+ QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
+ QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
+ QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
+
+
//
// destruct playback view
//
@@ -428,7 +464,8 @@
mVideoView->handleDeactivateView();
- QVERIFY( mVideoView->mVideoMpxWrapper == NULL );
+ QVERIFY( mVideoView->mVideoMpxWrapper != NULL );
+ QVERIFY( ! mVideoView->mVideoMpxWrapper->iActivated );
cleanup();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/inc/hbdialog.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub hbdialog
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBDIALOG_H
+#define HBDIALOG_H
+
+#include <QObject>
+
+class HbDialog : public QObject
+{
+ Q_OBJECT
+
+ signals:
+ void aboutToClose();
+
+ public:
+ HbDialog() {}
+ virtual ~HbDialog() {}
+ void setAttribute( int value )
+ {
+ Q_UNUSED(value);
+ }
+ void setDismissPolicy( int value )
+ {
+ Q_UNUSED(value);
+ }
+ void setTimeout( int value )
+ {
+ Q_UNUSED(value);
+ }
+ void show()
+ {
+ emit this->aboutToClose();
+ delete this;
+ }
+
+
+};
+
+#endif /*HBDIALOG_H*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/inc/hbmessagebox.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub hbmessagebox
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBMESSAGEBOX_H
+#define HBMESSAGEBOX_H
+
+#include "hbdialog.h"
+
+class HbMessageBox : public HbDialog
+{
+ Q_OBJECT
+
+ public:
+
+ enum MessageBoxType {
+ MessageTypeWarning
+ };
+ enum StandardButton {
+ NoButton = 0x00000000,
+ };
+
+ HbMessageBox(const QString &txt, int type)
+ {
+ Q_UNUSED(txt);
+ Q_UNUSED(type);
+ mMessageBConstructCount++;
+ }
+ virtual ~HbMessageBox()
+ {
+
+ }
+ void setStandardButtons(int value)
+ {
+ Q_UNUSED(value);
+ }
+
+ static int mMessageBConstructCount;
+};
+
+#endif /*HBMESSAGEBOX_H*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/inc/hbnotificationdialog.h Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub hbnotificationdialog
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBNOTIFICATIONDIALOG_H
+#define HBNOTIFICATIONDIALOG_H
+
+#include "hbdialog.h"
+
+class HbNotificationDialog : public HbDialog
+{
+ Q_OBJECT
+
+ public:
+ HbNotificationDialog(){mNotifConstructCount++;}
+ virtual ~HbNotificationDialog(){};
+ void setTitle(const QString &title)
+ {
+ Q_UNUSED(title);
+ }
+
+ static int mNotifConstructCount;
+
+};
+
+
+#endif /*HBNOTIFICATIONDIALOG_H*/
+
--- a/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/inc/mpxvideoviewwrapper.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/inc/mpxvideoviewwrapper.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
@@ -72,6 +72,10 @@
TInt GetMediaId();
+ void ActivateL();
+
+ void Deactivate();
+
public: // data
VideoBasePlaybackView* iView;
@@ -80,6 +84,7 @@
TBool iClosePlayerAO;
TBool iAppForeground;
TBool iViewForeground;
+ TBool iActivated;
TInt iCommand;
TInt iPlayPosition;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/src/hbmessagebox.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub hbmessagebox implementation
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "hbmessagebox.h"
+
+// static member requires separate build unit for initialization
+int HbMessageBox::mMessageBConstructCount = 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/src/hbnotificationdialog.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub hbnotificationdialog implementation
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "hbnotificationdialog.h"
+
+// static member requires separate build unit for initialization
+int HbNotificationDialog::mNotifConstructCount = 0;
--- a/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 11 %
+// Version : %version: 12 %
@@ -62,6 +62,24 @@
}
// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ActivateL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ActivateL()
+{
+ iActivated = ETrue;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::Deactivate()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::Deactivate()
+{
+ iActivated = EFalse;
+}
+
+// -------------------------------------------------------------------------------------------------
// CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
// -------------------------------------------------------------------------------------------------
//
--- a/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/testvideoplaybackview.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testvideoplaybackview/testvideoplaybackview.pro Mon Sep 20 18:25:37 2010 +0300
@@ -14,7 +14,7 @@
# Description: Project file for building Videoplayer components
#
#
-# Version : %version: 11 %
+# Version : %version: ou1cpsw#12 %
TEMPLATE = app
TARGET = testvideoplaybackview
@@ -38,6 +38,9 @@
../../../inc/videobaseplaybackview.h \
../../../inc/videoplaybackview.h \
videoplaybackviewfiledetails.h \
+ hbdialog.h \
+ hbmessagebox.h \
+ hbnotificationdialog.h \
hbtapgesture.h \
hbpangesture.h \
videoactivitystate.h
@@ -47,6 +50,8 @@
../../viewsrc/videobaseplaybackview.cpp \
../../viewsrc/videoplaybackview.cpp \
../../viewsrc/videoplaybackviewfiledetails.cpp \
+ hbmessagebox.cpp \
+ hbnotificationdialog.cpp \
hbtapgesture.cpp \
hbpangesture.cpp \
videoactivitystate.cpp
--- a/videoplayback/videoplaybackview/videoplaybackview.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/videoplaybackview.pro Mon Sep 20 18:25:37 2010 +0300
@@ -14,7 +14,7 @@
# Description: Project file for building Videoplayer components
#
#
-# Version : %version: da1mmcf#33 %
+# Version : %version: 34 %
TEMPLATE = lib
@@ -37,6 +37,7 @@
"DEFFILE ../bwins/videoplaybackview.def" \
"$${LITERAL_HASH}endif"
MMP_RULES += defBlock SMPSAFE
+ VERSION = 10.0
}
INCLUDEPATH += ../../inc
--- a/videoplayback/videoplaybackview/viewinc/mpxvideoviewwrapper.h Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/viewinc/mpxvideoviewwrapper.h Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#24 %
+// Version : %version: da1mmcf#25 %
@@ -212,6 +212,10 @@
void SurfacedAttached( TBool aAttached );
+ void ActivateL();
+
+ void Deactivate();
+
private:
/**
--- a/videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#47 %
+// Version : %version: da1mmcf#48 %
@@ -92,15 +92,6 @@
{
MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ConstructL()"));
-
- //
- // Get the playback utility instance from playback utility
- //
- iPlaybackUtility =
- MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault );
- iPlaybackUtility->AddObserverL( *this );
- iPlaybackUtility->SetPrimaryClientL();
-
//
// Get an instance of collection utility
// Used for the Collection Observer to get the MediaL callbacks
@@ -113,6 +104,27 @@
iCloseAO = CIdle::NewL( CActive::EPriorityStandard );
//
+ // Get the playback utility instance from playback utility
+ //
+ iPlaybackUtility =
+ MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault );
+ iPlaybackUtility->SetPrimaryClientL();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ActivateL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ActivateL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateL()"));
+
+ if ( iPlaybackUtility )
+ {
+ iPlaybackUtility->AddObserverL( *this );
+ }
+
+ //
// Create Video Playback Display Handler
//
iDisplayHandler = CVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this );
@@ -129,12 +141,12 @@
}
// -------------------------------------------------------------------------------------------------
-// CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+// CMPXVideoViewWrapper::DeactivateL()
// -------------------------------------------------------------------------------------------------
//
-CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+void CMPXVideoViewWrapper::Deactivate()
{
- MPX_DEBUG(_L("CMPXVideoViewWrapper::~CMPXVideoViewWrapper()"));
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::Deactivate()"));
//
// Delete the display handler when the view is deactivated
@@ -157,12 +169,6 @@
iControlsController = NULL;
}
- if ( iCloseAO )
- {
- delete iCloseAO;
- iCloseAO = NULL;
- }
-
if ( iFileDetails )
{
delete iFileDetails;
@@ -171,15 +177,35 @@
if ( iPlaybackUtility )
{
+ iPlaybackUtility->CancelRequest();
TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
- iPlaybackUtility->Close();
- iPlaybackUtility = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::~CMPXVideoViewWrapper()"));
+
+ if ( iCloseAO )
+ {
+ delete iCloseAO;
+ iCloseAO = NULL;
}
if ( iCollectionUtility )
{
iCollectionUtility->Close();
}
+
+ if ( iPlaybackUtility )
+ {
+ iPlaybackUtility->Close();
+ iPlaybackUtility = NULL;
+ }
}
// -------------------------------------------------------------------------------------------------
--- a/videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp Mon Sep 20 18:25:37 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#49 %
+// Version : %version: 49.1.2 %
@@ -30,6 +30,7 @@
#include <hbaction.h>
#include <hbinstance.h>
#include <hbnotificationdialog.h>
+#include <hbmessagebox.h>
#include <hblabel.h>
#include <hbtapgesture.h>
#include <hbpangesture.h>
@@ -100,6 +101,8 @@
mStayPaused = true;
}
+
+ MPX_TRAPD( err, mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) );
}
// -------------------------------------------------------------------------------------------------
@@ -140,7 +143,7 @@
{
MPX_ENTER_EXIT(_L("VideoBasePlaybackView::handleActivateView()"));
- MPX_TRAPD( err, mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) );
+ MPX_TRAPD( err, mVideoMpxWrapper->ActivateL() );
connect( hbInstance->allMainWindows()[0], SIGNAL( obscured() ), this, SLOT( handleAppBackground() ) );
connect( hbInstance->allMainWindows()[0], SIGNAL( revealed() ), this, SLOT( handleAppForeground() ) );
@@ -186,11 +189,7 @@
//
MPX_TRAPD( err, mVideoMpxWrapper->HandleCommandL( EMPXPbvCmdClose ) );
- if ( mVideoMpxWrapper )
- {
- delete mVideoMpxWrapper;
- mVideoMpxWrapper = NULL;
- }
+ MPX_TRAP( err, mVideoMpxWrapper->Deactivate() );
//
// go back to device orientation
@@ -307,19 +306,33 @@
// VideoBasePlaybackView::showDialog
// -------------------------------------------------------------------------------------------------
//
-void VideoBasePlaybackView::showDialog( const QString& string, bool closeView )
+void VideoBasePlaybackView::showDialog( const QString& string, bool closeView, bool isError )
{
- MPX_DEBUG(_L("VideoBasePlaybackView::showDialog( %s, %d )"), string.data(), closeView );
+ MPX_DEBUG(_L("VideoBasePlaybackView::showDialog( %s, %d, %d )"), string.data(), closeView, isError );
//
- // 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.
+ // create pop-up dialog for error notes and notifications,
+ // For error notes, HbMessageBox is used:
+ // - Note will be dismissed by using standard timeout or
+ // - If user taps anywhere on the screen.
+ // For notifications, HbNotification dialog will be used.
//
- QRectF screenRect = hbInstance->allMainWindows()[0]->rect();
- HbNotificationDialog* dlg = new HbNotificationDialog();
+
+ HbDialog *dlg = 0;
+ if(isError)
+ {
+ dlg = new HbMessageBox( string, HbMessageBox::MessageTypeWarning );
+ // dialog will be closed by timeout, no buttons used
+ qobject_cast<HbMessageBox*>( dlg )->setStandardButtons( HbMessageBox::NoButton );
+ }
+ else
+ {
+ dlg = new HbNotificationDialog();
+ qobject_cast<HbNotificationDialog*>( dlg )->setTitle( string );
+ }
dlg->setAttribute( Qt::WA_DeleteOnClose );
-
+ dlg->setDismissPolicy( HbPopup::TapAnywhere );
+ dlg->setTimeout( HbPopup::StandardTimeout );
if ( closeView )
{
//
@@ -329,7 +342,6 @@
connect( dlg, SIGNAL( aboutToClose() ), this, SLOT( handleClosePopupDialog() ) );
}
- dlg->setTitle( string );
dlg->show();
}
--- a/videoplayback/videoplaybackviewplugin/videoplaybackviewplugin.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayback/videoplaybackviewplugin/videoplaybackviewplugin.pro Mon Sep 20 18:25:37 2010 +0300
@@ -14,7 +14,7 @@
# Description: Project file for building Videoplayer components
#
#
-# Version : %version: da1mmcf#18 %
+# Version : %version: 19 %
TEMPLATE = lib
@@ -30,6 +30,7 @@
$$APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE
BLD_INF_RULES.prj_exports += "rom/videoplaybackviewplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videoplaybackviewplugin.iby)"
MMP_RULES += SMPSAFE
+ VERSION = 10.0
}
SERVICE.INTERFACE_NAME = org.nokia.mmdt.QViewPlugin/1.0
--- a/videoplayerapp/videoplayer/sis/videoplayer_stub.pkg Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayerapp/videoplayer/sis/videoplayer_stub.pkg Mon Sep 20 18:25:37 2010 +0300
@@ -18,13 +18,13 @@
&EN
; SIS header: name, uid, version
-# {"videoplayer"}, (0x200211FE), 10,10,1, TYPE=SA
+# {"videoplayer"}, (0x200211FE), 10,10,2, TYPE=SA
; Localised Vendor name
-%{"Nokia, Qt Software"}
+%{"Nokia"}
; Unique Vendor name
-:"Nokia, Qt Software"
+:"Nokia"
;
; Collection Plugin
@@ -61,6 +61,11 @@
"" - "z:\sys\bin\videoplayer.exe"
"" - "z:\resource\apps\videoplayer.r*"
"" - "z:\private\10003a3f\import\apps\videoplayer_reg.rsc"
-"" - "z:\resource\qt\translations\videos.qm"
+"" - "z:\resource\qt\translations\videos*.qm"
-
+;
+; Media settings
+;
+"" - "z:/sys/bin/mpsettropmodel.dll"
+"" - "z:/resource/plugins/mpsettropmodel.r*"
+"" - "z:/sys/bin/videosettingsplugin.dll"
Binary file videoplayerapp/videoplayer/sis/videoplayer_stub.sis has changed
--- a/videoplayerapp/videoplayer/sis/videoplayer_udeb.pkg Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayerapp/videoplayer/sis/videoplayer_udeb.pkg Mon Sep 20 18:25:37 2010 +0300
@@ -18,13 +18,13 @@
&EN
; SIS header: name, uid, version
-#{"videoplayer"},(0x200211FE),1,0,0,TYPE=SA, RU
+#{"videoplayer"},(0x200211FE),10,10,2,TYPE=SA, RU
; Localised Vendor name
-%{"Nokia, Qt Software"}
+%{"Nokia"}
; Unique Vendor name
-:"Nokia, Qt Software"
+:"Nokia"
; Dependencies
[0x101F7961],0,0,0,{"S60ProductID"}
@@ -57,8 +57,15 @@
"/epoc32/release/armv5/udeb/videoplayer.exe" - "!:/sys/bin/videoplayer.exe"
"/epoc32/data/z/resource/apps/videoplayer.rsc" - "!:/resource/apps/videoplayer.rsc"
"/epoc32/data/z/private/10003a3f/import/apps/videoplayer_reg.rsc" - "!:/private/10003a3f/import/apps/videoplayer_reg.rsc"
-"/epoc32/data/z/resource/qt/translations/videos_en.qm" - "!:/resource/qt/translations/videos.qm"
+"/epoc32/data/z/resource/qt/translations/videos_en.qm" - "!:/resource/qt/translations/videos_en.qm"
+
+"/epoc32/data/z/resource/plugins/videoplaybackviewplugin.rsc" - "!:/resource/plugins/videoplaybackviewplugin.rsc"
+"/epoc32/release/armv5/udeb/videoplaybackview.dll" - "!:/sys/bin/videoplaybackview.dll"
+"/epoc32/release/armv5/udeb/videoplaybackviewplugin.dll" - "!:/sys/bin/videoplaybackviewplugin.dll"
-"/epoc32/data/z/resource/plugins/videoplaybackviewplugin.rsc" - "!:/resource/plugins/videoplaybackviewplugin.rsc"
-"/epoc32/release/armv5/udeb/videoplaybackview.dll" - "!:/sys/bin/videoplaybackview.dll"
-"/epoc32/release/armv5/udeb/videoplaybackviewplugin.dll" - "!:/sys/bin/videoplaybackviewplugin.dll"
+;
+; Media settings
+;
+"/epoc32/release/armv5/udeb/mpsettropmodel.dll" - "!:/sys/bin/mpsettropmodel.dll"
+"/epoc32/data/z/resource/plugins/mpsettropmodel.rsc" - "!:/resource/plugins/mpsettropmodel.rsc"
+"/epoc32/release/armv5/udeb/videosettingsplugin.dll" - "!:/sys/bin/videosettingsplugin.dll"
--- a/videoplayerapp/videoplayer/sis/videoplayer_urel.pkg Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayerapp/videoplayer/sis/videoplayer_urel.pkg Mon Sep 20 18:25:37 2010 +0300
@@ -18,13 +18,13 @@
&EN
; SIS header: name, uid, version
-#{"videoplayer"},(0x200211FE),1,0,0,TYPE=SA, RU
+#{"videoplayer"},(0x200211FE),10,10,2,TYPE=SA, RU
; Localised Vendor name
-%{"Nokia, Qt Software"}
+%{"Nokia"}
; Unique Vendor name
-:"Nokia, Qt Software"
+:"Nokia"
; Dependencies
[0x101F7961],0,0,0,{"S60ProductID"}
@@ -57,8 +57,15 @@
"/epoc32/release/armv5/urel/videoplayer.exe" - "!:/sys/bin/videoplayer.exe"
"/epoc32/data/z/resource/apps/videoplayer.rsc" - "!:/resource/apps/videoplayer.rsc"
"/epoc32/data/z/private/10003a3f/import/apps/videoplayer_reg.rsc" - "!:/private/10003a3f/import/apps/videoplayer_reg.rsc"
-"/epoc32/data/z/resource/qt/translations/videos_en.qm" - "!:/resource/qt/translations/videos.qm"
+"/epoc32/data/z/resource/qt/translations/videos_en.qm" - "!:/resource/qt/translations/videos_en.qm"
+
+"/epoc32/data/z/resource/plugins/videoplaybackviewplugin.rsc" - "!:/resource/plugins/videoplaybackviewplugin.rsc"
+"/epoc32/release/armv5/urel/videoplaybackview.dll" - "!:/sys/bin/videoplaybackview.dll"
+"/epoc32/release/armv5/urel/videoplaybackviewplugin.dll" - "!:/sys/bin/videoplaybackviewplugin.dll"
-"/epoc32/data/z/resource/plugins/videoplaybackviewplugin.rsc" - "!:/resource/plugins/videoplaybackviewplugin.rsc"
-"/epoc32/release/armv5/urel/videoplaybackview.dll" - "!:/sys/bin/videoplaybackview.dll"
-"/epoc32/release/armv5/urel/videoplaybackviewplugin.dll" - "!:/sys/bin/videoplaybackviewplugin.dll"
+;
+; Media settings
+;
+"/epoc32/release/armv5/urel/mpsettropmodel.dll" - "!:/sys/bin/mpsettropmodel.dll"
+"/epoc32/data/z/resource/plugins/mpsettropmodel.rsc" - "!:/resource/plugins/mpsettropmodel.rsc"
+"/epoc32/release/armv5/urel/videosettingsplugin.dll" - "!:/sys/bin/videosettingsplugin.dll"
--- a/videoplayerapp/videoplayer/videoplayer.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayerapp/videoplayer/videoplayer.pro Mon Sep 20 18:25:37 2010 +0300
@@ -14,7 +14,7 @@
# Description: Project file for building Videoplayer components
#
#
-# Version : %version: 5 %
+# Version : %version: 6 %
TEMPLATE = app
@@ -37,6 +37,7 @@
"resources/videos.docml /epoc32/data/z/resource/hb/splashml/videos.docml" \
"resources/videos.splashml /epoc32/data/z/resource/hb/splashml/videos.splashml"
MMP_RULES += SMPSAFE
+ VERSION = 10.0
}
# Service provider specific configuration.
--- a/videoplayerapp/videoplayerengine/videoplayerengine.pro Fri Sep 03 12:37:43 2010 +0300
+++ b/videoplayerapp/videoplayerengine/videoplayerengine.pro Mon Sep 20 18:25:37 2010 +0300
@@ -14,7 +14,7 @@
# Description: Project file for building Videoplayer components
#
#
-# Version : %version: 32 %
+# Version : %version: 33 %
TEMPLATE = lib
@@ -38,6 +38,7 @@
"DEFFILE ../bwins/videoplayerengine.def" \
"$${LITERAL_HASH}endif"
MMP_RULES += defBlock SMPSAFE
+ VERSION = 10.0
}
INCLUDEPATH += ../../inc \