1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 18:49:54 +00:00
openmw-tes3mp/apps/browser/ServerModel.hpp

52 lines
1.4 KiB
C++
Raw Normal View History

2017-01-11 14:04:53 +00:00
#ifndef SERVERMODEL_FONTMODEL_HPP
#define SERVERMODEL_FONTMODEL_HPP
#include <QObject>
#include <vector>
#include <QString>
#include <QAbstractTableModel>
2017-04-27 03:40:41 +00:00
#include <components/openmw-mp/Master/MasterData.hpp>
2017-01-11 14:04:53 +00:00
2017-04-27 03:40:41 +00:00
struct ServerData : public QueryData
2017-01-11 14:04:53 +00:00
{
QString addr;
int ping;
enum IDS
{
ADDR,
HOSTNAME,
PLAYERS,
MAX_PLAYERS,
PASSW,
2017-01-11 14:04:53 +00:00
MODNAME,
PING,
2017-02-20 14:38:56 +00:00
VERSION,
2017-01-11 14:04:53 +00:00
LAST
};
};
class ServerModel: public QAbstractTableModel
{
Q_OBJECT
public:
explicit ServerModel(QObject *parent = nullptr);
2017-01-22 07:07:42 +00:00
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_FINAL;
int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_FINAL;
int columnCount(const QModelIndex &parent) const Q_DECL_FINAL;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_FINAL;
2017-01-11 14:04:53 +00:00
2017-01-22 07:07:42 +00:00
bool insertRows(int row, int count, const QModelIndex &index = QModelIndex()) Q_DECL_FINAL;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_FINAL;
2017-01-11 14:04:53 +00:00
2017-01-22 07:07:42 +00:00
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_FINAL;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_FINAL;
2017-01-11 14:04:53 +00:00
public:
//QHash<int, QByteArray> roles;
QVector<ServerData> myData;
};
#endif //SERVERMODEL_FONTMODEL_HPP