Filter registered-only games as unavailable when user isn't regged

This commit is contained in:
Daenyth 2011-12-04 12:16:19 -05:00
parent eebc615c1c
commit edd429d874
6 changed files with 17 additions and 10 deletions

View file

@ -106,8 +106,8 @@ void GamesModel::updateGameList(ServerInfo_Game *_game)
endInsertRows();
}
GamesProxyModel::GamesProxyModel(QObject *parent)
: QSortFilterProxyModel(parent), unjoinableGamesVisible(false)
GamesProxyModel::GamesProxyModel(QObject *parent, ServerInfo_User *_ownUser)
: QSortFilterProxyModel(parent), ownUser(_ownUser), unjoinableGamesVisible(false)
{
setDynamicSortFilter(true);
}
@ -130,6 +130,9 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
return false;
if (game->getStarted())
return false;
if (!(ownUser->getUserLevel() & ServerInfo_User::IsRegistered))
if (game->getOnlyRegistered())
return false;
}
return true;