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 += \
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

View file

@ -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);

View file

@ -26,7 +26,7 @@
#include <QHostInfo>
#include <QDebug>
#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

View file

@ -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;

View file

@ -15,8 +15,8 @@
*
* Author: Matti Viljanen
*/
#ifndef NOTIFICATION_H
#define NOTIFICATION_H
#ifndef MYNOTIFICATION_H
#define MYNOTIFICATION_H
#include <QObject>
#include <QProcess>
@ -24,13 +24,13 @@
#include <nemonotifications-qt5/notification.h>
#include <QDebug>
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