qtinternetradio/ui/src/irfileviewservice.cpp
changeset 11 f683e24efca3
child 17 38bbf2dcd608
equal deleted inserted replaced
8:3b03c28289e6 11:f683e24efca3
       
     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:
       
    15 *
       
    16 */
       
    17 #include <xqserviceutil.h>
       
    18 
       
    19 #include "irfileviewservice.h"
       
    20 #include "irplaylist.h"
       
    21 #include "irapplication.h"
       
    22 #include "irqsettings.h"
       
    23 
       
    24 #define INTERNETRADIO_SERVICE_NAME "internet_radio_10_1.com.nokia.symbian.IFileView"
       
    25 
       
    26 IRFileViewService::IRFileViewService(IRApplication *aApplication) : XQServiceProvider(INTERNETRADIO_SERVICE_NAME),
       
    27 iApplication(aApplication), iPlayList(NULL)
       
    28 {
       
    29     if (XQServiceUtil::isService())
       
    30     {
       
    31         //Publishes all public slots on this object
       
    32         publishAll();
       
    33     }
       
    34 }
       
    35 
       
    36 IRFileViewService::~IRFileViewService()
       
    37 {
       
    38     delete iPlayList;
       
    39 }
       
    40 
       
    41 IRPlayList* IRFileViewService::getPlayList() const
       
    42 {
       
    43     return iPlayList;
       
    44 }
       
    45 
       
    46 void IRFileViewService::view(const QString &aFileName)
       
    47 {
       
    48     if (NULL == iPlayList)
       
    49     {
       
    50         iPlayList = new IRPlayList;
       
    51     }
       
    52     
       
    53     iPlayList->parseFile(aFileName);
       
    54     
       
    55     if (1 == iPlayList->getNumberOfEntries())
       
    56     {
       
    57         iApplication->launchStartingView(EIRView_PlayingView);
       
    58     }
       
    59     else if (iPlayList->getNumberOfEntries() > 1)
       
    60     {
       
    61         iApplication->launchStartingView(EIRView_PlsView);
       
    62     }
       
    63     else
       
    64     {
       
    65         //normal launch, launch starting view
       
    66         TIRViewId viewId = EIRView_CategoryView;
       
    67         iApplication->getSettings()->getStartingViewId(viewId);        
       
    68         iApplication->launchStartingView(viewId);
       
    69     }
       
    70 }
       
    71 
       
    72 void IRFileViewService::view(const XQSharableFile &/*aSharableFile*/)
       
    73 {
       
    74 
       
    75 }