Feat: Add info dialog
This commit is contained in:
parent
2eaef1cb27
commit
d5a26c5a0e
5 changed files with 99 additions and 3 deletions
|
@ -2,7 +2,10 @@ QT += gui quick bluetooth quickcontrols2
|
|||
CONFIG += c++11
|
||||
|
||||
TARGET = ItsblueLedDisplayController
|
||||
VERSION = 1.2.0
|
||||
VERSION = 1.3.0
|
||||
|
||||
# Add version to define
|
||||
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
#include <qbluetoothleuartclient.h>
|
||||
#include <QTranslator>
|
||||
#include <QFontDatabase>
|
||||
#include <QQmlContext>
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QtAndroidExtras>
|
||||
#endif
|
||||
|
||||
#include "leddisplaybackend.h"
|
||||
#include "leddisplaytextmodel.h"
|
||||
|
||||
/*void permissionCallback(const QtAndroid::PermissionResultMap& results) {
|
||||
for(QtAndroid::PermissionResult result : results) {
|
||||
|
@ -38,6 +38,7 @@ int main(int argc, char *argv[])
|
|||
QQuickStyle::setStyle("Material");
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.rootContext()->setContextProperty("APP_VERSION", APP_VERSION);
|
||||
const QUrl url(QStringLiteral("qrc:/main.qml"));
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||
|
|
59
LedDisplayController/ressources/qml/DisclaimerDialog.qml
Normal file
59
LedDisplayController/ressources/qml/DisclaimerDialog.qml
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,6 +59,12 @@ ApplicationWindow {
|
|||
onClicked: mainStack.currentItem.backButtonClicked()
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
visible: mainStack.currentItem.actionButtonVisible
|
||||
opacity: 0
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
@ -71,13 +77,31 @@ ApplicationWindow {
|
|||
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 {
|
||||
id: actionToolButton
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: height
|
||||
|
||||
opacity: mainStack.currentItem.actionButtonVisible ? 1:0
|
||||
visible: mainStack.currentItem.actionButtonVisible
|
||||
|
||||
font.family: fontAwesome.name
|
||||
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>.")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
<file>Chip.qml</file>
|
||||
<file>DisplayEditDialog.qml</file>
|
||||
<file>PasswordInputDelegate.qml</file>
|
||||
<file>DisclaimerDialog.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in a new issue