2017-08-01 17:29:47 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QColorDialog>
|
|
|
|
#include <QCloseEvent>
|
|
|
|
|
|
|
|
#include <hyperion/Hyperion.h>
|
2019-07-14 22:43:22 +02:00
|
|
|
#include <hyperion/HyperionIManager.h>
|
2017-08-01 17:29:47 +02:00
|
|
|
|
|
|
|
class HyperionDaemon;
|
|
|
|
|
|
|
|
class SysTray : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-12-30 22:07:53 +01:00
|
|
|
SysTray(HyperionDaemon *hyperiond);
|
2017-08-01 17:29:47 +02:00
|
|
|
~SysTray();
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void showColorDialog();
|
|
|
|
void setColor(const QColor & color);
|
|
|
|
void closeEvent(QCloseEvent *event);
|
2021-03-19 22:52:41 +01:00
|
|
|
void settings() const;
|
2017-08-01 17:29:47 +02:00
|
|
|
void setEffect();
|
|
|
|
void clearEfxColor();
|
2020-08-01 17:50:20 +02:00
|
|
|
void setAutorunState();
|
2017-08-01 17:29:47 +02:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void iconActivated(QSystemTrayIcon::ActivationReason reason);
|
|
|
|
|
2018-12-30 22:07:53 +01:00
|
|
|
///
|
|
|
|
/// @brief is called whenever the webserver changes the port
|
|
|
|
///
|
2020-08-08 13:09:15 +02:00
|
|
|
void webserverPortChanged(quint16 port) { _webPort = port; };
|
2018-12-30 22:07:53 +01:00
|
|
|
|
2019-07-14 22:43:22 +02:00
|
|
|
///
|
2020-08-01 17:50:20 +02:00
|
|
|
/// @brief is called whenever a hyperion instance state changes
|
2019-07-14 22:43:22 +02:00
|
|
|
///
|
2020-08-08 13:09:15 +02:00
|
|
|
void handleInstanceStateChange(InstanceState state, quint8 instance, const QString& name);
|
2019-07-14 22:43:22 +02:00
|
|
|
|
2017-08-01 17:29:47 +02:00
|
|
|
private:
|
|
|
|
void createTrayIcon();
|
|
|
|
|
2020-08-01 17:50:20 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
///
|
|
|
|
/// @brief Checks whether Hyperion should start at Windows system start.
|
|
|
|
/// @return True on success, otherwise false
|
|
|
|
///
|
|
|
|
bool getCurrentAutorunState();
|
|
|
|
#endif
|
|
|
|
|
2019-07-14 22:43:22 +02:00
|
|
|
QAction *quitAction;
|
|
|
|
QAction *startAction;
|
|
|
|
QAction *stopAction;
|
|
|
|
QAction *colorAction;
|
|
|
|
QAction *settingsAction;
|
|
|
|
QAction *clearAction;
|
2020-08-01 17:50:20 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
QAction *autorunAction;
|
|
|
|
#endif
|
2019-07-14 22:43:22 +02:00
|
|
|
|
|
|
|
QSystemTrayIcon *_trayIcon;
|
|
|
|
QMenu *_trayIconMenu;
|
|
|
|
QMenu *_trayIconEfxMenu;
|
|
|
|
QColorDialog _colorDlg;
|
|
|
|
HyperionDaemon *_hyperiond;
|
|
|
|
Hyperion *_hyperion;
|
|
|
|
HyperionIManager *_instanceManager;
|
|
|
|
quint16 _webPort;
|
2017-08-01 17:29:47 +02:00
|
|
|
};
|