Rename the class so the code actually compiles...

This commit is contained in:
Matti Viljanen 2020-11-30 20:51:16 +02:00
parent 082030f1fa
commit 5e2fc08f45
5 changed files with 16 additions and 16 deletions

View file

@ -16,12 +16,12 @@ DEFINES += APP_NAME=\"\\\"$$TARGET\\\"\"
HEADERS += \ HEADERS += \
src/battery.h \ src/battery.h \
src/notification.h \ src/mynotification.h \
src/settings.h src/settings.h
SOURCES += \ SOURCES += \
src/battery.cpp \ src/battery.cpp \
src/notification.cpp \ src/mynotification.cpp \
src/settings.cpp \ src/settings.cpp \
src/harbour-batterybuddy-daemon.cpp src/harbour-batterybuddy-daemon.cpp

View file

@ -24,7 +24,7 @@ Battery::Battery(QObject *parent) : QObject(parent)
updateTimer = new QTimer(this); updateTimer = new QTimer(this);
highNotifyTimer = new QTimer(this); highNotifyTimer = new QTimer(this);
lowNotifyTimer = new QTimer(this); lowNotifyTimer = new QTimer(this);
notification = new Notification(this); notification = new MyNotification(this);
// Number: charge percentage, e.g. 42 // Number: charge percentage, e.g. 42
chargeFile = new QFile("/sys/class/power_supply/battery/capacity", this); chargeFile = new QFile("/sys/class/power_supply/battery/capacity", this);

View file

@ -26,7 +26,7 @@
#include <QHostInfo> #include <QHostInfo>
#include <QDebug> #include <QDebug>
#include "settings.h" #include "settings.h"
#include "notification.h" #include "mynotification.h"
class Battery : public QObject class Battery : public QObject
{ {
@ -57,7 +57,7 @@ private:
QTimer *updateTimer = nullptr; QTimer *updateTimer = nullptr;
QTimer *highNotifyTimer = nullptr; QTimer *highNotifyTimer = nullptr;
QTimer *lowNotifyTimer = nullptr; QTimer *lowNotifyTimer = nullptr;
Notification *notification = nullptr; MyNotification *notification = nullptr;
// Default values: // Default values:
int charge = 100; // 100% full int charge = 100; // 100% full

View file

@ -15,20 +15,20 @@
* *
* Author: Matti Viljanen * 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.setAppName("Battery Buddy");
notification.setAppIcon("harbour-batterybuddy"); notification.setAppIcon("harbour-batterybuddy");
} }
Notification::~Notification() MyNotification::~MyNotification()
{ {
close(); close();
} }
void Notification::send(QString title, QString body, QString soundFile) void MyNotification::send(QString title, QString body, QString soundFile)
{ {
title = title.replace("\"", "\\\""); title = title.replace("\"", "\\\"");
body = body.replace("\"", "\\\""); body = body.replace("\"", "\\\"");
@ -55,7 +55,7 @@ void Notification::send(QString title, QString body, QString soundFile)
return; return;
} }
void Notification::close() void MyNotification::close()
{ {
notification.close(); notification.close();
return; return;

View file

@ -15,8 +15,8 @@
* *
* Author: Matti Viljanen * Author: Matti Viljanen
*/ */
#ifndef NOTIFICATION_H #ifndef MYNOTIFICATION_H
#define NOTIFICATION_H #define MYNOTIFICATION_H
#include <QObject> #include <QObject>
#include <QProcess> #include <QProcess>
@ -24,13 +24,13 @@
#include <nemonotifications-qt5/notification.h> #include <nemonotifications-qt5/notification.h>
#include <QDebug> #include <QDebug>
class Notification : public QObject class MyNotification : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
Notification(QObject* parent = nullptr); MyNotification(QObject* parent = nullptr);
~Notification(); ~MyNotification();
public slots: public slots:
void send(QString title, QString body, QString soundFile); void send(QString title, QString body, QString soundFile);
@ -41,4 +41,4 @@ private:
Notification notification; Notification notification;
}; };
#endif // NOTIFICATION_H #endif // MYNOTIFICATION_H