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
8af0f01d
"cockatrice/src/tab_deck_editor.h" did not exist on "34d2649f65f8f5485e9a00ea99227a5878ed5224"
Commit
8af0f01d
authored
Feb 20, 2012
by
Max-Wilhelm Bruker
Browse files
CardInfoWidget fix
parent
aa158a4b
Changes
3
Show whitespace changes
Inline
Side-by-side
cockatrice/src/cardinfowidget.cpp
View file @
8af0f01d
...
...
@@ -10,9 +10,9 @@
#include
"main.h"
#include
"settingscache.h"
CardInfoWidget
::
CardInfoWidget
(
ResizeMode
_mode
,
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
CardInfoWidget
::
CardInfoWidget
(
ResizeMode
_mode
,
const
QString
&
cardName
,
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QFrame
(
parent
,
flags
)
,
pixmapWidth
(
16
0
)
,
pixmapWidth
(
0
)
,
aspectRatio
((
qreal
)
CARD_HEIGHT
/
(
qreal
)
CARD_WIDTH
)
,
minimized
(
settingsCache
->
getCardInfoMinimized
())
// Initialize the cardinfo view status from cache.
,
mode
(
_mode
)
...
...
@@ -68,18 +68,18 @@ CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlag
grid
->
setRowStretch
(
row
,
1
);
grid
->
setColumnStretch
(
1
,
1
);
CardInfo
*
cardBack
=
db
->
getCard
();
setCard
(
cardBack
);
retranslateUi
();
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Raised
);
if
(
mode
==
ModeGameTab
)
{
textLabel
->
setMinimumHeight
(
100
);
setFixedWidth
(
sizeHint
().
width
());
}
else
if
(
mode
==
ModePopUp
)
}
else
if
(
mode
==
ModePopUp
)
{
setFixedWidth
(
350
);
else
pixmapWidth
=
250
;
}
else
setFixedWidth
(
250
);
setCard
(
db
->
getCard
(
cardName
));
setMinimized
(
settingsCache
->
getCardInfoMinimized
());
}
...
...
@@ -106,8 +106,8 @@ void CardInfoWidget::setMinimized(int _minimized)
// Toggle oracle fields according to selected view.
bool
showAll
=
((
minimized
==
1
)
||
(
minimized
==
2
));
bool
showPowTough
=
showAll
&&
shouldShowPowTough
();
bool
showLoyalty
=
showAll
&&
shouldShowLoyalty
();
bool
showPowTough
=
info
?
(
showAll
&&
shouldShowPowTough
()
)
:
true
;
bool
showLoyalty
=
info
?
(
showAll
&&
shouldShowLoyalty
()
)
:
true
;
if
(
mode
==
ModeGameTab
)
{
nameLabel1
->
setVisible
(
showAll
);
nameLabel2
->
setVisible
(
showAll
);
...
...
@@ -177,6 +177,9 @@ void CardInfoWidget::clear()
void
CardInfoWidget
::
updatePixmap
()
{
if
(
pixmapWidth
==
0
)
return
;
QPixmap
*
resizedPixmap
=
info
->
getPixmap
(
QSize
(
pixmapWidth
,
pixmapWidth
*
aspectRatio
));
if
(
resizedPixmap
)
cardPicture
->
setPixmap
(
*
resizedPixmap
);
...
...
@@ -192,14 +195,19 @@ void CardInfoWidget::retranslateUi()
powtoughLabel1
->
setText
(
tr
(
"P / T:"
));
loyaltyLabel1
->
setText
(
tr
(
"Loyalty:"
));
}
void
CardInfoWidget
::
resizeEvent
(
QResizeEvent
*
/*event*/
)
{
if
(
(
mode
==
Mode
GameTab
)
&&
(
minimized
==
1
)
)
if
(
mode
==
Mode
PopUp
)
return
;
pixmapWidth
=
qMax
((
qreal
)
100.0
,
qMin
((
qreal
)
cardPicture
->
width
(),
(
qreal
)
((
height
()
-
cardHeightOffset
)
/
aspectRatio
)));
if
((
minimized
==
1
)
&&
(
mode
==
ModeGameTab
))
{
pixmapWidth
=
0
;
return
;
}
qreal
newPixmapWidth
=
qMax
((
qreal
)
100.0
,
qMin
((
qreal
)
cardPicture
->
width
(),
(
qreal
)
((
height
()
-
cardHeightOffset
)
/
aspectRatio
)));
if
(
newPixmapWidth
!=
pixmapWidth
)
{
pixmapWidth
=
newPixmapWidth
;
updatePixmap
();
}
}
QString
CardInfoWidget
::
getCardName
()
const
...
...
cockatrice/src/cardinfowidget.h
View file @
8af0f01d
...
...
@@ -43,7 +43,7 @@ private:
void
setMinimized
(
int
_minimized
);
public:
CardInfoWidget
(
ResizeMode
_mode
,
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
f
=
0
);
CardInfoWidget
(
ResizeMode
_mode
,
const
QString
&
cardName
=
QString
(),
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
f
=
0
);
void
retranslateUi
();
QString
getCardName
()
const
;
...
...
cockatrice/src/tab.cpp
View file @
8af0f01d
...
...
@@ -2,7 +2,7 @@
#include
"cardinfowidget.h"
#include
<QDesktopWidget>
#include
<QApplication>
#include
<QDebug>
Tab
::
Tab
(
TabSupervisor
*
_tabSupervisor
,
QWidget
*
parent
)
:
QWidget
(
parent
),
tabMenu
(
0
),
tabSupervisor
(
_tabSupervisor
),
contentsChanged
(
false
),
infoPopup
(
0
)
{
...
...
@@ -10,9 +10,8 @@ Tab::Tab(TabSupervisor *_tabSupervisor, QWidget *parent)
void
Tab
::
showCardInfoPopup
(
const
QPoint
&
pos
,
const
QString
&
cardName
)
{
infoPopup
=
new
CardInfoWidget
(
CardInfoWidget
::
ModePopUp
,
0
,
Qt
::
Widget
|
Qt
::
FramelessWindowHint
|
Qt
::
X11BypassWindowManagerHint
|
Qt
::
WindowStaysOnTopHint
);
infoPopup
=
new
CardInfoWidget
(
CardInfoWidget
::
ModePopUp
,
cardName
,
0
,
Qt
::
Widget
|
Qt
::
FramelessWindowHint
|
Qt
::
X11BypassWindowManagerHint
|
Qt
::
WindowStaysOnTopHint
);
infoPopup
->
setAttribute
(
Qt
::
WA_TransparentForMouseEvents
);
infoPopup
->
setCard
(
cardName
);
QRect
screenRect
=
qApp
->
desktop
()
->
screenGeometry
(
this
);
infoPopup
->
move
(
qMax
(
screenRect
.
left
(),
qMin
(
pos
.
x
()
-
infoPopup
->
width
()
/
2
,
screenRect
.
left
()
+
screenRect
.
width
()
-
infoPopup
->
width
())),
...
...
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