Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
trinity/include/desktop.h

28 lines
580 B
C
Raw Permalink Normal View History

2021-07-21 16:08:15 -04:00
#pragma once
#include <QApplication>
2022-08-15 21:53:56 -04:00
#include <QSystemTrayIcon>
2021-07-21 16:08:15 -04:00
2022-08-15 21:53:56 -04:00
class Desktop : public QObject {
2021-07-21 16:08:15 -04:00
Q_OBJECT
public:
Q_INVOKABLE void showTrayIcon(const bool shouldHide) {
QApplication::setQuitOnLastWindowClosed(shouldHide);
2022-08-15 21:53:56 -04:00
if (shouldHide)
2021-07-21 16:08:15 -04:00
icon->show();
else
icon->hide();
2021-07-21 16:08:15 -04:00
}
Q_INVOKABLE void showMessage(const QString title, const QString content) {
icon->showMessage(title, content);
}
Q_INVOKABLE bool isTrayIconEnabled() {
2022-08-15 21:53:56 -04:00
return icon->isVisible();
}
2021-07-21 16:08:15 -04:00
QSystemTrayIcon* icon;
};