mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 11:04:25 -04:00
Extract the system tray functionality to its own class
LibraryWindow is already a monster, so we'll try to not make it bigger.
This commit is contained in:
34
YACReaderLibrary/trayicon_controller.h
Normal file
34
YACReaderLibrary/trayicon_controller.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef TRAYICON_CONTROLLER_H
|
||||
#define TRAYICON_CONTROLLER_H
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
namespace YACReader {
|
||||
|
||||
class TrayIconController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrayIconController(QSettings *settings,
|
||||
QMainWindow *window);
|
||||
|
||||
void updateIconVisibility();
|
||||
|
||||
bool handleCloseToTrayIcon(QCloseEvent *event);
|
||||
|
||||
QSystemTrayIcon trayIcon;
|
||||
|
||||
public slots:
|
||||
void showWindow();
|
||||
|
||||
private:
|
||||
QSettings *settings;
|
||||
QMainWindow *window;
|
||||
|
||||
QMenu *trayIconMenu;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TRAYICON_CONTROLLER_H
|
Reference in New Issue
Block a user