videocollection/tsrc/stubs/inc/hbdocumentloader.h
author hgs
Thu, 01 Apr 2010 23:32:44 +0300
changeset 35 3738fe97f027
child 17 69946d1824c4
permissions -rw-r--r--
201011

/*
* 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:  hbdocumentloader stub
*
*/

#ifndef HBDOCUMENTLOADER_H
#define HBDOCUMENTLOADER_H

#include "hbwidget.h"
#include <qlist.h>
#include <qpointer.h>

class HbMainWindow;
class VideoCollectionUiLoader;

class ObjectData : public QObject
{
    Q_OBJECT
public:
    ObjectData(QObject *obj, QString name)
    {
        mObject = obj;
        mName = name;
    }
    ~ObjectData()
    {
        delete mObject;
    }
public:
    QPointer<QObject> mObject;
    QString mName;
};

class HbDocumentLoader
{

public:
    HbDocumentLoader();
    HbDocumentLoader(const HbMainWindow *window);
    virtual ~HbDocumentLoader();

    QObjectList load( const QString &fileName, const QString &section , bool *ok = 0 );
    QObjectList load( const QString &fileName, bool *ok = 0 );
        
    QGraphicsWidget *findWidget(const QString &name);
    QObject *findObject(const QString &name);

    void reset();
    
protected:
    virtual QObject *createObject(const QString& type, const QString &name);
    
private:
    
    QObject *doCreateObject(const QString &name);
    
    QList<ObjectData *> mObjects;
    
    bool mCreatingObject;
    
public:
    static bool mFindWidgetFails;
    static bool mFindObjectFails;
    static bool mCreateObjectFails;
};

#endif // HBDOCUMENTLOADER_H