From 217a49db7130220c8916d484fcc9945b71882824 Mon Sep 17 00:00:00 2001
From: Kevin Whitaker <eyecreate@eyecreate.org>
Date: Thu, 20 Aug 2020 16:30:57 -0400
Subject: [PATCH] Start down path of using settings for values.

---
 src/contents/ui/main.qml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/contents/ui/main.qml b/src/contents/ui/main.qml
index 096101b..5bc19cd 100644
--- a/src/contents/ui/main.qml
+++ b/src/contents/ui/main.qml
@@ -4,6 +4,7 @@ import QtQuick.Controls 2.14 as Controls
 import QtQuick.Layouts 1.14 as Layouts
 import QtQuick.Controls 1.4 as Old
 import QtQuick.Dialogs 1.3 as Dialogs
+import Qt.labs.settings 1.0 as Settings
 
 Kirigami.ApplicationWindow {
     id: root
@@ -24,6 +25,11 @@ Kirigami.ApplicationWindow {
      contextDrawer: Kirigami.ContextDrawer {
         id: contextDrawer
     }
+    
+    Settings.Settings {
+        id: appAnalyticsSettings
+        category: "analytics"
+    }
 
     Kirigami.PageRouter {
         id: router
@@ -257,20 +263,21 @@ Kirigami.ApplicationWindow {
         
         Kirigami.PageRoute {
             name: "servicerecords"
+            
             Component {
                 Kirigami.ScrollablePage {
                     property var serviceId: Kirigami.PageRouter.data.id
                     Component.onCompleted: {
                         recordModel.changeVehicleFilter(serviceId);
                         //Check vehicle warnings
-                        dbAnalytics.checkOilChangeNeededForVehicle(serviceId);
+                        dbAnalytics.checkOilChangeNeededForVehicle(serviceId, appAnalyticsSettings.value("milesForOilChange",5000), appAnalyticsSettings.value("monthsForOilChange",6));
                     }
                     Connections {
                         target: recordModel
                         function onVehicleUpdated(vehicleId) {
                             //Check vehicle warnings
                             if(vehicleId == serviceId) {
-                                dbAnalytics.checkOilChangeNeededForVehicle(vehicleId);
+                                dbAnalytics.checkOilChangeNeededForVehicle(vehicleId, appAnalyticsSettings.value("milesForOilChange",5000), appAnalyticsSettings.value("monthsForOilChange",6));
                             }
                         }
                     }
-- 
GitLab