19 #define HSSCENE_H |
19 #define HSSCENE_H |
20 |
20 |
21 #include <QObject> |
21 #include <QObject> |
22 #include <QScopedPointer> |
22 #include <QScopedPointer> |
23 #include <QSizeF> |
23 #include <QSizeF> |
|
24 #include <QPointF> |
24 |
25 |
25 #include "hsdomainmodel_global.h" |
26 #include "hsdomainmodel_global.h" |
26 #include "hstest_global.h" |
27 #include "hstest_global.h" |
27 |
28 |
28 HOMESCREEN_TEST_CLASS(TestRuntimeServices) |
29 HOMESCREEN_TEST_CLASS(TestHsDomainModel) |
29 HOMESCREEN_TEST_CLASS(HomeScreenStatePluginTest) |
30 HOMESCREEN_TEST_CLASS(HomeScreenStatePluginTest) |
30 |
31 |
|
32 class QGestureEvent; |
|
33 |
31 class HbMainWindow; |
34 class HbMainWindow; |
|
35 |
32 class HsWallpaper; |
36 class HsWallpaper; |
33 class HsPage; |
37 class HsPage; |
34 class HsWidgetHost; |
38 class HsWidgetHost; |
35 class HsSceneData; |
39 class HsSceneData; |
36 |
40 |
37 class HSDOMAINMODEL_EXPORT HsScene : public QObject |
41 class HSDOMAINMODEL_EXPORT HsScene : public QObject |
38 { |
42 { |
39 Q_OBJECT |
43 Q_OBJECT |
40 |
44 |
41 public: |
45 public: |
|
46 HsScene(QObject *parent = 0); |
42 ~HsScene(); |
47 ~HsScene(); |
43 |
48 |
44 int databaseId() const; |
49 int databaseId() const; |
45 |
50 |
46 bool load(); |
51 bool load(); |
54 |
59 |
55 bool setActivePage(HsPage *page); |
60 bool setActivePage(HsPage *page); |
56 bool setActivePageIndex(int index); |
61 bool setActivePageIndex(int index); |
57 HsPage *activePage() const; |
62 HsPage *activePage() const; |
58 int activePageIndex() const; |
63 int activePageIndex() const; |
59 int maximumPageCount() const; |
64 |
60 QSizeF maximumWidgetSizeInPixels() const; |
|
61 QSizeF minimumWidgetSizeInPixels() const; |
|
62 QSizeF maximumWidgetSizeInUnits() const; |
|
63 QSizeF minimumWidgetSizeInUnits() const; |
|
64 void setActiveWidget(HsWidgetHost *widget); |
65 void setActiveWidget(HsWidgetHost *widget); |
65 HsWidgetHost *activeWidget() const; |
66 HsWidgetHost *activeWidget() const; |
66 |
67 |
67 void setOnline(bool online = true); |
68 void setOnline(bool online = true); |
68 bool isOnline() const; |
69 bool isOnline() const; |
69 |
70 |
70 static HsScene *instance(); |
71 static HsScene *instance(); |
|
72 static HsScene *takeInstance(); |
|
73 static void setInstance(HsScene *instance); |
71 static HbMainWindow *mainWindow(); |
74 static HbMainWindow *mainWindow(); |
72 static Qt::Orientation orientation(); |
75 static Qt::Orientation orientation(); |
|
76 |
|
77 signals: |
|
78 void pageTapAndHoldFinished(QGestureEvent *event); |
|
79 void pagePanStarted(QGestureEvent *event); |
|
80 void pagePanUpdated(QGestureEvent *event); |
|
81 void pagePanFinished(QGestureEvent *event); |
|
82 void widgetTapStarted(HsWidgetHost *widget); |
|
83 void widgetTapAndHoldFinished(QGestureEvent *event, HsWidgetHost *widget); |
|
84 void widgetMoveUpdated(const QPointF &scenePos, HsWidgetHost *widget); |
|
85 void widgetMoveFinished(const QPointF &scenePos, HsWidgetHost *widget); |
|
86 void activePageChanged(); |
73 |
87 |
74 protected: |
88 protected: |
75 bool eventFilter(QObject *watched, QEvent *event); |
89 bool eventFilter(QObject *watched, QEvent *event); |
76 |
90 |
77 private: |
91 private: |
78 HsScene(QObject *parent = 0); |
|
79 void calculateWidgetSizeLimitations(); |
|
80 Q_DISABLE_COPY(HsScene) |
92 Q_DISABLE_COPY(HsScene) |
81 |
93 |
82 private: |
94 private: |
83 int mDatabaseId; |
95 int mDatabaseId; |
84 HsWallpaper *mWallpaper; |
96 HsWallpaper *mWallpaper; |
85 QList<HsPage *> mPages; |
97 QList<HsPage *> mPages; |
86 HsPage *mActivePage; |
98 HsPage *mActivePage; |
87 HsWidgetHost *mActiveWidget; |
99 HsWidgetHost *mActiveWidget; |
88 bool mIsOnline; |
100 bool mIsOnline; |
89 int mMaximumPageCount; |
101 bool mIsBackground; |
90 QSizeF mMaximumWidgetSizeInPixels; |
102 bool mIsSleeping; |
91 QSizeF mMinimumWidgetSizeInPixels; |
103 |
92 QSizeF mMaximumWidgetSizeInUnits; |
|
93 QSizeF mMinimumWidgetSizeInUnits; |
|
94 |
|
95 static HsScene *mInstance; |
104 static HsScene *mInstance; |
96 |
105 |
97 HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) |
106 friend class HsPage; |
|
107 friend class HsPageTouchArea; |
|
108 friend class HsWidgetHost; |
|
109 friend class HsWidgetTouchArea; |
|
110 friend class HsWidgetMoveTouchArea; |
|
111 |
|
112 HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel) |
98 HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest) |
113 HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest) |
99 }; |
114 }; |
100 |
115 |
101 #endif // HSSCENE_H |
116 #endif // HSSCENE_H |