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
86097d29
Commit
86097d29
authored
Jun 03, 2009
by
brukie
Browse files
foo
parent
04072b02
Changes
2
Show whitespace changes
Inline
Side-by-side
cockatrice/src/cardinfowidget.cpp
View file @
86097d29
...
...
@@ -4,17 +4,20 @@
#include
<QTextEdit>
CardInfoWidget
::
CardInfoWidget
(
CardDatabase
*
_db
,
QWidget
*
parent
)
:
QFrame
(
parent
),
db
(
_db
),
aspectratio
(
0
)
:
QFrame
(
parent
),
db
(
_db
),
pixmapHeight
(
0
)
{
cardPicture
=
new
QLabel
();
cardPicture
->
setAlignment
(
Qt
::
AlignCenter
);
nameLabel1
=
new
QLabel
(
tr
(
"Name:"
));
nameLabel2
=
new
QLabel
();
nameLabel2
->
setWordWrap
(
true
);
manacostLabel1
=
new
QLabel
(
tr
(
"Mana cost:"
));
manacostLabel2
=
new
QLabel
();
manacostLabel2
->
setWordWrap
(
true
);
cardtypeLabel1
=
new
QLabel
(
tr
(
"Card type:"
));
cardtypeLabel2
=
new
QLabel
();
cardtypeLabel2
->
setWordWrap
(
true
);
powtoughLabel1
=
new
QLabel
(
tr
(
"P / T:"
));
powtoughLabel2
=
new
QLabel
();
...
...
@@ -42,12 +45,11 @@ void CardInfoWidget::setCard(CardInfo *card)
if
(
!
card
)
return
;
if
(
aspectratio
==
0
)
{
if
(
pixmapHeight
==
0
)
{
QPixmap
*
bigPixmap
=
card
->
loadPixmap
();
aspectratio
=
(
double
)
bigPixmap
->
height
()
/
bigPixmap
->
width
();
pixmapHeight
=
pixmapWidth
*
bigPixmap
->
height
()
/
bigPixmap
->
width
();
}
double
w
=
180
;
cardPicture
->
setPixmap
(
*
card
->
getPixmap
(
QSize
(
w
,
w
*
aspectratio
)));
cardPicture
->
setPixmap
(
*
card
->
getPixmap
(
QSize
(
pixmapWidth
,
pixmapHeight
)));
nameLabel2
->
setText
(
card
->
getName
());
manacostLabel2
->
setText
(
card
->
getManacost
());
...
...
cockatrice/src/cardinfowidget.h
View file @
86097d29
...
...
@@ -11,7 +11,8 @@ class CardInfoWidget : public QFrame {
Q_OBJECT
private:
CardDatabase
*
db
;
double
aspectratio
;
static
const
int
pixmapWidth
=
180
;
int
pixmapHeight
;
QLabel
*
cardPicture
;
QLabel
*
nameLabel1
,
*
nameLabel2
;
...
...
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