videoplayerapp/videoplayerengine/src/videoservicebrowse.cpp
changeset 36 8aed59de29f9
child 20 b9e04db066d4
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of VideoServiceUriFetch
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: %
       
    19 
       
    20 #include <hbapplication.h>
       
    21 
       
    22 #include "videoservices.h"
       
    23 #include "videoservicebrowse.h"
       
    24 #include "mpxhbvideocommondefs.h"
       
    25 #include "mpxvideo_debug.h"
       
    26 
       
    27 // -------------------------------------------------------------------------------------------------
       
    28 // VideoServiceBrowse()
       
    29 // -------------------------------------------------------------------------------------------------
       
    30 //
       
    31 VideoServiceBrowse::VideoServiceBrowse( VideoServices* parent )
       
    32     : XQServiceProvider( QLatin1String("com.nokia.Videos.IVideoBrowse"), parent )
       
    33     , mRequestIndex( 0 )
       
    34     , mServiceApp( parent )
       
    35 {
       
    36     MPX_ENTER_EXIT(_L("VideoServiceBrowse::VideoServiceBrowse()"));
       
    37 
       
    38     publishAll();
       
    39 }
       
    40 
       
    41 // -------------------------------------------------------------------------------------------------
       
    42 // ~VideoServiceBrowse()
       
    43 // -------------------------------------------------------------------------------------------------
       
    44 //
       
    45 VideoServiceBrowse::~VideoServiceBrowse()
       
    46 {
       
    47     MPX_DEBUG(_L("VideoServiceBrowse::~VideoServiceBrowse()"));
       
    48 }
       
    49 
       
    50 // -------------------------------------------------------------------------------------------------
       
    51 // complete()
       
    52 // -------------------------------------------------------------------------------------------------
       
    53 //
       
    54 void VideoServiceBrowse::complete()
       
    55 {
       
    56     MPX_ENTER_EXIT(_L("VideoServiceBrowse::complete()"));	
       
    57 
       
    58     if ( mRequestIndex )
       
    59     {
       
    60         QStringList filesList;
       
    61         connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
       
    62         bool ok = completeRequest(mRequestIndex, filesList);
       
    63         mRequestIndex = 0;
       
    64         
       
    65         //
       
    66         // double check that request was completed succesfully, otherwise
       
    67         // videos application cannot be exited at all
       
    68         //
       
    69         if ( ! ok )
       
    70         {
       
    71             MPX_DEBUG(_L("VideoServiceBrowse::complete() : completeRequest FAILED !"));
       
    72             qApp->quit();
       
    73         }
       
    74     }
       
    75 }
       
    76 
       
    77 // -------------------------------------------------------------------------------------------------
       
    78 // getBrowseCategory()
       
    79 // -------------------------------------------------------------------------------------------------
       
    80 //
       
    81 int VideoServiceBrowse::getBrowseCategory() const
       
    82 {
       
    83     MPX_DEBUG(_L("VideoServiceBrowse::getBrowseCategory() ret %d"), mCategory);
       
    84     return mCategory;
       
    85 }
       
    86 
       
    87 // -------------------------------------------------------------------------------------------------
       
    88 // contextTitle()
       
    89 // -------------------------------------------------------------------------------------------------
       
    90 //
       
    91 QString VideoServiceBrowse::contextTitle() const
       
    92 {
       
    93     MPX_DEBUG(_L("VideoServiceBrowse::contextTitle() ret %s"), mTitle.data() );
       
    94     return mTitle;
       
    95 }
       
    96 
       
    97 // -------------------------------------------------------------------------------------------------
       
    98 // browseVideos()
       
    99 // -------------------------------------------------------------------------------------------------
       
   100 //
       
   101 void VideoServiceBrowse::browseVideos(const QString &title, int category)
       
   102 {    
       
   103     MPX_ENTER_EXIT(_L("VideoServiceBrowse::browseVideos()"));	
       
   104 
       
   105     // set application title
       
   106     QString appTitle(title);
       
   107     if (appTitle.isEmpty())
       
   108     {
       
   109         appTitle = hbTrId("txt_videos_title_videos");
       
   110     }
       
   111     
       
   112     mTitle = appTitle;
       
   113     mCategory = category;
       
   114 
       
   115     // start service
       
   116     mServiceApp->setCurrentService(VideoServices::EBrowse);
       
   117     emit mServiceApp->titleReady(appTitle);
       
   118     emit mServiceApp->activated(MpxHbVideoCommon::ActivateCollectionView);
       
   119 
       
   120     // store async request id
       
   121     mRequestIndex = setCurrentRequestAsync();
       
   122     MPX_DEBUG(_L("VideoServiceBrowse::browseVideos() : mRequestIndex = %d"), mRequestIndex );
       
   123 }
       
   124 
       
   125 // End of file