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
1217689e
Commit
1217689e
authored
Jul 07, 2014
by
arxanas
Browse files
Hash the game type.
parent
81419016
Changes
2
Show whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_filter_games.cpp
View file @
1217689e
...
...
@@ -10,6 +10,7 @@
#include
<QGridLayout>
#include
<QDialogButtonBox>
#include
<QSettings>
#include
<QCryptographicHash>
DlgFilterGames
::
DlgFilterGames
(
const
QMap
<
int
,
QString
>
&
_allGameTypes
,
QWidget
*
parent
)
:
QDialog
(
parent
),
...
...
@@ -50,7 +51,7 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, QWidget
QCheckBox
*
temp
=
new
QCheckBox
(
gameTypesIterator
.
value
());
temp
->
setChecked
(
settings
.
value
(
"game_type/"
+
gameTypesIterator
.
value
(),
"game_type/"
+
hashGameType
(
gameTypesIterator
.
value
()
)
,
false
).
toBool
()
);
...
...
@@ -145,7 +146,7 @@ void DlgFilterGames::actOk() {
checkboxIterator
.
next
();
settings
.
setValue
(
"game_type/"
+
gameTypeIterator
.
value
(),
"game_type/"
+
hashGameType
(
gameTypeIterator
.
value
()
)
,
checkboxIterator
.
value
()
->
isChecked
()
);
}
...
...
@@ -156,6 +157,10 @@ void DlgFilterGames::actOk() {
accept
();
}
QString
DlgFilterGames
::
hashGameType
(
const
QString
&
gameType
)
const
{
return
QCryptographicHash
::
hash
(
gameType
.
toUtf8
(),
QCryptographicHash
::
Md5
).
toHex
();
}
bool
DlgFilterGames
::
getUnavailableGamesVisible
()
const
{
return
unavailableGamesVisibleCheckBox
->
isChecked
();
...
...
cockatrice/src/dlg_filter_games.h
View file @
1217689e
...
...
@@ -21,6 +21,12 @@ private:
QSpinBox
*
maxPlayersFilterMaxSpinBox
;
const
QMap
<
int
,
QString
>
&
allGameTypes
;
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString
hashGameType
(
const
QString
&
gameType
)
const
;
private
slots
:
void
actOk
();
public:
...
...
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