4
1
mirror of https://github.com/QuasarApp/Snake.git synced 2025-05-11 08:59:46 +00:00

added notify service view

This commit is contained in:
Andrei Yankovich 2019-08-17 23:42:22 +03:00
parent 6e44950bfc
commit f0e20ceeb2
7 changed files with 43 additions and 49 deletions

@ -45,6 +45,7 @@ void MainClient::handleReceivePackage(ClientProtocol::Command cmd, const QByteAr
}
case ClientProtocol::Command::BadRequest: {
break;
}
default: return;

@ -5,6 +5,7 @@
#include <QQmlContext>
#include <back-end/ProfileViewItems/mainmenumodel.h>
#include <back-end/ProfileViewItems/notificationservice.h>
QByteArray ClientApp::initTheme() {
int themeIndex = Settings::get()->getValue(THEME, THEME_DEFAULT).toInt();
@ -39,6 +40,7 @@ bool ClientApp::init(QQmlApplicationEngine *engine) {
engine->addImageProvider(QLatin1String("userItems"), new ImageProvider());
root->setContextProperty("contr", &contr);
root->setContextProperty("notificationService", NotificationService::getService());
engine->load(QUrl(QStringLiteral("qrc:/front-end/main.qml")));
if (engine->rootObjects().isEmpty())

@ -6,50 +6,24 @@ import QtQuick.Layouts 1.3
BasePopUp {
id : popup
property string text: qsTr("Message")
property string img: ""
property string titleText: qsTr("Message")
autoClose: true;
closeInterval: 5000
function show(title_, message_, img_) {
title.text = title_;
message.text = message_;
if (img_) {
image.source = img_;
} else {
image.source = "";
}
_show();
}
Page {
id: page
title: "Level Up!!!"
title: titleText
anchors.fill: parent
Label {
id: title
x: 0
width: 200
height: 31
text: qsTr("Title Message")
font.bold: true
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 0
font.pointSize: 13
fontSizeMode: Text.Fit
renderType: Text.QtRendering
textFormat: Text.AutoText
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
}
contentItem:
RowLayout {
id: rowLayout
spacing: 5
clip: true
anchors.top: title.bottom
anchors.top: parent.bottom
anchors.topMargin: 1
anchors.left: parent.left
anchors.leftMargin: 0

@ -0,0 +1,25 @@
import QtQuick 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.12
Item {
readonly property var model: notificationService;
readonly property string msg: model.notify
readonly property var history: model.history
NotificationForm {
id: notyfyView
titleText : qsTr("new Message");
text: msg;
img: "";
x: parent.width - width - margin;
y: margin;
width: 40 * metrix.gamePt;
height: width * 0.5
}
}

@ -123,9 +123,9 @@ Item {
if (isVictory ) {
if (!autoTimer.running)
notification.show(qsTr(" Next Lvl!!!"),
qsTr(" You anblock next lvl (" + gameLvl + ")" ),
"qrc:/texture/up");
// notification.show(qsTr(" Next Lvl!!!"),
// qsTr(" You anblock next lvl (" + gameLvl + ")" ),
// "qrc:/texture/up");
model.nextLvl();
} else if (autoTimer.running) {
@ -155,19 +155,6 @@ Item {
}
}
NotificationForm {
z: -1
id: notification;
margin: metrix.gamePt;
x: parent.width - width - margin;
y: margin;
width: 40 * metrix.gamePt;
height: width * 0.5
}
Button {
id: returnToMenu;

@ -33,4 +33,8 @@ ApplicationWindow {
}
}
NotificationServiceView {
anchors.fill: parent;
}
}

@ -23,6 +23,7 @@
<file>front-end/LeftSideBar.qml</file>
<file>front-end/LeftBoxSideBar.qml</file>
<file>front-end/SettingsView.qml</file>
<file>front-end/NotificationServiceView.qml</file>
</qresource>
<qresource prefix="/texture">
<file alias="up">img/up.svg</file>