2020-05-23 02:30:51 +03:00
|
|
|
/*
|
2023-12-31 10:03:40 +01:00
|
|
|
* Copyright (C) 2018-2024 QuasarApp.
|
2023-03-29 12:57:55 +02:00
|
|
|
* Distributed under the GPLv3 software license, see the accompanying
|
2020-05-23 02:30:51 +03:00
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
2021-01-18 23:20:03 +03:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls.Material 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2019-11-19 15:20:38 +03:00
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
|
|
|
|
Item {
|
2021-10-21 18:46:18 +03:00
|
|
|
id : root;
|
2019-11-19 15:20:38 +03:00
|
|
|
readonly property var model: notificationService;
|
|
|
|
readonly property var msg: model.notify
|
2021-01-18 23:20:03 +03:00
|
|
|
readonly property var qst: model.question
|
|
|
|
|
2019-11-19 15:20:38 +03:00
|
|
|
readonly property var history: model.history
|
|
|
|
|
2019-11-19 18:09:01 +03:00
|
|
|
Metrix {
|
|
|
|
id: metrix
|
|
|
|
}
|
2019-11-19 15:20:38 +03:00
|
|
|
|
|
|
|
NotificationForm {
|
|
|
|
id: notyfyView
|
2021-05-31 16:28:00 +03:00
|
|
|
titleText : msg.title();
|
|
|
|
text: (msg)? msg.text(): "";
|
|
|
|
img: (msg && msg.img().length)? msg.img(): getDefaultImage((msg)? msg.type(): 0);
|
|
|
|
type: (msg)? msg.type(): 0;
|
2019-11-19 15:20:38 +03:00
|
|
|
|
|
|
|
x: parent.width - width - margin;
|
|
|
|
y: margin;
|
|
|
|
|
2021-11-09 12:14:37 +03:00
|
|
|
width: Math.min(6 * metrix.pt, root.width);
|
2021-11-07 11:23:45 +03:00
|
|
|
|
2019-11-19 15:20:38 +03:00
|
|
|
}
|
|
|
|
|
2021-01-18 23:20:03 +03:00
|
|
|
YesNoQuestion {
|
|
|
|
id: questionMsgBox
|
2021-05-31 16:28:00 +03:00
|
|
|
titleText : qst.title();
|
|
|
|
text: (qst)? qst.text(): "";
|
|
|
|
img: (qst && qst.img().length)? qst.img(): defImg;
|
2021-01-18 23:20:03 +03:00
|
|
|
type: 0;
|
|
|
|
|
|
|
|
x: parent.width / 2 - width / 2;
|
|
|
|
y: parent.height / 2 - height / 2;
|
|
|
|
|
2021-10-21 18:46:18 +03:00
|
|
|
width: Math.min(6 * metrix.pt, root.width);
|
2021-01-18 23:20:03 +03:00
|
|
|
|
|
|
|
onAccepted: {
|
|
|
|
if (model) {
|
2021-05-31 16:28:00 +03:00
|
|
|
model.questionComplete(true, qst.type())
|
2021-01-18 23:20:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onRejected: {
|
|
|
|
if (model) {
|
2021-05-31 16:28:00 +03:00
|
|
|
model.questionComplete(false, qst.type())
|
2021-01-18 23:20:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-19 15:20:38 +03:00
|
|
|
onMsgChanged: {
|
2019-11-20 17:54:52 +03:00
|
|
|
|
|
|
|
if (msg.isValid()) {
|
|
|
|
notyfyView._show();
|
|
|
|
}
|
2019-11-19 15:20:38 +03:00
|
|
|
}
|
2021-01-18 23:20:03 +03:00
|
|
|
|
|
|
|
onQstChanged: {
|
|
|
|
if (qst.isValid()) {
|
|
|
|
questionMsgBox._show();
|
|
|
|
}
|
|
|
|
}
|
2023-04-05 15:23:46 +03:00
|
|
|
|
|
|
|
NotificationHistoryView {
|
|
|
|
id: history
|
2023-04-16 11:21:42 +02:00
|
|
|
width: Math.min(Math.max(Math.min(parent.width * 0.6, 1024 ), 320), parent.width)
|
|
|
|
height: Math.min(Math.max(Math.min(parent.height * 0.6, 720), 240), parent.height)
|
|
|
|
|
2023-04-05 15:23:46 +03:00
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
2023-04-13 15:46:01 +03:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: model
|
|
|
|
function onSigShowHistory() {
|
|
|
|
history.open()
|
|
|
|
}
|
|
|
|
}
|
2019-11-19 15:20:38 +03:00
|
|
|
}
|