refactorings #2
+ removed static from enum + removed condition check for user level
This commit is contained in:
parent
8ac58259b4
commit
86bbf75ddd
1 changed files with 2 additions and 9 deletions
|
@ -8,8 +8,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
static const enum {ROOM, CREATED, DESCRIPTION, CREATOR, GAME_TYPE, RESTRICTIONS, PLAYERS, SPECTATORS};
|
const enum GameListColumn {ROOM, CREATED, DESCRIPTION, CREATOR, GAME_TYPE, RESTRICTIONS, PLAYERS, SPECTATORS};
|
||||||
static const enum {UNREGISTERED, REGISTERED};
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const unsigned SECS_PER_MIN = 60;
|
const unsigned SECS_PER_MIN = 60;
|
||||||
|
@ -115,15 +114,9 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
|
||||||
case SORT_ROLE:
|
case SORT_ROLE:
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return QString::fromStdString(g.creator_info().name());
|
return QString::fromStdString(g.creator_info().name());
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole: {
|
||||||
switch(g.creator_info().user_level()) {
|
|
||||||
case UNREGISTERED:
|
|
||||||
case REGISTERED:{
|
|
||||||
QPixmap avatarPixmap = UserLevelPixmapGenerator::generatePixmap(13, (UserLevelFlags)g.creator_info().user_level());
|
QPixmap avatarPixmap = UserLevelPixmapGenerator::generatePixmap(13, (UserLevelFlags)g.creator_info().user_level());
|
||||||
return QIcon(avatarPixmap);
|
return QIcon(avatarPixmap);
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
Loading…
Reference in a new issue