diff options
author | Arseniy-Movshev <dodoradio@outlook.com> | 2023-06-11 13:02:56 +0100 |
---|---|---|
committer | Arseniy-Movshev <dodoradio@outlook.com> | 2023-06-20 00:05:28 +0100 |
commit | 17af88e65e6cb0febcd2340771f52d128eae4fac (patch) | |
tree | 86adb1658412f788ee3b54260102688e52ab6059 /qmlplugin | |
parent | f6c090502058c63f7a51b7ba97672022657119d8 (diff) |
DataLoaders: switch to qvariant for qml compatibility
Diffstat (limited to 'qmlplugin')
-rw-r--r-- | qmlplugin/hrDataLoader.cpp | 8 | ||||
-rw-r--r-- | qmlplugin/hrDataLoader.h | 4 | ||||
-rw-r--r-- | qmlplugin/stepsDataLoader.cpp | 8 | ||||
-rw-r--r-- | qmlplugin/stepsDataLoader.h | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/qmlplugin/hrDataLoader.cpp b/qmlplugin/hrDataLoader.cpp index 7a39929..b1eb2ca 100644 --- a/qmlplugin/hrDataLoader.cpp +++ b/qmlplugin/hrDataLoader.cpp @@ -29,16 +29,16 @@ HrDataLoader::HrDataLoader() : QObject() } } -QList<QPointF> HrDataLoader::getTodayData() { +QVariant HrDataLoader::getTodayData() { return getDataForDate(QDate::currentDate()); } -QList<QPointF> HrDataLoader::getDataForDate(QDate date) { +QVariant HrDataLoader::getDataForDate(QDate date) { QList<QPointF> m_filedata; QFile file(fileNameForDate(date, "heartrateMonitor")); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "failed to open file"; - return m_filedata; + return QVariant::fromValue(m_filedata); } QTextStream inStream(&file); QString line; @@ -50,7 +50,7 @@ QList<QPointF> HrDataLoader::getDataForDate(QDate date) { m_filedata.append(point); } file.close(); - return m_filedata; + return QVariant::fromValue(m_filedata); } void HrDataLoader::triggerDaemonRecording() { diff --git a/qmlplugin/hrDataLoader.h b/qmlplugin/hrDataLoader.h index 0c6ffba..98ba400 100644 --- a/qmlplugin/hrDataLoader.h +++ b/qmlplugin/hrDataLoader.h @@ -22,8 +22,8 @@ class HrDataLoader : public QObject public: explicit HrDataLoader(); - Q_INVOKABLE QList<QPointF> getDataForDate(QDate date); - Q_INVOKABLE QList<QPointF> getTodayData(); + Q_INVOKABLE QVariant getDataForDate(QDate date); + Q_INVOKABLE QVariant getTodayData(); Q_INVOKABLE void triggerDaemonRecording(); private: QDBusInterface *m_iface; diff --git a/qmlplugin/stepsDataLoader.cpp b/qmlplugin/stepsDataLoader.cpp index 53bdc5e..bbc9b29 100644 --- a/qmlplugin/stepsDataLoader.cpp +++ b/qmlplugin/stepsDataLoader.cpp @@ -58,16 +58,16 @@ int StepsDataLoader::getTotalForDate(QDate date) { // This is obvious garbage. T return line.split(":")[1].toInt(); } -QList<QPointF> StepsDataLoader::getTodayData() { +QVariant StepsDataLoader::getTodayData() { return getDataForDate(QDate::currentDate()); } -QList<QPointF> StepsDataLoader::getDataForDate(QDate date) { +QVariant StepsDataLoader::getDataForDate(QDate date) { QList<QPointF> m_filedata; QFile file(fileNameForDate(date, "stepCounter")); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "failed to open file"; - return m_filedata; + return QVariant::fromValue(m_filedata); } QTextStream inStream(&file); QString line; @@ -79,7 +79,7 @@ QList<QPointF> StepsDataLoader::getDataForDate(QDate date) { m_filedata.append(point); } file.close(); - return m_filedata; + return QVariant::fromValue(m_filedata); } void StepsDataLoader::triggerDaemonRecording() { diff --git a/qmlplugin/stepsDataLoader.h b/qmlplugin/stepsDataLoader.h index f29dcb2..48a3861 100644 --- a/qmlplugin/stepsDataLoader.h +++ b/qmlplugin/stepsDataLoader.h @@ -26,8 +26,8 @@ public: explicit StepsDataLoader(); Q_INVOKABLE int getTotalForDate(QDate date); Q_INVOKABLE int getTodayTotal(); - Q_INVOKABLE QList<QPointF> getDataForDate(QDate date); - Q_INVOKABLE QList<QPointF> getTodayData(); + Q_INVOKABLE QVariant getDataForDate(QDate date); + Q_INVOKABLE QVariant getTodayData(); Q_INVOKABLE void triggerDaemonRecording(); signals: |