12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 #include <HbTextItem> |
18 #include "irdocumentloader.h" |
18 #include <HbMarqueeItem> |
19 #include "irbannerlabel.h" |
19 #include "irdocumentloader.h" |
20 #include "ircombobox.h" |
|
21 #include "irlineeditor.h" |
|
22 |
|
23 IRDocumentLoader::IRDocumentLoader(QObject *aParent) : iParent(aParent) |
|
24 { |
|
25 |
|
26 } |
|
27 |
|
28 QObjectList IRDocumentLoader::load(const QString &aFileName, const QString &aSection, QObject *aParent) |
|
29 { |
|
30 bool ok = false; |
|
31 QObjectList list = HbDocumentLoader::load(aFileName, aSection, &ok); |
|
32 Q_ASSERT_X(ok, "void IRDocumentLoader::load(const QString &aFileName, const QString &aSection)", "load failed"); |
|
33 |
|
34 int size = list.count(); |
|
35 QObject *parent = aParent ? aParent : iParent; |
|
36 for (int i = 0; i < size; i++) |
|
37 { |
|
38 QObject *obj = list[i]; |
|
39 if (obj != parent) |
|
40 { |
|
41 obj->setParent(parent); |
|
42 } |
|
43 } |
|
44 |
|
45 return list; |
|
46 } |
|
47 |
|
48 QObjectList IRDocumentLoader::load(const QString &aFileName, QObject *aParent) |
|
49 { |
|
50 bool ok = false; |
|
51 QObjectList list = HbDocumentLoader::load(aFileName, &ok); |
|
52 Q_ASSERT_X(ok, "void IRDocumentLoader::load(const QString &aFileName)", "load failed"); |
|
53 |
|
54 int size = list.count(); |
|
55 QObject *parent = aParent ? aParent : iParent; |
|
56 for (int i = 0; i < size; i++) |
|
57 { |
|
58 QObject *obj = list[i]; |
|
59 if (obj != parent) |
|
60 { |
|
61 obj->setParent(parent); |
|
62 } |
|
63 } |
|
64 |
|
65 return list; |
|
66 } |
|
67 |
20 |
68 QObject *IRDocumentLoader::createObject(const QString& aType, const QString &aName) |
21 QObject *IRDocumentLoader::createObject(const QString& aType, const QString &aName) |
69 { |
22 { |
70 if (aType == IrViewBannerLabel::staticMetaObject.className()) |
23 if (aType == HbTextItem::staticMetaObject.className()) |
71 { |
|
72 QObject *object = new IrViewBannerLabel(); |
|
73 object->setObjectName(aName); |
|
74 return object; |
|
75 } |
|
76 else if(aType == IrNowPlayingBannerLabel::staticMetaObject.className()) |
|
77 { |
|
78 QObject *object = new IrNowPlayingBannerLabel(); |
|
79 object->setObjectName(aName); |
|
80 return object; |
|
81 } |
|
82 else if(aType == IrComboBox::staticMetaObject.className()) |
|
83 { |
|
84 QObject *object = new IrComboBox(); |
|
85 object->setObjectName(aName); |
|
86 return object; |
|
87 } |
|
88 else if(aType == IrLineEditor::staticMetaObject.className()) |
|
89 { |
|
90 QObject *object = new IrLineEditor(); |
|
91 object->setObjectName(aName); |
|
92 return object; |
|
93 } |
|
94 else if (aType == HbTextItem::staticMetaObject.className()) |
|
95 { |
24 { |
96 QObject *object = new HbTextItem; |
25 QObject *object = new HbTextItem; |
97 object->setObjectName(aName); |
26 object->setObjectName(aName); |
98 return object; |
27 return object; |
99 } |
28 } |