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
8ca2135f
Commit
8ca2135f
authored
Apr 04, 2015
by
Zach
Browse files
Merge pull request #901 from poixen/left_justified_hand
Left hand justification
parents
7c6b6818
a082fbcf
Changes
6
Show whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_settings.cpp
View file @
8ca2135f
...
...
@@ -310,8 +310,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
horizontalHandCheckBox
.
setChecked
(
settingsCache
->
getHorizontalHand
());
connect
(
&
horizontalHandCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setHorizontalHand
(
int
)));
leftJustifiedHandCheckBox
.
setChecked
(
settingsCache
->
getLeftJustified
());
connect
(
&
leftJustifiedHandCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setLeftJustified
(
int
)));
QGridLayout
*
handGrid
=
new
QGridLayout
;
handGrid
->
addWidget
(
&
horizontalHandCheckBox
,
0
,
0
,
1
,
2
);
handGrid
->
addWidget
(
&
leftJustifiedHandCheckBox
,
1
,
0
,
1
,
2
);
handGroupBox
=
new
QGroupBox
;
handGroupBox
->
setLayout
(
handGrid
);
...
...
@@ -356,6 +360,7 @@ void AppearanceSettingsPage::retranslateUi()
handGroupBox
->
setTitle
(
tr
(
"Hand layout"
));
horizontalHandCheckBox
.
setText
(
tr
(
"Display hand horizontally (wastes space)"
));
leftJustifiedHandCheckBox
.
setText
(
tr
(
"Enable left justification"
));
tableGroupBox
->
setTitle
(
tr
(
"Table grid layout"
));
invertVerticalCoordinateCheckBox
.
setText
(
tr
(
"Invert vertical coordinate"
));
...
...
cockatrice/src/dlg_settings.h
View file @
8ca2135f
...
...
@@ -100,6 +100,7 @@ private:
QCheckBox
displayCardNamesCheckBox
;
QCheckBox
cardScalingCheckBox
;
QCheckBox
horizontalHandCheckBox
;
QCheckBox
leftJustifiedHandCheckBox
;
QCheckBox
invertVerticalCoordinateCheckBox
;
QGroupBox
*
zoneBgGroupBox
;
QGroupBox
*
cardsGroupBox
;
...
...
cockatrice/src/handzone.cpp
View file @
8ca2135f
...
...
@@ -88,19 +88,22 @@ void HandZone::reorganizeCards()
if
(
!
cards
.
isEmpty
())
{
const
int
cardCount
=
cards
.
size
();
if
(
settingsCache
->
getHorizontalHand
())
{
const
int
xPadding
=
5
;
qreal
totalWidth
=
boundingRect
().
width
()
-
2
*
xPadding
;
bool
leftJustified
=
settingsCache
->
getLeftJustified
();
qreal
cardWidth
=
cards
.
at
(
0
)
->
boundingRect
().
width
();
const
int
xPadding
=
leftJustified
?
cardWidth
*
1.4
:
5
;
qreal
totalWidth
=
leftJustified
?
boundingRect
().
width
()
-
(
1
*
xPadding
)
-
5
:
boundingRect
().
width
()
-
2
*
xPadding
;
for
(
int
i
=
0
;
i
<
cardCount
;
i
++
)
{
CardItem
*
c
=
cards
.
at
(
i
);
// If the total width of the cards is smaller than the available width,
// the cards do not need to overlap and are displayed in the center of the area.
if
(
cardWidth
*
cardCount
>
totalWidth
)
c
->
setPos
(
xPadding
+
((
qreal
)
i
)
*
(
totalWidth
-
cardWidth
)
/
(
cardCount
-
1
),
5
);
else
c
->
setPos
(
xPadding
+
((
qreal
)
i
)
*
cardWidth
+
(
totalWidth
-
cardCount
*
cardWidth
)
/
2
,
5
);
else
{
qreal
xPosition
=
leftJustified
?
xPadding
+
((
qreal
)
i
)
*
cardWidth
:
xPadding
+
((
qreal
)
i
)
*
cardWidth
+
(
totalWidth
-
cardCount
*
cardWidth
)
/
2
;
c
->
setPos
(
xPosition
,
5
);
}
c
->
setRealZValue
(
i
);
}
}
else
{
...
...
cockatrice/src/player.cpp
View file @
8ca2135f
...
...
@@ -115,6 +115,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
userInfo
->
CopyFrom
(
info
);
connect
(
settingsCache
,
SIGNAL
(
horizontalHandChanged
()),
this
,
SLOT
(
rearrangeZones
()));
connect
(
settingsCache
,
SIGNAL
(
handJustificationChanged
()),
this
,
SLOT
(
rearrangeZones
()));
playerArea
=
new
PlayerArea
(
this
);
...
...
cockatrice/src/settingscache.cpp
View file @
8ca2135f
...
...
@@ -77,6 +77,14 @@ SettingsCache::SettingsCache()
scaleCards
=
settings
->
value
(
"cards/scaleCards"
,
true
).
toBool
();
showMessagePopups
=
settings
->
value
(
"chat/showmessagepopups"
,
true
).
toBool
();
showMentionPopups
=
settings
->
value
(
"chat/showmentionpopups"
,
true
).
toBool
();
leftJustified
=
settings
->
value
(
"interface/leftjustified"
,
false
).
toBool
();
}
void
SettingsCache
::
setLeftJustified
(
const
int
_leftJustified
)
{
leftJustified
=
_leftJustified
;
settings
->
setValue
(
"interface/leftjustified"
,
leftJustified
);
emit
handJustificationChanged
();
}
void
SettingsCache
::
setCardScaling
(
const
int
_scaleCards
)
{
...
...
cockatrice/src/settingscache.h
View file @
8ca2135f
...
...
@@ -30,6 +30,7 @@ signals:
void
picDownloadHqChanged
();
void
displayCardNamesChanged
();
void
horizontalHandChanged
();
void
handJustificationChanged
();
void
invertVerticalCoordinateChanged
();
void
minPlayersForMultiColumnLayoutChanged
();
void
soundEnabledChanged
();
...
...
@@ -77,6 +78,7 @@ private:
bool
scaleCards
;
bool
showMessagePopups
;
bool
showMentionPopups
;
bool
leftJustified
;
public:
SettingsCache
();
const
QByteArray
&
getMainWindowGeometry
()
const
{
return
mainWindowGeometry
;
}
...
...
@@ -131,6 +133,7 @@ public:
bool
getScaleCards
()
const
{
return
scaleCards
;
}
bool
getShowMessagePopup
()
const
{
return
showMessagePopups
;
}
bool
getShowMentionPopup
()
const
{
return
showMentionPopups
;
}
bool
getLeftJustified
()
const
{
return
leftJustified
;
}
public
slots
:
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setLang
(
const
QString
&
_lang
);
...
...
@@ -178,6 +181,7 @@ public slots:
void
setCardScaling
(
const
int
_scaleCards
);
void
setShowMessagePopups
(
const
int
_showMessagePopups
);
void
setShowMentionPopups
(
const
int
_showMentionPopups
);
void
setLeftJustified
(
const
int
_leftJustified
);
};
extern
SettingsCache
*
settingsCache
;
...
...
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