hyperion.ng/src/hyperiond/systray.h

80 lines
1.7 KiB
C
Raw Normal View History

#pragma once
#include <QSystemTrayIcon>
#include <QMenu>
#include <QWidget>
#include <QColorDialog>
#include <QCloseEvent>
#include <hyperion/Hyperion.h>
#include <hyperion/HyperionIManager.h>
class HyperionDaemon;
class SysTray : public QWidget
{
Q_OBJECT
public:
2018-12-30 22:07:53 +01:00
SysTray(HyperionDaemon *hyperiond);
~SysTray();
public slots:
void showColorDialog();
void setColor(const QColor & color);
void closeEvent(QCloseEvent *event);
void settings() const;
#if defined(ENABLE_EFFECTENGINE)
void setEffect();
#endif
void clearEfxColor();
void setAutorunState();
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
///
/// @brief is called whenever a hyperion instance state changes
///
2020-08-08 13:09:15 +02:00
void handleInstanceStateChange(InstanceState state, quint8 instance, const QString& name);
private:
void createTrayIcon();
#ifdef _WIN32
///
/// @brief Checks whether Hyperion should start at Windows system start.
/// @return True on success, otherwise false
///
bool getCurrentAutorunState();
#endif
QAction *quitAction;
QAction *restartAction;
QAction *startAction;
QAction *stopAction;
QAction *colorAction;
QAction *settingsAction;
QAction *clearAction;
#ifdef _WIN32
QAction *autorunAction;
#endif
QSystemTrayIcon *_trayIcon;
QMenu *_trayIconMenu;
#if defined(ENABLE_EFFECTENGINE)
QMenu *_trayIconEfxMenu;
#endif
QColorDialog _colorDlg;
HyperionDaemon *_hyperiond;
Hyperion *_hyperion;
HyperionIManager *_instanceManager;
quint16 _webPort;
};