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
cfd715cc
Commit
cfd715cc
authored
May 29, 2010
by
Max-Wilhelm Bruker
Browse files
nicer looking active player display
parent
f2092b89
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/player.cpp
View file @
cfd715cc
...
...
@@ -726,6 +726,7 @@ void Player::showCardMenu(const QPoint &p)
void
Player
::
setActive
(
bool
_active
)
{
active
=
_active
;
table
->
setActive
(
active
);
update
();
}
...
...
@@ -747,23 +748,6 @@ void Player::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/
else
painter
->
fillRect
(
QRectF
(
0
,
0
,
totalWidth
,
boundingRect
().
height
()),
QBrush
(
bgPixmap
));
if
(
getActive
())
{
QFontMetrics
fm
(
font
);
double
w
=
fm
.
width
(
nameStr
)
*
1.7
;
double
h
=
fm
.
height
()
*
1.7
;
if
(
w
<
h
)
w
=
h
;
painter
->
setPen
(
Qt
::
transparent
);
QRadialGradient
grad
(
QPointF
(
0.5
,
0.5
),
0.5
);
grad
.
setCoordinateMode
(
QGradient
::
ObjectBoundingMode
);
grad
.
setColorAt
(
0
,
QColor
(
150
,
200
,
150
,
255
));
grad
.
setColorAt
(
0.7
,
QColor
(
150
,
200
,
150
,
255
));
grad
.
setColorAt
(
1
,
QColor
(
150
,
150
,
150
,
0
));
painter
->
setBrush
(
QBrush
(
grad
));
painter
->
drawEllipse
(
QRectF
(((
double
)
(
totalWidth
-
w
))
/
2
,
0
,
w
,
h
));
}
painter
->
setFont
(
font
);
painter
->
setPen
(
QPen
(
Qt
::
black
));
painter
->
drawText
(
QRectF
(
0
,
0
,
totalWidth
,
40
),
Qt
::
AlignCenter
,
nameStr
);
...
...
cockatrice/src/tablezone.cpp
View file @
cfd715cc
...
...
@@ -6,7 +6,7 @@
#include
"settingscache.h"
TableZone
::
TableZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"table"
,
true
,
false
,
true
,
parent
)
:
CardZone
(
_p
,
"table"
,
true
,
false
,
true
,
parent
)
,
active
(
false
)
{
connect
(
settingsCache
,
SIGNAL
(
tableBgPathChanged
()),
this
,
SLOT
(
updateBgPixmap
()));
connect
(
settingsCache
,
SIGNAL
(
economicGridChanged
()),
this
,
SLOT
(
reorganizeCards
()));
...
...
@@ -47,6 +47,26 @@ void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*optio
if
(
player
->
getMirrored
())
separatorY
=
height
-
separatorY
;
painter
->
drawLine
(
QPointF
(
0
,
separatorY
),
QPointF
(
width
,
separatorY
));
if
(
active
)
{
QColor
color1
(
255
,
255
,
255
,
150
);
QColor
color2
(
255
,
255
,
255
,
0
);
QLinearGradient
grad1
(
0
,
0
,
0
,
1
);
grad1
.
setCoordinateMode
(
QGradient
::
ObjectBoundingMode
);
grad1
.
setColorAt
(
0
,
color1
);
grad1
.
setColorAt
(
1
,
color2
);
painter
->
fillRect
(
QRectF
(
0
,
0
,
width
,
10
),
QBrush
(
grad1
));
grad1
.
setFinalStop
(
1
,
0
);
painter
->
fillRect
(
QRectF
(
0
,
0
,
10
,
height
),
QBrush
(
grad1
));
grad1
.
setStart
(
0
,
1
);
grad1
.
setFinalStop
(
0
,
0
);
painter
->
fillRect
(
QRectF
(
0
,
height
-
10
,
width
,
10
),
QBrush
(
grad1
));
grad1
.
setStart
(
1
,
0
);
painter
->
fillRect
(
QRectF
(
width
-
10
,
0
,
10
,
height
),
QBrush
(
grad1
));
}
}
void
TableZone
::
addCardImpl
(
CardItem
*
card
,
int
_x
,
int
_y
)
...
...
cockatrice/src/tablezone.h
View file @
cfd715cc
...
...
@@ -11,6 +11,7 @@ private:
int
width
,
height
;
int
currentMinimumWidth
;
QPixmap
bgPixmap
;
bool
active
;
private
slots
:
void
updateBgPixmap
();
public
slots
:
...
...
@@ -36,6 +37,7 @@ public:
int
getMinimumWidth
()
const
{
return
currentMinimumWidth
;
}
void
setWidth
(
qreal
_width
);
qreal
getWidth
()
const
{
return
width
;
}
void
setActive
(
bool
_active
)
{
active
=
_active
;
update
();
}
protected:
void
addCardImpl
(
CardItem
*
card
,
int
x
,
int
y
);
};
...
...
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