diff --git a/application/src/settings.cpp b/application/src/settings.cpp index 8650ca6..48b7a94 100644 --- a/application/src/settings.cpp +++ b/application/src/settings.cpp @@ -21,7 +21,7 @@ Settings::Settings(QObject *parent) : QObject(parent) { // Use the same file location as GUI for data exchange if(!mySettings) { - mySettings = new QSettings("harbour-batterybuddy", "harbour-batterybuddy"); + mySettings = new QSettings(appName, appName, this); } // Read in the values diff --git a/application/src/settings.h b/application/src/settings.h index 4c347d9..bd0b4d2 100644 --- a/application/src/settings.h +++ b/application/src/settings.h @@ -68,6 +68,7 @@ public: private: QSettings *mySettings = nullptr; + const char* appName = APP_NAME; // Default values int lowAlert = 25; diff --git a/service/src/mynotification.cpp b/service/src/mynotification.cpp index 2dfef2f..687e121 100644 --- a/service/src/mynotification.cpp +++ b/service/src/mynotification.cpp @@ -20,7 +20,7 @@ MyNotification::MyNotification(QObject* parent) : QObject(parent) { notification.setAppName("Battery Buddy"); - notification.setAppIcon("harbour-batterybuddy"); + notification.setAppIcon(APP_NAME); playSound = false; sound.setAudioRole(QAudio::NotificationRole); connect(&sound, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), diff --git a/service/src/settings.cpp b/service/src/settings.cpp index 94a0356..2c6c363 100644 --- a/service/src/settings.cpp +++ b/service/src/settings.cpp @@ -21,7 +21,7 @@ Settings::Settings(QObject *parent) : QObject(parent) { // Use the same file location as GUI for data exchange if(!mySettings) { - mySettings = new QSettings("harbour-batterybuddy", "harbour-batterybuddy"); + mySettings = new QSettings(appName, appName, this); } qDebug() << "Using" << mySettings->fileName(); @@ -79,14 +79,7 @@ Settings::Settings(QObject *parent) : QObject(parent) // so we must monitor it and update when it changes. } -Settings::~Settings() -{ - delete mySettings; -} - -int Settings::bound(int value, int min, int max) { - return (value <= min ? min : (value >= max ? max : value)); -} +Settings::~Settings() { } bool Settings::loadInteger(const char* key, int *value, int min, int max) { oldValue = *value; @@ -101,7 +94,7 @@ void Settings::updateConfig(QString path) { // Use the same file location as GUI for data exchange if(!mySettings) { - mySettings = new QSettings("harbour-batterybuddy", "harbour-batterybuddy"); + mySettings = new QSettings(appName, appName, this); } qDebug() << "Reading values..."; diff --git a/service/src/settings.h b/service/src/settings.h index bdea205..829839d 100644 --- a/service/src/settings.h +++ b/service/src/settings.h @@ -50,6 +50,7 @@ public: private: QSettings* mySettings = nullptr; QFileSystemWatcher *watcher = nullptr; + const char* appName = APP_NAME; int oldValue;