diff --git a/service/service.pro b/service/service.pro index fc1fd13..6a12908 100644 --- a/service/service.pro +++ b/service/service.pro @@ -16,12 +16,12 @@ DEFINES += APP_NAME=\"\\\"$$TARGET\\\"\" HEADERS += \ src/battery.h \ - src/notification.h \ + src/mynotification.h \ src/settings.h SOURCES += \ src/battery.cpp \ - src/notification.cpp \ + src/mynotification.cpp \ src/settings.cpp \ src/harbour-batterybuddy-daemon.cpp diff --git a/service/src/battery.cpp b/service/src/battery.cpp index 0c77c24..ba1fae6 100644 --- a/service/src/battery.cpp +++ b/service/src/battery.cpp @@ -24,7 +24,7 @@ Battery::Battery(QObject *parent) : QObject(parent) updateTimer = new QTimer(this); highNotifyTimer = new QTimer(this); lowNotifyTimer = new QTimer(this); - notification = new Notification(this); + notification = new MyNotification(this); // Number: charge percentage, e.g. 42 chargeFile = new QFile("/sys/class/power_supply/battery/capacity", this); diff --git a/service/src/battery.h b/service/src/battery.h index ed2ef6a..d0e2b94 100644 --- a/service/src/battery.h +++ b/service/src/battery.h @@ -26,7 +26,7 @@ #include #include #include "settings.h" -#include "notification.h" +#include "mynotification.h" class Battery : public QObject { @@ -57,7 +57,7 @@ private: QTimer *updateTimer = nullptr; QTimer *highNotifyTimer = nullptr; QTimer *lowNotifyTimer = nullptr; - Notification *notification = nullptr; + MyNotification *notification = nullptr; // Default values: int charge = 100; // 100% full diff --git a/service/src/notification.cpp b/service/src/mynotification.cpp similarity index 87% rename from service/src/notification.cpp rename to service/src/mynotification.cpp index a293e55..4dbf423 100644 --- a/service/src/notification.cpp +++ b/service/src/mynotification.cpp @@ -15,20 +15,20 @@ * * Author: Matti Viljanen */ -#include "notification.h" +#include "mynotification.h" -Notification::Notification(QObject* parent) : QObject(parent) +MyNotification::MyNotification(QObject* parent) : QObject(parent) { notification.setAppName("Battery Buddy"); notification.setAppIcon("harbour-batterybuddy"); } -Notification::~Notification() +MyNotification::~MyNotification() { close(); } -void Notification::send(QString title, QString body, QString soundFile) +void MyNotification::send(QString title, QString body, QString soundFile) { title = title.replace("\"", "\\\""); body = body.replace("\"", "\\\""); @@ -55,7 +55,7 @@ void Notification::send(QString title, QString body, QString soundFile) return; } -void Notification::close() +void MyNotification::close() { notification.close(); return; diff --git a/service/src/notification.h b/service/src/mynotification.h similarity index 85% rename from service/src/notification.h rename to service/src/mynotification.h index 7e79358..030bab6 100644 --- a/service/src/notification.h +++ b/service/src/mynotification.h @@ -15,8 +15,8 @@ * * Author: Matti Viljanen */ -#ifndef NOTIFICATION_H -#define NOTIFICATION_H +#ifndef MYNOTIFICATION_H +#define MYNOTIFICATION_H #include #include @@ -24,13 +24,13 @@ #include #include -class Notification : public QObject +class MyNotification : public QObject { Q_OBJECT public: - Notification(QObject* parent = nullptr); - ~Notification(); + MyNotification(QObject* parent = nullptr); + ~MyNotification(); public slots: void send(QString title, QString body, QString soundFile); @@ -41,4 +41,4 @@ private: Notification notification; }; -#endif // NOTIFICATION_H +#endif // MYNOTIFICATION_H