2017-01-14 20:07:12 +01:00
|
|
|
|
#ifndef CONNECTIONLISTMODEL_H
|
|
|
|
|
|
#define CONNECTIONLISTMODEL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
|
|
|
|
|
|
|
#include "connectionconfig.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConnectionListModel : public QAbstractListModel {
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
ConnectionListModel(QObject *parent);
|
|
|
|
|
|
|
|
|
|
|
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
2017-01-14 22:03:58 +01:00
|
|
|
|
virtual int columnCount(const QModelIndex &/*parent*/) const override;
|
2017-01-14 20:07:12 +01:00
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
// virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
2017-01-14 22:29:12 +01:00
|
|
|
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
|
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
|
2017-01-14 20:07:12 +01:00
|
|
|
|
|
2017-01-14 22:29:12 +01:00
|
|
|
|
void add(const ConnectionConfig &cfg);
|
2017-01-14 20:07:12 +01:00
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
using t_Connections = std::vector<ConnectionConfig>;
|
|
|
|
|
|
t_Connections m_connections;
|
|
|
|
|
|
|
|
|
|
|
|
static QString makeLongDescription(const ConnectionConfig &cfg);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CONNECTIONLISTMODEL_H
|