diff --git a/cockatrice/src/dlg_filter_games.cpp b/cockatrice/src/dlg_filter_games.cpp index ee099e35..28f2c8d7 100644 --- a/cockatrice/src/dlg_filter_games.cpp +++ b/cockatrice/src/dlg_filter_games.cpp @@ -23,8 +23,8 @@ DlgFilterGames::DlgFilterGames(const QMap &_allGameTypes, const Ga unavailableGamesVisibleCheckBox = new QCheckBox(tr("Show &unavailable games")); unavailableGamesVisibleCheckBox->setChecked(gamesProxyModel->getUnavailableGamesVisible()); - passwordProtectedGamesHiddenCheckBox = new QCheckBox(tr("Hide &password protected games")); - passwordProtectedGamesHiddenCheckBox->setChecked(gamesProxyModel->getPasswordProtectedGamesHidden()); + showPasswordProtectedGames = new QCheckBox(tr("Show &password protected games")); + showPasswordProtectedGames->setChecked(gamesProxyModel->getShowPasswordProtectedGames()); gameNameFilterEdit = new QLineEdit; gameNameFilterEdit->setText(gamesProxyModel->getGameNameFilter()); @@ -84,7 +84,7 @@ DlgFilterGames::DlgFilterGames(const QMap &_allGameTypes, const Ga leftGrid->addWidget(creatorNameFilterEdit, 1, 1); leftGrid->addWidget(maxPlayersGroupBox, 2, 0, 1, 2); leftGrid->addWidget(unavailableGamesVisibleCheckBox, 3, 0, 1, 2); - leftGrid->addWidget(passwordProtectedGamesHiddenCheckBox, 4, 0, 1, 2); + leftGrid->addWidget(showPasswordProtectedGames, 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::getPasswordProtectedGamesHidden() const +bool DlgFilterGames::getShowPasswordProtectedGames() const { - return passwordProtectedGamesHiddenCheckBox->isChecked(); + return showPasswordProtectedGames->isChecked(); } -void DlgFilterGames::setPasswordProtectedGamesHidden(bool _passwordProtectedGamesHidden) +void DlgFilterGames::setShowPasswordProtectedGames(bool _passwordProtectedGamesHidden) { - passwordProtectedGamesHiddenCheckBox->setChecked(_passwordProtectedGamesHidden); + showPasswordProtectedGames->setChecked(_passwordProtectedGamesHidden); } QString DlgFilterGames::getGameNameFilter() const diff --git a/cockatrice/src/dlg_filter_games.h b/cockatrice/src/dlg_filter_games.h index dbe1daa5..57ae5b8d 100644 --- a/cockatrice/src/dlg_filter_games.h +++ b/cockatrice/src/dlg_filter_games.h @@ -14,7 +14,7 @@ class DlgFilterGames : public QDialog { Q_OBJECT private: QCheckBox *unavailableGamesVisibleCheckBox; - QCheckBox *passwordProtectedGamesHiddenCheckBox; + QCheckBox *showPasswordProtectedGames; QLineEdit *gameNameFilterEdit; QLineEdit *creatorNameFilterEdit; QMap gameTypeFilterCheckBoxes; @@ -31,8 +31,8 @@ public: bool getUnavailableGamesVisible() const; void setUnavailableGamesVisible(bool _unavailableGamesVisible); - bool getPasswordProtectedGamesHidden() const; - void setPasswordProtectedGamesHidden(bool _passwordProtectedGamesHidden); + bool getShowPasswordProtectedGames() const; + void setShowPasswordProtectedGames(bool _passwordProtectedGamesHidden); QString getGameNameFilter() const; void setGameNameFilter(const QString &_gameNameFilter); QString getCreatorNameFilter() const; diff --git a/cockatrice/src/gameselector.cpp b/cockatrice/src/gameselector.cpp index fc9f1396..76218483 100644 --- a/cockatrice/src/gameselector.cpp +++ b/cockatrice/src/gameselector.cpp @@ -113,7 +113,7 @@ void GameSelector::actSetFilter() clearFilterButton->setEnabled(true); gameListProxyModel->setUnavailableGamesVisible(dlg.getUnavailableGamesVisible()); - gameListProxyModel->setPasswordProtectedGamesHidden(dlg.getPasswordProtectedGamesHidden()); + gameListProxyModel->setShowPasswordProtectedGames(dlg.getShowPasswordProtectedGames()); gameListProxyModel->setGameNameFilter(dlg.getGameNameFilter()); gameListProxyModel->setCreatorNameFilter(dlg.getCreatorNameFilter()); gameListProxyModel->setGameTypeFilter(dlg.getGameTypeFilter()); diff --git a/cockatrice/src/gamesmodel.cpp b/cockatrice/src/gamesmodel.cpp index 6f116714..a97ea0b6 100644 --- a/cockatrice/src/gamesmodel.cpp +++ b/cockatrice/src/gamesmodel.cpp @@ -223,7 +223,7 @@ GamesProxyModel::GamesProxyModel(QObject *parent, ServerInfo_User *_ownUser) : QSortFilterProxyModel(parent), ownUser(_ownUser), unavailableGamesVisible(false), - passwordProtectedGamesHidden(false), + showPasswordProtectedGames(true), maxPlayersFilterMin(-1), maxPlayersFilterMax(-1) { @@ -237,9 +237,9 @@ void GamesProxyModel::setUnavailableGamesVisible(bool _unavailableGamesVisible) invalidateFilter(); } -void GamesProxyModel::setPasswordProtectedGamesHidden(bool _passwordProtectedGamesHidden) +void GamesProxyModel::setShowPasswordProtectedGames(bool _showPasswordProtectedGames) { - passwordProtectedGamesHidden = _passwordProtectedGamesHidden; + showPasswordProtectedGames = _showPasswordProtectedGames; invalidateFilter(); } @@ -271,7 +271,7 @@ void GamesProxyModel::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlay void GamesProxyModel::resetFilterParameters() { unavailableGamesVisible = false; - passwordProtectedGamesHidden = false; + showPasswordProtectedGames = true; gameNameFilter = QString(); creatorNameFilter = QString(); gameTypeFilter.clear(); @@ -287,7 +287,7 @@ void GamesProxyModel::loadFilterParameters(const QMap &allGameType settings.beginGroup("filter_games"); unavailableGamesVisible = settings.value("unavailable_games_visible", false).toBool(); - passwordProtectedGamesHidden = settings.value("password_protected_games_hidden", false).toBool(); + showPasswordProtectedGames = settings.value("show_password_protected_games", true).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 &allGameType settings.setValue("unavailable_games_visible", unavailableGamesVisible); settings.setValue( - "password_protected_games_hidden", - passwordProtectedGamesHidden + "show_password_protected_games", + showPasswordProtectedGames ); 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 (passwordProtectedGamesHidden && game.with_password()) + if (!showPasswordProtectedGames && game.with_password()) return false; if (!gameNameFilter.isEmpty()) if (!QString::fromStdString(game.description()).contains(gameNameFilter, Qt::CaseInsensitive)) diff --git a/cockatrice/src/gamesmodel.h b/cockatrice/src/gamesmodel.h index c83c3e0a..df252958 100644 --- a/cockatrice/src/gamesmodel.h +++ b/cockatrice/src/gamesmodel.h @@ -47,7 +47,7 @@ class GamesProxyModel : public QSortFilterProxyModel { private: ServerInfo_User *ownUser; bool unavailableGamesVisible; - bool passwordProtectedGamesHidden; + bool showPasswordProtectedGames; QString gameNameFilter, creatorNameFilter; QSet gameTypeFilter; int maxPlayersFilterMin, maxPlayersFilterMax; @@ -64,8 +64,8 @@ public: bool getUnavailableGamesVisible() const { return unavailableGamesVisible; } void setUnavailableGamesVisible(bool _unavailableGamesVisible); - bool getPasswordProtectedGamesHidden() const { return passwordProtectedGamesHidden; } - void setPasswordProtectedGamesHidden(bool _passwordProtectedGamesHidden); + bool getShowPasswordProtectedGames() const { return showPasswordProtectedGames; } + void setShowPasswordProtectedGames(bool _showPasswordProtectedGames); QString getGameNameFilter() const { return gameNameFilter; } void setGameNameFilter(const QString &_gameNameFilter); QString getCreatorNameFilter() const { return creatorNameFilter; }