mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-03 12:03:55 -07:00
Clang-format (#3028)
* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
This commit is contained in:
parent
8dbdd24c8e
commit
b29bd9e070
272 changed files with 13378 additions and 9535 deletions
|
|
@ -1,30 +1,38 @@
|
|||
#ifndef GAMESMODEL_H
|
||||
#define GAMESMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include "gametypemap.h"
|
||||
#include "pb/serverinfo_game.pb.h"
|
||||
#include <QAbstractTableModel>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
class GamesModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
class GamesModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QList<ServerInfo_Game> gameList;
|
||||
QMap<int, QString> rooms;
|
||||
QMap<int, GameTypeMap> gameTypes;
|
||||
|
||||
static const int NUM_COLS = 8;
|
||||
static const int SECS_PER_MIN = 60;
|
||||
static const int SECS_PER_MIN = 60;
|
||||
static const int SECS_PER_TEN_MIN = 600;
|
||||
static const int SECS_PER_HOUR = 3600;
|
||||
|
||||
public:
|
||||
static const int SORT_ROLE = Qt::UserRole+1;
|
||||
static const int SORT_ROLE = Qt::UserRole + 1;
|
||||
|
||||
GamesModel(const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QObject *parent = 0);
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const { return parent.isValid() ? 0 : gameList.size(); }
|
||||
int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const { return NUM_COLS; }
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const
|
||||
{
|
||||
return parent.isValid() ? 0 : gameList.size();
|
||||
}
|
||||
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const
|
||||
{
|
||||
return NUM_COLS;
|
||||
}
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
const QString getGameCreatedString(const int secs) const;
|
||||
|
|
@ -35,15 +43,25 @@ public:
|
|||
*/
|
||||
void updateGameList(const ServerInfo_Game &game);
|
||||
|
||||
int roomColIndex() { return 0; }
|
||||
int startTimeColIndex() { return 1; }
|
||||
int roomColIndex()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int startTimeColIndex()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const QMap<int, GameTypeMap> &getGameTypes() { return gameTypes; }
|
||||
const QMap<int, GameTypeMap> &getGameTypes()
|
||||
{
|
||||
return gameTypes;
|
||||
}
|
||||
};
|
||||
|
||||
class ServerInfo_User;
|
||||
|
||||
class GamesProxyModel : public QSortFilterProxyModel {
|
||||
class GamesProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
bool ownUserIsRegistered;
|
||||
|
|
@ -54,28 +72,54 @@ private:
|
|||
QSet<int> gameTypeFilter;
|
||||
int maxPlayersFilterMin, maxPlayersFilterMax;
|
||||
|
||||
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
|
||||
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
|
||||
|
||||
public:
|
||||
GamesProxyModel(QObject *parent = 0, bool _ownUserIsRegistered = false);
|
||||
|
||||
bool getShowBuddiesOnlyGames() const {return showBuddiesOnlyGames; }
|
||||
bool getShowBuddiesOnlyGames() const
|
||||
{
|
||||
return showBuddiesOnlyGames;
|
||||
}
|
||||
void setShowBuddiesOnlyGames(bool _showBuddiesOnlyGames);
|
||||
bool getUnavailableGamesVisible() const { return unavailableGamesVisible; }
|
||||
bool getUnavailableGamesVisible() const
|
||||
{
|
||||
return unavailableGamesVisible;
|
||||
}
|
||||
void setUnavailableGamesVisible(bool _unavailableGamesVisible);
|
||||
bool getShowPasswordProtectedGames() const { return showPasswordProtectedGames; }
|
||||
bool getShowPasswordProtectedGames() const
|
||||
{
|
||||
return showPasswordProtectedGames;
|
||||
}
|
||||
void setShowPasswordProtectedGames(bool _showPasswordProtectedGames);
|
||||
QString getGameNameFilter() const { return gameNameFilter; }
|
||||
QString getGameNameFilter() const
|
||||
{
|
||||
return gameNameFilter;
|
||||
}
|
||||
void setGameNameFilter(const QString &_gameNameFilter);
|
||||
QString getCreatorNameFilter() const { return creatorNameFilter; }
|
||||
QString getCreatorNameFilter() const
|
||||
{
|
||||
return creatorNameFilter;
|
||||
}
|
||||
void setCreatorNameFilter(const QString &_creatorNameFilter);
|
||||
QSet<int> getGameTypeFilter() const { return gameTypeFilter; }
|
||||
QSet<int> getGameTypeFilter() const
|
||||
{
|
||||
return gameTypeFilter;
|
||||
}
|
||||
void setGameTypeFilter(const QSet<int> &_gameTypeFilter);
|
||||
int getMaxPlayersFilterMin() const { return maxPlayersFilterMin; }
|
||||
int getMaxPlayersFilterMax() const { return maxPlayersFilterMax; }
|
||||
int getMaxPlayersFilterMin() const
|
||||
{
|
||||
return maxPlayersFilterMin;
|
||||
}
|
||||
int getMaxPlayersFilterMax() const
|
||||
{
|
||||
return maxPlayersFilterMax;
|
||||
}
|
||||
void setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax);
|
||||
void resetFilterParameters();
|
||||
void loadFilterParameters(const QMap<int, QString> &allGameTypes);
|
||||
void saveFilterParameters(const QMap<int, QString> &allGameTypes);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue