AntiClipSettings/DataCollection.h

44 lines
991 B
C
Raw Normal View History

2024-08-21 09:26:06 +08:00
#ifndef DATACOLLECTION_H
#define DATACOLLECTION_H
#include <QObject>
#include <QQmlEngine>
class QNetworkAccessManager;
class DataCollection : public QObject {
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("Only created in C++...")
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged)
public:
explicit DataCollection(QObject *parent = nullptr);
Q_INVOKABLE void start(const QString &address);
Q_INVOKABLE void stop();
QString path() const;
void setPath(const QString &path);
bool enabled() const;
signals:
void pathChanged();
void enabledChanged();
protected:
void start();
void onCaptureFinished();
void onDataGetFinished();
private:
QNetworkAccessManager *m_manager = nullptr;
bool m_enabled = false;
QString m_address;
QString m_path;
QString m_filename;
};
#endif // DATACOLLECTION_H