From 5b9b84866d2998b1169adcdf0121de604d351021 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Mon, 3 Dec 2018 18:11:42 +0100 Subject: [PATCH] Add about dialog to Qt Quick GUI --- qml/main.qml | 50 +++++++++++++++++++++++++++++++++++++- quickgui/initiatequick.cpp | 3 +++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/qml/main.qml b/qml/main.qml index 752ede0..8cca223 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -15,7 +15,7 @@ Kirigami.ApplicationWindow { property bool showNoPasswordWarning: nativeInterface.fileOpen && !nativeInterface.passwordSet - title: qsTr("Password Manager") + title: app.applicationName titleIcon: "qrc://icons/hicolor/scalable/apps/passwordmanager-black.svg" visible: true resetMenuOnTriggered: false @@ -193,6 +193,11 @@ Kirigami.ApplicationWindow { onTriggered: nativeInterface.close() } ] + onBannerClicked: { + leftMenu.resetMenu() + aboutDialog.open() + } + Controls.Switch { text: qsTr("Use native file dialog") checked: nativeInterface.useNativeFileDialog @@ -205,6 +210,49 @@ Kirigami.ApplicationWindow { } Component.onCompleted: nativeInterface.init() + BasicDialog { + id: aboutDialog + standardButtons: Controls.Dialog.Ok + + ColumnLayout { + anchors.fill: parent + Image { + Layout.alignment: Qt.AlignHCenter + source: "qrc:/icons/hicolor/128x128/apps/passwordmanager.png" + } + Controls.Label { + Layout.fillWidth: true + text: app.applicationName + font.bold: true + font.pointSize: font.pointSize * 1.2 + horizontalAlignment: Text.AlignHCenter + } + Controls.Label { + Layout.fillWidth: true + text: app.applicationVersion + horizontalAlignment: Text.AlignHCenter + } + Controls.Label { + Layout.fillWidth: true + text: description + font.italic: true + horizontalAlignment: Text.AlignHCenter + } + Controls.Label { + Layout.fillWidth: true + text: "" + + app.organizationDomain + "" + horizontalAlignment: Text.AlignHCenter + onLinkActivated: Qt.openUrlExternally(app.organizationDomain) + } + Controls.Label { + Layout.fillWidth: true + text: qsTr("developed by %1").arg(app.organizationName) + horizontalAlignment: Text.AlignHCenter + } + } + } + PasswordDialog { id: enterPasswordDialog onAboutToShow: leftMenu.close() diff --git a/quickgui/initiatequick.cpp b/quickgui/initiatequick.cpp index fae8f52..b789d58 100644 --- a/quickgui/initiatequick.cpp +++ b/quickgui/initiatequick.cpp @@ -95,6 +95,9 @@ int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, c auto *const context(engine.rootContext()); context->setContextProperty(QStringLiteral("userPaths"), userPaths); context->setContextProperty(QStringLiteral("nativeInterface"), &controller); + context->setContextProperty(QStringLiteral("app"), &a); + context->setContextProperty(QStringLiteral("description"), QStringLiteral(APP_DESCRIPTION)); + context->setContextProperty(QStringLiteral("dependencyVersions"), QStringList(DEPENCENCY_VERSIONS)); engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); #ifdef Q_OS_ANDROID