videoplayerapp/videoplayerengine/src/videoservices.cpp
changeset 20 b9e04db066d4
parent 17 69946d1824c4
child 24 7d93ee07fb27
--- a/videoplayerapp/videoplayerengine/src/videoservices.cpp	Mon May 03 12:32:50 2010 +0300
+++ b/videoplayerapp/videoplayerengine/src/videoservices.cpp	Fri May 14 15:53:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: %
+// Version : %version: 6 %
 
 #include "videoplayerengine.h"
 #include "videoservices.h"
@@ -43,6 +43,7 @@
     {
     	mInstance->setEngine(engine);
     }
+
     mInstance->mReferenceCount++;
     return mInstance;
 }
@@ -95,7 +96,7 @@
 {
     MPX_DEBUG(_L("VideoServices::engine"));
 	
-	return mEngine;
+    return mEngine;
 }
 
 // ----------------------------------------------------------------------------
@@ -106,13 +107,14 @@
     : mReferenceCount( 0 )
     , mEngine( engine )
     , mCurrentService( VideoServices::ENoService )
+    , mFetchSelected( false )
 {
     MPX_ENTER_EXIT(_L("VideoServices::VideoServices()"));
     
     mServiceUriFetch = new VideoServiceUriFetch(this);
-	mServicePlay     = new VideoServicePlay(this, engine);
-	mServiceView     = new VideoServiceView(this, engine);
-	mServiceBrowse   = new VideoServiceBrowse(this);
+    mServicePlay     = new VideoServicePlay(this, engine);
+    mServiceView     = new VideoServiceView(this, engine);
+    mServiceBrowse   = new VideoServiceBrowse(this);
 }
 
 // ----------------------------------------------------------------------------
@@ -123,10 +125,10 @@
 {
     MPX_ENTER_EXIT(_L("VideoServices::~VideoServices()"));
     
-	delete mServiceUriFetch;
-	delete mServicePlay;
-	delete mServiceView;
-	delete mServiceBrowse;
+    delete mServiceUriFetch;
+    delete mServicePlay;
+    delete mServiceView;
+    delete mServiceBrowse;
 }
 
 // ----------------------------------------------------------------------------
@@ -137,7 +139,7 @@
 {
     MPX_DEBUG(_L("VideoServices::currentService() ret %d"), mCurrentService );
 	
-	return mCurrentService;
+    return mCurrentService;
 }
 
 // ----------------------------------------------------------------------------
@@ -166,7 +168,7 @@
 {
     MPX_DEBUG(_L("VideoServices::setCurrentService(%d)"), service );
 	
-	mCurrentService = service;	
+    mCurrentService = service;	
 }
 
 // ----------------------------------------------------------------------------
@@ -179,11 +181,11 @@
 	
     QString title;
     
-    if ( mCurrentService == VideoServices::EUriFetcher )
+    if (mCurrentService == VideoServices::EUriFetcher && mServiceUriFetch)
     {
         title = mServiceUriFetch->contextTitle();
     }
-    else if ( mCurrentService == VideoServices::EBrowse )
+    else if (mCurrentService == VideoServices::EBrowse && mServiceBrowse)
     {
         title = mServiceBrowse->contextTitle();
     }
@@ -192,6 +194,24 @@
 }
 
 // ----------------------------------------------------------------------------
+// sortRole()
+// ----------------------------------------------------------------------------
+//
+int VideoServices::sortRole() const
+{
+    MPX_ENTER_EXIT(_L("VideoServices::sortType()"));
+    
+    int sortRole = 0;
+    
+    if (mCurrentService == EBrowse && mServiceBrowse)
+    {
+        sortRole = mServiceBrowse->sortRole();
+    }
+    
+    return sortRole;
+}
+
+// ----------------------------------------------------------------------------
 // itemSelected()
 // ----------------------------------------------------------------------------
 //
@@ -203,6 +223,7 @@
     QStringList list;
     list.append( item );
     mServiceUriFetch->complete( list );
+    mFetchSelected = true;
 }
 
 // ----------------------------------------------------------------------------