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:
Luis Ángel San Martín
2019-09-21 10:47:01 +02:00
parent 3c07e7269a
commit 8e99d9e59f
5 changed files with 167 additions and 41 deletions

View 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