author | hgs |
Fri, 06 Aug 2010 13:36:36 +0300 | |
changeset 71 | 1db7cc813a4e |
parent 69 | 87476091b3f5 |
child 90 | 3ac3aaebaee5 |
permissions | -rw-r--r-- |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#ifndef HSPAGE_H |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#define HSPAGE_H |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
|
63 | 21 |
#include <QPointF> |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <HbWidget> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <HbIconItem> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "hsdomainmodel_global.h" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "hstest_global.h" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
class HsWidgetHost; |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
class HsPageData; |
62 | 29 |
class HsWallpaper; |
30 |
class HsPageTouchArea; |
|
69 | 31 |
class HsPageVisual; |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
|
62 | 33 |
HOMESCREEN_TEST_CLASS(TestHsDomainModel) |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
|
69 | 35 |
class HSDOMAINMODEL_EXPORT HsPage : public QObject |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
{ |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
37 |
Q_OBJECT |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
38 |
Q_PROPERTY(int pageIndex READ pageIndex) |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
public: |
69 | 41 |
HsPage(QObject *parent = 0); |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
42 |
~HsPage(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
int databaseId() const; |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
void setDatabaseId(int id); |
69 | 45 |
// void setGeometry(const QRectF &rect); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
bool load(); |
62 | 47 |
HsWallpaper *wallpaper() const; |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
bool addExistingWidget(HsWidgetHost *widgetHost); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
bool removeWidget(HsWidgetHost *widgeHost); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
QList<HsWidgetHost *> newWidgets(); |
62 | 51 |
bool addNewWidget(HsWidgetHost *widgetHost, const QPointF &position = QPointF()); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
void layoutNewWidgets(); |
62 | 53 |
void resetNewWidgets(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
bool deleteFromDatabase(); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
QList<HsWidgetHost *> widgets() const; |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
bool isRemovable() const; |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
void setRemovable(bool removable); |
62 | 58 |
bool isDefaultPage() const; |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
59 |
bool isActivePage() const; |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
static HsPage *createInstance(const HsPageData &pageData); |
63 | 61 |
QPointF adjustedWidgetPosition(const QRectF &origWidgetRect); |
62 |
QRectF contentGeometry(); |
|
63 |
QRectF contentGeometry(Qt::Orientation orientation); |
|
64 |
QRectF contentRect(); |
|
65 |
QRectF contentRect(Qt::Orientation orientation); |
|
69 | 66 |
HsPageVisual *visual() const; |
67 |
#ifdef HSWIDGETORGANIZER_ALGORITHM |
|
68 |
enum sortOrder { height, width}; |
|
69 |
#endif //HSWIDGETORGANIZER_ALGORITHM |
|
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
70 |
public slots: |
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
71 |
void showWidgets(); |
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
72 |
void hideWidgets(); |
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
73 |
void setOnline(bool online = true); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
74 |
void updateZValues(); |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
75 |
int pageIndex(); |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
76 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
private: |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
78 |
Q_DISABLE_COPY(HsPage) |
69 | 79 |
// void setupTouchArea(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
void connectWidget(HsWidgetHost *widget); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
void disconnectWidget(HsWidgetHost *widget); |
69 | 82 |
#ifdef HSWIDGETORGANIZER_ALGORITHM |
83 |
void sortWidgets(sortOrder order, QList<HsWidgetHost*> &widgets); |
|
84 |
#endif //HSWIDGETORGANIZER_ALGORITHM |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
private slots: |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
87 |
void onWidgetFinished(); |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
88 |
void onWidgetFaulted(); |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
89 |
void onWidgetResized(); |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
90 |
void onWidgetAvailable(); |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
91 |
void onWidgetUnavailable(); |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
92 |
void onOrientationChanged(Qt::Orientation orientation); |
63 | 93 |
void onPageMarginChanged(const QString &value); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
95 |
private: |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
96 |
int mDatabaseId; |
69 | 97 |
HsPageVisual *mPageVisual; |
62 | 98 |
HsWallpaper *mWallpaper; |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
bool mRemovable; |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
QList<HsWidgetHost*> mWidgets; |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
101 |
QList<HsWidgetHost*> mNewWidgets; |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
102 |
QList<HsWidgetHost*> mUnavailableWidgets; |
69 | 103 |
//HsPageTouchArea *mTouchArea; |
63 | 104 |
QPointF mTouchPoint; |
105 |
qreal mPageMargin; |
|
62 | 106 |
HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel) |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
}; |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
108 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
#endif |