syncthingtray/model/syncthingdevicemodel.h

43 lines
1.3 KiB
C
Raw Normal View History

2016-08-25 00:45:32 +02:00
#ifndef DATA_SYNCTHINGDEVICEMODEL_H
#define DATA_SYNCTHINGDEVICEMODEL_H
#include "./syncthingmodel.h"
2016-08-25 00:45:32 +02:00
#include <QIcon>
#include <vector>
namespace Data {
struct SyncthingDev;
2017-05-01 03:34:43 +02:00
class LIB_SYNCTHING_MODEL_EXPORT SyncthingDeviceModel : public SyncthingModel {
2016-08-25 00:45:32 +02:00
Q_OBJECT
public:
2017-05-01 03:34:43 +02:00
enum SyncthingDeviceModelRole { DeviceStatus = Qt::UserRole + 1, DevicePaused, IsOwnDevice };
2016-08-26 16:43:53 +02:00
2016-08-25 00:45:32 +02:00
explicit SyncthingDeviceModel(SyncthingConnection &connection, QObject *parent = nullptr);
public Q_SLOTS:
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &child) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
const SyncthingDev *devInfo(const QModelIndex &index) const;
2016-09-21 21:09:12 +02:00
private Q_SLOTS:
2016-08-26 16:43:53 +02:00
void newConfig();
void newDevices();
void devStatusChanged(const SyncthingDev &, int index);
2016-08-25 00:45:32 +02:00
private:
const std::vector<SyncthingDev> &m_devs;
};
} // namespace Data
#endif // DATA_SYNCTHINGDEVICEMODEL_H