Skip to content

Commit

Permalink
Clean up CardWindowManagerStates
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Palmer committed Sep 20, 2012
1 parent 3f05d29 commit 548d8e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 94 deletions.
89 changes: 7 additions & 82 deletions Src/lunaui/cards/CardWindowManagerStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,22 @@ void GroupState::mousePressEvent(QGraphicsSceneMouseEvent* event)

void GroupState::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
m_wm->handleMouseMoveGroup(event);
m_wm->handleMouseMoveGroup(event);
}

void GroupState::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
m_wm->handleMouseReleaseGroup(event);
m_wm->handleMouseReleaseGroup(event);
}

void GroupState::flickGestureEvent(QGestureEvent* event)
{
m_wm->handleFlickGestureGroup(event);
m_wm->handleFlickGestureGroup(event);
}

void GroupState::tapGestureEvent(QTapGesture* event)
{
m_wm->handleTapGestureGroupView(event);
}

void GroupState::tapAndHoldGestureEvent(QTapAndHoldGesture* event)
{
//m_wm->handleTapAndHoldGestureMinimized(event);
m_wm->handleTapGestureGroup(event);
}

bool GroupState::handleKeyNavigation(QKeyEvent* keyEvent)
Expand All @@ -215,82 +210,12 @@ bool GroupState::handleKeyNavigation(QKeyEvent* keyEvent)
return true;
}

void GroupState::animationsFinished()
{
// attempt to process any tap-to-share actions
m_wm->performPendingTouchToShareActions();

// attempt to auto restore a card to maximized
//m_wm->restoreCardToMaximized();

}

void GroupState::relayout(const QRectF& r, bool animate)
{
m_wm->showGroupCardsImmediate();

//Q_UNUSED(r);
//m_wm->minimizeActiveWindow(animate);
}

void GroupState::changeCardWindow(bool next)
{
if (next)
m_wm->switchToPrevApp();
else
m_wm->switchToNextApp();
}
void GroupState::windowAdded(CardWindow* win)
{
CardWindow* activeWin = m_wm->activeWindow();
//if (activeWin != win) {
// CardWindowManagerState::windowAdded(win);
// return;
//}

//if (!m_wm->windowHasAnimation(win)) {
m_wm->m_activeGroup->setActiveCard(win);
m_wm->maximizeActiveWindow(!lastWindowAddedType());
//}
}

void GroupState::windowTimedOut(CardWindow* win)
{
//CardWindow* activeWin = m_wm->activeWindow();
//if (win == activeWin) {
m_wm->addWindowTimedOutNormal(win);
//}
}

void GroupState::onExit(QEvent *event)
{
// in case we exit the Loading state during the maximizing animation
CardWindow* activeWin = m_wm->activeWindow();
if (activeWin && activeWin->addedToWindowManager()) {

activeWin->stopLoadingOverlay();
}
m_wm->stopMoveGroupTimer();

}


void GroupState::onEntry(QEvent* event)
{
CardWindowManagerState::onEntry(event);

CardWindow* activeWin = m_wm->activeWindow();
if (activeWin) {
m_wm->queueFocusAction(activeWin, false);
QRectF boundingRect = m_wm->normalOrScreenBounds(0);
activeWin->setBoundingRect(boundingRect.width(), boundingRect.height());
m_wm->firstCardAlert();
}

SystemUiController::instance()->setCardWindowMaximized(true);
SystemUiController::instance()->setMaximizedCardWindow(activeWin);
CardWindowManagerState::onEntry(event);

//SystemUiController::instance()->setMaximizedCardWindow(0);
m_wm->setGroupsTab();
m_wm->slideAllGroups();
}


Expand Down
13 changes: 1 addition & 12 deletions Src/lunaui/cards/CardWindowManagerStates.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,12 @@ class GroupState : public CardWindowManagerState

virtual void flickGestureEvent(QGestureEvent* event);
virtual void tapGestureEvent(QTapGesture* event);
virtual void tapAndHoldGestureEvent(QTapAndHoldGesture* event);

virtual void animationsFinished();
virtual void changeCardWindow(bool);
virtual void windowAdded(CardWindow* win);
virtual void windowTimedOut(CardWindow* win);

virtual void relayout(const QRectF& r, bool animate);

virtual bool handleKeyNavigation(QKeyEvent* keyEvent);

protected:
virtual void onExit(QEvent *event);
//virtual void onExit(QEvent *event);
virtual void onEntry(QEvent* event);

Q_SIGNALS:
void signalFirstCardRun();
};

// -----------------------------------------------------------------------------------
Expand Down

0 comments on commit 548d8e1

Please sign in to comment.