mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
parent
50c1ce673d
commit
7d0b95e9d6
5 changed files with 45 additions and 88 deletions
|
|
@ -6,12 +6,10 @@
|
|||
#include <QDialogButtonBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
||||
const GamesProxyModel *_gamesProxyModel,
|
||||
|
|
@ -24,17 +22,17 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
|||
{QTime(1, 0), tr("1 hour")},
|
||||
{QTime(2, 0), tr("2 hours")}})
|
||||
{
|
||||
showBuddiesOnlyGames = new QCheckBox(tr("Hide 'buddies only' games"));
|
||||
showBuddiesOnlyGames->setChecked(gamesProxyModel->getShowBuddiesOnlyGames());
|
||||
hideBuddiesOnlyGames = new QCheckBox(tr("Hide 'buddies only' games"));
|
||||
hideBuddiesOnlyGames->setChecked(gamesProxyModel->getHideBuddiesOnlyGames());
|
||||
|
||||
showFullGames = new QCheckBox(tr("Hide full games"));
|
||||
showFullGames->setChecked(gamesProxyModel->getShowFullGames());
|
||||
hideFullGames = new QCheckBox(tr("Hide full games"));
|
||||
hideFullGames->setChecked(gamesProxyModel->getHideFullGames());
|
||||
|
||||
showGamesThatStarted = new QCheckBox(tr("Hide games that have started"));
|
||||
showGamesThatStarted->setChecked(gamesProxyModel->getShowGamesThatStarted());
|
||||
hideGamesThatStarted = new QCheckBox(tr("Hide games that have started"));
|
||||
hideGamesThatStarted->setChecked(gamesProxyModel->getHideGamesThatStarted());
|
||||
|
||||
showPasswordProtectedGames = new QCheckBox(tr("Hide password protected games"));
|
||||
showPasswordProtectedGames->setChecked(gamesProxyModel->getShowPasswordProtectedGames());
|
||||
hidePasswordProtectedGames = new QCheckBox(tr("Hide password protected games"));
|
||||
hidePasswordProtectedGames->setChecked(gamesProxyModel->getHidePasswordProtectedGames());
|
||||
|
||||
hideIgnoredUserGames = new QCheckBox(tr("Hide 'ignored user' games"));
|
||||
hideIgnoredUserGames->setChecked(gamesProxyModel->getHideIgnoredUserGames());
|
||||
|
|
@ -108,10 +106,10 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
|||
maxPlayersGroupBox->setLayout(maxPlayersFilterLayout);
|
||||
|
||||
auto *restrictionsLayout = new QGridLayout;
|
||||
restrictionsLayout->addWidget(showFullGames, 0, 0);
|
||||
restrictionsLayout->addWidget(showGamesThatStarted, 1, 0);
|
||||
restrictionsLayout->addWidget(showPasswordProtectedGames, 2, 0);
|
||||
restrictionsLayout->addWidget(showBuddiesOnlyGames, 3, 0);
|
||||
restrictionsLayout->addWidget(hideFullGames, 0, 0);
|
||||
restrictionsLayout->addWidget(hideGamesThatStarted, 1, 0);
|
||||
restrictionsLayout->addWidget(hidePasswordProtectedGames, 2, 0);
|
||||
restrictionsLayout->addWidget(hideBuddiesOnlyGames, 3, 0);
|
||||
restrictionsLayout->addWidget(hideIgnoredUserGames, 4, 0);
|
||||
|
||||
auto *restrictionsGroupBox = new QGroupBox(tr("Restrictions"));
|
||||
|
|
@ -185,34 +183,24 @@ void DlgFilterGames::toggleSpectatorCheckboxEnabledness(bool spectatorsEnabled)
|
|||
showOnlyIfSpectatorsCanSeeHands->setDisabled(!spectatorsEnabled);
|
||||
}
|
||||
|
||||
bool DlgFilterGames::getShowFullGames() const
|
||||
bool DlgFilterGames::getHideFullGames() const
|
||||
{
|
||||
return showFullGames->isChecked();
|
||||
return hideFullGames->isChecked();
|
||||
}
|
||||
|
||||
bool DlgFilterGames::getShowGamesThatStarted() const
|
||||
bool DlgFilterGames::getHideGamesThatStarted() const
|
||||
{
|
||||
return showGamesThatStarted->isChecked();
|
||||
return hideGamesThatStarted->isChecked();
|
||||
}
|
||||
|
||||
bool DlgFilterGames::getShowBuddiesOnlyGames() const
|
||||
bool DlgFilterGames::getHideBuddiesOnlyGames() const
|
||||
{
|
||||
return showBuddiesOnlyGames->isChecked();
|
||||
return hideBuddiesOnlyGames->isChecked();
|
||||
}
|
||||
|
||||
void DlgFilterGames::setShowBuddiesOnlyGames(bool _showBuddiesOnlyGames)
|
||||
bool DlgFilterGames::getHidePasswordProtectedGames() const
|
||||
{
|
||||
showBuddiesOnlyGames->setChecked(_showBuddiesOnlyGames);
|
||||
}
|
||||
|
||||
bool DlgFilterGames::getShowPasswordProtectedGames() const
|
||||
{
|
||||
return showPasswordProtectedGames->isChecked();
|
||||
}
|
||||
|
||||
void DlgFilterGames::setShowPasswordProtectedGames(bool _passwordProtectedGamesHidden)
|
||||
{
|
||||
showPasswordProtectedGames->setChecked(_passwordProtectedGamesHidden);
|
||||
return hidePasswordProtectedGames->isChecked();
|
||||
}
|
||||
|
||||
bool DlgFilterGames::getHideIgnoredUserGames() const
|
||||
|
|
@ -220,31 +208,16 @@ bool DlgFilterGames::getHideIgnoredUserGames() const
|
|||
return hideIgnoredUserGames->isChecked();
|
||||
}
|
||||
|
||||
void DlgFilterGames::setHideIgnoredUserGames(bool _hideIgnoredUserGames)
|
||||
{
|
||||
hideIgnoredUserGames->setChecked(_hideIgnoredUserGames);
|
||||
}
|
||||
|
||||
QString DlgFilterGames::getGameNameFilter() const
|
||||
{
|
||||
return gameNameFilterEdit->text();
|
||||
}
|
||||
|
||||
void DlgFilterGames::setGameNameFilter(const QString &_gameNameFilter)
|
||||
{
|
||||
gameNameFilterEdit->setText(_gameNameFilter);
|
||||
}
|
||||
|
||||
QString DlgFilterGames::getCreatorNameFilter() const
|
||||
{
|
||||
return creatorNameFilterEdit->text();
|
||||
}
|
||||
|
||||
void DlgFilterGames::setCreatorNameFilter(const QString &_creatorNameFilter)
|
||||
{
|
||||
creatorNameFilterEdit->setText(_creatorNameFilter);
|
||||
}
|
||||
|
||||
QSet<int> DlgFilterGames::getGameTypeFilter() const
|
||||
{
|
||||
QSet<int> result;
|
||||
|
|
@ -257,15 +230,6 @@ QSet<int> DlgFilterGames::getGameTypeFilter() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void DlgFilterGames::setGameTypeFilter(const QSet<int> &_gameTypeFilter)
|
||||
{
|
||||
QMapIterator<int, QCheckBox *> i(gameTypeFilterCheckBoxes);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
i.value()->setChecked(_gameTypeFilter.contains(i.key()));
|
||||
}
|
||||
}
|
||||
|
||||
int DlgFilterGames::getMaxPlayersFilterMin() const
|
||||
{
|
||||
return maxPlayersFilterMinSpinBox->value();
|
||||
|
|
@ -285,13 +249,6 @@ QTime DlgFilterGames::getMaxGameAge() const
|
|||
return gameAgeMap.keys().at(index);
|
||||
}
|
||||
|
||||
void DlgFilterGames::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax)
|
||||
{
|
||||
maxPlayersFilterMinSpinBox->setValue(_maxPlayersFilterMin);
|
||||
maxPlayersFilterMaxSpinBox->setValue(_maxPlayersFilterMax == -1 ? maxPlayersFilterMaxSpinBox->maximum()
|
||||
: _maxPlayersFilterMax);
|
||||
}
|
||||
|
||||
bool DlgFilterGames::getShowOnlyIfSpectatorsCanWatch() const
|
||||
{
|
||||
return showOnlyIfSpectatorsCanWatch->isChecked();
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ class DlgFilterGames : public QDialog
|
|||
Q_OBJECT
|
||||
private:
|
||||
QGroupBox *generalGroupBox;
|
||||
QCheckBox *showBuddiesOnlyGames;
|
||||
QCheckBox *showFullGames;
|
||||
QCheckBox *showGamesThatStarted;
|
||||
QCheckBox *showPasswordProtectedGames;
|
||||
QCheckBox *hideBuddiesOnlyGames;
|
||||
QCheckBox *hideFullGames;
|
||||
QCheckBox *hideGamesThatStarted;
|
||||
QCheckBox *hidePasswordProtectedGames;
|
||||
QCheckBox *hideIgnoredUserGames;
|
||||
QLineEdit *gameNameFilterEdit;
|
||||
QLineEdit *creatorNameFilterEdit;
|
||||
|
|
@ -50,12 +50,12 @@ public:
|
|||
const GamesProxyModel *_gamesProxyModel,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
bool getShowFullGames() const;
|
||||
bool getShowGamesThatStarted() const;
|
||||
bool getShowPasswordProtectedGames() const;
|
||||
bool getHideFullGames() const;
|
||||
bool getHideGamesThatStarted() const;
|
||||
bool getHidePasswordProtectedGames() const;
|
||||
void setShowPasswordProtectedGames(bool _passwordProtectedGamesHidden);
|
||||
bool getShowBuddiesOnlyGames() const;
|
||||
void setShowBuddiesOnlyGames(bool _showBuddiesOnlyGames);
|
||||
bool getHideBuddiesOnlyGames() const;
|
||||
void setHideBuddiesOnlyGames(bool _hideBuddiesOnlyGames);
|
||||
bool getHideIgnoredUserGames() const;
|
||||
void setHideIgnoredUserGames(bool _hideIgnoredUserGames);
|
||||
QString getGameNameFilter() const;
|
||||
|
|
|
|||
|
|
@ -151,10 +151,10 @@ void GameSelector::actSetFilter()
|
|||
if (!dlg.exec())
|
||||
return;
|
||||
|
||||
gameListProxyModel->setShowBuddiesOnlyGames(dlg.getShowBuddiesOnlyGames());
|
||||
gameListProxyModel->setShowFullGames(dlg.getShowFullGames());
|
||||
gameListProxyModel->setShowGamesThatStarted(dlg.getShowGamesThatStarted());
|
||||
gameListProxyModel->setShowPasswordProtectedGames(dlg.getShowPasswordProtectedGames());
|
||||
gameListProxyModel->setHideBuddiesOnlyGames(dlg.getHideBuddiesOnlyGames());
|
||||
gameListProxyModel->setHideFullGames(dlg.getHideFullGames());
|
||||
gameListProxyModel->setHideGamesThatStarted(dlg.getHideGamesThatStarted());
|
||||
gameListProxyModel->setHidePasswordProtectedGames(dlg.getHidePasswordProtectedGames());
|
||||
gameListProxyModel->setHideIgnoredUserGames(dlg.getHideIgnoredUserGames());
|
||||
gameListProxyModel->setGameNameFilter(dlg.getGameNameFilter());
|
||||
gameListProxyModel->setCreatorNameFilter(dlg.getCreatorNameFilter());
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ GamesProxyModel::GamesProxyModel(QObject *parent, const UserListProxy *_userList
|
|||
setDynamicSortFilter(true);
|
||||
}
|
||||
|
||||
void GamesProxyModel::setShowBuddiesOnlyGames(bool _showBuddiesOnlyGames)
|
||||
void GamesProxyModel::setHideBuddiesOnlyGames(bool _showBuddiesOnlyGames)
|
||||
{
|
||||
hideBuddiesOnlyGames = _showBuddiesOnlyGames;
|
||||
invalidateFilter();
|
||||
|
|
@ -296,19 +296,19 @@ void GamesProxyModel::setHideIgnoredUserGames(bool _hideIgnoredUserGames)
|
|||
invalidateFilter();
|
||||
}
|
||||
|
||||
void GamesProxyModel::setShowFullGames(bool _showFullGames)
|
||||
void GamesProxyModel::setHideFullGames(bool _showFullGames)
|
||||
{
|
||||
hideFullGames = _showFullGames;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void GamesProxyModel::setShowGamesThatStarted(bool _showGamesThatStarted)
|
||||
void GamesProxyModel::setHideGamesThatStarted(bool _showGamesThatStarted)
|
||||
{
|
||||
hideGamesThatStarted = _showGamesThatStarted;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void GamesProxyModel::setShowPasswordProtectedGames(bool _showPasswordProtectedGames)
|
||||
void GamesProxyModel::setHidePasswordProtectedGames(bool _showPasswordProtectedGames)
|
||||
{
|
||||
hidePasswordProtectedGames = _showPasswordProtectedGames;
|
||||
invalidateFilter();
|
||||
|
|
|
|||
|
|
@ -90,31 +90,31 @@ private:
|
|||
public:
|
||||
explicit GamesProxyModel(QObject *parent = nullptr, const UserListProxy *_userListProxy = nullptr);
|
||||
|
||||
bool getShowBuddiesOnlyGames() const
|
||||
bool getHideBuddiesOnlyGames() const
|
||||
{
|
||||
return hideBuddiesOnlyGames;
|
||||
}
|
||||
void setShowBuddiesOnlyGames(bool _showBuddiesOnlyGames);
|
||||
void setHideBuddiesOnlyGames(bool _showBuddiesOnlyGames);
|
||||
bool getHideIgnoredUserGames() const
|
||||
{
|
||||
return hideIgnoredUserGames;
|
||||
}
|
||||
void setHideIgnoredUserGames(bool _hideIgnoredUserGames);
|
||||
bool getShowFullGames() const
|
||||
bool getHideFullGames() const
|
||||
{
|
||||
return hideFullGames;
|
||||
}
|
||||
void setShowFullGames(bool _showFullGames);
|
||||
bool getShowGamesThatStarted() const
|
||||
void setHideFullGames(bool _showFullGames);
|
||||
bool getHideGamesThatStarted() const
|
||||
{
|
||||
return hideGamesThatStarted;
|
||||
}
|
||||
void setShowGamesThatStarted(bool _showGamesThatStarted);
|
||||
bool getShowPasswordProtectedGames() const
|
||||
void setHideGamesThatStarted(bool _showGamesThatStarted);
|
||||
bool getHidePasswordProtectedGames() const
|
||||
{
|
||||
return hidePasswordProtectedGames;
|
||||
}
|
||||
void setShowPasswordProtectedGames(bool _showPasswordProtectedGames);
|
||||
void setHidePasswordProtectedGames(bool _showPasswordProtectedGames);
|
||||
QString getGameNameFilter() const
|
||||
{
|
||||
return gameNameFilter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue