radioapp/radiowidgetsplugin/main.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 15:52:32 +0300
changeset 19 afea38384506
parent 16 f54ebcfc1b80
child 37 451b2e1545b2
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/

// System includes
#include <QtPlugin>
#include <hbdocumentloaderplugin>

// User includes
#include "radiostationsview.h"
#include "radiomainview.h"
#include "radiohistoryview.h"
#include "radiostationcarousel.h"
#include "radiofrequencystrip.h"
#include "radiobannerlabel.h"
#include "radiofadinglabel.h"

// Class declaration
class RadioWidgetsPlugin : public HbDocumentLoaderPlugin
{
public:

    QObject* createObject(const QString& type, const QString& name);
    QList<const QMetaObject*> supportedObjects();

};

Q_EXPORT_PLUGIN(RadioWidgetsPlugin)

/*!
 *
 */
QObject* RadioWidgetsPlugin::createObject( const QString& type, const QString& name )
{
    QObject* object = 0;

    if ( type == RadioMainView::staticMetaObject.className() ) {
        object = new RadioMainView();
    } else if ( type == RadioStationsView::staticMetaObject.className() ) {
        object = new RadioStationsView();
    } else if ( type == RadioHistoryView::staticMetaObject.className() ) {
        object = new RadioHistoryView();
    } else if ( type == RadioStationCarousel::staticMetaObject.className() ) {
        object = new RadioStationCarousel();
    } else if ( type == RadioFrequencyStrip::staticMetaObject.className() ) {
        object = new RadioFrequencyStrip();
    } else if ( type == RadioBannerLabel::staticMetaObject.className() ) {
        object = new RadioBannerLabel();
    } else if ( type == RadioFadingLabel::staticMetaObject.className() ) {
        object = new RadioFadingLabel();
    }

    if ( object ) {
        object->setObjectName( name );
    }

    return object;
}

/*!
 *
 */
QList<const QMetaObject *> RadioWidgetsPlugin::supportedObjects()
{
    QList<const QMetaObject *> result;
    result.append( &RadioMainView::staticMetaObject );
    result.append( &RadioStationsView::staticMetaObject );
    result.append( &RadioHistoryView::staticMetaObject );
    result.append( &RadioBannerLabel::staticMetaObject );
    result.append( &RadioFadingLabel::staticMetaObject );
    result.append( &RadioFrequencyStrip::staticMetaObject );
    result.append( &RadioStationCarousel::staticMetaObject );
    return result;
}