Clean up notification.
This commit is contained in:
parent
316d1429fa
commit
ec43131a10
|
@ -30,7 +30,7 @@ Item {
|
|||
|
||||
connection: controller.connection
|
||||
|
||||
onNewMessage: if (!window.active && MSettings.showNotification) spectralController.postNotification(roomId, eventId, roomName, senderName, text, icon, iconPath)
|
||||
onNewMessage: if (!window.active && MSettings.showNotification) spectralController.postNotification(roomId, eventId, roomName, senderName, text, icon)
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
|
|
|
@ -234,10 +234,9 @@ void Controller::playAudio(QUrl localFile) {
|
|||
void Controller::postNotification(const QString& roomId, const QString& eventId,
|
||||
const QString& roomName,
|
||||
const QString& senderName,
|
||||
const QString& text, const QImage& icon,
|
||||
const QUrl& iconPath) {
|
||||
const QString& text, const QImage& icon) {
|
||||
notificationsManager.postNotification(roomId, eventId, roomName, senderName,
|
||||
text, icon, iconPath);
|
||||
text, icon);
|
||||
}
|
||||
|
||||
int Controller::dpi() {
|
||||
|
|
|
@ -101,8 +101,7 @@ class Controller : public QObject {
|
|||
void playAudio(QUrl localFile);
|
||||
void postNotification(const QString& roomId, const QString& eventId,
|
||||
const QString& roomName, const QString& senderName,
|
||||
const QString& text, const QImage& icon,
|
||||
const QUrl& iconPath);
|
||||
const QString& text, const QImage& icon);
|
||||
};
|
||||
|
||||
#endif // CONTROLLER_H
|
||||
|
|
|
@ -23,7 +23,7 @@ class NotificationsManager : public QObject {
|
|||
|
||||
void postNotification(const QString &roomId, const QString &eventId,
|
||||
const QString &roomName, const QString &senderName,
|
||||
const QString &text, const QImage &icon, const QUrl &iconPath);
|
||||
const QString &text, const QImage &icon);
|
||||
|
||||
signals:
|
||||
void notificationClicked(const QString roomId, const QString eventId);
|
||||
|
|
|
@ -25,8 +25,7 @@ NotificationsManager::NotificationsManager(QObject *parent)
|
|||
|
||||
void NotificationsManager::postNotification(
|
||||
const QString &roomid, const QString &eventid, const QString &roomname,
|
||||
const QString &sender, const QString &text, const QImage &icon,
|
||||
const QUrl &iconPath) {
|
||||
const QString &sender, const QString &text, const QImage &icon) {
|
||||
uint id = showNotification(roomname, sender + ": " + text, icon);
|
||||
notificationIds[id] = roomEventId{roomid, eventid};
|
||||
}
|
||||
|
|
|
@ -19,13 +19,11 @@ NotificationsManager::postNotification(
|
|||
const QString &roomName,
|
||||
const QString &senderName,
|
||||
const QString &text,
|
||||
const QImage &icon,
|
||||
const QUrl &iconPath)
|
||||
const QImage &icon)
|
||||
{
|
||||
Q_UNUSED(roomId);
|
||||
Q_UNUSED(eventId);
|
||||
Q_UNUSED(icon);
|
||||
Q_UNUSED(iconPath);
|
||||
|
||||
NSUserNotification * notif = [[NSUserNotification alloc] init];
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ NotificationsManager::NotificationsManager(QObject *parent) : QObject(parent) {}
|
|||
|
||||
void NotificationsManager::postNotification(
|
||||
const QString &room_id, const QString &event_id, const QString &room_name,
|
||||
const QString &sender, const QString &text, const QImage &icon,
|
||||
const QUrl &iconPath) {
|
||||
const QString &sender, const QString &text, const QImage &icon) {
|
||||
Q_UNUSED(room_id)
|
||||
Q_UNUSED(event_id)
|
||||
Q_UNUSED(icon)
|
||||
|
@ -65,9 +64,6 @@ void NotificationsManager::postNotification(
|
|||
templ.setTextField(QString("%1").arg(text).toStdWString(),
|
||||
WinToastTemplate::SecondLine);
|
||||
|
||||
templ.setImagePath(
|
||||
reinterpret_cast<const wchar_t *>(QDir::toNativeSeparators(iconPath.toLocalFile()).utf16()));
|
||||
|
||||
count++;
|
||||
CustomHandler *customHandler = new CustomHandler(count, this);
|
||||
notificationIds[count] = roomEventId{room_id, event_id};
|
||||
|
|
|
@ -86,11 +86,7 @@ void RoomListModel::connectRoomSignals(SpectralRoom* room) {
|
|||
emit newMessage(
|
||||
room->id(), event->id(), room->displayName(),
|
||||
sender->displayname(), utils::eventToString(*event),
|
||||
room->avatar(128),
|
||||
QUrl::fromLocalFile(QStandardPaths::writableLocation(
|
||||
QStandardPaths::CacheLocation) +
|
||||
"/avatar/" + _url.authority() + '_' +
|
||||
_url.fileName() + ".png"));
|
||||
room->avatar(128));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class RoomListModel : public QAbstractListModel {
|
|||
void roomAdded(SpectralRoom* room);
|
||||
void newMessage(const QString& roomId, const QString& eventId,
|
||||
const QString& roomName, const QString& senderName,
|
||||
const QString& text, const QImage& icon, const QUrl& iconPath);
|
||||
const QString& text, const QImage& icon);
|
||||
};
|
||||
|
||||
#endif // ROOMLISTMODEL_H
|
||||
|
|
Loading…
Reference in New Issue