35 lines
798 B
C++
35 lines
798 B
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QFileSystemWatcher>
|
|
#include <QUrl>
|
|
|
|
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;
|
|
|
|
signals:
|
|
void filePathChanged();
|
|
void figmaLinksChanged();
|
|
|
|
private:
|
|
void updateFigmaLinks(const QMap<QString, QStringList>& map);
|
|
void readFile();
|
|
void setupWatcher();
|
|
|
|
FigmaLinks *m_figmaLinks = nullptr;
|
|
QUrl m_filePath;
|
|
QFileSystemWatcher m_watcher;
|
|
};
|