homescreenapp/hsdomainmodel/inc/hspage.h
changeset 63 52b0f64eeb51
parent 62 341166945d65
child 69 87476091b3f5
equal deleted inserted replaced
62:341166945d65 63:52b0f64eeb51
    16 */
    16 */
    17 
    17 
    18 #ifndef HSPAGE_H
    18 #ifndef HSPAGE_H
    19 #define HSPAGE_H
    19 #define HSPAGE_H
    20 
    20 
       
    21 #include <QPointF>
    21 #include <HbWidget>
    22 #include <HbWidget>
    22 #include <HbIconItem>
    23 #include <HbIconItem>
    23 #include "hsdomainmodel_global.h"
    24 #include "hsdomainmodel_global.h"
    24 #include "hstest_global.h"
    25 #include "hstest_global.h"
    25 
    26 
    36     Q_PROPERTY(int pageIndex READ pageIndex)
    37     Q_PROPERTY(int pageIndex READ pageIndex)
    37 
    38 
    38 public:
    39 public:
    39     HsPage(QGraphicsItem *parent = 0);
    40     HsPage(QGraphicsItem *parent = 0);
    40     ~HsPage();
    41     ~HsPage();
    41 
       
    42     int databaseId() const;
    42     int databaseId() const;
    43     void setDatabaseId(int id);
    43     void setDatabaseId(int id);
    44 
       
    45     void setGeometry(const QRectF &rect);
    44     void setGeometry(const QRectF &rect);
    46 
       
    47     bool load();
    45     bool load();
    48 
       
    49     HsWallpaper *wallpaper() const;
    46     HsWallpaper *wallpaper() const;
    50 
       
    51     bool addExistingWidget(HsWidgetHost *widgetHost);
    47     bool addExistingWidget(HsWidgetHost *widgetHost);
    52     bool removeWidget(HsWidgetHost *widgeHost);
    48     bool removeWidget(HsWidgetHost *widgeHost);
    53 
       
    54     QList<HsWidgetHost *> newWidgets();
    49     QList<HsWidgetHost *> newWidgets();
    55     bool addNewWidget(HsWidgetHost *widgetHost, const QPointF &position = QPointF());
    50     bool addNewWidget(HsWidgetHost *widgetHost, const QPointF &position = QPointF());
    56     void layoutNewWidgets();
    51     void layoutNewWidgets();
    57     void resetNewWidgets();
    52     void resetNewWidgets();
    58     bool deleteFromDatabase();
    53     bool deleteFromDatabase();
    59 
       
    60     QList<HsWidgetHost *> widgets() const;
    54     QList<HsWidgetHost *> widgets() const;
    61 
       
    62     bool isRemovable() const;
    55     bool isRemovable() const;
    63     void setRemovable(bool removable);
    56     void setRemovable(bool removable);
    64 
       
    65     bool isDefaultPage() const;
    57     bool isDefaultPage() const;
    66     bool isActivePage() const;
    58     bool isActivePage() const;
    67     
       
    68     static HsPage *createInstance(const HsPageData &pageData);
    59     static HsPage *createInstance(const HsPageData &pageData);
    69 
    60     QPointF adjustedWidgetPosition(const QRectF &origWidgetRect);
    70     QPointF mTouchPoint;
    61     QRectF contentGeometry();
       
    62     QRectF contentGeometry(Qt::Orientation orientation);
       
    63     QRectF contentRect();
       
    64     QRectF contentRect(Qt::Orientation orientation);
    71 
    65 
    72 public slots:
    66 public slots:
    73     void showWidgets();
    67     void showWidgets();
    74     void hideWidgets();
    68     void hideWidgets();
    75     void setOnline(bool online = true);
    69     void setOnline(bool online = true);
    76 
       
    77     void updateZValues();
    70     void updateZValues();
    78 
       
    79     int pageIndex();
    71     int pageIndex();
    80 
    72 
    81 private:
    73 private:
    82     Q_DISABLE_COPY(HsPage)
    74     Q_DISABLE_COPY(HsPage)
    83     void setupTouchArea();
    75     void setupTouchArea();
    88     void onWidgetFinished();
    80     void onWidgetFinished();
    89     void onWidgetFaulted();
    81     void onWidgetFaulted();
    90     void onWidgetResized();
    82     void onWidgetResized();
    91     void onWidgetAvailable();
    83     void onWidgetAvailable();
    92     void onWidgetUnavailable();
    84     void onWidgetUnavailable();
    93 
       
    94     void onOrientationChanged(Qt::Orientation orientation);
    85     void onOrientationChanged(Qt::Orientation orientation);
       
    86     void onPageMarginChanged(const QString &value);
    95 
    87 
    96 private:
    88 private:
    97     int mDatabaseId;
    89     int mDatabaseId;
    98     HsWallpaper *mWallpaper;
    90     HsWallpaper *mWallpaper;
    99     bool mRemovable;
    91     bool mRemovable;
   100     QList<HsWidgetHost*> mWidgets;
    92     QList<HsWidgetHost*> mWidgets;
   101     QList<HsWidgetHost*> mNewWidgets;
    93     QList<HsWidgetHost*> mNewWidgets;
   102     QList<HsWidgetHost*> mUnavailableWidgets;
    94     QList<HsWidgetHost*> mUnavailableWidgets;
   103     HsPageTouchArea *mTouchArea;
    95     HsPageTouchArea *mTouchArea;
   104     
    96     QPointF mTouchPoint;    
       
    97     qreal mPageMargin;
   105     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
    98     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
   106 };
    99 };
   107 
   100 
   108 #endif
   101 #endif