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
68e176cc
Commit
68e176cc
authored
Jul 07, 2015
by
Fabio Bas
Browse files
Add an option to annotate tokens from card text (default off); fix #241
parent
685aa99a
Changes
6
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_create_token.cpp
View file @
68e176cc
...
...
@@ -10,10 +10,12 @@
#include
<QTreeView>
#include
<QRadioButton>
#include
<QHeaderView>
#include
"decklist.h"
#include
"dlg_create_token.h"
#include
"carddatabasemodel.h"
#include
"main.h"
#include
"settingscache.h"
DlgCreateToken
::
DlgCreateToken
(
const
QStringList
&
_predefinedTokens
,
QWidget
*
parent
)
:
QDialog
(
parent
),
predefinedTokens
(
_predefinedTokens
)
...
...
@@ -136,7 +138,8 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
const
QString
cardColor
=
cardInfo
->
getColors
().
isEmpty
()
?
QString
()
:
(
cardInfo
->
getColors
().
size
()
>
1
?
QString
(
"m"
)
:
cardInfo
->
getColors
().
first
());
colorEdit
->
setCurrentIndex
(
colorEdit
->
findData
(
cardColor
,
Qt
::
UserRole
,
Qt
::
MatchFixedString
));
ptEdit
->
setText
(
cardInfo
->
getPowTough
());
annotationEdit
->
setText
(
cardInfo
->
getText
());
if
(
settingsCache
->
getAnnotateTokens
())
annotationEdit
->
setText
(
cardInfo
->
getText
());
}
void
DlgCreateToken
::
actChooseTokenFromAll
(
bool
checked
)
...
...
cockatrice/src/dlg_settings.cpp
View file @
68e176cc
...
...
@@ -482,12 +482,16 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
playToStackCheckBox
.
setChecked
(
settingsCache
->
getPlayToStack
());
connect
(
&
playToStackCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setPlayToStack
(
int
)));
annotateTokensCheckBox
.
setChecked
(
settingsCache
->
getAnnotateTokens
());
connect
(
&
annotateTokensCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setAnnotateTokens
(
int
)));
QGridLayout
*
generalGrid
=
new
QGridLayout
;
generalGrid
->
addWidget
(
&
notificationsEnabledCheckBox
,
0
,
0
);
generalGrid
->
addWidget
(
&
specNotificationsEnabledCheckBox
,
1
,
0
);
generalGrid
->
addWidget
(
&
doubleClickToPlayCheckBox
,
2
,
0
);
generalGrid
->
addWidget
(
&
playToStackCheckBox
,
3
,
0
);
generalGrid
->
addWidget
(
&
annotateTokensCheckBox
,
4
,
0
);
generalGroupBox
=
new
QGroupBox
;
generalGroupBox
->
setLayout
(
generalGrid
);
...
...
@@ -519,6 +523,7 @@ void UserInterfaceSettingsPage::retranslateUi()
specNotificationsEnabledCheckBox
.
setText
(
tr
(
"Notify in the taskbar for game events while you are spectating"
));
doubleClickToPlayCheckBox
.
setText
(
tr
(
"&Double-click cards to play them (instead of single-click)"
));
playToStackCheckBox
.
setText
(
tr
(
"&Play all nonlands onto the stack (not the battlefield) by default"
));
annotateTokensCheckBox
.
setText
(
tr
(
"Annotate card text on tokens"
));
animationGroupBox
->
setTitle
(
tr
(
"Animation settings"
));
tapAnimationCheckBox
.
setText
(
tr
(
"&Tap/untap animation"
));
}
...
...
cockatrice/src/dlg_settings.h
View file @
68e176cc
...
...
@@ -127,6 +127,7 @@ private:
QCheckBox
specNotificationsEnabledCheckBox
;
QCheckBox
doubleClickToPlayCheckBox
;
QCheckBox
playToStackCheckBox
;
QCheckBox
annotateTokensCheckBox
;
QCheckBox
tapAnimationCheckBox
;
QGroupBox
*
generalGroupBox
;
QGroupBox
*
animationGroupBox
;
...
...
cockatrice/src/player.cpp
View file @
68e176cc
...
...
@@ -1075,7 +1075,7 @@ void Player::actCreatePredefinedToken()
lastTokenName
=
cardInfo
->
getName
();
lastTokenColor
=
cardInfo
->
getColors
().
isEmpty
()
?
QString
()
:
cardInfo
->
getColors
().
first
().
toLower
();
lastTokenPT
=
cardInfo
->
getPowTough
();
lastTokenAnnotation
=
cardInfo
->
getText
();
lastTokenAnnotation
=
settingsCache
->
getAnnotateTokens
()
?
cardInfo
->
getText
()
:
""
;
lastTokenTableRow
=
table
->
clampValidTableRow
(
2
-
cardInfo
->
getTableRow
());
lastTokenDestroy
=
true
;
aCreateAnotherToken
->
setEnabled
(
true
);
...
...
@@ -1100,6 +1100,7 @@ void Player::actCreateRelatedCard()
cmd
.
set_card_name
(
cardInfo
->
getName
().
toStdString
());
cmd
.
set_color
(
cardInfo
->
getColors
().
isEmpty
()
?
QString
().
toStdString
()
:
cardInfo
->
getColors
().
first
().
toLower
().
toStdString
());
cmd
.
set_pt
(
cardInfo
->
getPowTough
().
toStdString
());
cmd
.
set_annotation
(
settingsCache
->
getAnnotateTokens
()
?
cardInfo
->
getText
().
toStdString
()
:
QString
().
toStdString
());
cmd
.
set_destroy_on_zone_change
(
true
);
cmd
.
set_target_zone
(
sourceCard
->
getZone
()
->
getName
().
toStdString
());
cmd
.
set_target_card_id
(
sourceCard
->
getId
());
...
...
cockatrice/src/settingscache.cpp
View file @
68e176cc
...
...
@@ -46,6 +46,7 @@ SettingsCache::SettingsCache()
spectatorNotificationsEnabled
=
settings
->
value
(
"interface/specnotificationsenabled"
,
false
).
toBool
();
doubleClickToPlay
=
settings
->
value
(
"interface/doubleclicktoplay"
,
true
).
toBool
();
playToStack
=
settings
->
value
(
"interface/playtostack"
,
false
).
toBool
();
annotateTokens
=
settings
->
value
(
"interface/annotatetokens"
,
false
).
toBool
();
cardInfoMinimized
=
settings
->
value
(
"interface/cardinfominimized"
,
0
).
toInt
();
tabGameSplitterSizes
=
settings
->
value
(
"interface/tabgame_splittersizes"
).
toByteArray
();
displayCardNames
=
settings
->
value
(
"cards/displaycardnames"
,
true
).
toBool
();
...
...
@@ -251,6 +252,12 @@ void SettingsCache::setPlayToStack(int _playToStack)
settings
->
setValue
(
"interface/playtostack"
,
playToStack
);
}
void
SettingsCache
::
setAnnotateTokens
(
int
_annotateTokens
)
{
annotateTokens
=
_annotateTokens
;
settings
->
setValue
(
"interface/annotatetokens"
,
annotateTokens
);
}
void
SettingsCache
::
setCardInfoMinimized
(
int
_cardInfoMinimized
)
{
cardInfoMinimized
=
_cardInfoMinimized
;
...
...
cockatrice/src/settingscache.h
View file @
68e176cc
...
...
@@ -55,6 +55,7 @@ private:
bool
spectatorNotificationsEnabled
;
bool
doubleClickToPlay
;
bool
playToStack
;
bool
annotateTokens
;
int
cardInfoMinimized
;
QByteArray
tabGameSplitterSizes
;
bool
displayCardNames
;
...
...
@@ -106,6 +107,7 @@ public:
bool
getDoubleClickToPlay
()
const
{
return
doubleClickToPlay
;
}
bool
getPlayToStack
()
const
{
return
playToStack
;
}
bool
getAnnotateTokens
()
const
{
return
annotateTokens
;
}
int
getCardInfoMinimized
()
const
{
return
cardInfoMinimized
;
}
QByteArray
getTabGameSplitterSizes
()
const
{
return
tabGameSplitterSizes
;
}
bool
getDisplayCardNames
()
const
{
return
displayCardNames
;
}
...
...
@@ -161,6 +163,7 @@ public slots:
void
setSpectatorNotificationsEnabled
(
int
_spectatorNotificationsEnabled
);
void
setDoubleClickToPlay
(
int
_doubleClickToPlay
);
void
setPlayToStack
(
int
_playToStack
);
void
setAnnotateTokens
(
int
_annotateTokens
);
void
setCardInfoMinimized
(
int
_cardInfoMinimized
);
void
setTabGameSplitterSizes
(
const
QByteArray
&
_tabGameSplitterSizes
);
void
setDisplayCardNames
(
int
_displayCardNames
);
...
...
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