16 */ |
16 */ |
17 |
17 |
18 #ifndef HSWIDGETHOST_H |
18 #ifndef HSWIDGETHOST_H |
19 #define HSWIDGETHOST_H |
19 #define HSWIDGETHOST_H |
20 |
20 |
21 #include <HbWidget> |
21 #include <QObject> |
22 #include <QMetaMethod> |
22 #include <QMetaMethod> |
23 #include <QMetaProperty> |
23 #include <QMetaProperty> |
24 |
24 |
25 #include "hsdomainmodel_global.h" |
25 #include "hsdomainmodel_global.h" |
26 #include "hsdomainmodeldatastructures.h" |
26 #include "hsdomainmodeldatastructures.h" |
31 class QStateMachine; |
31 class QStateMachine; |
32 |
32 |
33 class HsWidgetTouchArea; |
33 class HsWidgetTouchArea; |
34 class HsWidgetComponent; |
34 class HsWidgetComponent; |
35 class HsPage; |
35 class HsPage; |
|
36 class HsWidgetHostVisual; |
36 |
37 |
37 class HSDOMAINMODEL_EXPORT HsWidgetHost : public HbWidget |
38 class HSDOMAINMODEL_EXPORT HsWidgetHost : public QObject |
38 { |
39 { |
39 Q_OBJECT |
40 Q_OBJECT |
40 |
41 |
41 public: |
42 public: |
42 HsWidgetHost(int databaseId, QGraphicsItem *parent = 0); |
43 HsWidgetHost(int databaseId, QObject *parent = 0); |
43 ~HsWidgetHost(); |
44 ~HsWidgetHost(); |
44 |
45 |
45 static HsWidgetHost *createInstance( |
46 static HsWidgetHost *createInstance( |
46 HsWidgetData &widgetData, |
47 HsWidgetData &widgetData, |
47 const QVariantHash &preferences = QVariantHash()); |
48 const QVariantHash &preferences = QVariantHash()); |
56 bool savePresentation(); |
57 bool savePresentation(); |
57 bool savePresentation(Qt::Orientation orientation); |
58 bool savePresentation(Qt::Orientation orientation); |
58 bool savePresentation(HsWidgetPresentationData &presentation); |
59 bool savePresentation(HsWidgetPresentationData &presentation); |
59 bool getPresentation(HsWidgetPresentationData &presentation); |
60 bool getPresentation(HsWidgetPresentationData &presentation); |
60 bool removePresentation(Qt::Orientation orientation); |
61 bool removePresentation(Qt::Orientation orientation); |
61 QPainterPath shape() const; |
62 |
62 |
63 HsWidgetHostVisual *visual() const; |
63 signals: |
64 signals: |
64 void event_startAndShow(); |
65 void event_startAndShow(); |
65 void event_startAndHide(); |
66 void event_startAndHide(); |
66 void event_unload(); |
67 void event_unload(); |
67 void event_show(); |
68 void event_show(); |
88 |
88 |
89 void startDragEffect(); |
89 void startDragEffect(); |
90 void startDropEffect(); |
90 void startDropEffect(); |
91 |
91 |
92 protected: |
92 protected: |
93 bool eventFilter(QObject *watched, QEvent *event); |
93 /* bool eventFilter(QObject *watched, QEvent *event); |
94 void gestureEvent(QGestureEvent *event); |
94 void gestureEvent(QGestureEvent *event); |
95 void mousePressEvent(QGraphicsSceneMouseEvent *) {} |
95 void mousePressEvent(QGraphicsSceneMouseEvent *) {} |
96 |
96 */ |
97 private: |
97 private: |
98 Q_DISABLE_COPY(HsWidgetHost) |
98 Q_DISABLE_COPY(HsWidgetHost) |
99 void setupTouchArea(); |
99 |
100 void setupEffects(); |
|
101 void setupStates(); |
100 void setupStates(); |
102 |
101 |
103 bool setProperty(const char *name, QMetaProperty &property); |
102 bool setProperty(const char *name, QMetaProperty &property); |
104 bool setMethod(const char *signature, QMetaMethod &method); |
103 bool setMethod(const char *signature, QMetaMethod &method); |
105 bool hasSignal(const char *signature); |
104 bool hasSignal(const char *signature); |
106 |
105 |
107 void setNewSize(const QSizeF &size); |
106 |
108 |
|
109 bool setPreferencesToWidget(); |
107 bool setPreferencesToWidget(); |
110 |
108 |
111 private slots: |
109 private slots: |
112 void action_connectComponent(); |
110 void action_connectComponent(); |
113 void action_disconnectComponent(); |
111 void action_disconnectComponent(); |
125 void onFinished(); |
123 void onFinished(); |
126 void onError(); |
124 void onError(); |
127 void onSetPreferences(const QStringList &names); |
125 void onSetPreferences(const QStringList &names); |
128 |
126 |
129 private: |
127 private: |
130 int mDatabaseId; |
128 int mDatabaseId; |
|
129 HsWidgetHostVisual *mVisual; |
131 QStateMachine *mStateMachine; |
130 QStateMachine *mStateMachine; |
132 QGraphicsWidget *mWidget; |
131 QObject *mWidget; |
133 HsPage *mPage; |
132 HsPage *mPage; |
134 HsWidgetComponent *mComponent; |
133 HsWidgetComponent *mComponent; |
135 HsWidgetTouchArea *mTouchArea; |
134 |
136 QMetaMethod mOnInitializeMethod; |
135 QMetaMethod mOnInitializeMethod; |
137 QMetaMethod mOnShowMethod; |
136 QMetaMethod mOnShowMethod; |
138 QMetaMethod mOnHideMethod; |
137 QMetaMethod mOnHideMethod; |
139 QMetaMethod mOnUninitializeMethod; |
138 QMetaMethod mOnUninitializeMethod; |
140 QMetaProperty mIsOnlineProperty; |
139 QMetaProperty mIsOnlineProperty; |