mpviewplugins/mpcollectionviewplugin/src/mpcollectiondocumentloader.cpp
changeset 19 4e84c994a771
child 20 82baf59ce8dd
equal deleted inserted replaced
5:2a40e88564c8 19:4e84c994a771
       
     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: Music Player collection view custom document loader.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "mpcollectiondocumentloader.h"
       
    20 #include "mpnowplayingwidget.h"
       
    21 #include "mpcollectioninfobar.h"
       
    22 #include "mpcommondefs.h"
       
    23 #include "mptrace.h"
       
    24 
       
    25 
       
    26 /*!
       
    27     \class MpCollectionDocumentLoader
       
    28     \brief Music Player collection view custom document loader.
       
    29 
       
    30     Collection document loader extends Orbit document loader to enable
       
    31     loading of custom widgets provided by the collection view.
       
    32 */
       
    33 
       
    34 /*!
       
    35  Creates and returns the object of the given \a type.
       
    36 
       
    37  \reimp
       
    38  */
       
    39 QObject *MpCollectionDocumentLoader::createObject(const QString& type, const QString &name)
       
    40 {
       
    41     TX_ENTRY_ARGS("type=" << type << ", name=" << name);
       
    42 
       
    43     if (type == MpNowPlayingWidget::staticMetaObject.className()) {
       
    44         QObject *object = new MpNowPlayingWidget(MpCommon::KMusicPlayerUid);
       
    45         object->setObjectName(name);
       
    46         TX_EXIT
       
    47         return object;
       
    48     }
       
    49     else if (type == MpCollectionInfoBar::staticMetaObject.className()) {
       
    50         QObject *object = new MpCollectionInfoBar();
       
    51         object->setObjectName(name);
       
    52         TX_EXIT
       
    53         return object;
       
    54     }
       
    55 
       
    56     TX_EXIT
       
    57     return HbDocumentLoader::createObject(type, name);
       
    58 }
       
    59