Martchus
4a42a3f0c0
* Rely not only on the FolderErrors event * Request pull errors when opening the dialog * Use "pullErrors" from FolderSummary * Move code for directory error dialog into its own class This should fix that sometimes obsolete errors were still displayed or actually present errors missing.
59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
#ifndef DATA_SYNCTHINGDIRECTORYMODEL_H
|
|
#define DATA_SYNCTHINGDIRECTORYMODEL_H
|
|
|
|
#include "./syncthingmodel.h"
|
|
|
|
#include <QIcon>
|
|
|
|
#include <vector>
|
|
|
|
namespace Data {
|
|
|
|
struct SyncthingDir;
|
|
|
|
class LIB_SYNCTHING_MODEL_EXPORT SyncthingDirectoryModel : public SyncthingModel {
|
|
Q_OBJECT
|
|
public:
|
|
enum SyncthingDirectoryModelRole {
|
|
DirectoryStatus = Qt::UserRole + 1,
|
|
DirectoryPaused,
|
|
DirectoryStatusString,
|
|
DirectoryStatusColor,
|
|
DirectoryId,
|
|
DirectoryPath,
|
|
DirectoryPullErrorCount,
|
|
DirectoryDetail,
|
|
};
|
|
|
|
explicit SyncthingDirectoryModel(SyncthingConnection &connection, QObject *parent = nullptr);
|
|
|
|
public Q_SLOTS:
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
const QVector<int> &colorRoles() const override;
|
|
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
|
QModelIndex parent(const QModelIndex &child) const override;
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
|
int rowCount(const QModelIndex &parent) const override;
|
|
int columnCount(const QModelIndex &parent) const override;
|
|
const SyncthingDir *dirInfo(const QModelIndex &index) const;
|
|
|
|
private Q_SLOTS:
|
|
void newConfig();
|
|
void newDirs();
|
|
void dirStatusChanged(const SyncthingDir &, int index);
|
|
|
|
private:
|
|
static QString dirStatusString(const SyncthingDir &dir);
|
|
QVariant dirStatusColor(const SyncthingDir &dir) const;
|
|
|
|
const std::vector<SyncthingDir> &m_dirs;
|
|
};
|
|
|
|
} // namespace Data
|
|
|
|
Q_DECLARE_METATYPE(QModelIndex)
|
|
|
|
#endif // DATA_SYNCTHINGDIRECTORYMODEL_H
|