2016-08-25 00:45:32 +02:00
|
|
|
#ifndef DATA_SYNCTHINGDIRECTORYMODEL_H
|
|
|
|
#define DATA_SYNCTHINGDIRECTORYMODEL_H
|
|
|
|
|
2016-11-02 21:05:32 +01:00
|
|
|
#include "./syncthingmodel.h"
|
2016-09-30 23:55:25 +02:00
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
#include <QIcon>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
struct SyncthingDir;
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
class LIB_SYNCTHING_MODEL_EXPORT SyncthingDirectoryModel : public SyncthingModel {
|
2016-08-25 00:45:32 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-05-01 03:34:43 +02:00
|
|
|
enum SyncthingDirectoryModelRole { DirectoryStatus = Qt::UserRole + 1, DirectoryPaused };
|
2017-02-23 14:59:00 +01:00
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
explicit SyncthingDirectoryModel(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 SyncthingDir *dirInfo(const QModelIndex &index) const;
|
|
|
|
|
2016-09-21 21:09:12 +02:00
|
|
|
private Q_SLOTS:
|
2016-08-25 00:45:32 +02:00
|
|
|
void newConfig();
|
|
|
|
void newDirs();
|
|
|
|
void dirStatusChanged(const SyncthingDir &, int index);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const std::vector<SyncthingDir> &m_dirs;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
#endif // DATA_SYNCTHINGDIRECTORYMODEL_H
|