Working D-Bus desktop notifications (#361)
* Working D-Bus desktop notifications * Remove return type on constructor * Fix the Windows placeholder class * Fix wrong variable name * Fix windows and macOS versions of notificationsmanager
This commit is contained in:
parent
e7f30b57e8
commit
80ebe3f29d
7 changed files with 286 additions and 18 deletions
|
|
@ -27,15 +27,25 @@ init()
|
|||
}
|
||||
}
|
||||
|
||||
NotificationsManager::NotificationsManager(QObject *parent): QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
NotificationsManager::postNotification(const QString &room, const QString &user, const QString &msg)
|
||||
NotificationsManager::postNotification(const QString &, //roomid
|
||||
const QString &, //eventid
|
||||
const QString &roomname,
|
||||
const QString &sender,
|
||||
const QString &text,
|
||||
const QImage &) //icon
|
||||
{
|
||||
if (!isInitialized)
|
||||
init();
|
||||
|
||||
auto templ = WinToastTemplate(WinToastTemplate::ImageAndText02);
|
||||
if (room != user)
|
||||
templ.setTextField(QString("%1 - %2").arg(user).arg(room).toStdWString(),
|
||||
if (roomname != sender)
|
||||
templ.setTextField(QString("%1 - %2").arg(sender).arg(roomname).toStdWString(),
|
||||
WinToastTemplate::FirstLine);
|
||||
else
|
||||
templ.setTextField(QString("%1").arg(user).toStdWString(),
|
||||
|
|
@ -46,3 +56,14 @@ NotificationsManager::postNotification(const QString &room, const QString &user,
|
|||
|
||||
WinToast::instance()->showToast(templ, new CustomHandler());
|
||||
}
|
||||
|
||||
//unused
|
||||
void
|
||||
NotificationsManager::actionInvoked(uint, QString)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
NotificationsManager::notificationClosed(uint, uint)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue