2016-11-02 21:05:32 +01:00
|
|
|
#ifndef DATA_SYNCTHINGMODEL_H
|
|
|
|
#define DATA_SYNCTHINGMODEL_H
|
|
|
|
|
|
|
|
#include "./global.h"
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
|
2020-09-04 01:09:18 +02:00
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
|
|
Q_MOC_INCLUDE("../connector/syncthingconnection.h")
|
|
|
|
#endif
|
|
|
|
|
2016-11-02 21:05:32 +01:00
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
class SyncthingConnection;
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
class LIB_SYNCTHING_MODEL_EXPORT SyncthingModel : public QAbstractItemModel {
|
2016-11-02 21:05:32 +01:00
|
|
|
Q_OBJECT
|
2018-11-03 21:30:17 +01:00
|
|
|
Q_PROPERTY(SyncthingConnection *connection READ connection)
|
2016-11-02 21:05:32 +01:00
|
|
|
Q_PROPERTY(bool brightColors READ brightColors WRITE setBrightColors)
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit SyncthingModel(SyncthingConnection &connection, QObject *parent = nullptr);
|
2018-11-03 21:30:17 +01:00
|
|
|
Data::SyncthingConnection *connection();
|
|
|
|
const Data::SyncthingConnection *connection() const;
|
2016-11-02 21:05:32 +01:00
|
|
|
bool brightColors() const;
|
|
|
|
void setBrightColors(bool brightColors);
|
|
|
|
|
|
|
|
protected:
|
2017-09-11 23:44:19 +02:00
|
|
|
virtual const QVector<int> &colorRoles() const;
|
2021-10-16 21:20:12 +02:00
|
|
|
void invalidateTopLevelIndicies(const QVector<int> &affectedRoles);
|
|
|
|
void invalidateNestedIndicies(const QVector<int> &affectedRoles);
|
2017-09-11 23:44:19 +02:00
|
|
|
|
2018-12-25 02:33:57 +01:00
|
|
|
private Q_SLOTS:
|
|
|
|
virtual void handleConfigInvalidated();
|
|
|
|
virtual void handleNewConfigAvailable();
|
2019-05-19 21:51:55 +02:00
|
|
|
virtual void handleStatusIconsChanged();
|
2021-10-16 21:20:12 +02:00
|
|
|
virtual void handleForkAwesomeIconsChanged();
|
2018-12-25 02:33:57 +01:00
|
|
|
|
|
|
|
protected:
|
2016-11-02 21:05:32 +01:00
|
|
|
Data::SyncthingConnection &m_connection;
|
|
|
|
bool m_brightColors;
|
|
|
|
};
|
|
|
|
|
2018-11-03 21:30:17 +01:00
|
|
|
inline SyncthingConnection *SyncthingModel::connection()
|
|
|
|
{
|
|
|
|
return &m_connection;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const SyncthingConnection *SyncthingModel::connection() const
|
|
|
|
{
|
|
|
|
return &m_connection;
|
|
|
|
}
|
|
|
|
|
2016-11-02 21:05:32 +01:00
|
|
|
inline bool SyncthingModel::brightColors() const
|
|
|
|
{
|
|
|
|
return m_brightColors;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
#endif // DATA_SYNCTHINGMODEL_H
|