Skip to content

Commit

Permalink
Rename LayoutMode to CardArranger
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Palmer committed Sep 19, 2012
1 parent fc3e890 commit 756c745
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
26 changes: 15 additions & 11 deletions Src/lunaui/cards/CardGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CardGroup::CardGroup(qreal curScale, qreal nonCurScale)
, m_rightWidth(0)
, m_activeCard(0)
, m_currentPosition(0)
, m_layoutMode(0)
, m_cardArranger(0)
, m_miniScale(1.0)
{
m_cardGroupRotFactor = Settings::LunaSettings()->cardGroupRotFactor;
Expand Down Expand Up @@ -739,8 +739,9 @@ QVector<CardWindow::Position> CardGroup::calculateOpenedPositions(qreal xOffset)
{
qreal x;

switch(m_layoutMode) {
case LayoutMode(Stack):
switch(m_cardArranger) {
//Minimized
case CardArranger(Stack):
{
x = ((i - m_currentPosition) / 3.0) * activeCardWidth * m_cardGroupXDistanceFactor;

Expand All @@ -761,7 +762,8 @@ QVector<CardWindow::Position> CardGroup::calculateOpenedPositions(qreal xOffset)

break;
}
case LayoutMode(Linear):
//Maximized
case CardArranger(Linear):
{
if(m_cards.size() > 1)
x = (i-m_cards.indexOf(m_activeCard)) * (m_activeCard->boundingRect().width() + Settings::LunaSettings()->gapBetweenCardGroups);
Expand All @@ -780,7 +782,8 @@ QVector<CardWindow::Position> CardGroup::calculateOpenedPositions(qreal xOffset)

break;
}
case LayoutMode(Minimize):
//Minimize Gesture
case CardArranger(Minimize):
{
x = (i - m_cards.indexOf(m_activeCard)) //Starting point - active card should always be at 0
* (m_activeCard->boundingRect().width() + Settings::LunaSettings()->gapBetweenCardGroups) //Card x difference
Expand All @@ -802,7 +805,8 @@ QVector<CardWindow::Position> CardGroup::calculateOpenedPositions(qreal xOffset)

break;
}
case LayoutMode(Tab):
//Tabbed Cards
case CardArranger(Tab):
{
break;
}
Expand Down Expand Up @@ -833,16 +837,16 @@ QVector<CardWindow::Position> CardGroup::calculateClosedPositions()
{
positions[i].trans.setX(xOff);

switch(m_layoutMode)
switch(m_cardArranger)
{
case LayoutMode(Stack):
case LayoutMode(Linear):
case CardArranger(Stack):
case CardArranger(Linear):
positions[i].trans.setZ(m_nonCurScale * m_miniScale);
break;
case LayoutMode(Minimize):
case CardArranger(Minimize):
positions[i].trans.setZ(1.0);
break;
case LayoutMode(Tab):
case CardArranger(Tab):
break;
}

Expand Down
8 changes: 4 additions & 4 deletions Src/lunaui/cards/CardGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class QPropertyAnimation;
QT_END_NAMESPACE

enum LayoutMode {
enum CardArranger {
Stack = 0, //Default minimized behaviour
Linear, //No overlap between cards
Minimize, //Minimize gesture
Expand Down Expand Up @@ -171,8 +171,8 @@ class CardGroup : public QObject
qreal xDistanceFactor() const { return m_cardGroupXDistanceFactor; }
void setXDistanceFactor(const qreal xDistanceFactor) { m_cardGroupXDistanceFactor = xDistanceFactor; }

int layoutMode() const { return m_layoutMode; }
void setLayoutMode(int layoutMode) { m_layoutMode = layoutMode; }
int cardArranger() const { return m_cardArranger; }
void setCardArranger(int cardArranger) { m_cardArranger = cardArranger; }

qreal miniScale() const { return m_miniScale; }
void setMiniScale(qreal scale) { m_miniScale = scale; }
Expand Down Expand Up @@ -206,7 +206,7 @@ class CardGroup : public QObject
// 1: 3-4 cards with the second card being the center of the group
// N: >4 cards where valid positions are between 1.0 and N - 4 + 1
qreal m_currentPosition;
int m_layoutMode;
int m_cardArranger;
qreal m_miniScale;
};

Expand Down
6 changes: 3 additions & 3 deletions Src/lunaui/cards/CardWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ void CardWindowManager::prepareAddWindowSibling(CardWindow* win)
if(m_activeGroup)
{
newGroup->setMiniScale(m_activeGroup->miniScale());
newGroup->setLayoutMode(m_activeGroup->layoutMode());
newGroup->setCardArranger(m_activeGroup->cardArranger());
}
newGroup->addToGroup(win);
m_groups.insert(m_groups.indexOf(m_activeGroup)+1, newGroup);
Expand Down Expand Up @@ -2478,14 +2478,14 @@ void CardWindowManager::setActiveGroup(CardGroup* group)
void CardWindowManager::setGroupsStack()
{
for (int i=0; i<m_groups.size();i++) {
m_groups[i]->setLayoutMode(LayoutMode(Stack));
m_groups[i]->setCardArranger(CardArranger(Tab));
}
}

void CardWindowManager::setGroupsLinear()
{
for (int i=0; i<m_groups.size();i++) {
m_groups[i]->setLayoutMode(LayoutMode(Linear));
m_groups[i]->setCardArranger(CardArranger(Linear));
}
}

Expand Down

0 comments on commit 756c745

Please sign in to comment.