-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrayicon.h
60 lines (51 loc) · 1.26 KB
/
trayicon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef TRAYICON
#define TRAYICON
#include <QSystemTrayIcon>
#include <QMenu>
#include <QPainter>
#include <QGraphicsScene>
#include <QTimer>
#include <QScreen>
#include <QGuiApplication>
#include <QDebug>
#include "mainwindow.h"
#include "memoryusage.h"
class TrayIcon : public QObject
{
Q_OBJECT
private:
QMenu trayIconMenu;
QSystemTrayIcon trayIcon;
QMap <int, QIcon> allIcons;
MemoryUsage memUsage;
QTimer refreshTimer;
bool m_shuttingDown = false;
QAction* showSettingsAction = nullptr;
QAction* quitProgramAction = nullptr;
Settings* settings = nullptr;
MainWindow* window = nullptr;
QColor m_colorText1;
QColor m_colorText2;
QColor m_colorBack1;
QColor m_colorBack2;
int m_refreshInterval;
bool m_showValue;
bool m_showBackground;
bool m_showBackgroundProgress;
bool m_availableMemory;
void loadSettings();
void generateIconsWithCurrentSettings();
void loadAndApplySettings();
void refresh();
void showSettingsWindow();
void quitProgram();
void iconActivated(QSystemTrayIcon::ActivationReason reason);
QIcon generateIcon(int value);
void applySettings();
public:
TrayIcon();
~TrayIcon();
private slots:
void deleteMainWindow();
};
#endif // TRAYICON