Feat: Add info dialog

This commit is contained in:
Dorian Zedler 2022-08-03 09:09:31 +02:00
parent 2eaef1cb27
commit d5a26c5a0e
Signed by: dorian
GPG key ID: 989DE36109AFA354
5 changed files with 99 additions and 3 deletions

View file

@ -2,7 +2,10 @@ QT += gui quick bluetooth quickcontrols2
CONFIG += c++11 CONFIG += c++11
TARGET = ItsblueLedDisplayController TARGET = ItsblueLedDisplayController
VERSION = 1.2.0 VERSION = 1.3.0
# Add version to define
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
TEMPLATE = app TEMPLATE = app

View file

@ -4,13 +4,13 @@
#include <qbluetoothleuartclient.h> #include <qbluetoothleuartclient.h>
#include <QTranslator> #include <QTranslator>
#include <QFontDatabase> #include <QFontDatabase>
#include <QQmlContext>
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
#include <QtAndroidExtras> #include <QtAndroidExtras>
#endif #endif
#include "leddisplaybackend.h" #include "leddisplaybackend.h"
#include "leddisplaytextmodel.h"
/*void permissionCallback(const QtAndroid::PermissionResultMap& results) { /*void permissionCallback(const QtAndroid::PermissionResultMap& results) {
for(QtAndroid::PermissionResult result : results) { for(QtAndroid::PermissionResult result : results) {
@ -38,6 +38,7 @@ int main(int argc, char *argv[])
QQuickStyle::setStyle("Material"); QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("APP_VERSION", APP_VERSION);
const QUrl url(QStringLiteral("qrc:/main.qml")); const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) { &app, [url](QObject *obj, const QUrl &objUrl) {

View file

@ -0,0 +1,59 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15
Dialog {
id: control
title: "Disclaimer"
property string content: ""
parent: Overlay.overlay
x: (parent.width - width) * 0.5
y: (parent.height - height) * 0.5
implicitWidth: parent.width * 0.9
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding
+ (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
//width: app.width * 0.8
//height: implicitHeight
modal: true
standardButtons: Dialog.Close
header: Label {
text: control.title
visible: control.title
elide: Label.ElideRight
padding: 24
bottomPadding: 0
font.bold: true
font.pixelSize: 16
background: Rectangle {
radius: 2
color: control.Material.dialogColor
clip: true
}
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
contentItem: Label {
wrapMode: Text.Wrap
width: control.parent * 0.8
text: control.content
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
}

View file

@ -59,6 +59,12 @@ ApplicationWindow {
onClicked: mainStack.currentItem.backButtonClicked() onClicked: mainStack.currentItem.backButtonClicked()
} }
ToolButton {
visible: mainStack.currentItem.actionButtonVisible
opacity: 0
enabled: false
}
Label { Label {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
@ -71,13 +77,31 @@ ApplicationWindow {
text: mainStack.currentItem.title text: mainStack.currentItem.title
} }
ToolButton {
id: infoToolButton
Layout.fillHeight: true
Layout.preferredWidth: height
font.family: fontAwesome.name
font.pixelSize: height * 0.4
Material.foreground: "black"
flat: true
text: "\uf05a"
onClicked: infoDisclaimerDialog.open()
}
ToolButton { ToolButton {
id: actionToolButton id: actionToolButton
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: height Layout.preferredWidth: height
opacity: mainStack.currentItem.actionButtonVisible ? 1:0 visible: mainStack.currentItem.actionButtonVisible
font.family: fontAwesome.name font.family: fontAwesome.name
font.pixelSize: height * 0.4 font.pixelSize: height * 0.4
@ -270,5 +294,13 @@ ApplicationWindow {
} }
} }
] ]
DisclaimerDialog {
id: infoDisclaimerDialog
title: "LedDisplayController v" + APP_VERSION + "<br>By <a href=\"https://itsblue.de\">Itsblue Development</a>, <a href=\"https://itsblue.de/apps/bluerock\">" + qsTr("privacy policy") + "</a>"
content: qsTr("This app was built using the <a href='https://qt.io'>Qt Framework</a> licensed under the <a href='https://www.gnu.org/licenses/lgpl-3.0.en.html'>GNU lgplV3 license</a>.<br><br>This app is open source and licensed under the <a href='https://www.gnu.org/licenses/agpl-3.0.en.html'>GNU agplV3 license</a>, the source code can be found <a href='https://itsblue.dev/fenoglion/omobileddisplay'>here</a>.")
}
} }
} }

View file

@ -14,5 +14,6 @@
<file>Chip.qml</file> <file>Chip.qml</file>
<file>DisplayEditDialog.qml</file> <file>DisplayEditDialog.qml</file>
<file>PasswordInputDelegate.qml</file> <file>PasswordInputDelegate.qml</file>
<file>DisclaimerDialog.qml</file>
</qresource> </qresource>
</RCC> </RCC>