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
4a34c52c
Commit
4a34c52c
authored
Feb 11, 2011
by
Max-Wilhelm Bruker
Browse files
optionally display card names on cards even if they have a picture
parent
8ccde614
Changes
5
Show whitespace changes
Inline
Side-by-side
cockatrice/src/abstractcarditem.cpp
View file @
4a34c52c
...
@@ -20,6 +20,7 @@ AbstractCardItem::AbstractCardItem(const QString &_name, Player *_owner, QGraphi
...
@@ -20,6 +20,7 @@ AbstractCardItem::AbstractCardItem(const QString &_name, Player *_owner, QGraphi
setCacheMode
(
DeviceCoordinateCache
);
setCacheMode
(
DeviceCoordinateCache
);
connect
(
info
,
SIGNAL
(
pixmapUpdated
()),
this
,
SLOT
(
pixmapUpdated
()));
connect
(
info
,
SIGNAL
(
pixmapUpdated
()),
this
,
SLOT
(
pixmapUpdated
()));
connect
(
settingsCache
,
SIGNAL
(
displayCardNamesChanged
()),
this
,
SLOT
(
update
()));
animationTimer
=
new
QTimer
(
this
);
animationTimer
=
new
QTimer
(
this
);
animationTimer
->
setSingleShot
(
false
);
animationTimer
->
setSingleShot
(
false
);
...
@@ -68,9 +69,11 @@ void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &transla
...
@@ -68,9 +69,11 @@ void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &transla
painter
->
setTransform
(
pixmapTransform
);
painter
->
setTransform
(
pixmapTransform
);
QFont
f
;
QFont
f
;
int
fontSize
=
translatedSize
.
height
()
/
6
;
int
fontSize
=
translatedSize
.
height
()
/
8
;
if
(
fontSize
<
9
)
if
(
fontSize
<
9
)
fontSize
=
9
;
fontSize
=
9
;
if
(
fontSize
>
12
)
fontSize
=
12
;
f
.
setPixelSize
(
fontSize
);
f
.
setPixelSize
(
fontSize
);
painter
->
setFont
(
f
);
painter
->
setFont
(
f
);
}
}
...
@@ -120,11 +123,18 @@ void AbstractCardItem::paintPicture(QPainter *painter, int angle)
...
@@ -120,11 +123,18 @@ void AbstractCardItem::paintPicture(QPainter *painter, int angle)
pen
.
setWidth
(
2
);
pen
.
setWidth
(
2
);
painter
->
setPen
(
pen
);
painter
->
setPen
(
pen
);
painter
->
drawRect
(
QRectF
(
1
,
1
,
CARD_WIDTH
-
2
,
CARD_HEIGHT
-
2
));
painter
->
drawRect
(
QRectF
(
1
,
1
,
CARD_WIDTH
-
2
,
CARD_HEIGHT
-
2
));
}
painter
->
restore
();
if
(
!
translatedPixmap
||
settingsCache
->
getDisplayCardNames
())
{
painter
->
save
();
transformPainter
(
painter
,
translatedSize
,
angle
);
transformPainter
(
painter
,
translatedSize
,
angle
);
painter
->
setPen
(
textColor
);
painter
->
setPen
(
Qt
::
white
);
painter
->
drawText
(
QRectF
(
4
*
scaleFactor
,
4
*
scaleFactor
,
translatedSize
.
width
()
-
8
*
scaleFactor
,
translatedSize
.
height
()
-
8
*
scaleFactor
),
Qt
::
AlignTop
|
Qt
::
AlignLeft
|
Qt
::
TextWrapAnywhere
,
name
);
painter
->
setBackground
(
Qt
::
black
);
painter
->
setBackgroundMode
(
Qt
::
OpaqueMode
);
painter
->
drawText
(
QRectF
(
3
*
scaleFactor
,
3
*
scaleFactor
,
translatedSize
.
width
()
-
6
*
scaleFactor
,
translatedSize
.
height
()
-
6
*
scaleFactor
),
Qt
::
AlignTop
|
Qt
::
AlignLeft
|
Qt
::
TextWrapAnywhere
,
name
);
}
}
painter
->
restore
();
painter
->
restore
();
}
}
...
...
cockatrice/src/dlg_settings.cpp
View file @
4a34c52c
...
@@ -218,6 +218,16 @@ AppearanceSettingsPage::AppearanceSettingsPage()
...
@@ -218,6 +218,16 @@ AppearanceSettingsPage::AppearanceSettingsPage()
zoneBgGroupBox
=
new
QGroupBox
;
zoneBgGroupBox
=
new
QGroupBox
;
zoneBgGroupBox
->
setLayout
(
zoneBgGrid
);
zoneBgGroupBox
->
setLayout
(
zoneBgGrid
);
displayCardNamesCheckBox
=
new
QCheckBox
;
displayCardNamesCheckBox
->
setChecked
(
settingsCache
->
getDisplayCardNames
());
connect
(
displayCardNamesCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setDisplayCardNames
(
int
)));
QGridLayout
*
cardsGrid
=
new
QGridLayout
;
cardsGrid
->
addWidget
(
displayCardNamesCheckBox
,
0
,
0
,
1
,
2
);
cardsGroupBox
=
new
QGroupBox
;
cardsGroupBox
->
setLayout
(
cardsGrid
);
horizontalHandCheckBox
=
new
QCheckBox
;
horizontalHandCheckBox
=
new
QCheckBox
;
horizontalHandCheckBox
->
setChecked
(
settingsCache
->
getHorizontalHand
());
horizontalHandCheckBox
->
setChecked
(
settingsCache
->
getHorizontalHand
());
connect
(
horizontalHandCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setHorizontalHand
(
int
)));
connect
(
horizontalHandCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setHorizontalHand
(
int
)));
...
@@ -254,6 +264,7 @@ AppearanceSettingsPage::AppearanceSettingsPage()
...
@@ -254,6 +264,7 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
mainLayout
->
addWidget
(
zoneBgGroupBox
);
mainLayout
->
addWidget
(
zoneBgGroupBox
);
mainLayout
->
addWidget
(
cardsGroupBox
);
mainLayout
->
addWidget
(
handGroupBox
);
mainLayout
->
addWidget
(
handGroupBox
);
mainLayout
->
addWidget
(
tableGroupBox
);
mainLayout
->
addWidget
(
tableGroupBox
);
mainLayout
->
addWidget
(
zoneViewGroupBox
);
mainLayout
->
addWidget
(
zoneViewGroupBox
);
...
@@ -270,6 +281,9 @@ void AppearanceSettingsPage::retranslateUi()
...
@@ -270,6 +281,9 @@ void AppearanceSettingsPage::retranslateUi()
playerAreaBgLabel
->
setText
(
tr
(
"Path to player info background:"
));
playerAreaBgLabel
->
setText
(
tr
(
"Path to player info background:"
));
cardBackPicturePathLabel
->
setText
(
tr
(
"Path to picture of card back:"
));
cardBackPicturePathLabel
->
setText
(
tr
(
"Path to picture of card back:"
));
cardsGroupBox
->
setTitle
(
tr
(
"Card rendering"
));
displayCardNamesCheckBox
->
setText
(
tr
(
"Display card names on cards having a picture"
));
handGroupBox
->
setTitle
(
tr
(
"Hand layout"
));
handGroupBox
->
setTitle
(
tr
(
"Hand layout"
));
horizontalHandCheckBox
->
setText
(
tr
(
"Display hand horizontally (wastes space)"
));
horizontalHandCheckBox
->
setText
(
tr
(
"Display hand horizontally (wastes space)"
));
...
@@ -468,8 +482,8 @@ DlgSettings::DlgSettings(QWidget *parent)
...
@@ -468,8 +482,8 @@ DlgSettings::DlgSettings(QWidget *parent)
contentsWidget
->
setViewMode
(
QListView
::
IconMode
);
contentsWidget
->
setViewMode
(
QListView
::
IconMode
);
contentsWidget
->
setIconSize
(
QSize
(
96
,
84
));
contentsWidget
->
setIconSize
(
QSize
(
96
,
84
));
contentsWidget
->
setMovement
(
QListView
::
Static
);
contentsWidget
->
setMovement
(
QListView
::
Static
);
contentsWidget
->
setMinimumWidth
(
1
15
);
contentsWidget
->
setMinimumWidth
(
1
30
);
contentsWidget
->
setMaximumWidth
(
1
3
0
);
contentsWidget
->
setMaximumWidth
(
1
5
0
);
contentsWidget
->
setSpacing
(
12
);
contentsWidget
->
setSpacing
(
12
);
pagesWidget
=
new
QStackedWidget
;
pagesWidget
=
new
QStackedWidget
;
...
@@ -500,7 +514,7 @@ DlgSettings::DlgSettings(QWidget *parent)
...
@@ -500,7 +514,7 @@ DlgSettings::DlgSettings(QWidget *parent)
retranslateUi
();
retranslateUi
();
resize
(
7
00
,
450
);
resize
(
8
00
,
450
);
}
}
void
DlgSettings
::
createIcons
()
void
DlgSettings
::
createIcons
()
...
...
cockatrice/src/dlg_settings.h
View file @
4a34c52c
...
@@ -67,8 +67,8 @@ signals:
...
@@ -67,8 +67,8 @@ signals:
private:
private:
QLabel
*
handBgLabel
,
*
stackBgLabel
,
*
tableBgLabel
,
*
playerAreaBgLabel
,
*
cardBackPicturePathLabel
;
QLabel
*
handBgLabel
,
*
stackBgLabel
,
*
tableBgLabel
,
*
playerAreaBgLabel
,
*
cardBackPicturePathLabel
;
QLineEdit
*
handBgEdit
,
*
stackBgEdit
,
*
tableBgEdit
,
*
playerAreaBgEdit
,
*
cardBackPicturePathEdit
;
QLineEdit
*
handBgEdit
,
*
stackBgEdit
,
*
tableBgEdit
,
*
playerAreaBgEdit
,
*
cardBackPicturePathEdit
;
QCheckBox
*
horizontalHandCheckBox
,
*
invertVerticalCoordinateCheckBox
,
*
zoneViewSortByNameCheckBox
,
*
zoneViewSortByTypeCheckBox
;
QCheckBox
*
displayCardNamesCheckBox
,
*
horizontalHandCheckBox
,
*
invertVerticalCoordinateCheckBox
,
*
zoneViewSortByNameCheckBox
,
*
zoneViewSortByTypeCheckBox
;
QGroupBox
*
zoneBgGroupBox
,
*
handGroupBox
,
*
tableGroupBox
,
*
zoneViewGroupBox
;
QGroupBox
*
zoneBgGroupBox
,
*
cardsGroupBox
,
*
handGroupBox
,
*
tableGroupBox
,
*
zoneViewGroupBox
;
public:
public:
AppearanceSettingsPage
();
AppearanceSettingsPage
();
void
retranslateUi
();
void
retranslateUi
();
...
...
cockatrice/src/settingscache.cpp
View file @
4a34c52c
...
@@ -20,6 +20,7 @@ SettingsCache::SettingsCache()
...
@@ -20,6 +20,7 @@ SettingsCache::SettingsCache()
picDownload
=
settings
->
value
(
"personal/picturedownload"
,
true
).
toBool
();
picDownload
=
settings
->
value
(
"personal/picturedownload"
,
true
).
toBool
();
doubleClickToPlay
=
settings
->
value
(
"interface/doubleclicktoplay"
,
true
).
toBool
();
doubleClickToPlay
=
settings
->
value
(
"interface/doubleclicktoplay"
,
true
).
toBool
();
cardInfoMinimized
=
settings
->
value
(
"interface/cardinfominimized"
,
false
).
toBool
();
cardInfoMinimized
=
settings
->
value
(
"interface/cardinfominimized"
,
false
).
toBool
();
displayCardNames
=
settings
->
value
(
"cards/displaycardnames"
,
true
).
toBool
();
horizontalHand
=
settings
->
value
(
"hand/horizontal"
,
true
).
toBool
();
horizontalHand
=
settings
->
value
(
"hand/horizontal"
,
true
).
toBool
();
invertVerticalCoordinate
=
settings
->
value
(
"table/invert_vertical"
,
false
).
toBool
();
invertVerticalCoordinate
=
settings
->
value
(
"table/invert_vertical"
,
false
).
toBool
();
tapAnimation
=
settings
->
value
(
"cards/tapanimation"
,
true
).
toBool
();
tapAnimation
=
settings
->
value
(
"cards/tapanimation"
,
true
).
toBool
();
...
@@ -109,6 +110,13 @@ void SettingsCache::setCardInfoMinimized(bool _cardInfoMinimized)
...
@@ -109,6 +110,13 @@ void SettingsCache::setCardInfoMinimized(bool _cardInfoMinimized)
settings
->
setValue
(
"interface/cardinfominimized"
,
cardInfoMinimized
);
settings
->
setValue
(
"interface/cardinfominimized"
,
cardInfoMinimized
);
}
}
void
SettingsCache
::
setDisplayCardNames
(
int
_displayCardNames
)
{
displayCardNames
=
_displayCardNames
;
settings
->
setValue
(
"cards/displaycardnames"
,
displayCardNames
);
emit
displayCardNamesChanged
();
}
void
SettingsCache
::
setHorizontalHand
(
int
_horizontalHand
)
void
SettingsCache
::
setHorizontalHand
(
int
_horizontalHand
)
{
{
horizontalHand
=
_horizontalHand
;
horizontalHand
=
_horizontalHand
;
...
...
cockatrice/src/settingscache.h
View file @
4a34c52c
...
@@ -17,6 +17,7 @@ signals:
...
@@ -17,6 +17,7 @@ signals:
void
playerBgPathChanged
();
void
playerBgPathChanged
();
void
cardBackPicturePathChanged
();
void
cardBackPicturePathChanged
();
void
picDownloadChanged
();
void
picDownloadChanged
();
void
displayCardNamesChanged
();
void
horizontalHandChanged
();
void
horizontalHandChanged
();
void
invertVerticalCoordinateChanged
();
void
invertVerticalCoordinateChanged
();
private:
private:
...
@@ -28,6 +29,7 @@ private:
...
@@ -28,6 +29,7 @@ private:
bool
picDownload
;
bool
picDownload
;
bool
doubleClickToPlay
;
bool
doubleClickToPlay
;
bool
cardInfoMinimized
;
bool
cardInfoMinimized
;
bool
displayCardNames
;
bool
horizontalHand
;
bool
horizontalHand
;
bool
invertVerticalCoordinate
;
bool
invertVerticalCoordinate
;
bool
tapAnimation
;
bool
tapAnimation
;
...
@@ -46,6 +48,7 @@ public:
...
@@ -46,6 +48,7 @@ public:
bool
getPicDownload
()
const
{
return
picDownload
;
}
bool
getPicDownload
()
const
{
return
picDownload
;
}
bool
getDoubleClickToPlay
()
const
{
return
doubleClickToPlay
;
}
bool
getDoubleClickToPlay
()
const
{
return
doubleClickToPlay
;
}
bool
getCardInfoMinimized
()
const
{
return
cardInfoMinimized
;
}
bool
getCardInfoMinimized
()
const
{
return
cardInfoMinimized
;
}
bool
getDisplayCardNames
()
const
{
return
displayCardNames
;
}
bool
getHorizontalHand
()
const
{
return
horizontalHand
;
}
bool
getHorizontalHand
()
const
{
return
horizontalHand
;
}
bool
getInvertVerticalCoordinate
()
const
{
return
invertVerticalCoordinate
;
}
bool
getInvertVerticalCoordinate
()
const
{
return
invertVerticalCoordinate
;
}
bool
getTapAnimation
()
const
{
return
tapAnimation
;
}
bool
getTapAnimation
()
const
{
return
tapAnimation
;
}
...
@@ -64,6 +67,7 @@ public slots:
...
@@ -64,6 +67,7 @@ public slots:
void
setPicDownload
(
int
_picDownload
);
void
setPicDownload
(
int
_picDownload
);
void
setDoubleClickToPlay
(
int
_doubleClickToPlay
);
void
setDoubleClickToPlay
(
int
_doubleClickToPlay
);
void
setCardInfoMinimized
(
bool
_cardInfoMinimized
);
void
setCardInfoMinimized
(
bool
_cardInfoMinimized
);
void
setDisplayCardNames
(
int
_displayCardNames
);
void
setHorizontalHand
(
int
_horizontalHand
);
void
setHorizontalHand
(
int
_horizontalHand
);
void
setInvertVerticalCoordinate
(
int
_invertVerticalCoordinate
);
void
setInvertVerticalCoordinate
(
int
_invertVerticalCoordinate
);
void
setTapAnimation
(
int
_tapAnimation
);
void
setTapAnimation
(
int
_tapAnimation
);
...
...
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