homescreenapp/hsdomainmodel/inc/hspage.h
changeset 69 87476091b3f5
parent 63 52b0f64eeb51
child 90 3ac3aaebaee5
equal deleted inserted replaced
67:474929a40a0f 69:87476091b3f5
    26 
    26 
    27 class HsWidgetHost;
    27 class HsWidgetHost;
    28 class HsPageData;
    28 class HsPageData;
    29 class HsWallpaper;
    29 class HsWallpaper;
    30 class HsPageTouchArea;
    30 class HsPageTouchArea;
       
    31 class HsPageVisual;
    31 
    32 
    32 HOMESCREEN_TEST_CLASS(TestHsDomainModel)
    33 HOMESCREEN_TEST_CLASS(TestHsDomainModel)
    33 
    34 
    34 class HSDOMAINMODEL_EXPORT HsPage : public HbWidget
    35 class HSDOMAINMODEL_EXPORT HsPage : public QObject
    35 {
    36 {
    36     Q_OBJECT
    37     Q_OBJECT
    37     Q_PROPERTY(int pageIndex READ pageIndex)
    38     Q_PROPERTY(int pageIndex READ pageIndex)
    38 
    39 
    39 public:
    40 public:
    40     HsPage(QGraphicsItem *parent = 0);
    41     HsPage(QObject *parent = 0);
    41     ~HsPage();
    42     ~HsPage();
    42     int databaseId() const;
    43     int databaseId() const;
    43     void setDatabaseId(int id);
    44     void setDatabaseId(int id);
    44     void setGeometry(const QRectF &rect);
    45    // void setGeometry(const QRectF &rect);
    45     bool load();
    46     bool load();
    46     HsWallpaper *wallpaper() const;
    47     HsWallpaper *wallpaper() const;
    47     bool addExistingWidget(HsWidgetHost *widgetHost);
    48     bool addExistingWidget(HsWidgetHost *widgetHost);
    48     bool removeWidget(HsWidgetHost *widgeHost);
    49     bool removeWidget(HsWidgetHost *widgeHost);
    49     QList<HsWidgetHost *> newWidgets();
    50     QList<HsWidgetHost *> newWidgets();
    60     QPointF adjustedWidgetPosition(const QRectF &origWidgetRect);
    61     QPointF adjustedWidgetPosition(const QRectF &origWidgetRect);
    61     QRectF contentGeometry();
    62     QRectF contentGeometry();
    62     QRectF contentGeometry(Qt::Orientation orientation);
    63     QRectF contentGeometry(Qt::Orientation orientation);
    63     QRectF contentRect();
    64     QRectF contentRect();
    64     QRectF contentRect(Qt::Orientation orientation);
    65     QRectF contentRect(Qt::Orientation orientation);
    65 
    66     HsPageVisual *visual() const;
       
    67 #ifdef HSWIDGETORGANIZER_ALGORITHM
       
    68     enum sortOrder { height, width};
       
    69 #endif //HSWIDGETORGANIZER_ALGORITHM
    66 public slots:
    70 public slots:
    67     void showWidgets();
    71     void showWidgets();
    68     void hideWidgets();
    72     void hideWidgets();
    69     void setOnline(bool online = true);
    73     void setOnline(bool online = true);
    70     void updateZValues();
    74     void updateZValues();
    71     int pageIndex();
    75     int pageIndex();
    72 
    76 
    73 private:
    77 private:
    74     Q_DISABLE_COPY(HsPage)
    78     Q_DISABLE_COPY(HsPage)
    75     void setupTouchArea();
    79   //  void setupTouchArea();
    76     void connectWidget(HsWidgetHost *widget);
    80     void connectWidget(HsWidgetHost *widget);
    77     void disconnectWidget(HsWidgetHost *widget);
    81     void disconnectWidget(HsWidgetHost *widget);
       
    82 #ifdef HSWIDGETORGANIZER_ALGORITHM
       
    83     void sortWidgets(sortOrder order, QList<HsWidgetHost*> &widgets);
       
    84 #endif //HSWIDGETORGANIZER_ALGORITHM
    78 
    85 
    79 private slots:
    86 private slots:
    80     void onWidgetFinished();
    87     void onWidgetFinished();
    81     void onWidgetFaulted();
    88     void onWidgetFaulted();
    82     void onWidgetResized();
    89     void onWidgetResized();
    85     void onOrientationChanged(Qt::Orientation orientation);
    92     void onOrientationChanged(Qt::Orientation orientation);
    86     void onPageMarginChanged(const QString &value);
    93     void onPageMarginChanged(const QString &value);
    87 
    94 
    88 private:
    95 private:
    89     int mDatabaseId;
    96     int mDatabaseId;
       
    97     HsPageVisual *mPageVisual;
    90     HsWallpaper *mWallpaper;
    98     HsWallpaper *mWallpaper;
    91     bool mRemovable;
    99     bool mRemovable;
    92     QList<HsWidgetHost*> mWidgets;
   100     QList<HsWidgetHost*> mWidgets;
    93     QList<HsWidgetHost*> mNewWidgets;
   101     QList<HsWidgetHost*> mNewWidgets;
    94     QList<HsWidgetHost*> mUnavailableWidgets;
   102     QList<HsWidgetHost*> mUnavailableWidgets;
    95     HsPageTouchArea *mTouchArea;
   103     //HsPageTouchArea *mTouchArea;
    96     QPointF mTouchPoint;    
   104     QPointF mTouchPoint;    
    97     qreal mPageMargin;
   105     qreal mPageMargin;
    98     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
   106     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
    99 };
   107 };
   100 
   108