mirror of
https://github.com/ysoftdevs/Testa.git
synced 2026-01-14 07:33:25 +01:00
20 lines
514 B
C++
20 lines
514 B
C++
#include <QSystemTrayIcon>
|
|
|
|
#include "notification.h"
|
|
|
|
static QSystemTrayIcon* sharedSystemTrayIcon;
|
|
|
|
void Notification::show(const std::string& title, const std::string& message)
|
|
{
|
|
if (sharedSystemTrayIcon == nullptr)
|
|
sharedSystemTrayIcon = new QSystemTrayIcon();
|
|
sharedSystemTrayIcon->show();
|
|
sharedSystemTrayIcon->showMessage(QString::fromStdString(title), QString::fromStdString(message));
|
|
}
|
|
|
|
void Notification::hide()
|
|
{
|
|
sharedSystemTrayIcon->hide();
|
|
delete sharedSystemTrayIcon;
|
|
}
|