videoplayerapp/videoplayerengine/src/videoservices.cpp
changeset 24 7d93ee07fb27
parent 20 b9e04db066d4
child 44 518105d52e45
child 52 e3cecb93e76a
equal deleted inserted replaced
20:b9e04db066d4 24:7d93ee07fb27
    13 *
    13 *
    14 * Description:  Implementation of VideoServices
    14 * Description:  Implementation of VideoServices
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 6 %
    18 // Version : %version: da1mmcf#8 %
    19 
    19 
    20 #include "videoplayerengine.h"
    20 #include "videoplayerengine.h"
    21 #include "videoservices.h"
    21 #include "videoservices.h"
    22 #include "videoserviceurifetch.h"
    22 #include "videoserviceurifetch.h"
    23 #include "videoserviceplay.h"
    23 #include "videoserviceplay.h"
    24 #include "videoserviceview.h"
    24 #include "videoserviceview.h"
    25 #include "videoservicebrowse.h"
    25 #include "videoservicebrowse.h"
    26 #include "mpxvideo_debug.h"
    26 #include "mpxvideo_debug.h"
       
    27 #include <xqaiwdecl.h>
       
    28 #include <xqserviceutil.h>
    27 
    29 
    28 VideoServices *VideoServices::mInstance = 0;
    30 VideoServices *VideoServices::mInstance = 0;
    29 
    31 
    30 // -----------------------------------------------------------------------------
    32 // -----------------------------------------------------------------------------
    31 // VideoServices::instance()
    33 // VideoServices::instance()
   108     , mEngine( engine )
   110     , mEngine( engine )
   109     , mCurrentService( VideoServices::ENoService )
   111     , mCurrentService( VideoServices::ENoService )
   110     , mFetchSelected( false )
   112     , mFetchSelected( false )
   111 {
   113 {
   112     MPX_ENTER_EXIT(_L("VideoServices::VideoServices()"));
   114     MPX_ENTER_EXIT(_L("VideoServices::VideoServices()"));
   113     
   115    
   114     mServiceUriFetch = new VideoServiceUriFetch(this);
   116     mServicePlay     = new VideoServicePlay(this, engine, QLatin1String("videoplayer.com.nokia.symbian.IVideoView"));  //New service, new interface
   115     mServicePlay     = new VideoServicePlay(this, engine);
   117     mServiceView     = new VideoServiceView(this, engine, QLatin1String("videoplayer.com.nokia.symbian.IFileView"));   //New service, new interface        
   116     mServiceView     = new VideoServiceView(this, engine);
   118     mServiceUriFetch = new VideoServiceUriFetch(this, QLatin1String("videoplayer.com.nokia.symbian.IVideoFetch")); //New service, new interface
   117     mServiceBrowse   = new VideoServiceBrowse(this);
   119     mServiceBrowse   = new VideoServiceBrowse(  this, QLatin1String("videoplayer.com.nokia.symbian.IVideoBrowse")); //New service, new interface
       
   120 
       
   121     mServicePlayDeprecatedNewService = new VideoServicePlay(this, engine, QLatin1String("videoplayer.IVideoView")); //New service, old interface
       
   122     mServicePlayDeprecatedOldService = new VideoServicePlay(this, engine, QLatin1String("com.nokia.Videos.IVideoView")); //Old service, old interface   
       
   123     
       
   124     mServiceViewDeprecatedNewService = new VideoServiceView(this, engine, QLatin1String("videoplayer.IFileView")); //New service, old interface
       
   125     mServiceViewDeprecatedOldService = new VideoServiceView(this, engine, QLatin1String("com.nokia.Videos.IFileView")); //Old service, old interface     
       
   126     
       
   127     mServiceUriFetchDeprecatedNewService = new VideoServiceUriFetch(this, QLatin1String("videoplayer.IVideoFetch")); //New service, old interface
       
   128     mServiceUriFetchDeprecatedOldService = new VideoServiceUriFetch(this, QLatin1String("com.nokia.Videos.IVideoFetch")); //Old service, old interface    
       
   129 
       
   130     mServiceBrowseDeprecatedNewService   = new VideoServiceBrowse(this, QLatin1String("videoplayer.IVideoBrowse")); //New service, old interface
       
   131     mServiceBrowseDeprecatedOldService   = new VideoServiceBrowse(this, QLatin1String("com.nokia.Videos.IVideoBrowse")); //Old service, old interface
   118 }
   132 }
   119 
   133 
   120 // ----------------------------------------------------------------------------
   134 // ----------------------------------------------------------------------------
   121 // ~VideoServices()
   135 // ~VideoServices()
   122 // ----------------------------------------------------------------------------
   136 // ----------------------------------------------------------------------------
   127     
   141     
   128     delete mServiceUriFetch;
   142     delete mServiceUriFetch;
   129     delete mServicePlay;
   143     delete mServicePlay;
   130     delete mServiceView;
   144     delete mServiceView;
   131     delete mServiceBrowse;
   145     delete mServiceBrowse;
       
   146     delete mServicePlayDeprecatedNewService;
       
   147     delete mServicePlayDeprecatedOldService;
       
   148     delete mServiceViewDeprecatedNewService;
       
   149     delete mServiceViewDeprecatedOldService;
       
   150     delete mServiceBrowseDeprecatedNewService;
       
   151     delete mServiceUriFetchDeprecatedNewService;
       
   152     delete mServiceBrowseDeprecatedOldService;
       
   153     delete mServiceUriFetchDeprecatedOldService;
   132 }
   154 }
   133 
   155 
   134 // ----------------------------------------------------------------------------
   156 // ----------------------------------------------------------------------------
   135 // currentService()
   157 // currentService()
   136 // ----------------------------------------------------------------------------
   158 // ----------------------------------------------------------------------------
   149 int VideoServices::getBrowseCategory() const
   171 int VideoServices::getBrowseCategory() const
   150 {
   172 {
   151     MPX_DEBUG(_L("VideoServices::getBrowseCategory()"));
   173     MPX_DEBUG(_L("VideoServices::getBrowseCategory()"));
   152 	
   174 	
   153     int category = 0;
   175     int category = 0;
   154     
   176 
   155     if ( mServiceBrowse )
   177     if ( mServiceBrowse && (XQServiceUtil::interfaceName().contains("symbian")))
   156     {
   178     {
   157         category = mServiceBrowse->getBrowseCategory();
   179         category = mServiceBrowse->getBrowseCategory();
   158     }
   180     }
   159     
   181     else if ( mServiceBrowseDeprecatedNewService && mServiceBrowseDeprecatedOldService && !(XQServiceUtil::interfaceName().contains("symbian")))
       
   182     {
       
   183     	if (mServiceBrowseDeprecatedNewService->isActive())
       
   184     	{
       
   185     		category = mServiceBrowseDeprecatedNewService->getBrowseCategory();
       
   186     	}
       
   187     	else
       
   188     	{
       
   189     		category = mServiceBrowseDeprecatedOldService->getBrowseCategory();
       
   190     	}
       
   191     }
       
   192 
   160     return category;
   193     return category;
   161 }
   194 }
   162 
   195 
   163 // ----------------------------------------------------------------------------
   196 // ----------------------------------------------------------------------------
   164 // setCurrentService()
   197 // setCurrentService()
   178 QString VideoServices::contextTitle() const
   211 QString VideoServices::contextTitle() const
   179 {
   212 {
   180     MPX_DEBUG(_L("VideoServices::contextTitle()") );
   213     MPX_DEBUG(_L("VideoServices::contextTitle()") );
   181 	
   214 	
   182     QString title;
   215     QString title;
   183     
   216 
   184     if (mCurrentService == VideoServices::EUriFetcher && mServiceUriFetch)
   217     if (mCurrentService == VideoServices::EUriFetcher)
   185     {
   218     {
   186         title = mServiceUriFetch->contextTitle();
   219     	if(mServiceUriFetch && (XQServiceUtil::interfaceName().contains("symbian")))
   187     }
   220     	{
   188     else if (mCurrentService == VideoServices::EBrowse && mServiceBrowse)
   221     		title = mServiceUriFetch->contextTitle();
   189     {
   222     	}
   190         title = mServiceBrowse->contextTitle();
   223     	else if (mServiceUriFetchDeprecatedNewService && mServiceUriFetchDeprecatedOldService && !(XQServiceUtil::interfaceName().contains("symbian")))
       
   224     	{
       
   225     		if(mServiceUriFetchDeprecatedNewService->isActive())
       
   226     		{
       
   227     			title = mServiceUriFetchDeprecatedNewService->contextTitle();
       
   228     		}
       
   229     		else
       
   230     		{
       
   231     			title = mServiceUriFetchDeprecatedOldService->contextTitle();
       
   232     		}
       
   233     	}
       
   234     }
       
   235     else if (mCurrentService == VideoServices::EBrowse)
       
   236     {
       
   237     	if ( mServiceBrowse && (XQServiceUtil::interfaceName().contains("symbian")))
       
   238 		{
       
   239 			title = mServiceBrowse->contextTitle();
       
   240 		}
       
   241     	else if ( mServiceBrowseDeprecatedNewService && mServiceBrowseDeprecatedOldService && !(XQServiceUtil::interfaceName().contains("symbian")))
       
   242 		{
       
   243         	if (mServiceBrowseDeprecatedNewService->isActive())
       
   244         	{
       
   245     			title = mServiceBrowseDeprecatedNewService->contextTitle();
       
   246         	}
       
   247         	else
       
   248         	{
       
   249     			title = mServiceBrowseDeprecatedOldService->contextTitle();
       
   250         	}
       
   251 		}
   191     }
   252     }
   192     
   253     
   193     return title;
   254     return title;
   194 }
   255 }
   195 
   256 
   200 int VideoServices::sortRole() const
   261 int VideoServices::sortRole() const
   201 {
   262 {
   202     MPX_ENTER_EXIT(_L("VideoServices::sortType()"));
   263     MPX_ENTER_EXIT(_L("VideoServices::sortType()"));
   203     
   264     
   204     int sortRole = 0;
   265     int sortRole = 0;
   205     
   266 
   206     if (mCurrentService == EBrowse && mServiceBrowse)
   267     if (mCurrentService == EBrowse)
   207     {
   268     {
   208         sortRole = mServiceBrowse->sortRole();
   269     	if ( mServiceBrowse && (XQServiceUtil::interfaceName().contains("symbian")))
       
   270 		{
       
   271 			sortRole = mServiceBrowse->sortRole();
       
   272 		}
       
   273     	else if ( mServiceBrowseDeprecatedNewService && mServiceBrowseDeprecatedOldService && !(XQServiceUtil::interfaceName().contains("symbian")))
       
   274 		{
       
   275         	if (mServiceBrowseDeprecatedNewService->isActive())
       
   276         	{
       
   277         		sortRole = mServiceBrowseDeprecatedNewService->sortRole();
       
   278         	}
       
   279         	else
       
   280         	{
       
   281         		sortRole = mServiceBrowseDeprecatedOldService->sortRole();
       
   282         	}
       
   283 		}
   209     }
   284     }
   210     
   285     
   211     return sortRole;
   286     return sortRole;
   212 }
   287 }
   213 
   288 
   220     MPX_ENTER_EXIT(_L("VideoServices::itemSelected()"),
   295     MPX_ENTER_EXIT(_L("VideoServices::itemSelected()"),
   221                    _L("item = %s"), item.data() );
   296                    _L("item = %s"), item.data() );
   222     
   297     
   223     QStringList list;
   298     QStringList list;
   224     list.append( item );
   299     list.append( item );
   225     mServiceUriFetch->complete( list );
   300 
       
   301     if(mServiceUriFetch && (XQServiceUtil::interfaceName().contains("symbian")))
       
   302     {
       
   303     	mServiceUriFetch->complete( list );
       
   304     }
       
   305     else if (mServiceUriFetchDeprecatedNewService && mServiceUriFetchDeprecatedOldService)
       
   306     {
       
   307     	if (mServiceUriFetchDeprecatedNewService->isActive())
       
   308     	{
       
   309         	mServiceUriFetchDeprecatedNewService->complete( list );
       
   310     	}
       
   311     	else
       
   312     	{
       
   313         	mServiceUriFetchDeprecatedOldService->complete( list );
       
   314     	}
       
   315     }
   226     mFetchSelected = true;
   316     mFetchSelected = true;
   227 }
   317 }
   228 
   318 
   229 // ----------------------------------------------------------------------------
   319 // ----------------------------------------------------------------------------
   230 // browsingEnded()
   320 // browsingEnded()
   231 // ----------------------------------------------------------------------------
   321 // ----------------------------------------------------------------------------
   232 //
   322 //
   233 void VideoServices::browsingEnded()
   323 void VideoServices::browsingEnded()
   234 {
   324 {
   235     MPX_ENTER_EXIT(_L("VideoServices::browsingEnded()"));
   325     MPX_ENTER_EXIT(_L("VideoServices::browsingEnded()"));
   236 	
   326 
   237     if ( mServiceBrowse )
   327 	if ( mServiceBrowse && (XQServiceUtil::interfaceName().contains("symbian")))
   238     {
   328 	{
   239         mServiceBrowse->complete();
   329 		mServiceBrowse->complete();
   240     }
   330 	}
       
   331 	else if ( mServiceBrowseDeprecatedNewService && mServiceBrowseDeprecatedOldService && !(XQServiceUtil::interfaceName().contains("symbian")))
       
   332 	{
       
   333     	if (mServiceBrowseDeprecatedNewService->isActive())
       
   334     	{
       
   335     		mServiceBrowseDeprecatedNewService->complete();
       
   336     	}
       
   337     	else
       
   338     	{
       
   339     		mServiceBrowseDeprecatedOldService->complete();
       
   340     	}
       
   341 	}
   241 }
   342 }
   242 
   343 
   243 // End of file
   344 // End of file