videocollection/tsrc/stubs/inc/hbdocumentloader.h
changeset 35 3738fe97f027
child 17 69946d1824c4
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
       
     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:  hbdocumentloader stub
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef HBDOCUMENTLOADER_H
       
    19 #define HBDOCUMENTLOADER_H
       
    20 
       
    21 #include "hbwidget.h"
       
    22 #include <qlist.h>
       
    23 #include <qpointer.h>
       
    24 
       
    25 class HbMainWindow;
       
    26 class VideoCollectionUiLoader;
       
    27 
       
    28 class ObjectData : public QObject
       
    29 {
       
    30     Q_OBJECT
       
    31 public:
       
    32     ObjectData(QObject *obj, QString name)
       
    33     {
       
    34         mObject = obj;
       
    35         mName = name;
       
    36     }
       
    37     ~ObjectData()
       
    38     {
       
    39         delete mObject;
       
    40     }
       
    41 public:
       
    42     QPointer<QObject> mObject;
       
    43     QString mName;
       
    44 };
       
    45 
       
    46 class HbDocumentLoader
       
    47 {
       
    48 
       
    49 public:
       
    50     HbDocumentLoader();
       
    51     HbDocumentLoader(const HbMainWindow *window);
       
    52     virtual ~HbDocumentLoader();
       
    53 
       
    54     QObjectList load( const QString &fileName, const QString &section , bool *ok = 0 );
       
    55     QObjectList load( const QString &fileName, bool *ok = 0 );
       
    56         
       
    57     QGraphicsWidget *findWidget(const QString &name);
       
    58     QObject *findObject(const QString &name);
       
    59 
       
    60     void reset();
       
    61     
       
    62 protected:
       
    63     virtual QObject *createObject(const QString& type, const QString &name);
       
    64     
       
    65 private:
       
    66     
       
    67     QObject *doCreateObject(const QString &name);
       
    68     
       
    69     QList<ObjectData *> mObjects;
       
    70     
       
    71     bool mCreatingObject;
       
    72     
       
    73 public:
       
    74     static bool mFindWidgetFails;
       
    75     static bool mFindObjectFails;
       
    76     static bool mCreateObjectFails;
       
    77 };
       
    78 
       
    79 #endif // HBDOCUMENTLOADER_H