Add about dialog to Qt Quick GUI

This commit is contained in:
Marius Kittler 2018-12-03 18:11:42 +01:00
parent 2d249b210a
commit 5b9b84866d
2 changed files with 52 additions and 1 deletions

View File

@ -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: "<a href=\"" + app.organizationDomain + "\">"
+ app.organizationDomain + "</a>"
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()

View File

@ -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