mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 04:53:54 -07:00
Add dropdown for game age filtering (#4092)
* Part 1 for #3067: Basic combo box (dropdown) filtering mechanism for game age. * Apply suggestions from draft review # Conflicts: # cockatrice/src/gamesmodel.cpp # cockatrice/src/gamesmodel.h * switch to using QTime * check for games older than a day * formatting for casts and more unnecessary cosmetic changes * ebbit1q fixes Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
58d024d067
commit
eba9c097f6
7 changed files with 136 additions and 46 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "gamefilterssettings.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QTime>
|
||||
|
||||
GameFiltersSettings::GameFiltersSettings(QString settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "gamefilters.ini", parent)
|
||||
|
|
@ -102,6 +103,17 @@ int GameFiltersSettings::getMaxPlayers()
|
|||
return previous == QVariant() ? 99 : previous.toInt();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setMaxGameAge(const QTime &maxGameAge)
|
||||
{
|
||||
setValue(maxGameAge, "max_game_age_time", "filter_games");
|
||||
}
|
||||
|
||||
QTime GameFiltersSettings::getMaxGameAge()
|
||||
{
|
||||
QVariant previous = getValue("max_game_age_time", "filter_games");
|
||||
return previous.toTime();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setGameTypeEnabled(QString gametype, bool enabled)
|
||||
{
|
||||
setValue(enabled, "game_type/" + hashGameType(gametype), "filter_games");
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public:
|
|||
QString getCreatorNameFilter();
|
||||
int getMinPlayers();
|
||||
int getMaxPlayers();
|
||||
QTime getMaxGameAge();
|
||||
bool isGameTypeEnabled(QString gametype);
|
||||
|
||||
void setShowBuddiesOnlyGames(bool show);
|
||||
|
|
@ -27,6 +28,7 @@ public:
|
|||
void setCreatorNameFilter(QString creatorName);
|
||||
void setMinPlayers(int min);
|
||||
void setMaxPlayers(int max);
|
||||
void setMaxGameAge(const QTime &maxGameAge);
|
||||
void setGameTypeEnabled(QString gametype, bool enabled);
|
||||
void setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled);
|
||||
signals:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue