homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsidlestate.h
changeset 62 341166945d65
parent 55 03646e8da489
child 63 52b0f64eeb51
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
    20 
    20 
    21 #include <QState>
    21 #include <QState>
    22 #include <QTimer>
    22 #include <QTimer>
    23 #include <QPointF>
    23 #include <QPointF>
    24 #include <QPointer>
    24 #include <QPointer>
       
    25 #include <QRectF>
       
    26 
       
    27 #include "hswidgetpositioningonwidgetmove.h"
    25 
    28 
    26 #include "hstest_global.h"
    29 #include "hstest_global.h"
    27 HOMESCREEN_TEST_CLASS(HomeScreenStatePluginTest)
    30 HOMESCREEN_TEST_CLASS(HomeScreenStatePluginTest)
    28 
    31 
    29 class QGraphicsItem;
    32 class QGraphicsItem;
    30 class QGraphicsSceneMouseEvent;
    33 class QGraphicsSceneMouseEvent;
    31 class QPropertyAnimation;
    34 class QPropertyAnimation;
       
    35 class QGestureEvent;
    32 class HbAction;
    36 class HbAction;
    33 class HbContinuousFeedback;
    37 class HbContinuousFeedback;
    34 class HsIdleWidget;
    38 class HsIdleWidget;
    35 class HsTitleResolver;
    39 class HsTitleResolver;
    36 class QParallelAnimationGroup;
    40 class QParallelAnimationGroup;
    37 class HbMenu;
    41 class HbMenu;
    38 #ifdef Q_OS_SYMBIAN
    42 #ifdef Q_OS_SYMBIAN
    39 class XQSettingsManager;
    43 class XQSettingsManager;
    40 #endif
    44 #endif
       
    45 
       
    46 class HsWidgetHost;
    41 
    47 
    42 class HsIdleState : public QState
    48 class HsIdleState : public QState
    43 {
    49 {
    44     Q_OBJECT
    50     Q_OBJECT
    45 
    51 
    48     ~HsIdleState();
    54     ~HsIdleState();
    49 
    55 
    50 signals:
    56 signals:
    51     void event_applicationLibrary();
    57     void event_applicationLibrary();
    52     void event_waitInput();
    58     void event_waitInput();
    53     void event_widgetInteraction();
       
    54     void event_sceneInteraction();
       
    55     void event_moveWidget();
    59     void event_moveWidget();
    56     void event_moveScene();
    60     void event_moveScene();
    57     void event_sceneMenu();
    61     void event_selectWallpaper();
    58     void event_selectSceneWallpaper();
       
    59     void event_addPage();
    62     void event_addPage();
    60     void event_removePage();
    63     void event_removePage();
    61     void event_toggleConnection();
    64     void event_toggleConnection();
    62 
    65 
    63 protected:
    66 protected:
    70     void startPageChangeAnimation(int targetPageIndex, int duration);
    73     void startPageChangeAnimation(int targetPageIndex, int duration);
    71     void startPageChangeZoneAnimation(int duration);
    74     void startPageChangeZoneAnimation(int duration);
    72     bool isInPageChangeZone();
    75     bool isInPageChangeZone();
    73     bool isInLeftPageChangeZone();
    76     bool isInLeftPageChangeZone();
    74     bool isInRightPageChangeZone();
    77     bool isInRightPageChangeZone();
    75     void addPageToScene(int pageIndex);
    78     void addPageToScene(int pageIndex);    
    76     qreal parallaxFactor() const;
       
    77     void updateZoneAnimation();
    79     void updateZoneAnimation();
    78     void showTrashBin();
    80     void showTrashBin();
    79     void removeActivePage();
    81     void removeActivePage();
       
    82     void deleteZoneAnimation();
       
    83     QList<QRectF> createInactiveWidgetRects();
       
    84     void updatePagePresentationToWidgetSnap();
       
    85     void resetSnapPosition();
       
    86     void showVerticalLine();
       
    87     void showHorizontalLine();
       
    88     void hideVerticalLine();
       
    89     void hideHorizontalLine();
    80 
    90 
    81 private slots:
    91 private slots:    
    82     void action_disableUserInteraction();
       
    83     void action_enableUserInteraction();
       
    84     void action_idle_setupView();
    92     void action_idle_setupView();
    85     void action_idle_layoutNewWidgets();
    93     void action_idle_layoutNewWidgets();
    86     void action_idle_showActivePage();
    94     void action_idle_showActivePage();
    87     void action_idle_connectOrientationChangeEventHandler();
    95     void action_idle_connectOrientationChangeEventHandler();
       
    96     void action_idle_orientationChanged();
    88     void action_idle_installEventFilter();
    97     void action_idle_installEventFilter();
    89     void action_idle_cleanupView();
    98     void action_idle_cleanupView();
    90     void action_idle_disconnectOrientationChangeEventHandler();
    99     void action_idle_disconnectOrientationChangeEventHandler();
    91     void action_idle_uninstallEventFilter();
   100     void action_idle_uninstallEventFilter();
    92     void action_waitInput_updateOptionsMenu();
   101     void action_waitInput_updateOptionsMenu();
    93     void action_waitInput_connectMouseEventHandlers();
   102     void action_waitInput_connectGestureHandlers();
    94     void action_waitInput_publishIdleKey();
   103     void action_waitInput_publishIdleKey();
    95     void action_waitInput_disconnectMouseEventHandlers();
   104     void action_waitInput_disconnectGestureHandlers();
    96     void action_widgetInteraction_connectMouseEventHandlers();
   105     void action_waitInput_resetNewWidgets();
    97     void action_widgetInteraction_connectGestureTimers();
       
    98     void action_widgetInteraction_disconnectMouseEventHandlers();
       
    99     void action_widgetInteraction_disconnectGestureTimers();
       
   100     void action_sceneInteraction_connectMouseEventHandlers();
       
   101     void action_sceneInteraction_connectGestureTimers();
       
   102     void action_sceneInteraction_disconnectMouseEventHandlers();
       
   103     void action_sceneInteraction_disconnectGestureTimers();
       
   104     void action_moveWidget_reparentToControlLayer();
   106     void action_moveWidget_reparentToControlLayer();
   105     void action_moveWidget_startWidgetDragEffect();
   107     void action_moveWidget_startWidgetDragEffect();
   106     void action_moveWidget_connectMouseEventHandlers();
   108     void action_moveWidget_connectGestureHandlers();
       
   109     void action_moveWidget_setWidgetSnap();
       
   110 
   107     void action_moveWidget_reparentToPage();
   111     void action_moveWidget_reparentToPage();
   108     void action_moveWidget_startWidgetDropEffect();
   112     void action_moveWidget_startWidgetDropEffect();
   109     void action_moveWidget_disconnectMouseEventHandlers();
   113     void action_moveWidget_disconnectGestureHandlers();
   110     void action_moveScene_connectMouseEventHandlers();
   114     void action_moveWidget_preventZoneAnimation();
       
   115     void action_moveWidget_deleteWidgetSnap();
       
   116     void action_moveScene_connectGestureHandlers();
   111     void action_moveScene_moveToNearestPage();
   117     void action_moveScene_moveToNearestPage();
   112     void action_moveScene_disconnectMouseEventHandlers();
   118     void action_moveScene_disconnectGestureHandlers();    
   113     void action_sceneMenu_showMenu();
       
   114     void action_addPage_addPage();
   119     void action_addPage_addPage();
   115     void action_removePage_removePage();
   120     void action_removePage_removePage();
   116     void action_toggleConnection_toggleConnection();
   121     void action_toggleConnection_toggleConnection();
   117     void action_idle_setupTitle();
   122     void action_idle_setupTitle();
   118     void action_idle_cleanupTitle();
   123     void action_idle_cleanupTitle();
   119 
   124     
   120     void waitInput_onMousePressed(
   125     void onPageTapAndHoldFinished(QGestureEvent *event);
   121         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
   126     void onPagePanStarted(QGestureEvent *event);
   122     void widgetInteraction_onMouseMoved(
   127     void onPagePanUpdated(QGestureEvent *event);
   123         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
   128     void onPagePanFinished(QGestureEvent *event);
   124     void widgetInteraction_onMouseReleased(
   129     void onWidgetTapStarted(HsWidgetHost *widget);
   125         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
   130     void onWidgetTapAndHoldFinished(QGestureEvent *event, HsWidgetHost *widget);
   126     void sceneInteraction_onMouseMoved(
   131     void onWidgetMoveUpdated(const QPointF &scenePos, HsWidgetHost *widget);
   127         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
   132     void onWidgetMoveFinished(const QPointF &scenePos, HsWidgetHost *widget);
   128     void sceneInteraction_onMouseReleased(
       
   129         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
       
   130     void moveWidget_onMouseMoved(
       
   131         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
       
   132     void moveWidget_onMouseReleased(
       
   133         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
       
   134     void moveScene_onMouseMoved(
       
   135         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
       
   136     void moveScene_onMouseReleased(
       
   137         QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
       
   138 
       
   139     void widgetInteraction_onTapAndHoldTimeout();
       
   140     void sceneInteraction_onTapAndHoldTimeout();
       
   141     void onTitleChanged(QString title);
   133     void onTitleChanged(QString title);
   142     void onAddContentActionTriggered();
   134     void onAddContentFromContextMenuActionTriggered();
       
   135     void onAddContentFromOptionsMenuActionTriggered();
   143     bool openTaskSwitcher();
   136     bool openTaskSwitcher();
   144     void zoneAnimationFinished();
   137     void zoneAnimationFinished();
   145     void onSceneMenuTriggered(HbAction *action);
   138     void pageChangeAnimationFinished();
   146     void onRemovePageConfirmationOk();
   139     void onRemovePageConfirmationOk();
   147     void onSceneMenuAboutToClose();
   140     void onVerticalSnapLineTimerTimeout();
       
   141     void onHorizontalSnapLineTimerTimeout();
       
   142     void onActivePageChanged();
   148 
   143 
   149 private:
   144 private:
   150     HbAction *mNavigationAction;
   145     HbAction *mNavigationAction;
   151     HsIdleWidget *mUiWidget;
   146     HsIdleWidget *mUiWidget;  
   152     
       
   153     QTimer mTimer;
       
   154 
       
   155     QPointF mTouchScenePos;
       
   156     HsTitleResolver *mTitleResolver;
   147     HsTitleResolver *mTitleResolver;
   157     QPropertyAnimation *mZoneAnimation;
   148     QPropertyAnimation *mZoneAnimation;
   158     bool mPageChanged;
       
   159     bool mAllowZoneAnimation;
   149     bool mAllowZoneAnimation;
   160     QParallelAnimationGroup *mPageChangeAnimation;
   150     QPropertyAnimation *mPageChangeAnimation;
   161     HbContinuousFeedback *mContinuousFeedback;
   151     HbContinuousFeedback *mContinuousFeedback;
   162     bool mTrashBinFeedbackAlreadyPlayed;
   152     bool mTrashBinFeedbackAlreadyPlayed;    
   163 
   153     QPointF mPageHotSpot;
       
   154     QPointF mWidgetHotSpot;
       
   155     QPointF mWidgetHotSpotOffset;
   164     qreal mDeltaX;
   156     qreal mDeltaX;
   165     QPointer<HbMenu> mSceneMenu;
   157     QPointer<HbMenu> mSceneMenu;
       
   158     HsWidgetPositioningOnWidgetMove::Result mSnapResult;
       
   159     HsWidgetPositioningOnWidgetMove::Result mPreviousSnapResult;
       
   160     qreal mSnapBorderGap;
       
   161     QTimer mVerticalSnapLineTimer;
       
   162     QTimer mHorizontalSnapLineTimer;
   166 #ifdef Q_OS_SYMBIAN    
   163 #ifdef Q_OS_SYMBIAN    
   167     XQSettingsManager *mSettingsMgr;
   164     XQSettingsManager *mSettingsMgr;
   168 #endif    
   165 #endif    
   169     HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest)
   166     HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest)
   170 };
   167 };