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
970da7d2
Commit
970da7d2
authored
Oct 13, 2010
by
Max-Wilhelm Bruker
Browse files
save minimized state of card info widget in settings
parent
a215b350
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/cardinfowidget.cpp
View file @
970da7d2
...
...
@@ -7,6 +7,7 @@
#include
"carditem.h"
#include
"carddatabase.h"
#include
"main.h"
#include
"settingscache.h"
CardInfoWidget
::
CardInfoWidget
(
bool
showMinimizeButton
,
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QFrame
(
parent
,
flags
),
pixmapHeight
(
pixmapWidth
),
minimized
(
false
),
minimizeButton
(
0
),
info
(
0
)
...
...
@@ -73,6 +74,7 @@ CardInfoWidget::CardInfoWidget(bool showMinimizeButton, QWidget *parent, Qt::Win
if
(
showMinimizeButton
)
{
textLabel
->
setFixedHeight
(
100
);
setFixedWidth
(
sizeHint
().
width
());
setMinimized
(
settingsCache
->
getCardInfoMinimized
());
}
else
setFixedWidth
(
350
);
setFixedHeight
(
sizeHint
().
height
());
...
...
@@ -80,19 +82,28 @@ CardInfoWidget::CardInfoWidget(bool showMinimizeButton, QWidget *parent, Qt::Win
void
CardInfoWidget
::
minimizeClicked
()
{
cardPicture
->
setVisible
(
minimized
);
nameLabel2
->
setVisible
(
minimized
);
nameLabel1
->
setVisible
(
minimized
);
manacostLabel1
->
setVisible
(
minimized
);
manacostLabel2
->
setVisible
(
minimized
);
cardtypeLabel1
->
setVisible
(
minimized
);
cardtypeLabel2
->
setVisible
(
minimized
);
powtoughLabel1
->
setVisible
(
minimized
);
powtoughLabel2
->
setVisible
(
minimized
);
textLabel
->
setVisible
(
minimized
);
setMinimized
(
!
minimized
);
settingsCache
->
setCardInfoMinimized
(
minimized
);
}
void
CardInfoWidget
::
setMinimized
(
bool
_minimized
)
{
minimized
=
_minimized
;
cardPicture
->
setVisible
(
!
minimized
);
nameLabel2
->
setVisible
(
!
minimized
);
nameLabel1
->
setVisible
(
!
minimized
);
manacostLabel1
->
setVisible
(
!
minimized
);
manacostLabel2
->
setVisible
(
!
minimized
);
cardtypeLabel1
->
setVisible
(
!
minimized
);
cardtypeLabel2
->
setVisible
(
!
minimized
);
powtoughLabel1
->
setVisible
(
!
minimized
);
powtoughLabel2
->
setVisible
(
!
minimized
);
textLabel
->
setVisible
(
!
minimized
);
if
(
minimizeButton
)
minimizeButton
->
setIcon
(
style
()
->
standardIcon
(
minimized
?
QStyle
::
SP_ArrowDown
:
QStyle
::
SP_ArrowUp
));
minimizeButton
->
setIcon
(
style
()
->
standardIcon
(
minimized
?
QStyle
::
SP_ArrowUp
:
QStyle
::
SP_ArrowDown
));
minimized
=
!
minimized
;
setFixedHeight
(
sizeHint
().
height
());
}
...
...
cockatrice/src/cardinfowidget.h
View file @
970da7d2
...
...
@@ -25,6 +25,7 @@ private:
QTextEdit
*
textLabel
;
CardInfo
*
info
;
void
setMinimized
(
bool
_minimized
);
public:
CardInfoWidget
(
bool
showMinimizeButton
=
true
,
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
f
=
0
);
void
retranslateUi
();
...
...
cockatrice/src/settingscache.cpp
View file @
970da7d2
...
...
@@ -18,6 +18,7 @@ SettingsCache::SettingsCache()
picDownload
=
settings
->
value
(
"personal/picturedownload"
,
false
).
toBool
();
doubleClickToPlay
=
settings
->
value
(
"interface/doubleclicktoplay"
,
true
).
toBool
();
cardInfoMinimized
=
settings
->
value
(
"interface/cardinfominimized"
,
false
).
toBool
();
horizontalHand
=
settings
->
value
(
"hand/horizontal"
,
false
).
toBool
();
economicalGrid
=
settings
->
value
(
"table/economic"
,
false
).
toBool
();
tapAnimation
=
settings
->
value
(
"cards/tapanimation"
,
true
).
toBool
();
...
...
@@ -94,6 +95,12 @@ void SettingsCache::setDoubleClickToPlay(int _doubleClickToPlay)
settings
->
setValue
(
"interface/doubleclicktoplay"
,
doubleClickToPlay
);
}
void
SettingsCache
::
setCardInfoMinimized
(
bool
_cardInfoMinimized
)
{
cardInfoMinimized
=
_cardInfoMinimized
;
settings
->
setValue
(
"interface/cardinfominimized"
,
cardInfoMinimized
);
}
void
SettingsCache
::
setHorizontalHand
(
int
_horizontalHand
)
{
horizontalHand
=
_horizontalHand
;
...
...
cockatrice/src/settingscache.h
View file @
970da7d2
...
...
@@ -26,6 +26,7 @@ private:
QString
handBgPath
,
tableBgPath
,
playerBgPath
,
cardBackPicturePath
;
bool
picDownload
;
bool
doubleClickToPlay
;
bool
cardInfoMinimized
;
bool
horizontalHand
;
bool
economicalGrid
;
bool
tapAnimation
;
...
...
@@ -42,6 +43,7 @@ public:
QString
getCardBackPicturePath
()
const
{
return
cardBackPicturePath
;
}
bool
getPicDownload
()
const
{
return
picDownload
;
}
bool
getDoubleClickToPlay
()
const
{
return
doubleClickToPlay
;
}
bool
getCardInfoMinimized
()
const
{
return
cardInfoMinimized
;
}
bool
getHorizontalHand
()
const
{
return
horizontalHand
;
}
bool
getEconomicalGrid
()
const
{
return
economicalGrid
;
}
bool
getTapAnimation
()
const
{
return
tapAnimation
;
}
...
...
@@ -58,6 +60,7 @@ public slots:
void
setCardBackPicturePath
(
const
QString
&
_cardBackPicturePath
);
void
setPicDownload
(
int
_picDownload
);
void
setDoubleClickToPlay
(
int
_doubleClickToPlay
);
void
setCardInfoMinimized
(
bool
_cardInfoMinimized
);
void
setHorizontalHand
(
int
_horizontalHand
);
void
setEconomicalGrid
(
int
_economicalGrid
);
void
setTapAnimation
(
int
_tapAnimation
);
...
...
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