Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
aad98756
Commit
aad98756
authored
Jan 15, 2015
by
Matt Lowe
Browse files
Refactorings
+ added comments + refactored optimumRect
parent
e4e3a1d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/settingscache.h
View file @
aad98756
...
@@ -96,7 +96,15 @@ public:
...
@@ -96,7 +96,15 @@ public:
bool
getChatMention
()
const
{
return
chatMention
;
}
bool
getChatMention
()
const
{
return
chatMention
;
}
bool
getZoneViewSortByName
()
const
{
return
zoneViewSortByName
;
}
bool
getZoneViewSortByName
()
const
{
return
zoneViewSortByName
;
}
bool
getZoneViewSortByType
()
const
{
return
zoneViewSortByType
;
}
bool
getZoneViewSortByType
()
const
{
return
zoneViewSortByType
;
}
/**
Returns if the view should be sorted into pile view.
@return zoneViewPileView if the view should be sorted into pile view.
*/
bool
getZoneViewPileView
()
const
{
return
zoneViewPileView
;
}
bool
getZoneViewPileView
()
const
{
return
zoneViewPileView
;
}
/**
Returns if the view should be shuffled on closing.
@return zoneViewShuffle if the view should be shuffled on closing.
*/
bool
getZoneViewShuffle
()
const
{
return
zoneViewShuffle
;
}
bool
getZoneViewShuffle
()
const
{
return
zoneViewShuffle
;
}
bool
getSoundEnabled
()
const
{
return
soundEnabled
;
}
bool
getSoundEnabled
()
const
{
return
soundEnabled
;
}
QString
getSoundPath
()
const
{
return
soundPath
;
}
QString
getSoundPath
()
const
{
return
soundPath
;
}
...
...
cockatrice/src/zoneviewwidget.cpp
View file @
aad98756
...
@@ -123,6 +123,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
...
@@ -123,6 +123,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
zone
=
new
ZoneViewZone
(
player
,
_origZone
,
numberCards
,
_revealZone
,
_writeableRevealZone
,
zoneContainer
);
zone
=
new
ZoneViewZone
(
player
,
_origZone
,
numberCards
,
_revealZone
,
_writeableRevealZone
,
zoneContainer
);
connect
(
zone
,
SIGNAL
(
wheelEventReceived
(
QGraphicsSceneWheelEvent
*
)),
this
,
SLOT
(
handleWheelEvent
(
QGraphicsSceneWheelEvent
*
)));
connect
(
zone
,
SIGNAL
(
wheelEventReceived
(
QGraphicsSceneWheelEvent
*
)),
this
,
SLOT
(
handleWheelEvent
(
QGraphicsSceneWheelEvent
*
)));
// numberCard is the num of cards we want to reveal from an area. Ex: scry the top 3 cards.
// If the number is < 0 then it means that we can make the area sorted and we dont care about the order.
if
(
numberCards
<
0
)
{
if
(
numberCards
<
0
)
{
connect
(
&
sortByNameCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
processSortByName
(
int
)));
connect
(
&
sortByNameCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
processSortByName
(
int
)));
connect
(
&
sortByTypeCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
processSortByType
(
int
)));
connect
(
&
sortByTypeCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
processSortByType
(
int
)));
...
...
cockatrice/src/zoneviewzone.cpp
View file @
aad98756
...
@@ -118,10 +118,12 @@ void ZoneViewZone::reorganizeCards()
...
@@ -118,10 +118,12 @@ void ZoneViewZone::reorganizeCards()
}
}
}
}
if
(
pileView
&&
sortByType
)
qreal
aleft
=
0
;
optimumRect
=
QRectF
(
0
,
0
,
qMax
(
typeColumn
+
1
,
3
)
*
CARD_WIDTH
+
20
,
((
longestRow
-
1
)
*
CARD_HEIGHT
)
/
3
+
CARD_HEIGHT
+
60
);
qreal
atop
=
0
;
else
qreal
awidth
=
(
pileView
&&
sortByType
)
?
qMax
(
typeColumn
+
1
,
3
)
*
CARD_WIDTH
+
20
:
qMax
(
cols
,
1
)
*
CARD_WIDTH
+
20
;
optimumRect
=
QRectF
(
0
,
0
,
qMax
(
cols
,
1
)
*
CARD_WIDTH
+
20
,
((
rows
-
1
)
*
CARD_HEIGHT
)
/
3
+
CARD_HEIGHT
+
20
);
qreal
aheight
=
(
pileView
&&
sortByType
)
?
((
longestRow
-
1
)
*
CARD_HEIGHT
)
/
3
+
CARD_HEIGHT
+
60
:
((
rows
-
1
)
*
CARD_HEIGHT
)
/
3
+
CARD_HEIGHT
+
20
;
optimumRect
=
QRectF
(
aleft
,
atop
,
awidth
,
aheight
);
updateGeometry
();
updateGeometry
();
emit
optimumRectChanged
();
emit
optimumRectChanged
();
}
}
...
@@ -134,7 +136,7 @@ void ZoneViewZone::setPileViewPositions(int cardCount, CardList &cardsToDisplay,
...
@@ -134,7 +136,7 @@ void ZoneViewZone::setPileViewPositions(int cardCount, CardList &cardsToDisplay,
QString
cardType
=
c
->
getInfo
()
->
getMainCardType
();
QString
cardType
=
c
->
getInfo
()
->
getMainCardType
();
if
(
i
){
if
(
i
){
//
l
ast card and this card have a matching main type?
//
if not the first card. L
ast card and this card have a matching main type?
cardTypeMatch
=
cardType
.
compare
(
cardsToDisplay
.
at
(
i
-
1
)
->
getInfo
()
->
getMainCardType
())
==
0
?
true
:
false
;
cardTypeMatch
=
cardType
.
compare
(
cardsToDisplay
.
at
(
i
-
1
)
->
getInfo
()
->
getMainCardType
())
==
0
?
true
:
false
;
if
(
!
cardTypeMatch
)
{
// if no match then move card to next column
if
(
!
cardTypeMatch
)
{
// if no match then move card to next column
typeColumn
++
;
typeColumn
++
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment