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
7c06d6d8
Commit
7c06d6d8
authored
Sep 01, 2009
by
Max-Wilhelm Bruker
Browse files
zone background textures
parent
af605ab1
Changes
8
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_settings.cpp
View file @
7c06d6d8
...
@@ -191,12 +191,93 @@ void GeneralSettingsPage::retranslateUi()
...
@@ -191,12 +191,93 @@ void GeneralSettingsPage::retranslateUi()
AppearanceSettingsPage
::
AppearanceSettingsPage
()
AppearanceSettingsPage
::
AppearanceSettingsPage
()
{
{
zoneBgGroupBox
=
new
QGroupBox
;
QSettings
settings
;
settings
.
beginGroup
(
"zonebg"
);
handBgLabel
=
new
QLabel
;
handBgEdit
=
new
QLineEdit
(
settings
.
value
(
"hand"
).
toString
());
handBgEdit
->
setReadOnly
(
true
);
QPushButton
*
handBgButton
=
new
QPushButton
(
"..."
);
connect
(
handBgButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
handBgButtonClicked
()));
tableBgLabel
=
new
QLabel
;
tableBgEdit
=
new
QLineEdit
(
settings
.
value
(
"table"
).
toString
());
tableBgEdit
->
setReadOnly
(
true
);
QPushButton
*
tableBgButton
=
new
QPushButton
(
"..."
);
connect
(
tableBgButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
tableBgButtonClicked
()));
playerAreaBgLabel
=
new
QLabel
;
playerAreaBgEdit
=
new
QLineEdit
(
settings
.
value
(
"carddatabase"
).
toString
());
playerAreaBgEdit
->
setReadOnly
(
true
);
QPushButton
*
playerAreaBgButton
=
new
QPushButton
(
"..."
);
connect
(
playerAreaBgButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
playerAreaBgButtonClicked
()));
QGridLayout
*
zoneBgGrid
=
new
QGridLayout
;
zoneBgGrid
->
addWidget
(
handBgLabel
,
0
,
0
);
zoneBgGrid
->
addWidget
(
handBgEdit
,
0
,
1
);
zoneBgGrid
->
addWidget
(
handBgButton
,
0
,
2
);
zoneBgGrid
->
addWidget
(
tableBgLabel
,
1
,
0
);
zoneBgGrid
->
addWidget
(
tableBgEdit
,
1
,
1
);
zoneBgGrid
->
addWidget
(
tableBgButton
,
1
,
2
);
zoneBgGrid
->
addWidget
(
playerAreaBgLabel
,
2
,
0
);
zoneBgGrid
->
addWidget
(
playerAreaBgEdit
,
2
,
1
);
zoneBgGrid
->
addWidget
(
playerAreaBgButton
,
2
,
2
);
zoneBgGroupBox
->
setLayout
(
zoneBgGrid
);
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
mainLayout
->
addWidget
(
zoneBgGroupBox
);
setLayout
(
mainLayout
);
}
}
void
AppearanceSettingsPage
::
retranslateUi
()
void
AppearanceSettingsPage
::
retranslateUi
()
{
{
zoneBgGroupBox
->
setTitle
(
tr
(
"Zone background pictures"
));
handBgLabel
->
setText
(
tr
(
"Path to hand background:"
));
tableBgLabel
->
setText
(
tr
(
"Path to table background:"
));
playerAreaBgLabel
->
setText
(
tr
(
"Path to player info background:"
));
}
void
AppearanceSettingsPage
::
handBgButtonClicked
()
{
QString
path
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose path"
));
if
(
path
.
isEmpty
())
return
;
QSettings
settings
;
settings
.
beginGroup
(
"zonebg"
);
settings
.
setValue
(
"hand"
,
path
);
handBgEdit
->
setText
(
path
);
emit
handBgChanged
(
path
);
}
void
AppearanceSettingsPage
::
tableBgButtonClicked
()
{
QString
path
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose path"
));
if
(
path
.
isEmpty
())
return
;
QSettings
settings
;
settings
.
beginGroup
(
"zonebg"
);
settings
.
setValue
(
"table"
,
path
);
tableBgEdit
->
setText
(
path
);
emit
tableBgChanged
(
path
);
}
void
AppearanceSettingsPage
::
playerAreaBgButtonClicked
()
{
QString
path
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose path"
));
if
(
path
.
isEmpty
())
return
;
QSettings
settings
;
settings
.
beginGroup
(
"zonebg"
);
settings
.
setValue
(
"playerarea"
,
path
);
playerAreaBgEdit
->
setText
(
path
);
emit
playerAreaBgChanged
(
path
);
}
}
MessagesSettingsPage
::
MessagesSettingsPage
()
MessagesSettingsPage
::
MessagesSettingsPage
()
...
...
cockatrice/src/dlg_settings.h
View file @
7c06d6d8
...
@@ -50,6 +50,18 @@ private:
...
@@ -50,6 +50,18 @@ private:
class
AppearanceSettingsPage
:
public
AbstractSettingsPage
{
class
AppearanceSettingsPage
:
public
AbstractSettingsPage
{
Q_OBJECT
Q_OBJECT
private
slots
:
void
handBgButtonClicked
();
void
tableBgButtonClicked
();
void
playerAreaBgButtonClicked
();
signals:
void
handBgChanged
(
const
QString
&
path
);
void
tableBgChanged
(
const
QString
&
path
);
void
playerAreaBgChanged
(
const
QString
&
path
);
private:
QLabel
*
handBgLabel
,
*
tableBgLabel
,
*
playerAreaBgLabel
;
QLineEdit
*
handBgEdit
,
*
tableBgEdit
,
*
playerAreaBgEdit
;
QGroupBox
*
zoneBgGroupBox
;
public:
public:
AppearanceSettingsPage
();
AppearanceSettingsPage
();
void
retranslateUi
();
void
retranslateUi
();
...
...
cockatrice/src/handzone.cpp
View file @
7c06d6d8
...
@@ -6,6 +6,11 @@
...
@@ -6,6 +6,11 @@
HandZone
::
HandZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
HandZone
::
HandZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"hand"
,
false
,
false
,
_p
->
getLocal
(),
parent
)
:
CardZone
(
_p
,
"hand"
,
false
,
false
,
_p
->
getLocal
(),
parent
)
{
{
QSettings
settings
;
QString
bgPath
=
settings
.
value
(
"zonebg/hand"
).
toString
();
if
(
!
bgPath
.
isEmpty
())
bgPixmap
.
load
(
bgPath
);
setCacheMode
(
DeviceCoordinateCache
);
setCacheMode
(
DeviceCoordinateCache
);
setAcceptsHoverEvents
(
true
);
// Awkwardly, this is needed to repaint the cached item after it has been corrupted by buggy rubberband drag.
setAcceptsHoverEvents
(
true
);
// Awkwardly, this is needed to repaint the cached item after it has been corrupted by buggy rubberband drag.
}
}
...
@@ -17,7 +22,10 @@ QRectF HandZone::boundingRect() const
...
@@ -17,7 +22,10 @@ QRectF HandZone::boundingRect() const
void
HandZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
void
HandZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
{
{
painter
->
fillRect
(
boundingRect
(),
Qt
::
darkGreen
);
if
(
bgPixmap
.
isNull
())
painter
->
fillRect
(
boundingRect
(),
Qt
::
darkGreen
);
else
painter
->
fillRect
(
boundingRect
(),
QBrush
(
bgPixmap
));
}
}
void
HandZone
::
reorganizeCards
()
void
HandZone
::
reorganizeCards
()
...
...
cockatrice/src/handzone.h
View file @
7c06d6d8
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
class
HandZone
:
public
CardZone
{
class
HandZone
:
public
CardZone
{
private:
private:
QPixmap
bgPixmap
;
public:
public:
HandZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
HandZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
QRectF
boundingRect
()
const
;
...
...
cockatrice/src/playerarea.cpp
View file @
7c06d6d8
...
@@ -5,10 +5,15 @@
...
@@ -5,10 +5,15 @@
#include
"pilezone.h"
#include
"pilezone.h"
#include
"counter.h"
#include
"counter.h"
#include
<QPainter>
#include
<QPainter>
#include
<QSettings>
PlayerArea
::
PlayerArea
(
Player
*
_player
,
QGraphicsItem
*
parent
)
PlayerArea
::
PlayerArea
(
Player
*
_player
,
QGraphicsItem
*
parent
)
:
QGraphicsItem
(
parent
),
player
(
_player
)
:
QGraphicsItem
(
parent
),
player
(
_player
)
{
{
QSettings
settings
;
QString
bgPath
=
settings
.
value
(
"zonebg/playerarea"
).
toString
();
if
(
!
bgPath
.
isEmpty
())
bgPixmap
.
load
(
bgPath
);
setCacheMode
(
DeviceCoordinateCache
);
setCacheMode
(
DeviceCoordinateCache
);
QPointF
base
=
QPointF
(
55
,
50
);
QPointF
base
=
QPointF
(
55
,
50
);
...
@@ -51,7 +56,10 @@ QRectF PlayerArea::boundingRect() const
...
@@ -51,7 +56,10 @@ QRectF PlayerArea::boundingRect() const
void
PlayerArea
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
void
PlayerArea
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
{
{
painter
->
fillRect
(
boundingRect
(),
QColor
(
200
,
200
,
200
));
if
(
bgPixmap
.
isNull
())
painter
->
fillRect
(
boundingRect
(),
QColor
(
200
,
200
,
200
));
else
painter
->
fillRect
(
boundingRect
(),
QBrush
(
bgPixmap
));
QString
nameStr
=
player
->
getName
();
QString
nameStr
=
player
->
getName
();
QFont
font
(
"Times"
);
QFont
font
(
"Times"
);
...
...
cockatrice/src/playerarea.h
View file @
7c06d6d8
...
@@ -9,6 +9,7 @@ class Counter;
...
@@ -9,6 +9,7 @@ class Counter;
class
PlayerArea
:
public
QGraphicsItem
{
class
PlayerArea
:
public
QGraphicsItem
{
private:
private:
QPixmap
bgPixmap
;
QRectF
bRect
;
QRectF
bRect
;
Player
*
player
;
Player
*
player
;
QList
<
Counter
*>
counterList
;
QList
<
Counter
*>
counterList
;
...
...
cockatrice/src/tablezone.cpp
View file @
7c06d6d8
...
@@ -48,6 +48,12 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
...
@@ -48,6 +48,12 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
<<
QPoint
(
19
,
0
)
<<
QPoint
(
19
,
0
)
<<
QPoint
(
1
,
0
)
<<
QPoint
(
1
,
0
)
<<
QPoint
(
22
,
0
));
<<
QPoint
(
22
,
0
));
QSettings
settings
;
QString
bgPath
=
settings
.
value
(
"zonebg/table"
).
toString
();
if
(
!
bgPath
.
isEmpty
())
bgPixmap
.
load
(
bgPath
);
setCacheMode
(
DeviceCoordinateCache
);
}
}
QRectF
TableZone
::
boundingRect
()
const
QRectF
TableZone
::
boundingRect
()
const
...
@@ -57,7 +63,10 @@ QRectF TableZone::boundingRect() const
...
@@ -57,7 +63,10 @@ QRectF TableZone::boundingRect() const
void
TableZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
void
TableZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
{
{
painter
->
fillRect
(
boundingRect
(),
QColor
(
0
,
0
,
100
));
if
(
bgPixmap
.
isNull
())
painter
->
fillRect
(
boundingRect
(),
QColor
(
0
,
0
,
100
));
else
painter
->
fillRect
(
boundingRect
(),
QBrush
(
bgPixmap
));
}
}
void
TableZone
::
addCardImpl
(
CardItem
*
card
,
int
_x
,
int
_y
)
void
TableZone
::
addCardImpl
(
CardItem
*
card
,
int
_x
,
int
_y
)
...
...
cockatrice/src/tablezone.h
View file @
7c06d6d8
...
@@ -7,6 +7,7 @@ class TableZone : public CardZone {
...
@@ -7,6 +7,7 @@ class TableZone : public CardZone {
private:
private:
int
width
,
height
;
int
width
,
height
;
QList
<
QList
<
QPoint
>
>
gridPoints
;
QList
<
QList
<
QPoint
>
>
gridPoints
;
QPixmap
bgPixmap
;
public:
public:
static
const
int
gridPointsPerCardX
=
2
;
static
const
int
gridPointsPerCardX
=
2
;
static
const
int
gridPointsPerCardY
=
3
;
static
const
int
gridPointsPerCardY
=
3
;
...
...
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