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
975c5e0d
Commit
975c5e0d
authored
Feb 02, 2015
by
Gavin Bises
Browse files
Show password protected games by default
parent
b7521bad
Changes
5
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_filter_games.cpp
View file @
975c5e0d
...
...
@@ -23,8 +23,8 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const Ga
unavailableGamesVisibleCheckBox
=
new
QCheckBox
(
tr
(
"Show &unavailable games"
));
unavailableGamesVisibleCheckBox
->
setChecked
(
gamesProxyModel
->
getUnavailableGamesVisible
());
passwordProtectedGames
Visible
CheckBox
=
new
QCheckBox
(
tr
(
"
Show
&password protected games"
));
passwordProtectedGames
Visible
CheckBox
->
setChecked
(
gamesProxyModel
->
getPasswordProtectedGames
Visible
());
passwordProtectedGames
Hidden
CheckBox
=
new
QCheckBox
(
tr
(
"
Hide
&password protected games"
));
passwordProtectedGames
Hidden
CheckBox
->
setChecked
(
gamesProxyModel
->
getPasswordProtectedGames
Hidden
());
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
(
passwordProtectedGames
Visible
CheckBox
,
4
,
0
,
1
,
2
);
leftGrid
->
addWidget
(
passwordProtectedGames
Hidden
CheckBox
,
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
Visible
()
const
bool
DlgFilterGames
::
getPasswordProtectedGames
Hidden
()
const
{
return
passwordProtectedGames
Visible
CheckBox
->
isChecked
();
return
passwordProtectedGames
Hidden
CheckBox
->
isChecked
();
}
void
DlgFilterGames
::
setPasswordProtectedGames
Visible
(
bool
_passwordProtectedGames
Visible
)
void
DlgFilterGames
::
setPasswordProtectedGames
Hidden
(
bool
_passwordProtectedGames
Hidden
)
{
passwordProtectedGames
Visible
CheckBox
->
setChecked
(
_passwordProtectedGames
Visible
);
passwordProtectedGames
Hidden
CheckBox
->
setChecked
(
_passwordProtectedGames
Hidden
);
}
QString
DlgFilterGames
::
getGameNameFilter
()
const
...
...
cockatrice/src/dlg_filter_games.h
View file @
975c5e0d
...
...
@@ -14,7 +14,7 @@ class DlgFilterGames : public QDialog {
Q_OBJECT
private:
QCheckBox
*
unavailableGamesVisibleCheckBox
;
QCheckBox
*
passwordProtectedGames
Visible
CheckBox
;
QCheckBox
*
passwordProtectedGames
Hidden
CheckBox
;
QLineEdit
*
gameNameFilterEdit
;
QLineEdit
*
creatorNameFilterEdit
;
QMap
<
int
,
QCheckBox
*>
gameTypeFilterCheckBoxes
;
...
...
@@ -31,8 +31,8 @@ public:
bool
getUnavailableGamesVisible
()
const
;
void
setUnavailableGamesVisible
(
bool
_unavailableGamesVisible
);
bool
getPasswordProtectedGames
Visible
()
const
;
void
setPasswordProtectedGames
Visible
(
bool
_passwordProtectedGames
Visible
);
bool
getPasswordProtectedGames
Hidden
()
const
;
void
setPasswordProtectedGames
Hidden
(
bool
_passwordProtectedGames
Hidden
);
QString
getGameNameFilter
()
const
;
void
setGameNameFilter
(
const
QString
&
_gameNameFilter
);
QString
getCreatorNameFilter
()
const
;
...
...
cockatrice/src/gameselector.cpp
View file @
975c5e0d
...
...
@@ -94,7 +94,7 @@ void GameSelector::actSetFilter()
clearFilterButton
->
setEnabled
(
true
);
gameListProxyModel
->
setUnavailableGamesVisible
(
dlg
.
getUnavailableGamesVisible
());
gameListProxyModel
->
setPasswordProtectedGames
Visible
(
dlg
.
getPasswordProtectedGames
Visible
());
gameListProxyModel
->
setPasswordProtectedGames
Hidden
(
dlg
.
getPasswordProtectedGames
Hidden
());
gameListProxyModel
->
setGameNameFilter
(
dlg
.
getGameNameFilter
());
gameListProxyModel
->
setCreatorNameFilter
(
dlg
.
getCreatorNameFilter
());
gameListProxyModel
->
setGameTypeFilter
(
dlg
.
getGameTypeFilter
());
...
...
cockatrice/src/gamesmodel.cpp
View file @
975c5e0d
...
...
@@ -232,7 +232,7 @@ GamesProxyModel::GamesProxyModel(QObject *parent, ServerInfo_User *_ownUser)
:
QSortFilterProxyModel
(
parent
),
ownUser
(
_ownUser
),
unavailableGamesVisible
(
false
),
passwordProtectedGames
Visible
(
false
),
passwordProtectedGames
Hidden
(
false
),
maxPlayersFilterMin
(
-
1
),
maxPlayersFilterMax
(
-
1
)
{
...
...
@@ -246,9 +246,9 @@ void GamesProxyModel::setUnavailableGamesVisible(bool _unavailableGamesVisible)
invalidateFilter
();
}
void
GamesProxyModel
::
setPasswordProtectedGames
Visible
(
bool
_passwordProtectedGames
Visible
)
void
GamesProxyModel
::
setPasswordProtectedGames
Hidden
(
bool
_passwordProtectedGames
Hidden
)
{
passwordProtectedGames
Visible
=
_passwordProtectedGames
Visible
;
passwordProtectedGames
Hidden
=
_passwordProtectedGames
Hidden
;
invalidateFilter
();
}
...
...
@@ -280,7 +280,7 @@ void GamesProxyModel::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlay
void
GamesProxyModel
::
resetFilterParameters
()
{
unavailableGamesVisible
=
false
;
passwordProtectedGames
Visible
=
false
;
passwordProtectedGames
Hidden
=
false
;
gameNameFilter
=
QString
();
creatorNameFilter
=
QString
();
gameTypeFilter
.
clear
();
...
...
@@ -296,7 +296,7 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
settings
.
beginGroup
(
"filter_games"
);
unavailableGamesVisible
=
settings
.
value
(
"unavailable_games_visible"
,
false
).
toBool
();
passwordProtectedGames
Visible
=
settings
.
value
(
"password_protected_games_
visible
"
,
false
).
toBool
();
passwordProtectedGames
Hidden
=
settings
.
value
(
"password_protected_games_
hidden
"
,
false
).
toBool
();
gameNameFilter
=
settings
.
value
(
"game_name_filter"
,
""
).
toString
();
creatorNameFilter
=
settings
.
value
(
"creator_name_filter"
,
""
).
toString
();
maxPlayersFilterMin
=
settings
.
value
(
"min_players"
,
1
).
toInt
();
...
...
@@ -320,8 +320,8 @@ void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameType
settings
.
setValue
(
"unavailable_games_visible"
,
unavailableGamesVisible
);
settings
.
setValue
(
"password_protected_games_
visible
"
,
passwordProtectedGames
Visible
"password_protected_games_
hidden
"
,
passwordProtectedGames
Hidden
);
settings
.
setValue
(
"game_name_filter"
,
gameNameFilter
);
settings
.
setValue
(
"creator_name_filter"
,
creatorNameFilter
);
...
...
@@ -356,7 +356,7 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
if
(
game
.
only_registered
())
return
false
;
}
if
(
!
passwordProtectedGames
Visible
&&
game
.
with_password
())
if
(
passwordProtectedGames
Hidden
&&
game
.
with_password
())
return
false
;
if
(
!
gameNameFilter
.
isEmpty
())
if
(
!
QString
::
fromStdString
(
game
.
description
()).
contains
(
gameNameFilter
,
Qt
::
CaseInsensitive
))
...
...
cockatrice/src/gamesmodel.h
View file @
975c5e0d
...
...
@@ -45,7 +45,7 @@ class GamesProxyModel : public QSortFilterProxyModel {
private:
ServerInfo_User
*
ownUser
;
bool
unavailableGamesVisible
;
bool
passwordProtectedGames
Visible
;
bool
passwordProtectedGames
Hidden
;
QString
gameNameFilter
,
creatorNameFilter
;
QSet
<
int
>
gameTypeFilter
;
int
maxPlayersFilterMin
,
maxPlayersFilterMax
;
...
...
@@ -62,8 +62,8 @@ public:
bool
getUnavailableGamesVisible
()
const
{
return
unavailableGamesVisible
;
}
void
setUnavailableGamesVisible
(
bool
_unavailableGamesVisible
);
bool
getPasswordProtectedGames
Visible
()
const
{
return
passwordProtectedGames
Visible
;
}
void
setPasswordProtectedGames
Visible
(
bool
_passwordProtectedGames
Visible
);
bool
getPasswordProtectedGames
Hidden
()
const
{
return
passwordProtectedGames
Hidden
;
}
void
setPasswordProtectedGames
Hidden
(
bool
_passwordProtectedGames
Hidden
);
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