diff --git a/CMakeLists.txt b/CMakeLists.txt index 11ddd4b..9c04086 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,56 +1,56 @@ project(plasma-camera) cmake_minimum_required(VERSION 2.8.12) set(KF5_MIN_VERSION "5.18.0") set(QT_MIN_VERSION "5.5.0") ################# Disallow in-source build ################# if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "This application requires an out of source build. Please create a separate build directory.") endif() # Make CPack available to easy generate binary packages include(CPack) include(FeatureSummary) ################# set KDE specific information ################# find_package(ECM 0.0.8 REQUIRED NO_MODULE) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(ECMSetupVersion) include(ECMGenerateHeaders) include(KDEInstallDirs) include(KDECMakeSettings) include(ECMPoQmTools) include(KDECompilerSettings NO_POLICY_SCOPE) set(KF5_VERSION "5.22.0") find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2) -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2) +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 CoreAddons I18n) ################# Enable C++11 features for clang and gcc ################# if(UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") endif() ################# now find all used packages ################# set (QT_MIN_VERSION "5.6.0") find_package(PkgConfig) ######################################################################### add_subdirectory(src) install(PROGRAMS org.kde.mobile.camera.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(FILES org.kde.mobile.camera.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 18921ba..a36a246 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,8 +1,8 @@ set(plasma-camera_SRCS main.cpp ) qt5_add_resources(RESOURCES resources.qrc) add_executable(plasma-camera ${plasma-camera_SRCS} ${RESOURCES}) -target_link_libraries(plasma-camera Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg) +target_link_libraries(plasma-camera Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg KF5::CoreAddons KF5::I18n) install(TARGETS plasma-camera ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/contents/ui/AboutDialog.qml b/src/contents/ui/AboutDialog.qml deleted file mode 100644 index ed5adc8..0000000 --- a/src/contents/ui/AboutDialog.qml +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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: root.width > root.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: "" + i18n("Simple camera application") + "" - textFormat: Text.StyledText - wrapMode: Text.WordWrap - Layout.fillWidth: true - horizontalAlignment: Qt.AlignHCenter - } - - Controls.Label { - text: "" + i18n("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: i18n("View source code online") - onClicked: Qt.openUrlExternally("https://phabricator.kde.org/source/plasma-camera/") - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter - } - } - } -} diff --git a/src/contents/ui/AboutPage.qml b/src/contents/ui/AboutPage.qml new file mode 100644 index 0000000..afd4e29 --- /dev/null +++ b/src/contents/ui/AboutPage.qml @@ -0,0 +1,53 @@ +/* + * 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.6 as Kirigami + +Kirigami.AboutPage { + aboutData: cameraAboutData + + onIsCurrentPageChanged: { + if (isCurrentPage) + applicationWindow().pageStack.globalToolBar.style = Kirigami.ApplicationHeaderStyle.ToolBar + else + applicationWindow().pageStack.globalToolBar.style = applicationWindow().headerStyle + } + + contextualActions: [ + Kirigami.Action { + text: "Close" + onTriggered: pageStack.pop() + } + + ] +} diff --git a/src/contents/ui/CameraPage.qml b/src/contents/ui/CameraPage.qml index fedbf67..f83b6d2 100644 --- a/src/contents/ui/CameraPage.qml +++ b/src/contents/ui/CameraPage.qml @@ -1,262 +1,264 @@ /**************************************************************************** ** ** 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 QtMultimedia 5.8 import org.kde.kirigami 2.0 as Kirigami import QtQuick.Controls 2.0 as Controls import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.2 import QtGraphicalEffects 1.0 Kirigami.Page { id: cameraPage property var camera + title: i18n("Camera") + leftPadding: 0 rightPadding: 0 bottomPadding: 0 topPadding: 0 leftAction: Kirigami.Action { id: switchModeAction text: i18n("Switch mode") icon.color: "transparent" icon.name: { if (camera.captureMode === Camera.CaptureStillImage) return "emblem-videos-symbolic" else if (camera.captureMode === Camera.CaptureVideo) return "camera-photo-symbolic" } onTriggered: { if (camera.captureMode === Camera.CaptureStillImage) camera.captureMode = Camera.CaptureVideo else camera.captureMode = Camera.CaptureStillImage console.log("Capture Mode switched") } } mainAction: Kirigami.Action { id: captureAction text: { if (camera.captureMode === Camera.CaptureStillImage) return i18n("Capture photo") else if (camera.videoRecorder.recorderStatus === CameraRecorder.RecordingStatus) return i18n("Stop recording video") else if (camera.captureMode === Camera.CaptureVideo) return i18n("Start recording video") } icon.color: "transparent" icon.name: { if (camera.captureMode === Camera.CaptureStillImage) return "camera-photo-symbolic" else if (camera.videoRecorder.recorderStatus === CameraRecorder.RecordingStatus) return "window-close-symbolic" else if (camera.captureMode === Camera.CaptureVideo) return "emblem-videos-symbolic" } onTriggered: { if (camera.captureMode === Camera.CaptureStillImage) { camera.imageCapture.capture() showPassiveNotification(i18n("Took a photo")) } else if (camera.videoRecorder.recorderStatus === CameraRecorder.RecordingStatus) { camera.videoRecorder.stop() recordingFeedback.visible = false showPassiveNotification(i18n("Stopped recording")) } else if (camera.captureMode === Camera.CaptureVideo) { camera.videoRecorder.record() recordingFeedback.visible = true showPassiveNotification(i18n("Started recording")) } } enabled: { if (camera.captureMode === camera.CaptureStillImage) return camera.imageCapture.ready else return true } } rightAction: Kirigami.Action { id: switchCameaAction text: i18n("Switch Camera") icon.color: "transparent" icon.name: "camera-photo-symbolic" enabled: (camera.position !== Camera.UnspecifiedPosition) onTriggered: { if (settings.cameraPosition == Camera.BackFace) settings.cameraPosition = Camera.FrontFace else if (settings.cameraPosition == Camera.FrontFace) settings.cameraPosition = Camera.BackFace } } Rectangle { id: cameraUI state: "PhotoCapture" anchors { fill: parent centerIn: parent } color: "black" states: [ State { name: "PhotoCapture" StateChangeScript { script: { cameraPage.camera.captureMode = Camera.CaptureStillImage cameraPage.camera.start() } } }, State { name: "VideoCapture" StateChangeScript { script: { cameraPage.camera.captureMode = Camera.CaptureVideo cameraPage.camera.start() } } } ] Kirigami.Heading { anchors.centerIn: parent wrapMode: Text.WordWrap text: { if (cameraPage.camera.availability === Camera.Unavailable) return i18n("Camera not available") else if (cameraPage.camera.availability === Camera.Busy) return i18n("Camera is busy. Is another application using it?") } } VideoOutput { id: viewfinder visible: cameraUI.state == "PhotoCapture" || cameraUI.state == "VideoCapture" // Workaround orientation: Kirigami.Settings.isMobile ? -90 : 0 anchors.fill: parent source: cameraPage.camera } PinchArea { anchors.fill: parent property real initialZoom onPinchStarted: { initialZoom = cameraPage.camera.digitalZoom; } onPinchUpdated: { var scale = cameraPage.camera.maximumDigitalZoom / 8 * pinch.scale - cameraPage.camera.maximumDigitalZoom / 8; cameraPage.camera.setDigitalZoom(Math.min(cameraPage.camera.maximumDigitalZoom, cameraPage.camera.digitalZoom + scale)) } } MouseArea { anchors.fill: parent onClicked: { if (cameraPage.camera.lockStatus === cameraPage.camera.Unlocked) { cameraPage.camera.searchAndLock(); console.log("searching focus...") } else { cameraPage.camera.unlock(); console.log("unlocking focus...") } } } } ZoomControl { anchors { right: parent.right margins: Kirigami.Units.gridUnit * 2 } width : Kirigami.Units.gridUnit * 2 height: parent.height currentZoom: cameraPage.camera.digitalZoom maximumZoom: Math.min(4.0, cameraPage.camera.maximumDigitalZoom) onZoomTo: cameraPage.camera.setDigitalZoom(value) } Rectangle { id: recordingFeedback visible: false color: "red" radius: Kirigami.Units.gridUnit height: Kirigami.Units.gridUnit * 2 width: height layer.enabled: recordingFeedback.enabled layer.effect: DropShadow { color: Material.dropShadowColor samples: 30 spread: 0.5 } anchors { left: parent.left top: parent.top margins: Kirigami.Units.gridUnit * 2 } } PreviewArea { imageCapture: camera.imageCapture anchors { right: parent.right bottom: parent.bottom margins: Kirigami.Units.gridUnit } } } diff --git a/src/contents/ui/GlobalDrawer.qml b/src/contents/ui/GlobalDrawer.qml index 3444e21..994fda0 100644 --- a/src/contents/ui/GlobalDrawer.qml +++ b/src/contents/ui/GlobalDrawer.qml @@ -1,149 +1,152 @@ /**************************************************************************** ** ** 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 { id: drawer property var camera 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: i18n("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: i18n("Resolution") iconName: "ratiocrop" Component.onCompleted: { var resolutions = drawer.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: i18n("White balance") iconName: "whitebalance" Kirigami.Action { iconName: "qrc:///camera_auto_mode.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceAuto text: i18n("Auto") } Kirigami.Action { iconName: "qrc:///camera_white_balance_sunny.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceSunlight text: i18n("Sunlight") } Kirigami.Action { iconName: "qrc:///camera_white_balance_cloudy.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceCloudy text: i18n("Cloudy") } Kirigami.Action { iconName: "qrc:///camera_white_balance_incandescent.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceTungsten text: i18n("Tungsten") } Kirigami.Action { iconName: "qrc:///camera_white_balance_flourescent.png" onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceFluorescent text: i18n("Fluorescent") } }, Kirigami.Action { text: i18n("About") iconName: "help-about" onTriggered: { - aboutDialog.open(); + while (pageStack.depth > 1) + pageStack.pop() + + pageStack.push(aboutPage) } } ] } diff --git a/src/contents/ui/main.qml b/src/contents/ui/main.qml index b3c4bf5..9732ace 100644 --- a/src/contents/ui/main.qml +++ b/src/contents/ui/main.qml @@ -1,103 +1,99 @@ /**************************************************************************** ** ** 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 + + readonly property int headerStyle: Kirigami.Settings.isMobile ? Kirigami.ApplicationHeaderStyle.None : Kirigami.ApplicationHeaderStyle.ToolBar + Settings { id: settings // Default settings property size resolution property string cameraDeviceId property int cameraPosition property int whiteBalanceMode } Component { id: cameraPage CameraPage { camera: mainCamera } } - // About Dialog - AboutDialog { - id: aboutDialog - focus: true - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 + Component { + id: aboutPage + + AboutPage {} } Camera { id: mainCamera captureMode: Camera.CaptureStillImage deviceId: settings.cameraDeviceId imageProcessing.whiteBalanceMode: settings.whiteBalanceMode imageCapture { id: imageCapture resolution: settings.resolution } videoRecorder { id: videoRecorder resolution: settings.resolution frameRate: 30 } } title: i18n("Camera") globalDrawer: GlobalDrawer { camera: mainCamera } pageStack.initialPage: cameraPage - pageStack.globalToolBar.style: { - if (Kirigami.Settings.isMobile) - return Kirigami.ApplicationHeaderStyle.None - else - return Kirigami.ApplicationHeaderStyle.ToolBar - } + pageStack.globalToolBar.style: applicationWindow().headerStyle } diff --git a/src/main.cpp b/src/main.cpp index c2e0211..13cffec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,23 +1,47 @@ +// Qt includes #include #include #include #include +#include + +// KDE includes +#include +#include + Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QCoreApplication::setOrganizationName("KDE"); QCoreApplication::setOrganizationDomain("kde.org"); QCoreApplication::setApplicationName("plasma-camera"); + QGuiApplication::setApplicationDisplayName("Plasma Camera"); + QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("camera-photo"))); + + // About Data + KAboutData about(app.applicationName(), app.applicationDisplayName(), app.applicationVersion(), QString(), + KAboutLicense::GPL, i18n("© Plasma Mobile Developers"), QString()); + + about.addAuthor(i18n("Marco Martin"), QString(), QStringLiteral("mart@kde.org"), QStringLiteral("notmart.org")); + about.addAuthor(i18n("Jonah Brüchert"), QString(), QStringLiteral("jbb@kaidan.im"), QStringLiteral("jbbgameich.github.io")); + about.setProgramLogo(app.windowIcon()); + KAboutData::setApplicationData(about); + + + // QML Engine QQmlApplicationEngine engine; + engine.rootContext()->setContextProperty(QStringLiteral("cameraAboutData"), + QVariant::fromValue(KAboutData::applicationData())); + engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); if (engine.rootObjects().isEmpty()) { return -1; } return app.exec(); } diff --git a/src/resources.qrc b/src/resources.qrc index 4ec3ec9..a7715da 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -1,20 +1,20 @@ contents/ui/main.qml contents/ui/GlobalDrawer.qml contents/ui/CameraPage.qml - contents/ui/AboutDialog.qml + contents/ui/AboutPage.qml contents/ui/ZoomControl.qml contents/ui/images/camera_flash_off.png contents/ui/images/camera_camera_setting.png contents/ui/images/camera_auto_mode.png contents/ui/images/camera_white_balance_sunny.png contents/ui/images/camera_white_balance_incandescent.png contents/ui/images/camera_flash_auto.png contents/ui/images/camera_flash_redeye.png contents/ui/images/camera_white_balance_cloudy.png contents/ui/images/camera_white_balance_flourescent.png contents/ui/images/camera_flash_fill.png contents/ui/PreviewArea.qml