Add game filtering for spectator attributes (#4127)
This commit is contained in:
parent
1a94261490
commit
a49c4865bb
8 changed files with 291 additions and 62 deletions
|
@ -27,8 +27,11 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
||||||
showBuddiesOnlyGames = new QCheckBox(tr("Show '&buddies only' games"));
|
showBuddiesOnlyGames = new QCheckBox(tr("Show '&buddies only' games"));
|
||||||
showBuddiesOnlyGames->setChecked(gamesProxyModel->getShowBuddiesOnlyGames());
|
showBuddiesOnlyGames->setChecked(gamesProxyModel->getShowBuddiesOnlyGames());
|
||||||
|
|
||||||
unavailableGamesVisibleCheckBox = new QCheckBox(tr("Show &unavailable games"));
|
showFullGames = new QCheckBox(tr("Show &full games"));
|
||||||
unavailableGamesVisibleCheckBox->setChecked(gamesProxyModel->getUnavailableGamesVisible());
|
showFullGames->setChecked(gamesProxyModel->getShowFullGames());
|
||||||
|
|
||||||
|
showGamesThatStarted = new QCheckBox(tr("Show games &that have started"));
|
||||||
|
showGamesThatStarted->setChecked(gamesProxyModel->getShowGamesThatStarted());
|
||||||
|
|
||||||
showPasswordProtectedGames = new QCheckBox(tr("Show &password protected games"));
|
showPasswordProtectedGames = new QCheckBox(tr("Show &password protected games"));
|
||||||
showPasswordProtectedGames->setChecked(gamesProxyModel->getShowPasswordProtectedGames());
|
showPasswordProtectedGames->setChecked(gamesProxyModel->getShowPasswordProtectedGames());
|
||||||
|
@ -41,19 +44,19 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
||||||
maxGameAgeComboBox->addItems(gameAgeMap.values());
|
maxGameAgeComboBox->addItems(gameAgeMap.values());
|
||||||
QTime gameAge = gamesProxyModel->getMaxGameAge();
|
QTime gameAge = gamesProxyModel->getMaxGameAge();
|
||||||
maxGameAgeComboBox->setCurrentIndex(gameAgeMap.keys().indexOf(gameAge)); // index is -1 if unknown
|
maxGameAgeComboBox->setCurrentIndex(gameAgeMap.keys().indexOf(gameAge)); // index is -1 if unknown
|
||||||
QLabel *maxGameAgeLabel = new QLabel(tr("&Newer than:"));
|
auto *maxGameAgeLabel = new QLabel(tr("&Newer than:"));
|
||||||
maxGameAgeLabel->setBuddy(maxGameAgeComboBox);
|
maxGameAgeLabel->setBuddy(maxGameAgeComboBox);
|
||||||
|
|
||||||
gameNameFilterEdit = new QLineEdit;
|
gameNameFilterEdit = new QLineEdit;
|
||||||
gameNameFilterEdit->setText(gamesProxyModel->getGameNameFilter());
|
gameNameFilterEdit->setText(gamesProxyModel->getGameNameFilter());
|
||||||
QLabel *gameNameFilterLabel = new QLabel(tr("Game &description:"));
|
auto *gameNameFilterLabel = new QLabel(tr("Game &description:"));
|
||||||
gameNameFilterLabel->setBuddy(gameNameFilterEdit);
|
gameNameFilterLabel->setBuddy(gameNameFilterEdit);
|
||||||
creatorNameFilterEdit = new QLineEdit;
|
creatorNameFilterEdit = new QLineEdit;
|
||||||
creatorNameFilterEdit->setText(gamesProxyModel->getCreatorNameFilter());
|
creatorNameFilterEdit->setText(gamesProxyModel->getCreatorNameFilter());
|
||||||
QLabel *creatorNameFilterLabel = new QLabel(tr("&Creator name:"));
|
auto *creatorNameFilterLabel = new QLabel(tr("&Creator name:"));
|
||||||
creatorNameFilterLabel->setBuddy(creatorNameFilterEdit);
|
creatorNameFilterLabel->setBuddy(creatorNameFilterEdit);
|
||||||
|
|
||||||
QGridLayout *generalGrid = new QGridLayout;
|
auto *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(gameNameFilterLabel, 0, 0);
|
generalGrid->addWidget(gameNameFilterLabel, 0, 0);
|
||||||
generalGrid->addWidget(gameNameFilterEdit, 0, 1);
|
generalGrid->addWidget(gameNameFilterEdit, 0, 1);
|
||||||
generalGrid->addWidget(creatorNameFilterLabel, 1, 0);
|
generalGrid->addWidget(creatorNameFilterLabel, 1, 0);
|
||||||
|
@ -63,12 +66,12 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
||||||
generalGroupBox = new QGroupBox(tr("General"));
|
generalGroupBox = new QGroupBox(tr("General"));
|
||||||
generalGroupBox->setLayout(generalGrid);
|
generalGroupBox->setLayout(generalGrid);
|
||||||
|
|
||||||
QVBoxLayout *gameTypeFilterLayout = new QVBoxLayout;
|
auto *gameTypeFilterLayout = new QVBoxLayout;
|
||||||
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
|
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
|
||||||
while (gameTypesIterator.hasNext()) {
|
while (gameTypesIterator.hasNext()) {
|
||||||
gameTypesIterator.next();
|
gameTypesIterator.next();
|
||||||
|
|
||||||
QCheckBox *temp = new QCheckBox(gameTypesIterator.value());
|
auto *temp = new QCheckBox(gameTypesIterator.value());
|
||||||
temp->setChecked(gamesProxyModel->getGameTypeFilter().contains(gameTypesIterator.key()));
|
temp->setChecked(gamesProxyModel->getGameTypeFilter().contains(gameTypesIterator.key()));
|
||||||
|
|
||||||
gameTypeFilterCheckBoxes.insert(gameTypesIterator.key(), temp);
|
gameTypeFilterCheckBoxes.insert(gameTypesIterator.key(), temp);
|
||||||
|
@ -79,61 +82,86 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
||||||
gameTypeFilterGroupBox = new QGroupBox(tr("&Game types"));
|
gameTypeFilterGroupBox = new QGroupBox(tr("&Game types"));
|
||||||
gameTypeFilterGroupBox->setLayout(gameTypeFilterLayout);
|
gameTypeFilterGroupBox->setLayout(gameTypeFilterLayout);
|
||||||
} else
|
} else
|
||||||
gameTypeFilterGroupBox = 0;
|
gameTypeFilterGroupBox = nullptr;
|
||||||
|
|
||||||
QLabel *maxPlayersFilterMinLabel = new QLabel(tr("at &least:"));
|
auto *maxPlayersFilterMinLabel = new QLabel(tr("at &least:"));
|
||||||
maxPlayersFilterMinSpinBox = new QSpinBox;
|
maxPlayersFilterMinSpinBox = new QSpinBox;
|
||||||
maxPlayersFilterMinSpinBox->setMinimum(1);
|
maxPlayersFilterMinSpinBox->setMinimum(1);
|
||||||
maxPlayersFilterMinSpinBox->setMaximum(99);
|
maxPlayersFilterMinSpinBox->setMaximum(99);
|
||||||
maxPlayersFilterMinSpinBox->setValue(gamesProxyModel->getMaxPlayersFilterMin());
|
maxPlayersFilterMinSpinBox->setValue(gamesProxyModel->getMaxPlayersFilterMin());
|
||||||
maxPlayersFilterMinLabel->setBuddy(maxPlayersFilterMinSpinBox);
|
maxPlayersFilterMinLabel->setBuddy(maxPlayersFilterMinSpinBox);
|
||||||
|
|
||||||
QLabel *maxPlayersFilterMaxLabel = new QLabel(tr("at &most:"));
|
auto *maxPlayersFilterMaxLabel = new QLabel(tr("at &most:"));
|
||||||
maxPlayersFilterMaxSpinBox = new QSpinBox;
|
maxPlayersFilterMaxSpinBox = new QSpinBox;
|
||||||
maxPlayersFilterMaxSpinBox->setMinimum(1);
|
maxPlayersFilterMaxSpinBox->setMinimum(1);
|
||||||
maxPlayersFilterMaxSpinBox->setMaximum(99);
|
maxPlayersFilterMaxSpinBox->setMaximum(99);
|
||||||
maxPlayersFilterMaxSpinBox->setValue(gamesProxyModel->getMaxPlayersFilterMax());
|
maxPlayersFilterMaxSpinBox->setValue(gamesProxyModel->getMaxPlayersFilterMax());
|
||||||
maxPlayersFilterMaxLabel->setBuddy(maxPlayersFilterMaxSpinBox);
|
maxPlayersFilterMaxLabel->setBuddy(maxPlayersFilterMaxSpinBox);
|
||||||
|
|
||||||
QGridLayout *maxPlayersFilterLayout = new QGridLayout;
|
auto *maxPlayersFilterLayout = new QGridLayout;
|
||||||
maxPlayersFilterLayout->addWidget(maxPlayersFilterMinLabel, 0, 0);
|
maxPlayersFilterLayout->addWidget(maxPlayersFilterMinLabel, 0, 0);
|
||||||
maxPlayersFilterLayout->addWidget(maxPlayersFilterMinSpinBox, 0, 1);
|
maxPlayersFilterLayout->addWidget(maxPlayersFilterMinSpinBox, 0, 1);
|
||||||
maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxLabel, 1, 0);
|
maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxLabel, 1, 0);
|
||||||
maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxSpinBox, 1, 1);
|
maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxSpinBox, 1, 1);
|
||||||
|
|
||||||
QGroupBox *maxPlayersGroupBox = new QGroupBox(tr("Maximum player count"));
|
auto *maxPlayersGroupBox = new QGroupBox(tr("Maximum player count"));
|
||||||
maxPlayersGroupBox->setLayout(maxPlayersFilterLayout);
|
maxPlayersGroupBox->setLayout(maxPlayersFilterLayout);
|
||||||
|
|
||||||
QGridLayout *restrictionsLayout = new QGridLayout;
|
auto *restrictionsLayout = new QGridLayout;
|
||||||
restrictionsLayout->addWidget(unavailableGamesVisibleCheckBox, 0, 0);
|
restrictionsLayout->addWidget(showFullGames, 0, 0);
|
||||||
restrictionsLayout->addWidget(showPasswordProtectedGames, 1, 0);
|
restrictionsLayout->addWidget(showGamesThatStarted, 1, 0);
|
||||||
restrictionsLayout->addWidget(showBuddiesOnlyGames, 2, 0);
|
restrictionsLayout->addWidget(showPasswordProtectedGames, 2, 0);
|
||||||
restrictionsLayout->addWidget(hideIgnoredUserGames, 3, 0);
|
restrictionsLayout->addWidget(showBuddiesOnlyGames, 3, 0);
|
||||||
|
restrictionsLayout->addWidget(hideIgnoredUserGames, 4, 0);
|
||||||
|
|
||||||
QGroupBox *restrictionsGroupBox = new QGroupBox(tr("Restrictions"));
|
auto *restrictionsGroupBox = new QGroupBox(tr("Restrictions"));
|
||||||
restrictionsGroupBox->setLayout(restrictionsLayout);
|
restrictionsGroupBox->setLayout(restrictionsLayout);
|
||||||
|
|
||||||
QGridLayout *leftGrid = new QGridLayout;
|
showOnlyIfSpectatorsCanWatch = new QCheckBox(tr("Show games only if &spectators can watch"));
|
||||||
|
showOnlyIfSpectatorsCanWatch->setChecked(gamesProxyModel->getShowOnlyIfSpectatorsCanWatch());
|
||||||
|
connect(showOnlyIfSpectatorsCanWatch, SIGNAL(toggled(bool)), this, SLOT(toggleSpectatorCheckboxEnabledness(bool)));
|
||||||
|
|
||||||
|
showSpectatorPasswordProtected = new QCheckBox(tr("Show spectator password p&rotected games"));
|
||||||
|
showSpectatorPasswordProtected->setChecked(gamesProxyModel->getShowSpectatorPasswordProtected());
|
||||||
|
showOnlyIfSpectatorsCanChat = new QCheckBox(tr("Show only if spectators can ch&at"));
|
||||||
|
showOnlyIfSpectatorsCanChat->setChecked(gamesProxyModel->getShowOnlyIfSpectatorsCanChat());
|
||||||
|
showOnlyIfSpectatorsCanSeeHands = new QCheckBox(tr("Show only if spectators can see &hands"));
|
||||||
|
showOnlyIfSpectatorsCanSeeHands->setChecked(gamesProxyModel->getShowOnlyIfSpectatorsCanSeeHands());
|
||||||
|
toggleSpectatorCheckboxEnabledness(getShowOnlyIfSpectatorsCanWatch());
|
||||||
|
|
||||||
|
auto *spectatorsLayout = new QGridLayout;
|
||||||
|
spectatorsLayout->addWidget(showOnlyIfSpectatorsCanWatch, 0, 0);
|
||||||
|
spectatorsLayout->addWidget(showSpectatorPasswordProtected, 1, 0);
|
||||||
|
spectatorsLayout->addWidget(showOnlyIfSpectatorsCanChat, 2, 0);
|
||||||
|
spectatorsLayout->addWidget(showOnlyIfSpectatorsCanSeeHands, 3, 0);
|
||||||
|
|
||||||
|
auto *spectatorsGroupBox = new QGroupBox(tr("Spectators"));
|
||||||
|
spectatorsGroupBox->setLayout(spectatorsLayout);
|
||||||
|
|
||||||
|
auto *leftGrid = new QGridLayout;
|
||||||
leftGrid->addWidget(generalGroupBox, 0, 0, 1, 2);
|
leftGrid->addWidget(generalGroupBox, 0, 0, 1, 2);
|
||||||
leftGrid->addWidget(maxPlayersGroupBox, 2, 0, 1, 2);
|
leftGrid->addWidget(maxPlayersGroupBox, 2, 0, 1, 2);
|
||||||
leftGrid->addWidget(restrictionsGroupBox, 3, 0, 1, 2);
|
leftGrid->addWidget(restrictionsGroupBox, 3, 0, 1, 2);
|
||||||
|
|
||||||
QVBoxLayout *leftColumn = new QVBoxLayout;
|
auto *leftColumn = new QVBoxLayout;
|
||||||
leftColumn->addLayout(leftGrid);
|
leftColumn->addLayout(leftGrid);
|
||||||
leftColumn->addStretch();
|
leftColumn->addStretch();
|
||||||
|
|
||||||
QVBoxLayout *rightColumn = new QVBoxLayout;
|
auto *rightGrid = new QGridLayout;
|
||||||
rightColumn->addWidget(gameTypeFilterGroupBox);
|
rightGrid->addWidget(gameTypeFilterGroupBox, 0, 0, 1, 1);
|
||||||
|
rightGrid->addWidget(spectatorsGroupBox, 1, 0, 1, 1);
|
||||||
|
auto *rightColumn = new QVBoxLayout;
|
||||||
|
rightColumn->addLayout(rightGrid);
|
||||||
|
|
||||||
QHBoxLayout *hbox = new QHBoxLayout;
|
auto *hbox = new QHBoxLayout;
|
||||||
hbox->addLayout(leftColumn);
|
hbox->addLayout(leftColumn);
|
||||||
hbox->addLayout(rightColumn);
|
hbox->addLayout(rightColumn);
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk()));
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk()));
|
||||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
auto *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(hbox);
|
mainLayout->addLayout(hbox);
|
||||||
mainLayout->addWidget(buttonBox);
|
mainLayout->addWidget(buttonBox);
|
||||||
|
|
||||||
|
@ -146,14 +174,21 @@ void DlgFilterGames::actOk()
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DlgFilterGames::getUnavailableGamesVisible() const
|
void DlgFilterGames::toggleSpectatorCheckboxEnabledness(bool spectatorsEnabled)
|
||||||
{
|
{
|
||||||
return unavailableGamesVisibleCheckBox->isChecked();
|
showSpectatorPasswordProtected->setDisabled(!spectatorsEnabled);
|
||||||
|
showOnlyIfSpectatorsCanChat->setDisabled(!spectatorsEnabled);
|
||||||
|
showOnlyIfSpectatorsCanSeeHands->setDisabled(!spectatorsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgFilterGames::setUnavailableGamesVisible(bool _unavailableGamesVisible)
|
bool DlgFilterGames::getShowFullGames() const
|
||||||
{
|
{
|
||||||
unavailableGamesVisibleCheckBox->setChecked(_unavailableGamesVisible);
|
return showFullGames->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgFilterGames::getShowGamesThatStarted() const
|
||||||
|
{
|
||||||
|
return showGamesThatStarted->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DlgFilterGames::getShowBuddiesOnlyGames() const
|
bool DlgFilterGames::getShowBuddiesOnlyGames() const
|
||||||
|
@ -252,3 +287,23 @@ void DlgFilterGames::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlaye
|
||||||
maxPlayersFilterMaxSpinBox->setValue(_maxPlayersFilterMax == -1 ? maxPlayersFilterMaxSpinBox->maximum()
|
maxPlayersFilterMaxSpinBox->setValue(_maxPlayersFilterMax == -1 ? maxPlayersFilterMaxSpinBox->maximum()
|
||||||
: _maxPlayersFilterMax);
|
: _maxPlayersFilterMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DlgFilterGames::getShowOnlyIfSpectatorsCanWatch() const
|
||||||
|
{
|
||||||
|
return showOnlyIfSpectatorsCanWatch->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgFilterGames::getShowSpectatorPasswordProtected() const
|
||||||
|
{
|
||||||
|
return showSpectatorPasswordProtected->isEnabled() && showSpectatorPasswordProtected->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgFilterGames::getShowOnlyIfSpectatorsCanChat() const
|
||||||
|
{
|
||||||
|
return showOnlyIfSpectatorsCanChat->isEnabled() && showOnlyIfSpectatorsCanChat->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgFilterGames::getShowOnlyIfSpectatorsCanSeeHands() const
|
||||||
|
{
|
||||||
|
return showOnlyIfSpectatorsCanSeeHands->isEnabled() && showOnlyIfSpectatorsCanSeeHands->isChecked();
|
||||||
|
}
|
|
@ -22,7 +22,8 @@ class DlgFilterGames : public QDialog
|
||||||
private:
|
private:
|
||||||
QGroupBox *generalGroupBox;
|
QGroupBox *generalGroupBox;
|
||||||
QCheckBox *showBuddiesOnlyGames;
|
QCheckBox *showBuddiesOnlyGames;
|
||||||
QCheckBox *unavailableGamesVisibleCheckBox;
|
QCheckBox *showFullGames;
|
||||||
|
QCheckBox *showGamesThatStarted;
|
||||||
QCheckBox *showPasswordProtectedGames;
|
QCheckBox *showPasswordProtectedGames;
|
||||||
QCheckBox *hideIgnoredUserGames;
|
QCheckBox *hideIgnoredUserGames;
|
||||||
QLineEdit *gameNameFilterEdit;
|
QLineEdit *gameNameFilterEdit;
|
||||||
|
@ -32,19 +33,25 @@ private:
|
||||||
QSpinBox *maxPlayersFilterMaxSpinBox;
|
QSpinBox *maxPlayersFilterMaxSpinBox;
|
||||||
QComboBox *maxGameAgeComboBox;
|
QComboBox *maxGameAgeComboBox;
|
||||||
|
|
||||||
|
QCheckBox *showOnlyIfSpectatorsCanWatch;
|
||||||
|
QCheckBox *showSpectatorPasswordProtected;
|
||||||
|
QCheckBox *showOnlyIfSpectatorsCanChat;
|
||||||
|
QCheckBox *showOnlyIfSpectatorsCanSeeHands;
|
||||||
|
|
||||||
const QMap<int, QString> &allGameTypes;
|
const QMap<int, QString> &allGameTypes;
|
||||||
const GamesProxyModel *gamesProxyModel;
|
const GamesProxyModel *gamesProxyModel;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void actOk();
|
void actOk();
|
||||||
|
void toggleSpectatorCheckboxEnabledness(bool spectatorsEnabled);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
||||||
const GamesProxyModel *_gamesProxyModel,
|
const GamesProxyModel *_gamesProxyModel,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
bool getUnavailableGamesVisible() const;
|
bool getShowFullGames() const;
|
||||||
void setUnavailableGamesVisible(bool _unavailableGamesVisible);
|
bool getShowGamesThatStarted() const;
|
||||||
bool getShowPasswordProtectedGames() const;
|
bool getShowPasswordProtectedGames() const;
|
||||||
void setShowPasswordProtectedGames(bool _passwordProtectedGamesHidden);
|
void setShowPasswordProtectedGames(bool _passwordProtectedGamesHidden);
|
||||||
bool getShowBuddiesOnlyGames() const;
|
bool getShowBuddiesOnlyGames() const;
|
||||||
|
@ -62,6 +69,10 @@ public:
|
||||||
void setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax);
|
void setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax);
|
||||||
const QTime &getMaxGameAge() const;
|
const QTime &getMaxGameAge() const;
|
||||||
const QMap<QTime, QString> gameAgeMap;
|
const QMap<QTime, QString> gameAgeMap;
|
||||||
|
bool getShowOnlyIfSpectatorsCanWatch() const;
|
||||||
|
bool getShowSpectatorPasswordProtected() const;
|
||||||
|
bool getShowOnlyIfSpectatorsCanChat() const;
|
||||||
|
bool getShowOnlyIfSpectatorsCanSeeHands() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -152,7 +152,8 @@ void GameSelector::actSetFilter()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gameListProxyModel->setShowBuddiesOnlyGames(dlg.getShowBuddiesOnlyGames());
|
gameListProxyModel->setShowBuddiesOnlyGames(dlg.getShowBuddiesOnlyGames());
|
||||||
gameListProxyModel->setUnavailableGamesVisible(dlg.getUnavailableGamesVisible());
|
gameListProxyModel->setShowFullGames(dlg.getShowFullGames());
|
||||||
|
gameListProxyModel->setShowGamesThatStarted(dlg.getShowGamesThatStarted());
|
||||||
gameListProxyModel->setShowPasswordProtectedGames(dlg.getShowPasswordProtectedGames());
|
gameListProxyModel->setShowPasswordProtectedGames(dlg.getShowPasswordProtectedGames());
|
||||||
gameListProxyModel->setHideIgnoredUserGames(dlg.getHideIgnoredUserGames());
|
gameListProxyModel->setHideIgnoredUserGames(dlg.getHideIgnoredUserGames());
|
||||||
gameListProxyModel->setGameNameFilter(dlg.getGameNameFilter());
|
gameListProxyModel->setGameNameFilter(dlg.getGameNameFilter());
|
||||||
|
@ -160,6 +161,10 @@ void GameSelector::actSetFilter()
|
||||||
gameListProxyModel->setGameTypeFilter(dlg.getGameTypeFilter());
|
gameListProxyModel->setGameTypeFilter(dlg.getGameTypeFilter());
|
||||||
gameListProxyModel->setMaxPlayersFilter(dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax());
|
gameListProxyModel->setMaxPlayersFilter(dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax());
|
||||||
gameListProxyModel->setMaxGameAge(dlg.getMaxGameAge());
|
gameListProxyModel->setMaxGameAge(dlg.getMaxGameAge());
|
||||||
|
gameListProxyModel->setShowOnlyIfSpectatorsCanWatch(dlg.getShowOnlyIfSpectatorsCanWatch());
|
||||||
|
gameListProxyModel->setShowSpectatorPasswordProtected(dlg.getShowSpectatorPasswordProtected());
|
||||||
|
gameListProxyModel->setShowOnlyIfSpectatorsCanChat(dlg.getShowOnlyIfSpectatorsCanChat());
|
||||||
|
gameListProxyModel->setShowOnlyIfSpectatorsCanSeeHands(dlg.getShowOnlyIfSpectatorsCanSeeHands());
|
||||||
gameListProxyModel->saveFilterParameters(gameTypeMap);
|
gameListProxyModel->saveFilterParameters(gameTypeMap);
|
||||||
|
|
||||||
clearFilterButton->setEnabled(!gameListProxyModel->areFilterParametersSetToDefaults());
|
clearFilterButton->setEnabled(!gameListProxyModel->areFilterParametersSetToDefaults());
|
||||||
|
|
|
@ -23,10 +23,15 @@ enum GameListColumn
|
||||||
SPECTATORS
|
SPECTATORS
|
||||||
};
|
};
|
||||||
|
|
||||||
const bool DEFAULT_UNAVAILABLE_GAMES_VISIBLE = false;
|
const bool DEFAULT_SHOW_FULL_GAMES = false;
|
||||||
|
const bool DEFAULT_SHOW_GAMES_THAT_STARTED = false;
|
||||||
const bool DEFAULT_SHOW_PASSWORD_PROTECTED_GAMES = true;
|
const bool DEFAULT_SHOW_PASSWORD_PROTECTED_GAMES = true;
|
||||||
const bool DEFAULT_SHOW_BUDDIES_ONLY_GAMES = true;
|
const bool DEFAULT_SHOW_BUDDIES_ONLY_GAMES = true;
|
||||||
const bool DEFAULT_HIDE_IGNORED_USER_GAMES = false;
|
const bool DEFAULT_HIDE_IGNORED_USER_GAMES = false;
|
||||||
|
const bool DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_WATCH = false;
|
||||||
|
const bool DEFAULT_SHOW_SPECTATOR_PASSWORD_PROTECTED = true;
|
||||||
|
const bool DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_CHAT = false;
|
||||||
|
const bool DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_SEE_HANDS = false;
|
||||||
const int DEFAULT_MAX_PLAYERS_MIN = 1;
|
const int DEFAULT_MAX_PLAYERS_MIN = 1;
|
||||||
const int DEFAULT_MAX_PLAYERS_MAX = 99;
|
const int DEFAULT_MAX_PLAYERS_MAX = 99;
|
||||||
constexpr QTime DEFAULT_MAX_GAME_AGE = QTime();
|
constexpr QTime DEFAULT_MAX_GAME_AGE = QTime();
|
||||||
|
@ -288,9 +293,15 @@ void GamesProxyModel::setHideIgnoredUserGames(bool _hideIgnoredUserGames)
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setUnavailableGamesVisible(bool _unavailableGamesVisible)
|
void GamesProxyModel::setShowFullGames(bool _showFullGames)
|
||||||
{
|
{
|
||||||
unavailableGamesVisible = _unavailableGamesVisible;
|
showFullGames = _showFullGames;
|
||||||
|
invalidateFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GamesProxyModel::setShowGamesThatStarted(bool _showGamesThatStarted)
|
||||||
|
{
|
||||||
|
showGamesThatStarted = _showGamesThatStarted;
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,6 +342,30 @@ void GamesProxyModel::setMaxGameAge(const QTime &_maxGameAge)
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GamesProxyModel::setShowOnlyIfSpectatorsCanWatch(bool _showOnlyIfSpectatorsCanWatch)
|
||||||
|
{
|
||||||
|
showOnlyIfSpectatorsCanWatch = _showOnlyIfSpectatorsCanWatch;
|
||||||
|
invalidateFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GamesProxyModel::setShowSpectatorPasswordProtected(bool _showSpectatorPasswordProtected)
|
||||||
|
{
|
||||||
|
showSpectatorPasswordProtected = _showSpectatorPasswordProtected;
|
||||||
|
invalidateFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GamesProxyModel::setShowOnlyIfSpectatorsCanChat(bool _showOnlyIfSpectatorsCanChat)
|
||||||
|
{
|
||||||
|
showOnlyIfSpectatorsCanChat = _showOnlyIfSpectatorsCanChat;
|
||||||
|
invalidateFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GamesProxyModel::setShowOnlyIfSpectatorsCanSeeHands(bool _showOnlyIfSpectatorsCanSeeHands)
|
||||||
|
{
|
||||||
|
showOnlyIfSpectatorsCanSeeHands = _showOnlyIfSpectatorsCanSeeHands;
|
||||||
|
invalidateFilter();
|
||||||
|
}
|
||||||
|
|
||||||
int GamesProxyModel::getNumFilteredGames() const
|
int GamesProxyModel::getNumFilteredGames() const
|
||||||
{
|
{
|
||||||
GamesModel *model = qobject_cast<GamesModel *>(sourceModel());
|
GamesModel *model = qobject_cast<GamesModel *>(sourceModel());
|
||||||
|
@ -348,7 +383,8 @@ int GamesProxyModel::getNumFilteredGames() const
|
||||||
|
|
||||||
void GamesProxyModel::resetFilterParameters()
|
void GamesProxyModel::resetFilterParameters()
|
||||||
{
|
{
|
||||||
unavailableGamesVisible = DEFAULT_UNAVAILABLE_GAMES_VISIBLE;
|
showFullGames = DEFAULT_SHOW_FULL_GAMES;
|
||||||
|
showGamesThatStarted = DEFAULT_SHOW_GAMES_THAT_STARTED;
|
||||||
showPasswordProtectedGames = DEFAULT_SHOW_PASSWORD_PROTECTED_GAMES;
|
showPasswordProtectedGames = DEFAULT_SHOW_PASSWORD_PROTECTED_GAMES;
|
||||||
showBuddiesOnlyGames = DEFAULT_SHOW_BUDDIES_ONLY_GAMES;
|
showBuddiesOnlyGames = DEFAULT_SHOW_BUDDIES_ONLY_GAMES;
|
||||||
hideIgnoredUserGames = DEFAULT_HIDE_IGNORED_USER_GAMES;
|
hideIgnoredUserGames = DEFAULT_HIDE_IGNORED_USER_GAMES;
|
||||||
|
@ -358,24 +394,33 @@ void GamesProxyModel::resetFilterParameters()
|
||||||
maxPlayersFilterMin = DEFAULT_MAX_PLAYERS_MIN;
|
maxPlayersFilterMin = DEFAULT_MAX_PLAYERS_MIN;
|
||||||
maxPlayersFilterMax = DEFAULT_MAX_PLAYERS_MAX;
|
maxPlayersFilterMax = DEFAULT_MAX_PLAYERS_MAX;
|
||||||
maxGameAge = DEFAULT_MAX_GAME_AGE;
|
maxGameAge = DEFAULT_MAX_GAME_AGE;
|
||||||
|
showOnlyIfSpectatorsCanWatch = DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_WATCH;
|
||||||
|
showSpectatorPasswordProtected = DEFAULT_SHOW_SPECTATOR_PASSWORD_PROTECTED;
|
||||||
|
showOnlyIfSpectatorsCanChat = DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_CHAT;
|
||||||
|
showOnlyIfSpectatorsCanSeeHands = DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_SEE_HANDS;
|
||||||
|
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GamesProxyModel::areFilterParametersSetToDefaults() const
|
bool GamesProxyModel::areFilterParametersSetToDefaults() const
|
||||||
{
|
{
|
||||||
return unavailableGamesVisible == DEFAULT_UNAVAILABLE_GAMES_VISIBLE &&
|
return showFullGames == DEFAULT_SHOW_FULL_GAMES && showGamesThatStarted == DEFAULT_SHOW_GAMES_THAT_STARTED &&
|
||||||
showPasswordProtectedGames == DEFAULT_SHOW_PASSWORD_PROTECTED_GAMES &&
|
showPasswordProtectedGames == DEFAULT_SHOW_PASSWORD_PROTECTED_GAMES &&
|
||||||
showBuddiesOnlyGames == DEFAULT_SHOW_BUDDIES_ONLY_GAMES &&
|
showBuddiesOnlyGames == DEFAULT_SHOW_BUDDIES_ONLY_GAMES &&
|
||||||
hideIgnoredUserGames == DEFAULT_HIDE_IGNORED_USER_GAMES && gameNameFilter.isEmpty() &&
|
hideIgnoredUserGames == DEFAULT_HIDE_IGNORED_USER_GAMES && gameNameFilter.isEmpty() &&
|
||||||
creatorNameFilter.isEmpty() && gameTypeFilter.isEmpty() && maxPlayersFilterMin == DEFAULT_MAX_PLAYERS_MIN &&
|
creatorNameFilter.isEmpty() && gameTypeFilter.isEmpty() && maxPlayersFilterMin == DEFAULT_MAX_PLAYERS_MIN &&
|
||||||
maxPlayersFilterMax == DEFAULT_MAX_PLAYERS_MAX && maxGameAge == DEFAULT_MAX_GAME_AGE;
|
maxPlayersFilterMax == DEFAULT_MAX_PLAYERS_MAX && maxGameAge == DEFAULT_MAX_GAME_AGE &&
|
||||||
|
showOnlyIfSpectatorsCanWatch == DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_WATCH &&
|
||||||
|
showSpectatorPasswordProtected == DEFAULT_SHOW_SPECTATOR_PASSWORD_PROTECTED &&
|
||||||
|
showOnlyIfSpectatorsCanChat == DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_CHAT &&
|
||||||
|
showOnlyIfSpectatorsCanSeeHands == DEFAULT_SHOW_ONLY_IF_SPECTATORS_CAN_SEE_HANDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
|
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
|
||||||
{
|
{
|
||||||
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
||||||
unavailableGamesVisible = gameFilters.isUnavailableGamesVisible();
|
showFullGames = gameFilters.isShowFullGames();
|
||||||
|
showGamesThatStarted = gameFilters.isShowGamesThatStarted();
|
||||||
showPasswordProtectedGames = gameFilters.isShowPasswordProtectedGames();
|
showPasswordProtectedGames = gameFilters.isShowPasswordProtectedGames();
|
||||||
hideIgnoredUserGames = gameFilters.isHideIgnoredUserGames();
|
hideIgnoredUserGames = gameFilters.isHideIgnoredUserGames();
|
||||||
showBuddiesOnlyGames = gameFilters.isShowBuddiesOnlyGames();
|
showBuddiesOnlyGames = gameFilters.isShowBuddiesOnlyGames();
|
||||||
|
@ -384,6 +429,10 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
|
||||||
maxPlayersFilterMin = gameFilters.getMinPlayers();
|
maxPlayersFilterMin = gameFilters.getMinPlayers();
|
||||||
maxPlayersFilterMax = gameFilters.getMaxPlayers();
|
maxPlayersFilterMax = gameFilters.getMaxPlayers();
|
||||||
maxGameAge = gameFilters.getMaxGameAge();
|
maxGameAge = gameFilters.getMaxGameAge();
|
||||||
|
showOnlyIfSpectatorsCanWatch = gameFilters.isShowOnlyIfSpectatorsCanWatch();
|
||||||
|
showSpectatorPasswordProtected = gameFilters.isShowSpectatorPasswordProtected();
|
||||||
|
showOnlyIfSpectatorsCanChat = gameFilters.isShowOnlyIfSpectatorsCanChat();
|
||||||
|
showOnlyIfSpectatorsCanSeeHands = gameFilters.isShowOnlyIfSpectatorsCanSeeHands();
|
||||||
|
|
||||||
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
|
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
|
||||||
while (gameTypesIterator.hasNext()) {
|
while (gameTypesIterator.hasNext()) {
|
||||||
|
@ -400,7 +449,8 @@ void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameType
|
||||||
{
|
{
|
||||||
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
||||||
gameFilters.setShowBuddiesOnlyGames(showBuddiesOnlyGames);
|
gameFilters.setShowBuddiesOnlyGames(showBuddiesOnlyGames);
|
||||||
gameFilters.setUnavailableGamesVisible(unavailableGamesVisible);
|
gameFilters.setShowFullGames(showFullGames);
|
||||||
|
gameFilters.setShowGamesThatStarted(showGamesThatStarted);
|
||||||
gameFilters.setShowPasswordProtectedGames(showPasswordProtectedGames);
|
gameFilters.setShowPasswordProtectedGames(showPasswordProtectedGames);
|
||||||
gameFilters.setHideIgnoredUserGames(hideIgnoredUserGames);
|
gameFilters.setHideIgnoredUserGames(hideIgnoredUserGames);
|
||||||
gameFilters.setGameNameFilter(gameNameFilter);
|
gameFilters.setGameNameFilter(gameNameFilter);
|
||||||
|
@ -416,6 +466,11 @@ void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameType
|
||||||
gameFilters.setMinPlayers(maxPlayersFilterMin);
|
gameFilters.setMinPlayers(maxPlayersFilterMin);
|
||||||
gameFilters.setMaxPlayers(maxPlayersFilterMax);
|
gameFilters.setMaxPlayers(maxPlayersFilterMax);
|
||||||
gameFilters.setMaxGameAge(maxGameAge);
|
gameFilters.setMaxGameAge(maxGameAge);
|
||||||
|
|
||||||
|
gameFilters.setShowOnlyIfSpectatorsCanWatch(showOnlyIfSpectatorsCanWatch);
|
||||||
|
gameFilters.setShowSpectatorPasswordProtected(showSpectatorPasswordProtected);
|
||||||
|
gameFilters.setShowOnlyIfSpectatorsCanChat(showOnlyIfSpectatorsCanChat);
|
||||||
|
gameFilters.setShowOnlyIfSpectatorsCanSeeHands(showOnlyIfSpectatorsCanSeeHands);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sourceParent*/) const
|
bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sourceParent*/) const
|
||||||
|
@ -430,7 +485,7 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
|
||||||
#else
|
#else
|
||||||
static const QDate epochDate = QDateTime::fromTime_t(0, Qt::UTC).date();
|
static const QDate epochDate = QDateTime::fromTime_t(0, Qt::UTC).date();
|
||||||
#endif
|
#endif
|
||||||
GamesModel *model = qobject_cast<GamesModel *>(sourceModel());
|
auto *model = qobject_cast<GamesModel *>(sourceModel());
|
||||||
if (!model)
|
if (!model)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -443,15 +498,13 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
|
||||||
QString::fromStdString(game.creator_info().name()))) {
|
QString::fromStdString(game.creator_info().name()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!unavailableGamesVisible) {
|
if (!showFullGames && game.player_count() == game.max_players())
|
||||||
if (game.player_count() == game.max_players())
|
return false;
|
||||||
|
if (!showGamesThatStarted && game.started())
|
||||||
|
return false;
|
||||||
|
if (!ownUserIsRegistered)
|
||||||
|
if (game.only_registered())
|
||||||
return false;
|
return false;
|
||||||
if (game.started())
|
|
||||||
return false;
|
|
||||||
if (!ownUserIsRegistered)
|
|
||||||
if (game.only_registered())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!showPasswordProtectedGames && game.with_password())
|
if (!showPasswordProtectedGames && game.with_password())
|
||||||
return false;
|
return false;
|
||||||
if (!gameNameFilter.isEmpty())
|
if (!gameNameFilter.isEmpty())
|
||||||
|
@ -482,6 +535,17 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showOnlyIfSpectatorsCanWatch) {
|
||||||
|
if (!game.spectators_allowed())
|
||||||
|
return false;
|
||||||
|
if (!showSpectatorPasswordProtected && game.spectators_need_password())
|
||||||
|
return false;
|
||||||
|
if (showOnlyIfSpectatorsCanChat && !game.spectators_can_chat())
|
||||||
|
return false;
|
||||||
|
if (showOnlyIfSpectatorsCanSeeHands && !game.spectators_omniscient())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,12 +80,15 @@ private:
|
||||||
// - filterAcceptsRow()
|
// - filterAcceptsRow()
|
||||||
bool showBuddiesOnlyGames;
|
bool showBuddiesOnlyGames;
|
||||||
bool hideIgnoredUserGames;
|
bool hideIgnoredUserGames;
|
||||||
bool unavailableGamesVisible;
|
bool showFullGames;
|
||||||
|
bool showGamesThatStarted;
|
||||||
bool showPasswordProtectedGames;
|
bool showPasswordProtectedGames;
|
||||||
QString gameNameFilter, creatorNameFilter;
|
QString gameNameFilter, creatorNameFilter;
|
||||||
QSet<int> gameTypeFilter;
|
QSet<int> gameTypeFilter;
|
||||||
quint32 maxPlayersFilterMin, maxPlayersFilterMax;
|
quint32 maxPlayersFilterMin, maxPlayersFilterMax;
|
||||||
QTime maxGameAge;
|
QTime maxGameAge;
|
||||||
|
bool showOnlyIfSpectatorsCanWatch, showSpectatorPasswordProtected, showOnlyIfSpectatorsCanChat,
|
||||||
|
showOnlyIfSpectatorsCanSeeHands;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GamesProxyModel(QObject *parent = nullptr, const TabSupervisor *_tabSupervisor = nullptr);
|
GamesProxyModel(QObject *parent = nullptr, const TabSupervisor *_tabSupervisor = nullptr);
|
||||||
|
@ -100,11 +103,16 @@ public:
|
||||||
return hideIgnoredUserGames;
|
return hideIgnoredUserGames;
|
||||||
}
|
}
|
||||||
void setHideIgnoredUserGames(bool _hideIgnoredUserGames);
|
void setHideIgnoredUserGames(bool _hideIgnoredUserGames);
|
||||||
bool getUnavailableGamesVisible() const
|
bool getShowFullGames() const
|
||||||
{
|
{
|
||||||
return unavailableGamesVisible;
|
return showFullGames;
|
||||||
}
|
}
|
||||||
void setUnavailableGamesVisible(bool _unavailableGamesVisible);
|
void setShowFullGames(bool _showFullGames);
|
||||||
|
bool getShowGamesThatStarted() const
|
||||||
|
{
|
||||||
|
return showGamesThatStarted;
|
||||||
|
}
|
||||||
|
void setShowGamesThatStarted(bool _showGamesThatStarted);
|
||||||
bool getShowPasswordProtectedGames() const
|
bool getShowPasswordProtectedGames() const
|
||||||
{
|
{
|
||||||
return showPasswordProtectedGames;
|
return showPasswordProtectedGames;
|
||||||
|
@ -139,6 +147,26 @@ public:
|
||||||
return maxGameAge;
|
return maxGameAge;
|
||||||
}
|
}
|
||||||
void setMaxGameAge(const QTime &_maxGameAge);
|
void setMaxGameAge(const QTime &_maxGameAge);
|
||||||
|
bool getShowOnlyIfSpectatorsCanWatch() const
|
||||||
|
{
|
||||||
|
return showOnlyIfSpectatorsCanWatch;
|
||||||
|
}
|
||||||
|
void setShowOnlyIfSpectatorsCanWatch(bool _showOnlyIfSpectatorsCanWatch);
|
||||||
|
bool getShowSpectatorPasswordProtected() const
|
||||||
|
{
|
||||||
|
return showSpectatorPasswordProtected;
|
||||||
|
}
|
||||||
|
void setShowSpectatorPasswordProtected(bool _showSpectatorPasswordProtected);
|
||||||
|
bool getShowOnlyIfSpectatorsCanChat() const
|
||||||
|
{
|
||||||
|
return showOnlyIfSpectatorsCanChat;
|
||||||
|
}
|
||||||
|
void setShowOnlyIfSpectatorsCanChat(bool _showOnlyIfSpectatorsCanChat);
|
||||||
|
bool getShowOnlyIfSpectatorsCanSeeHands() const
|
||||||
|
{
|
||||||
|
return showOnlyIfSpectatorsCanSeeHands;
|
||||||
|
}
|
||||||
|
void setShowOnlyIfSpectatorsCanSeeHands(bool _showOnlyIfSpectatorsCanSeeHands);
|
||||||
|
|
||||||
int getNumFilteredGames() const;
|
int getNumFilteredGames() const;
|
||||||
void resetFilterParameters();
|
void resetFilterParameters();
|
||||||
|
|
|
@ -28,14 +28,25 @@ bool GameFiltersSettings::isShowBuddiesOnlyGames()
|
||||||
return previous == QVariant() ? true : previous.toBool();
|
return previous == QVariant() ? true : previous.toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameFiltersSettings::setUnavailableGamesVisible(bool enabled)
|
void GameFiltersSettings::setShowFullGames(bool show)
|
||||||
{
|
{
|
||||||
setValue(enabled, "unavailable_games_visible", "filter_games");
|
setValue(show, "show_full_games", "filter_games");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameFiltersSettings::isUnavailableGamesVisible()
|
bool GameFiltersSettings::isShowFullGames()
|
||||||
{
|
{
|
||||||
QVariant previous = getValue("unavailable_games_visible", "filter_games");
|
QVariant previous = getValue("show_full_games", "filter_games");
|
||||||
|
return previous == QVariant() ? false : previous.toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameFiltersSettings::setShowGamesThatStarted(bool show)
|
||||||
|
{
|
||||||
|
setValue(show, "show_games_that_started", "filter_games");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameFiltersSettings::isShowGamesThatStarted()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("show_games_that_started", "filter_games");
|
||||||
return previous == QVariant() ? false : previous.toBool();
|
return previous == QVariant() ? false : previous.toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,3 +140,47 @@ bool GameFiltersSettings::isGameTypeEnabled(QString gametype)
|
||||||
QVariant previous = getValue("game_type/" + hashGameType(gametype), "filter_games");
|
QVariant previous = getValue("game_type/" + hashGameType(gametype), "filter_games");
|
||||||
return previous == QVariant() ? false : previous.toBool();
|
return previous == QVariant() ? false : previous.toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameFiltersSettings::setShowOnlyIfSpectatorsCanWatch(bool show)
|
||||||
|
{
|
||||||
|
setValue(show, "show_only_if_spectators_can_watch", "filter_games");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanWatch()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("show_only_if_spectators_can_watch", "filter_games");
|
||||||
|
return previous == QVariant() ? false : previous.toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show)
|
||||||
|
{
|
||||||
|
setValue(show, "show_spectator_password_protected", "filter_games");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameFiltersSettings::isShowSpectatorPasswordProtected()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("show_spectator_password_protected", "filter_games");
|
||||||
|
return previous == QVariant() ? true : previous.toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
|
||||||
|
{
|
||||||
|
setValue(show, "show_only_if_spectators_can_chat", "filter_games");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("show_only_if_spectators_can_chat", "filter_games");
|
||||||
|
return previous == QVariant() ? true : previous.toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
|
||||||
|
{
|
||||||
|
setValue(show, "show_only_if_spectators_can_see_hands", "filter_games");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("show_only_if_spectators_can_see_hands", "filter_games");
|
||||||
|
return previous == QVariant() ? true : previous.toBool();
|
||||||
|
}
|
|
@ -10,7 +10,8 @@ class GameFiltersSettings : public SettingsManager
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool isShowBuddiesOnlyGames();
|
bool isShowBuddiesOnlyGames();
|
||||||
bool isUnavailableGamesVisible();
|
bool isShowFullGames();
|
||||||
|
bool isShowGamesThatStarted();
|
||||||
bool isShowPasswordProtectedGames();
|
bool isShowPasswordProtectedGames();
|
||||||
bool isHideIgnoredUserGames();
|
bool isHideIgnoredUserGames();
|
||||||
QString getGameNameFilter();
|
QString getGameNameFilter();
|
||||||
|
@ -19,10 +20,15 @@ public:
|
||||||
int getMaxPlayers();
|
int getMaxPlayers();
|
||||||
QTime getMaxGameAge();
|
QTime getMaxGameAge();
|
||||||
bool isGameTypeEnabled(QString gametype);
|
bool isGameTypeEnabled(QString gametype);
|
||||||
|
bool isShowOnlyIfSpectatorsCanWatch();
|
||||||
|
bool isShowSpectatorPasswordProtected();
|
||||||
|
bool isShowOnlyIfSpectatorsCanChat();
|
||||||
|
bool isShowOnlyIfSpectatorsCanSeeHands();
|
||||||
|
|
||||||
void setShowBuddiesOnlyGames(bool show);
|
void setShowBuddiesOnlyGames(bool show);
|
||||||
void setHideIgnoredUserGames(bool hide);
|
void setHideIgnoredUserGames(bool hide);
|
||||||
void setUnavailableGamesVisible(bool enabled);
|
void setShowFullGames(bool show);
|
||||||
|
void setShowGamesThatStarted(bool show);
|
||||||
void setShowPasswordProtectedGames(bool show);
|
void setShowPasswordProtectedGames(bool show);
|
||||||
void setGameNameFilter(QString gameName);
|
void setGameNameFilter(QString gameName);
|
||||||
void setCreatorNameFilter(QString creatorName);
|
void setCreatorNameFilter(QString creatorName);
|
||||||
|
@ -31,6 +37,10 @@ public:
|
||||||
void setMaxGameAge(const QTime &maxGameAge);
|
void setMaxGameAge(const QTime &maxGameAge);
|
||||||
void setGameTypeEnabled(QString gametype, bool enabled);
|
void setGameTypeEnabled(QString gametype, bool enabled);
|
||||||
void setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled);
|
void setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled);
|
||||||
|
void setShowOnlyIfSpectatorsCanWatch(bool show);
|
||||||
|
void setShowSpectatorPasswordProtected(bool show);
|
||||||
|
void setShowOnlyIfSpectatorsCanChat(bool show);
|
||||||
|
void setShowOnlyIfSpectatorsCanSeeHands(bool show);
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -95,7 +95,8 @@ void SettingsCache::translateLegacySettings()
|
||||||
|
|
||||||
// Game filters
|
// Game filters
|
||||||
legacySetting.beginGroup("filter_games");
|
legacySetting.beginGroup("filter_games");
|
||||||
gameFilters().setUnavailableGamesVisible(legacySetting.value("unavailable_games_visible").toBool());
|
gameFilters().setShowFullGames(legacySetting.value("unavailable_games_visible").toBool());
|
||||||
|
gameFilters().setShowGamesThatStarted(legacySetting.value("unavailable_games_visible").toBool());
|
||||||
gameFilters().setShowPasswordProtectedGames(legacySetting.value("show_password_protected_games").toBool());
|
gameFilters().setShowPasswordProtectedGames(legacySetting.value("show_password_protected_games").toBool());
|
||||||
gameFilters().setGameNameFilter(legacySetting.value("game_name_filter").toString());
|
gameFilters().setGameNameFilter(legacySetting.value("game_name_filter").toString());
|
||||||
gameFilters().setShowBuddiesOnlyGames(legacySetting.value("show_buddies_only_games").toBool());
|
gameFilters().setShowBuddiesOnlyGames(legacySetting.value("show_buddies_only_games").toBool());
|
||||||
|
|
Loading…
Reference in a new issue