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
8938d291
Commit
8938d291
authored
Apr 15, 2015
by
Matt Lowe
Browse files
Filter password games consistancy
parent
feeaa9c9
Changes
5
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_filter_games.cpp
View file @
8938d291
...
...
@@ -23,8 +23,8 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const Ga
unavailableGamesVisibleCheckBox
=
new
QCheckBox
(
tr
(
"Show &unavailable games"
));
unavailableGamesVisibleCheckBox
->
setChecked
(
gamesProxyModel
->
getUnavailableGamesVisible
());
p
asswordProtectedGames
HiddenCheckBox
=
new
QCheckBox
(
tr
(
"
Hide
&password protected games"
));
p
asswordProtectedGames
HiddenCheckBox
->
setChecked
(
gamesProxyModel
->
getPasswordProtectedGames
Hidden
());
showP
asswordProtectedGames
=
new
QCheckBox
(
tr
(
"
Show
&password protected games"
));
showP
asswordProtectedGames
->
setChecked
(
gamesProxyModel
->
get
Show
PasswordProtectedGames
());
gameNameFilterEdit
=
new
QLineEdit
;
gameNameFilterEdit
->
setText
(
gamesProxyModel
->
getGameNameFilter
());
...
...
@@ -84,7 +84,7 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const Ga
leftGrid
->
addWidget
(
creatorNameFilterEdit
,
1
,
1
);
leftGrid
->
addWidget
(
maxPlayersGroupBox
,
2
,
0
,
1
,
2
);
leftGrid
->
addWidget
(
unavailableGamesVisibleCheckBox
,
3
,
0
,
1
,
2
);
leftGrid
->
addWidget
(
p
asswordProtectedGames
HiddenCheckBox
,
4
,
0
,
1
,
2
);
leftGrid
->
addWidget
(
showP
asswordProtectedGames
,
4
,
0
,
1
,
2
);
QVBoxLayout
*
leftColumn
=
new
QVBoxLayout
;
leftColumn
->
addLayout
(
leftGrid
);
...
...
@@ -123,14 +123,14 @@ void DlgFilterGames::setUnavailableGamesVisible(bool _unavailableGamesVisible)
unavailableGamesVisibleCheckBox
->
setChecked
(
_unavailableGamesVisible
);
}
bool
DlgFilterGames
::
getPasswordProtectedGames
Hidden
()
const
bool
DlgFilterGames
::
get
Show
PasswordProtectedGames
()
const
{
return
p
asswordProtectedGames
HiddenCheckBox
->
isChecked
();
return
showP
asswordProtectedGames
->
isChecked
();
}
void
DlgFilterGames
::
setPasswordProtectedGames
Hidden
(
bool
_passwordProtectedGamesHidden
)
void
DlgFilterGames
::
set
Show
PasswordProtectedGames
(
bool
_passwordProtectedGamesHidden
)
{
p
asswordProtectedGames
HiddenCheckBox
->
setChecked
(
_passwordProtectedGamesHidden
);
showP
asswordProtectedGames
->
setChecked
(
_passwordProtectedGamesHidden
);
}
QString
DlgFilterGames
::
getGameNameFilter
()
const
...
...
cockatrice/src/dlg_filter_games.h
View file @
8938d291
...
...
@@ -14,7 +14,7 @@ class DlgFilterGames : public QDialog {
Q_OBJECT
private:
QCheckBox
*
unavailableGamesVisibleCheckBox
;
QCheckBox
*
p
asswordProtectedGames
HiddenCheckBox
;
QCheckBox
*
showP
asswordProtectedGames
;
QLineEdit
*
gameNameFilterEdit
;
QLineEdit
*
creatorNameFilterEdit
;
QMap
<
int
,
QCheckBox
*>
gameTypeFilterCheckBoxes
;
...
...
@@ -31,8 +31,8 @@ public:
bool
getUnavailableGamesVisible
()
const
;
void
setUnavailableGamesVisible
(
bool
_unavailableGamesVisible
);
bool
getPasswordProtectedGames
Hidden
()
const
;
void
setPasswordProtectedGames
Hidden
(
bool
_passwordProtectedGamesHidden
);
bool
get
Show
PasswordProtectedGames
()
const
;
void
set
Show
PasswordProtectedGames
(
bool
_passwordProtectedGamesHidden
);
QString
getGameNameFilter
()
const
;
void
setGameNameFilter
(
const
QString
&
_gameNameFilter
);
QString
getCreatorNameFilter
()
const
;
...
...
cockatrice/src/gameselector.cpp
View file @
8938d291
...
...
@@ -113,7 +113,7 @@ void GameSelector::actSetFilter()
clearFilterButton
->
setEnabled
(
true
);
gameListProxyModel
->
setUnavailableGamesVisible
(
dlg
.
getUnavailableGamesVisible
());
gameListProxyModel
->
setPasswordProtectedGames
Hidden
(
dlg
.
getPasswordProtectedGames
Hidden
());
gameListProxyModel
->
set
Show
PasswordProtectedGames
(
dlg
.
get
Show
PasswordProtectedGames
());
gameListProxyModel
->
setGameNameFilter
(
dlg
.
getGameNameFilter
());
gameListProxyModel
->
setCreatorNameFilter
(
dlg
.
getCreatorNameFilter
());
gameListProxyModel
->
setGameTypeFilter
(
dlg
.
getGameTypeFilter
());
...
...
cockatrice/src/gamesmodel.cpp
View file @
8938d291
...
...
@@ -223,7 +223,7 @@ GamesProxyModel::GamesProxyModel(QObject *parent, ServerInfo_User *_ownUser)
:
QSortFilterProxyModel
(
parent
),
ownUser
(
_ownUser
),
unavailableGamesVisible
(
false
),
p
asswordProtectedGames
Hidden
(
fals
e
),
showP
asswordProtectedGames
(
tru
e
),
maxPlayersFilterMin
(
-
1
),
maxPlayersFilterMax
(
-
1
)
{
...
...
@@ -237,9 +237,9 @@ void GamesProxyModel::setUnavailableGamesVisible(bool _unavailableGamesVisible)
invalidateFilter
();
}
void
GamesProxyModel
::
setPasswordProtectedGames
Hidden
(
bool
_
p
asswordProtectedGames
Hidden
)
void
GamesProxyModel
::
set
Show
PasswordProtectedGames
(
bool
_
showP
asswordProtectedGames
)
{
p
asswordProtectedGames
Hidden
=
_p
asswordProtectedGames
Hidden
;
showP
asswordProtectedGames
=
_showP
asswordProtectedGames
;
invalidateFilter
();
}
...
...
@@ -271,7 +271,7 @@ void GamesProxyModel::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlay
void
GamesProxyModel
::
resetFilterParameters
()
{
unavailableGamesVisible
=
false
;
p
asswordProtectedGames
Hidden
=
fals
e
;
showP
asswordProtectedGames
=
tru
e
;
gameNameFilter
=
QString
();
creatorNameFilter
=
QString
();
gameTypeFilter
.
clear
();
...
...
@@ -287,7 +287,7 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
settings
.
beginGroup
(
"filter_games"
);
unavailableGamesVisible
=
settings
.
value
(
"unavailable_games_visible"
,
false
).
toBool
();
p
asswordProtectedGames
Hidden
=
settings
.
value
(
"password_protected_games
_hidden"
,
fals
e
).
toBool
();
showP
asswordProtectedGames
=
settings
.
value
(
"
show_
password_protected_games
"
,
tru
e
).
toBool
();
gameNameFilter
=
settings
.
value
(
"game_name_filter"
,
""
).
toString
();
maxPlayersFilterMin
=
settings
.
value
(
"min_players"
,
1
).
toInt
();
maxPlayersFilterMax
=
settings
.
value
(
"max_players"
,
DEFAULT_MAX_PLAYERS_MAX
).
toInt
();
...
...
@@ -310,8 +310,8 @@ void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameType
settings
.
setValue
(
"unavailable_games_visible"
,
unavailableGamesVisible
);
settings
.
setValue
(
"password_protected_games
_hidden
"
,
p
asswordProtectedGames
Hidden
"
show_
password_protected_games"
,
showP
asswordProtectedGames
);
settings
.
setValue
(
"game_name_filter"
,
gameNameFilter
);
...
...
@@ -345,7 +345,7 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
if
(
game
.
only_registered
())
return
false
;
}
if
(
p
asswordProtectedGames
Hidden
&&
game
.
with_password
())
if
(
!
showP
asswordProtectedGames
&&
game
.
with_password
())
return
false
;
if
(
!
gameNameFilter
.
isEmpty
())
if
(
!
QString
::
fromStdString
(
game
.
description
()).
contains
(
gameNameFilter
,
Qt
::
CaseInsensitive
))
...
...
cockatrice/src/gamesmodel.h
View file @
8938d291
...
...
@@ -47,7 +47,7 @@ class GamesProxyModel : public QSortFilterProxyModel {
private:
ServerInfo_User
*
ownUser
;
bool
unavailableGamesVisible
;
bool
p
asswordProtectedGames
Hidden
;
bool
showP
asswordProtectedGames
;
QString
gameNameFilter
,
creatorNameFilter
;
QSet
<
int
>
gameTypeFilter
;
int
maxPlayersFilterMin
,
maxPlayersFilterMax
;
...
...
@@ -64,8 +64,8 @@ public:
bool
getUnavailableGamesVisible
()
const
{
return
unavailableGamesVisible
;
}
void
setUnavailableGamesVisible
(
bool
_unavailableGamesVisible
);
bool
getPasswordProtectedGames
Hidden
()
const
{
return
p
asswordProtectedGames
Hidden
;
}
void
setPasswordProtectedGames
Hidden
(
bool
_
p
asswordProtectedGames
Hidden
);
bool
get
Show
PasswordProtectedGames
()
const
{
return
showP
asswordProtectedGames
;
}
void
set
Show
PasswordProtectedGames
(
bool
_
showP
asswordProtectedGames
);
QString
getGameNameFilter
()
const
{
return
gameNameFilter
;
}
void
setGameNameFilter
(
const
QString
&
_gameNameFilter
);
QString
getCreatorNameFilter
()
const
{
return
creatorNameFilter
;
}
...
...
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