radioapp/radiowidgetsplugin/main.cpp
changeset 23 a2b50a479edf
parent 19 afea38384506
child 24 6df133bd92e1
equal deleted inserted replaced
19:afea38384506 23:a2b50a479edf
     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 
       
    18 // System includes
       
    19 #include <QtPlugin>
       
    20 #include <hbdocumentloaderplugin>
       
    21 
       
    22 // User includes
       
    23 #include "radiostationsview.h"
       
    24 #include "radiomainview.h"
       
    25 #include "radiohistoryview.h"
       
    26 #include "radiostationcarousel.h"
       
    27 #include "radiofrequencystrip.h"
       
    28 #include "radiobannerlabel.h"
       
    29 #include "radiofadinglabel.h"
       
    30 
       
    31 // Class declaration
       
    32 class RadioWidgetsPlugin : public HbDocumentLoaderPlugin
       
    33 {
       
    34 public:
       
    35 
       
    36     QObject* createObject(const QString& type, const QString& name);
       
    37     QList<const QMetaObject*> supportedObjects();
       
    38 
       
    39 };
       
    40 
       
    41 Q_EXPORT_PLUGIN(RadioWidgetsPlugin)
       
    42 
       
    43 /*!
       
    44  *
       
    45  */
       
    46 QObject* RadioWidgetsPlugin::createObject( const QString& type, const QString& name )
       
    47 {
       
    48     QObject* object = 0;
       
    49 
       
    50     if ( type == RadioMainView::staticMetaObject.className() ) {
       
    51         object = new RadioMainView();
       
    52     } else if ( type == RadioStationsView::staticMetaObject.className() ) {
       
    53         object = new RadioStationsView();
       
    54     } else if ( type == RadioHistoryView::staticMetaObject.className() ) {
       
    55         object = new RadioHistoryView();
       
    56     } else if ( type == RadioStationCarousel::staticMetaObject.className() ) {
       
    57         object = new RadioStationCarousel();
       
    58     } else if ( type == RadioFrequencyStrip::staticMetaObject.className() ) {
       
    59         object = new RadioFrequencyStrip();
       
    60     } else if ( type == RadioBannerLabel::staticMetaObject.className() ) {
       
    61         object = new RadioBannerLabel();
       
    62     } else if ( type == RadioFadingLabel::staticMetaObject.className() ) {
       
    63         object = new RadioFadingLabel();
       
    64     }
       
    65 
       
    66     if ( object ) {
       
    67         object->setObjectName( name );
       
    68     }
       
    69 
       
    70     return object;
       
    71 }
       
    72 
       
    73 /*!
       
    74  *
       
    75  */
       
    76 QList<const QMetaObject *> RadioWidgetsPlugin::supportedObjects()
       
    77 {
       
    78     QList<const QMetaObject *> result;
       
    79     result.append( &RadioMainView::staticMetaObject );
       
    80     result.append( &RadioStationsView::staticMetaObject );
       
    81     result.append( &RadioHistoryView::staticMetaObject );
       
    82     result.append( &RadioBannerLabel::staticMetaObject );
       
    83     result.append( &RadioFadingLabel::staticMetaObject );
       
    84     result.append( &RadioFrequencyStrip::staticMetaObject );
       
    85     result.append( &RadioStationCarousel::staticMetaObject );
       
    86     return result;
       
    87 }