Change "Show full" "Show running" checkboxes to a single box

IMO these should not have been split
This commit is contained in:
Daenyth 2011-12-03 22:54:57 -05:00
parent a7f3ce4050
commit eebc615c1c
4 changed files with 20 additions and 36 deletions

View file

@ -107,20 +107,14 @@ void GamesModel::updateGameList(ServerInfo_Game *_game)
}
GamesProxyModel::GamesProxyModel(QObject *parent)
: QSortFilterProxyModel(parent), fullGamesVisible(false)
: QSortFilterProxyModel(parent), unjoinableGamesVisible(false)
{
setDynamicSortFilter(true);
}
void GamesProxyModel::setFullGamesVisible(bool _fullGamesVisible)
void GamesProxyModel::setUnjoinableGamesVisible(bool _unjoinableGamesVisible)
{
fullGamesVisible = _fullGamesVisible;
invalidateFilter();
}
void GamesProxyModel::setRunningGamesVisible(bool _runningGamesVisible)
{
runningGamesVisible = _runningGamesVisible;
unjoinableGamesVisible = _unjoinableGamesVisible;
invalidateFilter();
}
@ -131,10 +125,12 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
return false;
ServerInfo_Game *game = model->getGame(sourceRow);
if ((game->getPlayerCount() == game->getMaxPlayers()) && !fullGamesVisible)
return false;
if (game->getStarted() && !runningGamesVisible)
return false;
if (!unjoinableGamesVisible) {
if (game->getPlayerCount() == game->getMaxPlayers())
return false;
if (game->getStarted())
return false;
}
return true;
}