File: systemtray.h

package info (click to toggle)
redshift-qt 0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 476 kB
  • sloc: cpp: 277; makefile: 4
file content (56 lines) | stat: -rw-r--r-- 1,078 bytes parent folder | download
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
#pragma once

#include <QtWidgets/QSystemTrayIcon>
#include <QtCore/QProcess>

class QIcon;
class QProcess;
class QAction;
class QTimer;

class SystemTray
        : public QSystemTrayIcon
{
public:
    SystemTray();

    bool CreateIcon();
    bool StartRedshift(QStringList);
    void ToggleRedshift(bool enable = true);
    void StopRedshift();
    void onSuspend();

private:
    void CreateMenu();

private:
    void onClick(QSystemTrayIcon::ActivationReason);
    void onQuit();
    void onRedshiftQuit(int exitCode, QProcess::ExitStatus exitStatus);
    void onRedshiftOutput();

    // FIXME: this looks bad
    void onSuspend10minutes();
    void onSuspend1hour();
    void onSuspend2hours();

    void onTimeout();

    void onGetInfo();

private:
    QString _colorTemp;
    QString _period;
    QString _info;
    QString _errText;

    QIcon _iconEnabled;
    QIcon _iconDisabled;
    QAction *_suspendMenu = nullptr;

    QProcess *_redshiftProcess = nullptr;
    QTimer *_suspendTimer = nullptr;

    bool _warnOnRedshiftQuit = true;
    bool _enabled = false;
};