|
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 #ifndef HSWIDGETHOST_H |
|
19 #define HSWIDGETHOST_H |
|
20 |
|
21 #include <QVariantMap> |
|
22 #include <QMetaMethod> |
|
23 #include <QMetaProperty> |
|
24 |
|
25 #include <HbWidget> |
|
26 |
|
27 #include "hswidgetdata.h" |
|
28 #include "hsdomainmodel_global.h" |
|
29 #include "hstest_global.h" |
|
30 |
|
31 #include "cadefs.h" |
|
32 |
|
33 class HsPage; |
|
34 class CaEntry; |
|
35 |
|
36 HOMESCREEN_TEST_CLASS(TestRuntimeServices) |
|
37 |
|
38 class HSDOMAINMODEL_EXPORT HsWidgetHost : public HbWidget |
|
39 { |
|
40 Q_OBJECT |
|
41 |
|
42 public: |
|
43 static HsWidgetHost *createInstance(const HsWidgetData &widgetData, |
|
44 const QVariantMap &preferences = QVariantMap()); |
|
45 |
|
46 HsWidgetHost(int databaseId, QGraphicsItem *parent = 0); |
|
47 |
|
48 ~HsWidgetHost(); |
|
49 |
|
50 bool load(); |
|
51 |
|
52 bool setPage(HsPage *page); |
|
53 HsPage *page() const; |
|
54 |
|
55 bool isValid() const; |
|
56 |
|
57 int databaseId() const; |
|
58 |
|
59 bool deleteFromDatabase(); |
|
60 |
|
61 bool setWidgetPresentation(); |
|
62 bool setWidgetPresentationData(HsWidgetPresentationData &presentationData); |
|
63 bool widgetPresentationData(const QString &key, HsWidgetPresentationData &presentationData); |
|
64 |
|
65 HsWidgetPresentationData widgetPresentation(Qt::Orientation orientation); |
|
66 bool loadWidgetPresentation(); |
|
67 bool deleteWidgetPresentation(Qt::Orientation orientation); |
|
68 |
|
69 signals: |
|
70 void widgetFinished(HsWidgetHost *widget); |
|
71 void widgetError(HsWidgetHost *widget); |
|
72 |
|
73 public slots: |
|
74 void initializeWidget(); |
|
75 void showWidget(); |
|
76 void hideWidget(); |
|
77 void uninitializeWidget(); |
|
78 void setOnline(bool online = true); |
|
79 |
|
80 void startDragAnimation(); |
|
81 void startDropAnimation(); |
|
82 |
|
83 private: |
|
84 bool setProperty(const char *name, QMetaProperty &property); |
|
85 bool setMethod(const char *signature, QMetaMethod &method); |
|
86 bool hasSignal(const char *signature); |
|
87 bool setPreferencesToWidget(); |
|
88 |
|
89 private slots: |
|
90 void onSetPreferences(const QStringList &names); |
|
91 void onFinished(); |
|
92 void onError(); |
|
93 |
|
94 void onEntryChanged(const CaEntry &entry, ChangeType changeType); |
|
95 |
|
96 private: |
|
97 Q_DISABLE_COPY(HsWidgetHost) |
|
98 QGraphicsWidget *mWidget; |
|
99 HsPage *mPage; |
|
100 QMetaMethod mOnInitializeMethod; |
|
101 QMetaMethod mOnShowMethod; |
|
102 QMetaMethod mOnHideMethod; |
|
103 QMetaMethod mOnUninitializeMethod; |
|
104 QMetaProperty mIsOnlineProperty; |
|
105 |
|
106 int mDatabaseId; |
|
107 QString mUri; |
|
108 |
|
109 HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) |
|
110 }; |
|
111 |
|
112 #endif // HSWIDGETHOST_H |