Converted project to CPP and use Qt instead of Gtk.
This commit is contained in:
parent
22c991cd26
commit
966314dae7
10 changed files with 253 additions and 641 deletions
45
spacetray.h
Normal file
45
spacetray.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef SPACETRAY_H
|
||||
#define SPACETRAY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMenu>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
|
||||
class SpaceTray : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SpaceTray(const QString &url, QObject *parent = nullptr);
|
||||
~SpaceTray();
|
||||
|
||||
private slots:
|
||||
void fetchData();
|
||||
void onFinished(QNetworkReply *reply);
|
||||
void quit();
|
||||
|
||||
private:
|
||||
void updateTray();
|
||||
void showNotification(const QString &message);
|
||||
|
||||
QString m_statusUrl;
|
||||
QSystemTrayIcon *m_trayIcon;
|
||||
QMenu *m_trayMenu;
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QTimer *m_timer;
|
||||
|
||||
bool m_doorOpen;
|
||||
bool m_oldDoorOpen;
|
||||
qint64 m_doorLastChange;
|
||||
QString m_spaceName;
|
||||
bool m_firstRun;
|
||||
|
||||
QIcon m_iconOpen;
|
||||
QIcon m_iconClosed;
|
||||
};
|
||||
|
||||
#endif // SPACETRAY_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue