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
cef4fb11
Commit
cef4fb11
authored
Nov 26, 2011
by
Max-Wilhelm Bruker
Browse files
maximize card pics in card info
parent
7611bdd7
Changes
2
Show whitespace changes
Inline
Side-by-side
cockatrice/src/cardinfowidget.cpp
View file @
cef4fb11
...
@@ -20,7 +20,7 @@ CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlag
...
@@ -20,7 +20,7 @@ CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlag
{
{
if
(
mode
==
ModeGameTab
)
{
if
(
mode
==
ModeGameTab
)
{
// Create indexed list of status views for card.
// Create indexed list of status views for card.
const
QStringList
cardInfoStatus
=
QStringList
()
<<
tr
(
"Hide card info"
)
<<
tr
(
"Show card only"
)
<<
tr
(
"Show text only"
)
<<
tr
(
"Show full info"
);
const
QStringList
cardInfoStatus
=
QStringList
()
<<
tr
(
"Show card only"
)
<<
tr
(
"Show text only"
)
<<
tr
(
"Show full info"
);
// Create droplist for cardinfo view selection, and set right current index.
// Create droplist for cardinfo view selection, and set right current index.
dropList
=
new
QComboBox
();
dropList
=
new
QComboBox
();
...
@@ -70,15 +70,13 @@ CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlag
...
@@ -70,15 +70,13 @@ CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlag
retranslateUi
();
retranslateUi
();
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Raised
);
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Raised
);
if
(
mode
==
ModeGameTab
)
{
if
(
mode
==
ModeGameTab
)
{
textLabel
->
set
Fixed
Height
(
100
);
textLabel
->
set
Minimum
Height
(
100
);
setFixedWidth
(
sizeHint
().
width
());
setFixedWidth
(
sizeHint
().
width
());
setMinimized
(
settingsCache
->
getCardInfoMinimized
());
}
else
if
(
mode
==
ModePopUp
)
}
else
if
(
mode
==
ModePopUp
)
setFixedWidth
(
350
);
setFixedWidth
(
350
);
else
else
setFixedWidth
(
250
);
setFixedWidth
(
250
);
if
(
mode
!=
ModeDeckEditor
)
setMinimized
(
settingsCache
->
getCardInfoMinimized
());
setFixedHeight
(
sizeHint
().
height
());
}
}
void
CardInfoWidget
::
minimizeClicked
(
int
newMinimized
)
void
CardInfoWidget
::
minimizeClicked
(
int
newMinimized
)
...
@@ -92,19 +90,11 @@ void CardInfoWidget::setMinimized(int _minimized)
...
@@ -92,19 +90,11 @@ void CardInfoWidget::setMinimized(int _minimized)
{
{
minimized
=
_minimized
;
minimized
=
_minimized
;
// Set the picture to be shown only at "card only" (1) and "full info" (3)
// Toggle oracle fields according to selected view.
if
(
minimized
==
1
||
minimized
==
3
)
{
bool
showAll
=
((
minimized
==
1
)
||
(
minimized
==
2
));
cardPicture
->
setVisible
(
true
);
if
(
mode
==
ModeGameTab
)
{
}
else
{
cardPicture
->
setVisible
(
false
);
}
// Set the rest of the fields to be shown only at "full info" (3) and "oracle only" (2)
bool
showAll
=
(
minimized
==
2
||
minimized
==
3
)
?
true
:
false
;
// Toggle oracle fields as according to selected view.
nameLabel2
->
setVisible
(
showAll
);
nameLabel1
->
setVisible
(
showAll
);
nameLabel1
->
setVisible
(
showAll
);
nameLabel2
->
setVisible
(
showAll
);
manacostLabel1
->
setVisible
(
showAll
);
manacostLabel1
->
setVisible
(
showAll
);
manacostLabel2
->
setVisible
(
showAll
);
manacostLabel2
->
setVisible
(
showAll
);
cardtypeLabel1
->
setVisible
(
showAll
);
cardtypeLabel1
->
setVisible
(
showAll
);
...
@@ -112,8 +102,22 @@ void CardInfoWidget::setMinimized(int _minimized)
...
@@ -112,8 +102,22 @@ void CardInfoWidget::setMinimized(int _minimized)
powtoughLabel1
->
setVisible
(
showAll
);
powtoughLabel1
->
setVisible
(
showAll
);
powtoughLabel2
->
setVisible
(
showAll
);
powtoughLabel2
->
setVisible
(
showAll
);
textLabel
->
setVisible
(
showAll
);
textLabel
->
setVisible
(
showAll
);
}
cardPicture
->
hide
();
cardHeightOffset
=
minimumSizeHint
().
height
()
+
10
;
// Set the picture to be shown only at "card only" (0) and "full info" (2)
if
(
mode
==
ModeGameTab
)
{
cardPicture
->
setVisible
((
minimized
==
0
)
||
(
minimized
==
2
));
setFixedHeight
(
sizeHint
().
height
());
if
(
minimized
==
0
)
setMaximumHeight
(
cardHeightOffset
+
width
()
*
aspectRatio
);
else
setMaximumHeight
(
1000000
);
}
else
cardPicture
->
show
();
resize
(
width
(),
sizeHint
().
height
());
}
}
void
CardInfoWidget
::
setCard
(
CardInfo
*
card
)
void
CardInfoWidget
::
setCard
(
CardInfo
*
card
)
...
@@ -166,10 +170,11 @@ void CardInfoWidget::retranslateUi()
...
@@ -166,10 +170,11 @@ void CardInfoWidget::retranslateUi()
void
CardInfoWidget
::
resizeEvent
(
QResizeEvent
*
/*event*/
)
void
CardInfoWidget
::
resizeEvent
(
QResizeEvent
*
/*event*/
)
{
{
if
(
mode
==
ModeDeckEditor
)
{
if
((
mode
==
ModeGameTab
)
&&
(
minimized
==
1
))
pixmapWidth
=
qMin
(
width
()
*
0.95
,
(
height
()
-
200
)
/
aspectRatio
);
return
;
pixmapWidth
=
qMax
(
100.0
,
qMin
((
qreal
)
cardPicture
->
width
(),
(
height
()
-
cardHeightOffset
)
/
aspectRatio
));
updatePixmap
();
updatePixmap
();
}
}
}
QString
CardInfoWidget
::
getCardName
()
const
QString
CardInfoWidget
::
getCardName
()
const
...
...
cockatrice/src/cardinfowidget.h
View file @
cef4fb11
...
@@ -21,8 +21,9 @@ public:
...
@@ -21,8 +21,9 @@ public:
private:
private:
int
pixmapWidth
;
int
pixmapWidth
;
qreal
cardHeightOffset
;
qreal
aspectRatio
;
qreal
aspectRatio
;
int
minimized
;
// 0 -
minimized, 1 -
card,
2
- oracle only,
3
- full
int
minimized
;
// 0 - card,
1
- oracle only,
2
- full
ResizeMode
mode
;
ResizeMode
mode
;
QComboBox
*
dropList
;
QComboBox
*
dropList
;
...
...
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