From c2fca955c4cefe1531ce496af821c34883012da7 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 27 Jul 2014 18:00:18 +0200 Subject: [PATCH] Added about dialog. --- app/AboutDialog.qml | 103 ++++++++++++++++++++++++++++++++++++ app/ApplicationSettings.qml | 1 + app/main.qml | 16 ++++++ 3 files changed, 120 insertions(+) create mode 100644 app/AboutDialog.qml diff --git a/app/AboutDialog.qml b/app/AboutDialog.qml new file mode 100644 index 0000000..8c109c2 --- /dev/null +++ b/app/AboutDialog.qml @@ -0,0 +1,103 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Window{ + id: dialogwindow + title: qsTr("About") + width: 450 + height: 300 + + ColumnLayout{ + anchors.fill: parent + anchors.margins: 15 + spacing: 15 + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: "cool-old-term" + font {bold: true; pointSize: 18} + } + Loader{ + id: mainContent + Layout.fillHeight: true + Layout.fillWidth: true + + states: [ + State { + name: "Default" + PropertyChanges { + target: mainContent + sourceComponent: defaultComponent + } + }, + State { + name: "License" + PropertyChanges { + target: mainContent + sourceComponent: licenseComponent + } + } + ] + Component.onCompleted: mainContent.state = "Default"; + } + Item{ + Layout.fillWidth: true + height: childrenRect.height + Button{ + anchors.left: parent.left + text: qsTr("License") + onClicked: { + mainContent.state == "Default" ? mainContent.state = "License" : mainContent.state = "Default" + } + } + Button{ + anchors.right: parent.right + text: qsTr("Close") + onClicked: dialogwindow.close(); + } + } + } + // MAIN COMPONENTS //////////////////////////////////////////////////////// + Component{ + id: defaultComponent + ColumnLayout{ + anchors.fill: parent + anchors.margins: 10 + spacing: 10 + Item{ + Layout.fillHeight: true + } + Text{ + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: shadersettings.version + "\n" + + qsTr("Author: ") + "Filippo Scognamiglio\n" + + qsTr("Email: ") + "flscogna@gmail.com\n" + + qsTr("Source: ") + "https://github.com/Swordifish90/cool-old-term\n" + } + } + } + Component{ + id: licenseComponent + TextArea{ + anchors.fill: parent + readOnly: true + text: "Copyright (c) 2013 Filippo Scognamiglio \n\n" + + "https://github.com/Swordifish90/cool-old-term\n\n" + + + "cool-old-term is free software: you can redistribute it and/or modify " + + "it under the terms of the GNU General Public License as published by " + + "the Free Software Foundation, either version 3 of the License, or " + + "(at your option) any later version.\n\n" + + + "This program is distributed in the hope that it will be useful, " + + "but WITHOUT ANY WARRANTY; without even the implied warranty of " + + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " + + "GNU General Public License for more details.\n\n" + + + "You should have received a copy of the GNU General Public License " + + "along with this program. If not, see ." + } + } +} diff --git a/app/ApplicationSettings.qml b/app/ApplicationSettings.qml index 531a454..9daf9b2 100644 --- a/app/ApplicationSettings.qml +++ b/app/ApplicationSettings.qml @@ -23,6 +23,7 @@ import QtQuick 2.2 Item{ + property string version: "0.9" // GENERAL SETTINGS /////////////////////////////////////////////////// diff --git a/app/main.qml b/app/main.qml index af15d71..b808b53 100644 --- a/app/main.qml +++ b/app/main.qml @@ -90,6 +90,13 @@ ApplicationWindow{ shadersettings.setScalingIndex(Math.max(oldScaling - 1, 0)); } } + Action{ + id: showAboutAction + text: qsTr("About") + onTriggered: { + aboutDialog.show(); + } + } menuBar: MenuBar { id: menubar @@ -114,6 +121,11 @@ ApplicationWindow{ MenuItem {action: zoomIn} MenuItem {action: zoomOut} } + Menu{ + title: qsTr("Help") + visible: shadersettings.fullscreen ? false : true + MenuItem {action: showAboutAction} + } } ApplicationSettings{ id: shadersettings @@ -156,6 +168,10 @@ ApplicationWindow{ id: settingswindow visible: false } + AboutDialog{ + id: aboutDialog + visible: false + } Loader{ id: sizeoverlayloader z: 3