diff --git a/package/contents/ui/AboutDialog.qml b/package/contents/ui/AboutDialog.qml new file mode 100644 index 0000000..ae529fe --- /dev/null +++ b/package/contents/ui/AboutDialog.qml @@ -0,0 +1,109 @@ +/* + * Kaidan - A user-friendly XMPP client for every device! + * + * Copyright (C) 2017-2018 Kaidan developers and contributors + * (see the LICENSE file for a full list of copyright authors) + * + * Kaidan 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. + * + * In addition, as a special exception, the author of Kaidan gives + * permission to link the code of its release with the OpenSSL + * project's "OpenSSL" library (or with modified versions of it that + * use the same license as the "OpenSSL" library), and distribute the + * linked executables. You must obey the GNU General Public License in + * all respects for all of the code used other than "OpenSSL". If you + * modify this file, you may extend this exception to your version of + * the file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + * + * Kaidan 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. + * + * You should have received a copy of the GNU General Public License + * along with Kaidan. If not, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.2 +import QtQuick.Controls 2.1 as Controls +import org.kde.kirigami 2.0 as Kirigami + +Controls.Dialog { + id: aboutDialog + modal: true + standardButtons: Controls.Dialog.Ok + onAccepted: close() + + GridLayout { + anchors.fill: parent + flow: mainWindow.width > mainWindow.height ? GridLayout.LeftToRight : GridLayout.TopToBottom + columnSpacing: 20 + rowSpacing: 20 + + Kirigami.Icon { + source: "camera-photo" + Layout.preferredWidth: Kirigami.Units.gridUnit * 9 + Layout.preferredHeight: Kirigami.Units.gridUnit * 9 + Layout.fillWidth: true + Layout.fillHeight: true + Layout.alignment: Qt.AlignCenter + } + + ColumnLayout { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.margins: Kirigami.Units.gridUnit * 1.5 + spacing: Kirigami.gridUnit * 0.6 + + Kirigami.Heading { + text: "Plasma Camera" + textFormat: Text.PlainText + wrapMode: Text.WordWrap + Layout.fillWidth: true + horizontalAlignment: Qt.AlignHCenter + } + + Controls.Label { + text: "" + qsTr("Simple camera application") + "" + textFormat: Text.StyledText + wrapMode: Text.WordWrap + Layout.fillWidth: true + horizontalAlignment: Qt.AlignHCenter + } + + Controls.Label { + text: "" + qsTr("License:") + " GPLv2+" + textFormat: Text.StyledText + wrapMode: Text.WordWrap + Layout.fillWidth: true + horizontalAlignment: Qt.AlignHCenter + } + + Controls.Label { + text: [ + "Copyright ©", + "2013 Digia Plc", + "2014 Marco Martin", + "2018 Jonah Brüchert " + ].join('\n') + textFormat: Text.PlainText + wrapMode: Text.WordWrap + Layout.fillWidth: true + Layout.preferredWidth: contentWidth + horizontalAlignment: Qt.AlignHCenter + } + + Controls.ToolButton { + text: qsTr("View source code online") + onClicked: Qt.openUrlExternally("https://phabricator.kde.org/source/plasma-camera/") + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + } + } + } +} diff --git a/package/contents/ui/GlobalDrawer.qml b/package/contents/ui/GlobalDrawer.qml index 62171c1..4624885 100644 --- a/package/contents/ui/GlobalDrawer.qml +++ b/package/contents/ui/GlobalDrawer.qml @@ -1,144 +1,151 @@ /**************************************************************************** ** ** Copyright (C) 2018 Jonah Brüchert ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ import org.kde.kirigami 2.0 as Kirigami import QtQuick 2.7 import QtMultimedia 5.8 Kirigami.GlobalDrawer { Component { id: devicesSubAction Kirigami.Action { property string value onTriggered: { settings.cameraDeviceId = value } } } Component { id: resolutionSubAction Kirigami.Action { property size value onTriggered: { settings.resolution = value } } } actions: [ Kirigami.Action { id: devicesAction text: qsTr("Camera") iconName: "camera-photo" Component.onCompleted: { var cameras = QtMultimedia.availableCameras var childrenList = [] for (var i in cameras) { childrenList[i] = devicesSubAction.createObject(devicesAction, { value: cameras[i].deviceId, text: "%1".arg(cameras[i].displayName) }) devicesAction.children = childrenList } } }, Kirigami.Action { id: resolutionAction text: qsTr("Resolution") iconName: "ratiocrop" Component.onCompleted: { var resolutions = camera.imageCapture.supportedResolutions var childrenList = [] for (var i in resolutions) { var pixels = resolutions[i].width * resolutions[i].height var megapixels = Math.round(pixels / 10000) / 100 childrenList[i] = resolutionSubAction.createObject(resolutionAction, { value: resolutions[i], text: "%1 x %2 (%3 MP)".arg(resolutions[i].width).arg(resolutions[i].height).arg(megapixels) }) resolutionAction.children = childrenList } } }, Kirigami.Action { id: wbaction text: qsTr("White balance") iconName: "whitebalance" Kirigami.Action { iconName: "images/camera_auto_mode.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceAuto text: qsTr("Auto") } Kirigami.Action { iconName: "images/camera_white_balance_sunny.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceSunlight text: qsTr("Sunlight") } Kirigami.Action { iconName: "images/camera_white_balance_cloudy.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceCloudy text: qsTr("Cloudy") } Kirigami.Action { iconName: "images/camera_white_balance_incandescent.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceTungsten text: qsTr("Tungsten") } Kirigami.Action { iconName: "images/camera_white_balance_flourescent.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceFluorescent text: qsTr("Fluorescent") } + }, + Kirigami.Action { + text: qsTr("About") + iconName: "help-about" + onTriggered: { + aboutDialog.open(); + } } ] Camera { id: camera deviceId: settings.cameraDeviceId } } diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index 11a8dc8..35edb71 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -1,62 +1,70 @@ /**************************************************************************** ** ** Copyright (C) 2018 Jonah Brüchert ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ import QtQuick 2.7 import org.kde.kirigami 2.2 as Kirigami import Qt.labs.settings 1.0 import QtMultimedia 5.8 Kirigami.ApplicationWindow { id: root Settings { id: settings // Default settings property size resolution property string cameraDeviceId property int whiteBalanceMode } Component {id: cameraPage; CameraPage {}} + // About Dialog + AboutDialog { + id: aboutDialog + focus: true + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + } + title: qsTr("Camera") globalDrawer: GlobalDrawer {} pageStack.initialPage: cameraPage }