From 86bbf75ddd0bbdea29ab6112afc6a144abae1ac0 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Thu, 22 Jan 2015 22:23:21 +0100 Subject: [PATCH] refactorings #2 + removed static from enum + removed condition check for user level --- cockatrice/src/gamesmodel.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/cockatrice/src/gamesmodel.cpp b/cockatrice/src/gamesmodel.cpp index 28581955..87a37e05 100644 --- a/cockatrice/src/gamesmodel.cpp +++ b/cockatrice/src/gamesmodel.cpp @@ -8,8 +8,7 @@ #include #include -static const enum {ROOM, CREATED, DESCRIPTION, CREATOR, GAME_TYPE, RESTRICTIONS, PLAYERS, SPECTATORS}; -static const enum {UNREGISTERED, REGISTERED}; +const enum GameListColumn {ROOM, CREATED, DESCRIPTION, CREATOR, GAME_TYPE, RESTRICTIONS, PLAYERS, SPECTATORS}; namespace { const unsigned SECS_PER_MIN = 60; @@ -115,15 +114,9 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const case SORT_ROLE: case Qt::DisplayRole: return QString::fromStdString(g.creator_info().name()); - case Qt::DecorationRole: - switch(g.creator_info().user_level()) { - case UNREGISTERED: - case REGISTERED:{ + case Qt::DecorationRole: { QPixmap avatarPixmap = UserLevelPixmapGenerator::generatePixmap(13, (UserLevelFlags)g.creator_info().user_level()); return QIcon(avatarPixmap); - } - default: - break; } default: return QVariant();