#pragma once #include #include #include class FigmaLinks; class FigmaLinksSource : public QObject { Q_OBJECT Q_PROPERTY(QUrl filePath READ getFilePath WRITE setFilePath NOTIFY filePathChanged) Q_PROPERTY(FigmaLinks* figmaLinks READ getFigmaLinks NOTIFY figmaLinksChanged) public: explicit FigmaLinksSource(QObject *parent = nullptr); const QUrl& getFilePath() const; void setFilePath(const QUrl& path); FigmaLinks* getFigmaLinks() const; Q_INVOKABLE void remove(const QString &key, const QList &indexes); Q_INVOKABLE void append(const QString &key, const QList &links); signals: void filePathChanged(); void figmaLinksChanged(); private: void updateFigmaLinks(const QMap& map); void readFile(); void setupWatcher(); FigmaLinks *m_figmaLinks = nullptr; QUrl m_filePath; QFileSystemWatcher m_watcher; };