23 #ifndef CARDWINDOWMANAGER_H
24 #define CARDWINDOWMANAGER_H
30 #include <QStateMachine>
31 #include <QGraphicsSceneMouseEvent>
32 #include <QGestureEvent>
33 #include <QParallelAnimationGroup>
35 #include <QEasingCurve>
48 class QTapAndHoldGesture;
49 class QPropertyAnimation;
78 void resize(
int width,
int height);
91 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
92 virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
93 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
94 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
95 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
96 #endif // QT_VERISON < 5.0.0
105 void slotPositiveSpaceAboutToChange(
const QRect& r,
bool fullScreen,
bool screenResizing);
106 void slotPositiveSpaceChangeFinished(
const QRect& r);
107 void slotPositiveSpaceChanged(
const QRect& r);
108 void slotLauncherVisible(
bool val,
bool fullyVisible);
109 void slotLauncherShown(
bool val);
111 void slotAnimationsFinished();
112 void slotDeletedAnimationFinished();
113 void slotTouchToShareAnimationFinished();
115 void slotMaximizeActiveCardWindow();
116 void slotMinimizeActiveCardWindow();
118 void slotChangeCardWindow(
bool next);
120 void slotFocusMaximizedCardWindow(
bool focus);
122 void slotTouchToShareAppUrlTransfered(
const std::string& appId);
123 void slotOpacityAnimationFinished();
124 void slotDismissActiveModalWindow();
125 void slotDismissModalTimerStopped();
140 void performPostModalWindowRemovedActions(
Window* win,
bool restore =
true);
141 void initiateRemovalOfActiveModalWindow();
143 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
144 void handleMousePressMinimized(QGraphicsSceneMouseEvent* event);
146 void handleMouseMoveMinimized(QGraphicsSceneMouseEvent* event);
147 void handleMouseMoveReorder(QGraphicsSceneMouseEvent* event);
149 void handleMouseReleaseMinimized(QGraphicsSceneMouseEvent* event);
150 void handleMouseReleaseReorder(QGraphicsSceneMouseEvent* event);
153 void handleTouchBeginMinimized(QTouchEvent* e);
155 void handleTouchUpdateMinimized(QTouchEvent* e);
156 void handleTouchUpdateReorder(QTouchEvent* e);
158 void handleTouchEndMinimized(QTouchEvent* e);
159 void handleTouchEndReorder(QTouchEvent* e);
161 void slideAllGroupsOnTouchUpdate(
int xOffset);
162 #endif // QT_VERSION < 5.0.0
164 void handleFlickGestureMinimized(QGestureEvent* event);
166 void handleTapGestureMinimized(QTapGesture* event);
168 void handleTapAndHoldGestureMinimized(QTapAndHoldGesture* event);
170 void handleKeyNavigationMinimized(QKeyEvent* keyEvent);
174 void maximizeActiveWindow(
bool animate=
true);
175 void minimizeActiveWindow(
bool animate=
true);
179 void setActiveCardOffScreen(
bool fullsize=
true);
181 QRect normalOrScreenBounds(
CardWindow* win)
const;
182 QRect targetPositiveSpace()
const {
return m_targetPositiveSpace; }
184 void prepareAddWindowSibling(
CardWindow* win);
185 void addWindowTimedOutNormal(
CardWindow* win);
187 void removeCardFromGroupMaximized(
CardWindow* win);
188 void removeCardFromGroup(
CardWindow* win,
bool adjustLayout=
true);
190 void closeWindow(
CardWindow* win,
bool angryCard=
false);
192 CardGroup* groupClosestToCenterHorizontally()
const;
194 void enterReorder(QPoint pt);
195 void cycleReorderSlot();
196 void moveReorderSlotRight();
197 void moveReorderSlotLeft();
198 void moveReorderSlotCenter(QPointF pt);
202 void switchToNextGroup();
204 void switchToPrevGroup();
206 void switchToNextApp();
207 void switchToPrevApp();
208 void switchToNextAppMaximized();
209 void switchToPrevAppMaximized();
215 void slideAllGroups(
bool includeActiveCard =
true);
216 void slideAllGroupsTo(
int xOffset);
220 void layoutAllGroups(
bool includeActiveCard =
true);
224 void layoutGroups(qreal xDiff);
229 void slideToActiveCard();
233 void disableCardRestoreToMaximized();
234 void restoreCardToMaximized();
236 void cancelReorder(
bool dueToPenCancel=
false);
238 void queueFocusAction(
CardWindow* win,
bool focused);
239 void performPendingFocusActions();
241 void queueTouchToShareAction(
CardWindow* win);
242 void performPendingTouchToShareActions();
244 void removePendingActionWindow(
CardWindow* win);
246 void setAnimationForWindow(
CardWindow* win, QPropertyAnimation* anim);
247 void removeAnimationForWindow(
CardWindow* win,
bool includeDeletedAnimations=
false);
248 bool windowHasAnimation(
CardWindow* win)
const;
250 void setAnimationForGroup(
CardGroup* group, QPropertyAnimation* anim);
251 void removeAnimationForGroup(
CardGroup* group);
252 bool groupHasAnimation(
CardGroup* group)
const;
253 void startAnimations();
254 void clearAnimations();
256 void updateAllowWindowUpdates();
260 void removeWindowWithModality(
CardWindow* win);
261 bool performCommonWindowRemovalTasks(
CardWindow* w,
bool checkCardGroup=
true);
262 void resetMouseTrackState();
263 void resetModalFlags(
bool forceReset=
false);
264 void handleModalRemovalForDeletedParent(
CardWindow* w);
266 bool playAngryCardSounds()
const;
267 void updateAngryCardThreshold();
269 void markFirstCardDone();
271 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
272 bool handleTouchBegin(QTouchEvent *e);
273 bool handleTouchEnd(QTouchEvent *e);
274 bool handleTouchUpdate(QTouchEvent *e);
277 QSet<CardWindow*> m_pendingActionWinSet;
278 QSet<CardWindow*> m_pendingTouchToShareWinSet;
280 QVector<CardGroup*> m_groups;
283 QRect m_normalScreenBounds;
284 QRect m_targetPositiveSpace;
292 bool m_addingModalWindow;
293 bool m_initModalMaximizing;
294 bool m_modalDismissInProgress;
295 bool m_animateWindowForModalDismisal;
296 int m_dismissModalImmediately;
297 bool m_modalDimissed;
298 bool m_dismissedFirstCard;
301 enum ModalWindowState {
303 ModalWindowAddInitCheckFail,
304 ModalWindowDismissedParentSwitched,
305 ModalWindowDismissedInternally,
306 ModalWindowDismissedExternally,
307 ModalParentDismissed,
308 ModalParentDimissedWaitForChildDismissal
311 ModalWindowState m_modalWindowState;
313 enum NotifySystemUiControllerAction {
316 ModalDismissNoAnimate,
320 void notifySysControllerOfModalStatus(
int reason,
bool restore, NotifySystemUiControllerAction type,
Window* win = NULL);
328 bool m_trackWithinGroup;
329 bool m_seenFlickOrTap;
330 int m_activeGroupPivot;
333 ReorderZone_Center = 0,
337 ReorderZone m_reorderZone;
338 ReorderZone getReorderZone(QPoint pt);
351 QMap<CardWindow*,QPropertyAnimation*> m_cardAnimMap;
352 QMap<CardGroup*,QPropertyAnimation*> m_groupAnimMap;
356 QParallelAnimationGroup m_anims;
357 QMap<CardWindow*,QPropertyAnimation*> m_deletedAnimMap;
359 bool m_playedAngryCardStretchSound;
361 bool m_animationsActive;