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
bc7b48a7
Commit
bc7b48a7
authored
Oct 14, 2010
by
Max-Wilhelm Bruker
Browse files
new table layout with inverted y coordinate
parent
2543a5b2
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_settings.cpp
View file @
bc7b48a7
...
@@ -220,8 +220,13 @@ AppearanceSettingsPage::AppearanceSettingsPage()
...
@@ -220,8 +220,13 @@ AppearanceSettingsPage::AppearanceSettingsPage()
economicalGridCheckBox
->
setChecked
(
settingsCache
->
getEconomicalGrid
());
economicalGridCheckBox
->
setChecked
(
settingsCache
->
getEconomicalGrid
());
connect
(
economicalGridCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setEconomicalGrid
(
int
)));
connect
(
economicalGridCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setEconomicalGrid
(
int
)));
invertVerticalCoordinateCheckBox
=
new
QCheckBox
;
invertVerticalCoordinateCheckBox
->
setChecked
(
settingsCache
->
getInvertVerticalCoordinate
());
connect
(
invertVerticalCoordinateCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setInvertVerticalCoordinate
(
int
)));
QGridLayout
*
tableGrid
=
new
QGridLayout
;
QGridLayout
*
tableGrid
=
new
QGridLayout
;
tableGrid
->
addWidget
(
economicalGridCheckBox
,
0
,
0
,
1
,
2
);
tableGrid
->
addWidget
(
economicalGridCheckBox
,
0
,
0
,
1
,
2
);
tableGrid
->
addWidget
(
invertVerticalCoordinateCheckBox
,
1
,
0
,
1
,
2
);
tableGroupBox
=
new
QGroupBox
;
tableGroupBox
=
new
QGroupBox
;
tableGroupBox
->
setLayout
(
tableGrid
);
tableGroupBox
->
setLayout
(
tableGrid
);
...
@@ -247,7 +252,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
...
@@ -247,7 +252,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
mainLayout
->
addWidget
(
zoneViewGroupBox
);
mainLayout
->
addWidget
(
zoneViewGroupBox
);
setLayout
(
mainLayout
);
setLayout
(
mainLayout
);
}
}
void
AppearanceSettingsPage
::
retranslateUi
()
void
AppearanceSettingsPage
::
retranslateUi
()
...
@@ -263,6 +267,7 @@ void AppearanceSettingsPage::retranslateUi()
...
@@ -263,6 +267,7 @@ void AppearanceSettingsPage::retranslateUi()
tableGroupBox
->
setTitle
(
tr
(
"Table grid layout"
));
tableGroupBox
->
setTitle
(
tr
(
"Table grid layout"
));
economicalGridCheckBox
->
setText
(
tr
(
"Economical layout"
));
economicalGridCheckBox
->
setText
(
tr
(
"Economical layout"
));
invertVerticalCoordinateCheckBox
->
setText
(
tr
(
"Invert vertical coordinate"
));
zoneViewGroupBox
->
setTitle
(
tr
(
"Zone view layout"
));
zoneViewGroupBox
->
setTitle
(
tr
(
"Zone view layout"
));
zoneViewSortByNameCheckBox
->
setText
(
tr
(
"Sort by name"
));
zoneViewSortByNameCheckBox
->
setText
(
tr
(
"Sort by name"
));
...
...
cockatrice/src/dlg_settings.h
View file @
bc7b48a7
...
@@ -64,7 +64,7 @@ signals:
...
@@ -64,7 +64,7 @@ signals:
private:
private:
QLabel
*
handBgLabel
,
*
tableBgLabel
,
*
playerAreaBgLabel
,
*
cardBackPicturePathLabel
;
QLabel
*
handBgLabel
,
*
tableBgLabel
,
*
playerAreaBgLabel
,
*
cardBackPicturePathLabel
;
QLineEdit
*
handBgEdit
,
*
tableBgEdit
,
*
playerAreaBgEdit
,
*
cardBackPicturePathEdit
;
QLineEdit
*
handBgEdit
,
*
tableBgEdit
,
*
playerAreaBgEdit
,
*
cardBackPicturePathEdit
;
QCheckBox
*
horizontalHandCheckBox
,
*
economicalGridCheckBox
,
*
zoneViewSortByNameCheckBox
,
*
zoneViewSortByTypeCheckBox
;
QCheckBox
*
horizontalHandCheckBox
,
*
economicalGridCheckBox
,
*
invertVerticalCoordinateCheckBox
,
*
zoneViewSortByNameCheckBox
,
*
zoneViewSortByTypeCheckBox
;
QGroupBox
*
zoneBgGroupBox
,
*
handGroupBox
,
*
tableGroupBox
,
*
zoneViewGroupBox
;
QGroupBox
*
zoneBgGroupBox
,
*
handGroupBox
,
*
tableGroupBox
,
*
zoneViewGroupBox
;
public:
public:
AppearanceSettingsPage
();
AppearanceSettingsPage
();
...
...
cockatrice/src/settingscache.cpp
View file @
bc7b48a7
...
@@ -21,6 +21,7 @@ SettingsCache::SettingsCache()
...
@@ -21,6 +21,7 @@ SettingsCache::SettingsCache()
cardInfoMinimized
=
settings
->
value
(
"interface/cardinfominimized"
,
false
).
toBool
();
cardInfoMinimized
=
settings
->
value
(
"interface/cardinfominimized"
,
false
).
toBool
();
horizontalHand
=
settings
->
value
(
"hand/horizontal"
,
false
).
toBool
();
horizontalHand
=
settings
->
value
(
"hand/horizontal"
,
false
).
toBool
();
economicalGrid
=
settings
->
value
(
"table/economic"
,
false
).
toBool
();
economicalGrid
=
settings
->
value
(
"table/economic"
,
false
).
toBool
();
invertVerticalCoordinate
=
settings
->
value
(
"table/invert_vertical"
,
false
).
toBool
();
tapAnimation
=
settings
->
value
(
"cards/tapanimation"
,
true
).
toBool
();
tapAnimation
=
settings
->
value
(
"cards/tapanimation"
,
true
).
toBool
();
zoneViewSortByName
=
settings
->
value
(
"zoneview/sortbyname"
,
false
).
toBool
();
zoneViewSortByName
=
settings
->
value
(
"zoneview/sortbyname"
,
false
).
toBool
();
...
@@ -115,6 +116,13 @@ void SettingsCache::setEconomicalGrid(int _economicalGrid)
...
@@ -115,6 +116,13 @@ void SettingsCache::setEconomicalGrid(int _economicalGrid)
emit
economicalGridChanged
();
emit
economicalGridChanged
();
}
}
void
SettingsCache
::
setInvertVerticalCoordinate
(
int
_invertVerticalCoordinate
)
{
invertVerticalCoordinate
=
_invertVerticalCoordinate
;
settings
->
setValue
(
"table/invert_vertical"
,
invertVerticalCoordinate
);
emit
invertVerticalCoordinateChanged
();
}
void
SettingsCache
::
setTapAnimation
(
int
_tapAnimation
)
void
SettingsCache
::
setTapAnimation
(
int
_tapAnimation
)
{
{
tapAnimation
=
_tapAnimation
;
tapAnimation
=
_tapAnimation
;
...
...
cockatrice/src/settingscache.h
View file @
bc7b48a7
...
@@ -18,6 +18,7 @@ signals:
...
@@ -18,6 +18,7 @@ signals:
void
picDownloadChanged
();
void
picDownloadChanged
();
void
horizontalHandChanged
();
void
horizontalHandChanged
();
void
economicalGridChanged
();
void
economicalGridChanged
();
void
invertVerticalCoordinateChanged
();
private:
private:
QSettings
*
settings
;
QSettings
*
settings
;
...
@@ -29,6 +30,7 @@ private:
...
@@ -29,6 +30,7 @@ private:
bool
cardInfoMinimized
;
bool
cardInfoMinimized
;
bool
horizontalHand
;
bool
horizontalHand
;
bool
economicalGrid
;
bool
economicalGrid
;
bool
invertVerticalCoordinate
;
bool
tapAnimation
;
bool
tapAnimation
;
bool
zoneViewSortByName
,
zoneViewSortByType
;
bool
zoneViewSortByName
,
zoneViewSortByType
;
public:
public:
...
@@ -46,6 +48,7 @@ public:
...
@@ -46,6 +48,7 @@ public:
bool
getCardInfoMinimized
()
const
{
return
cardInfoMinimized
;
}
bool
getCardInfoMinimized
()
const
{
return
cardInfoMinimized
;
}
bool
getHorizontalHand
()
const
{
return
horizontalHand
;
}
bool
getHorizontalHand
()
const
{
return
horizontalHand
;
}
bool
getEconomicalGrid
()
const
{
return
economicalGrid
;
}
bool
getEconomicalGrid
()
const
{
return
economicalGrid
;
}
bool
getInvertVerticalCoordinate
()
const
{
return
invertVerticalCoordinate
;
}
bool
getTapAnimation
()
const
{
return
tapAnimation
;
}
bool
getTapAnimation
()
const
{
return
tapAnimation
;
}
bool
getZoneViewSortByName
()
const
{
return
zoneViewSortByName
;
}
bool
getZoneViewSortByName
()
const
{
return
zoneViewSortByName
;
}
bool
getZoneViewSortByType
()
const
{
return
zoneViewSortByType
;
}
bool
getZoneViewSortByType
()
const
{
return
zoneViewSortByType
;
}
...
@@ -63,6 +66,7 @@ public slots:
...
@@ -63,6 +66,7 @@ public slots:
void
setCardInfoMinimized
(
bool
_cardInfoMinimized
);
void
setCardInfoMinimized
(
bool
_cardInfoMinimized
);
void
setHorizontalHand
(
int
_horizontalHand
);
void
setHorizontalHand
(
int
_horizontalHand
);
void
setEconomicalGrid
(
int
_economicalGrid
);
void
setEconomicalGrid
(
int
_economicalGrid
);
void
setInvertVerticalCoordinate
(
int
_invertVerticalCoordinate
);
void
setTapAnimation
(
int
_tapAnimation
);
void
setTapAnimation
(
int
_tapAnimation
);
void
setZoneViewSortByName
(
int
_zoneViewSortByName
);
void
setZoneViewSortByName
(
int
_zoneViewSortByName
);
void
setZoneViewSortByType
(
int
_zoneViewSortByType
);
void
setZoneViewSortByType
(
int
_zoneViewSortByType
);
...
...
cockatrice/src/tablezone.cpp
View file @
bc7b48a7
...
@@ -13,6 +13,7 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
...
@@ -13,6 +13,7 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
{
{
connect
(
settingsCache
,
SIGNAL
(
tableBgPathChanged
()),
this
,
SLOT
(
updateBgPixmap
()));
connect
(
settingsCache
,
SIGNAL
(
tableBgPathChanged
()),
this
,
SLOT
(
updateBgPixmap
()));
connect
(
settingsCache
,
SIGNAL
(
economicalGridChanged
()),
this
,
SLOT
(
reorganizeCards
()));
connect
(
settingsCache
,
SIGNAL
(
economicalGridChanged
()),
this
,
SLOT
(
reorganizeCards
()));
connect
(
settingsCache
,
SIGNAL
(
invertVerticalCoordinateChanged
()),
this
,
SLOT
(
reorganizeCards
()));
updateBgPixmap
();
updateBgPixmap
();
if
(
settingsCache
->
getEconomicalGrid
())
if
(
settingsCache
->
getEconomicalGrid
())
...
@@ -39,6 +40,11 @@ QRectF TableZone::boundingRect() const
...
@@ -39,6 +40,11 @@ QRectF TableZone::boundingRect() const
return
QRectF
(
0
,
0
,
width
,
height
);
return
QRectF
(
0
,
0
,
width
,
height
);
}
}
bool
TableZone
::
isInverted
()
const
{
return
((
player
->
getMirrored
()
&&
!
settingsCache
->
getInvertVerticalCoordinate
())
||
(
!
player
->
getMirrored
()
&&
settingsCache
->
getInvertVerticalCoordinate
()));
}
void
TableZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
void
TableZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
{
{
if
(
bgPixmap
.
isNull
())
if
(
bgPixmap
.
isNull
())
...
@@ -47,7 +53,7 @@ void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*optio
...
@@ -47,7 +53,7 @@ void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*optio
painter
->
fillRect
(
boundingRect
(),
QBrush
(
bgPixmap
));
painter
->
fillRect
(
boundingRect
(),
QBrush
(
bgPixmap
));
painter
->
setPen
(
QColor
(
255
,
255
,
255
,
40
));
painter
->
setPen
(
QColor
(
255
,
255
,
255
,
40
));
qreal
separatorY
=
3
*
(
CARD_HEIGHT
+
paddingY
)
+
boxLineWidth
-
paddingY
/
2
;
qreal
separatorY
=
3
*
(
CARD_HEIGHT
+
paddingY
)
+
boxLineWidth
-
paddingY
/
2
;
if
(
player
->
getMirror
ed
())
if
(
isInvert
ed
())
separatorY
=
height
-
separatorY
;
separatorY
=
height
-
separatorY
;
painter
->
drawLine
(
QPointF
(
0
,
separatorY
),
QPointF
(
width
,
separatorY
));
painter
->
drawLine
(
QPointF
(
0
,
separatorY
),
QPointF
(
width
,
separatorY
));
...
@@ -220,7 +226,7 @@ QPointF TableZone::mapFromGrid(const QPoint &gridPoint) const
...
@@ -220,7 +226,7 @@ QPointF TableZone::mapFromGrid(const QPoint &gridPoint) const
y
=
boxLineWidth
+
(
CARD_HEIGHT
+
paddingY
)
*
gridPoint
.
y
();
y
=
boxLineWidth
+
(
CARD_HEIGHT
+
paddingY
)
*
gridPoint
.
y
();
}
}
if
(
player
->
getMirror
ed
())
if
(
isInvert
ed
())
y
=
height
-
CARD_HEIGHT
-
y
;
y
=
height
-
CARD_HEIGHT
-
y
;
return
QPointF
(
x
,
y
);
return
QPointF
(
x
,
y
);
...
@@ -230,7 +236,7 @@ QPoint TableZone::mapToGrid(const QPointF &mapPoint) const
...
@@ -230,7 +236,7 @@ QPoint TableZone::mapToGrid(const QPointF &mapPoint) const
{
{
qreal
x
=
mapPoint
.
x
()
-
marginX
;
qreal
x
=
mapPoint
.
x
()
-
marginX
;
qreal
y
=
mapPoint
.
y
();
qreal
y
=
mapPoint
.
y
();
if
(
player
->
getMirror
ed
())
if
(
isInvert
ed
())
y
=
height
-
y
;
y
=
height
-
y
;
y
+=
paddingY
/
2
-
boxLineWidth
;
y
+=
paddingY
/
2
-
boxLineWidth
;
...
...
cockatrice/src/tablezone.h
View file @
bc7b48a7
...
@@ -18,6 +18,7 @@ private:
...
@@ -18,6 +18,7 @@ private:
int
currentMinimumWidth
;
int
currentMinimumWidth
;
QPixmap
bgPixmap
;
QPixmap
bgPixmap
;
bool
active
;
bool
active
;
bool
isInverted
()
const
;
private
slots
:
private
slots
:
void
updateBgPixmap
();
void
updateBgPixmap
();
public
slots
:
public
slots
:
...
...
cockatrice/translations/cockatrice_de.ts
View file @
bc7b48a7
This diff is collapsed.
Click to expand it.
cockatrice/translations/cockatrice_en.ts
View file @
bc7b48a7
This diff is collapsed.
Click to expand it.
cockatrice/translations/cockatrice_es.ts
View file @
bc7b48a7
This diff is collapsed.
Click to expand it.
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