Init desktop notifications.
This commit is contained in:
parent
43f02c4fa1
commit
7dd9132176
|
@ -1,4 +1,4 @@
|
|||
QT += quick
|
||||
QT += quick widgets
|
||||
CONFIG += c++14
|
||||
CONFIG += object_parallel_to_source
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ Page {
|
|||
|
||||
connection: matriqueController.isLogin ? page.connection : undefined
|
||||
|
||||
onNewMessage: console.log("New message in room " + room.displayName)
|
||||
onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName)
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
|
|
@ -98,6 +98,7 @@ Item {
|
|||
delegate: MessageDelegate {}
|
||||
|
||||
onAtYBeginningChanged: atYBeginning && currentRoom ? currentRoom.getPreviousContent(50) : {}
|
||||
onAtYEndChanged: atYEnd && currentRoom ? currentRoom.markAllMessagesAsRead() : {}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
|
|
21
qml/main.qml
21
qml/main.qml
|
@ -28,18 +28,18 @@ ApplicationWindow {
|
|||
property alias token: matriqueController.token
|
||||
}
|
||||
|
||||
// Platform.SystemTrayIcon {
|
||||
// id: trayIcon
|
||||
Platform.SystemTrayIcon {
|
||||
id: trayIcon
|
||||
|
||||
// visible: true
|
||||
// iconSource: "qrc:/asset/img/icon.png"
|
||||
visible: true
|
||||
iconSource: "qrc:/asset/img/icon.png"
|
||||
|
||||
// onActivated: {
|
||||
// window.show()
|
||||
// window.raise()
|
||||
// window.requestActivate()
|
||||
// }
|
||||
// }
|
||||
onActivated: {
|
||||
window.show()
|
||||
window.raise()
|
||||
window.requestActivate()
|
||||
}
|
||||
}
|
||||
|
||||
Controller {
|
||||
id: matriqueController
|
||||
|
@ -163,7 +163,6 @@ ApplicationWindow {
|
|||
Component.onCompleted: {
|
||||
imageProvider.connection = matriqueController.connection
|
||||
|
||||
console.log(matriqueController.homeserver, matriqueController.userID, matriqueController.token)
|
||||
if (matriqueController.userID && matriqueController.token) {
|
||||
console.log("Perform auto-login.");
|
||||
matriqueController.login();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QNetworkProxy>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[]) {
|
|||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// Enable this if you need proxy.
|
||||
// QNetworkProxy proxy;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "roomlistmodel.h"
|
||||
|
||||
#include "events/roomevent.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QBrush>
|
||||
#include <QtGui/QColor>
|
||||
|
@ -62,9 +64,20 @@ void RoomListModel::connectRoomSignals(QMatrixClient::Room* room) {
|
|||
connect(room, &QMatrixClient::Room::avatarChanged, this,
|
||||
[=] { refresh(room, {AvatarRole}); });
|
||||
|
||||
connect(
|
||||
room, &QMatrixClient::Room::aboutToAddNewMessages, this,
|
||||
[=](QMatrixClient::RoomEventsRange events) { emit newMessage(room); });
|
||||
connect(room, &QMatrixClient::Room::unreadMessagesChanged, this,
|
||||
[=](QMatrixClient::Room* r) {
|
||||
if (r->hasUnreadMessages()) emit newMessage(r);
|
||||
});
|
||||
// connect(
|
||||
// room, &QMatrixClient::Room::aboutToAddNewMessages, this,
|
||||
// [=](QMatrixClient::RoomEventsRange eventsRange) {
|
||||
// for (QMatrixClient::RoomEvents events : eventsRange.const_iterator) {
|
||||
// for (QMatrixClient::RoomEvent event : events) {
|
||||
// qDebug() << event.fullJson();
|
||||
// }
|
||||
// }
|
||||
// emit newMessage(room);
|
||||
// });
|
||||
}
|
||||
|
||||
void RoomListModel::updateRoom(QMatrixClient::Room* room,
|
||||
|
|
Loading…
Reference in New Issue