From a816cfed03b7a02156377c29bd8a77b9c58333db Mon Sep 17 00:00:00 2001 From: Arseniy-Movshev Date: Thu, 8 Jun 2023 14:55:29 +0100 Subject: Move fileNameForDate to a common header file This function shows up in quite a few places so this seems justified. Other functions may get this treatment later --- qmlplugin/CMakeLists.txt | 2 ++ qmlplugin/stepsDataLoader.cpp | 7 +------ qmlplugin/stepsDataLoader.h | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'qmlplugin') diff --git a/qmlplugin/CMakeLists.txt b/qmlplugin/CMakeLists.txt index 2b36163..3d24374 100644 --- a/qmlplugin/CMakeLists.txt +++ b/qmlplugin/CMakeLists.txt @@ -6,6 +6,8 @@ add_library( stepsDataLoader.h loggerSettings.cpp loggerSettings.h + ../common.cpp + ../common.h ) target_link_libraries(sensorlogdqmlplugin diff --git a/qmlplugin/stepsDataLoader.cpp b/qmlplugin/stepsDataLoader.cpp index 8a281a2..2fbd9f1 100644 --- a/qmlplugin/stepsDataLoader.cpp +++ b/qmlplugin/stepsDataLoader.cpp @@ -13,11 +13,11 @@ #include #include #include -#include #include #include #include "stepsDataLoader.h" +#include "../common.h" StepsDataLoader::StepsDataLoader() : QObject() { @@ -79,8 +79,3 @@ QList StepsDataLoader::getDataForDate(QDate date) { void StepsDataLoader::triggerDaemonRecording() { m_iface->call("triggerRecording"); } - -QString fileNameForDate(QDate date, QString prefix) { - QSettings settings("asteroid", "sensorlogd"); // this should be moved out of here at some point TODO - return settings.value("loggerRootPath", QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.asteroid-sensorlogd/").toString() + prefix + "/" + date.toString("yyyy-MM-dd.log"); -} diff --git a/qmlplugin/stepsDataLoader.h b/qmlplugin/stepsDataLoader.h index fa551a3..a1bcb5d 100644 --- a/qmlplugin/stepsDataLoader.h +++ b/qmlplugin/stepsDataLoader.h @@ -29,6 +29,5 @@ public: private: QDBusInterface *m_iface; }; -QString fileNameForDate(QDate date, QString prefix); #endif // STEPSDATALOADER_H -- cgit v1.2.3-54-g00ecf