Unverified Commit a07f2ac3 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Restructure project based on hellokirigami template

parent aeb72590
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)
find_package(PkgConfig)
################# set KDE specific information #################
......@@ -13,17 +22,35 @@ 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(KDECompilerSettings)
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 Multimedia)
find_package(KF5Kirigami2 ${KF5_DEP_VERSION} "5.22.0")
################# 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)
#########################################################################
# find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui)
add_subdirectory(src)
set (QT_MIN_VERSION "5.9.0")
find_package(KF5Kirigami2 REQUIRED)
find_package(KF5 REQUIRED COMPONENTS
Package)
install(PROGRAMS org.kde.plasma-camera.desktop DESTINATION ${KDE_INSTALL_APPDIR})
kpackage_install_package(package org.kde.phone.camera genericqml)
install(FILES package/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.camera.desktop)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
[Desktop Entry]
Name=Camera
Comment=Take photos and record videos
Version=1.0
Exec=plasma-camera
Icon=camera-photo
Type=Application
Terminal=false
Categories=Qt;KDE;
[Dolphin]
Timestamp=2015,7,15,15,36,31
Version=3
[Desktop Entry]
Comment=
Encoding=UTF-8
Keywords=
Name=Camera
Type=Application
Icon=camera-photo
Exec=kpackagelauncherqml -a org.kde.phone.camera
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Category=Miscellaneous
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-Name=org.kde.phone.camera
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-KDE-ServiceTypes=KPackage/GenericQML
X-Plasma-MainScript=ui/main.qml
X-Plasma-RemoteLocation=
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)
install(TARGETS plasma-camera ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
/****************************************************************************
**
** Copyright (C) 2018 Jonah Brüchert
......@@ -36,7 +37,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
import QtMultimedia 5.8
import org.kde.kirigami 2.0 as Kirigami
......@@ -75,13 +75,11 @@ Kirigami.Page {
if (camera.captureMode == Camera.CaptureStillImage) {
camera.imageCapture.capture()
showPassiveNotification(qsTr("Took a photo"))
}
else if (camera.videoRecorder.recorderStatus == CameraRecorder.RecordingStatus) {
} else if (camera.videoRecorder.recorderStatus == CameraRecorder.RecordingStatus) {
camera.videoRecorder.stop()
recordingFeedback.visible = false
showPassiveNotification(qsTr("Stopped recording"))
}
else if (camera.captureMode == Camera.CaptureVideo) {
} else if (camera.captureMode == Camera.CaptureVideo) {
camera.videoRecorder.record()
recordingFeedback.visible = true
showPassiveNotification(qsTr("Started recording"))
......@@ -132,7 +130,6 @@ Kirigami.Page {
camera.start()
}
}
}
]
......@@ -155,7 +152,8 @@ Kirigami.Page {
VideoOutput {
id: viewfinder
visible: cameraUI.state == "PhotoCapture" || cameraUI.state == "VideoCapture"
visible: cameraUI.state == "PhotoCapture"
|| cameraUI.state == "VideoCapture"
// Workaround
orientation: Kirigami.Settings.isMobile ? -90 : 0
......@@ -169,11 +167,13 @@ Kirigami.Page {
anchors.fill: parent
property real initialZoom
onPinchStarted: {
initialZoom = camera.digitalZoom;
initialZoom = camera.digitalZoom
}
onPinchUpdated: {
var scale = camera.maximumDigitalZoom / 8 * pinch.scale - camera.maximumDigitalZoom / 8;
camera.setDigitalZoom(Math.min(camera.maximumDigitalZoom, camera.digitalZoom + scale))
var scale = camera.maximumDigitalZoom / 8 * pinch.scale
- camera.maximumDigitalZoom / 8
camera.setDigitalZoom(Math.min(camera.maximumDigitalZoom,
camera.digitalZoom + scale))
}
}
......@@ -182,11 +182,10 @@ Kirigami.Page {
onClicked: {
if (camera.lockStatus == Camera.Unlocked) {
camera.searchAndLock();
camera.searchAndLock()
console.log("searching focus...")
}
else {
camera.unlock();
} else {
camera.unlock()
console.log("unlocking focus...")
}
}
......
/****************************************************************************
**
** Copyright (C) 2018 Jonah Brüchert
......@@ -36,10 +37,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
import org.kde.kirigami 2.0 as Kirigami
import QtQuick 2.7
import QtQml.Models 2.2
import QtQml 2.2
import QtMultimedia 5.8
Kirigami.GlobalDrawer {
......@@ -47,38 +47,39 @@ Kirigami.GlobalDrawer {
Kirigami.Action {
text: qsTr("Camera")
iconName: "camera-photo"
DelegateModel {
Instantiator {
model: QtMultimedia.availableCameras
onObjectAdded: console.log("object added: " + object.text)
delegate: Kirigami.Action {
text: model.displayName
onTriggered: settings.cameraDeviceId = model.deviceId
text: modelData.displayName
onTriggered: settings.cameraDeviceId = modelData.deviceId
}
}
},
Kirigami.Action {
text: qsTr("Video resolution")
text: qsTr("Photo resolution")
iconName: "ratiocrop"
DelegateModel {
model: CameraRecorder.supportedResolutions
Instantiator {
model: CameraCapture.supportedResolutions
delegate: Kirigami.Action {
text: model
onTriggered: settings.videoResolution = text;
text: modelData
onTriggered: settings.photoResolution = text
}
}
},
Kirigami.Action {
text: qsTr("Photo resolution")
text: qsTr("Video resolution")
iconName: "ratiocrop"
DelegateModel {
Instantiator {
model: CameraCapture.supportedResolutions
delegate: Kirigami.Action {
text: model
onTriggered: settings.photoResolution = text;
text: modelData
onTriggered: settings.videoResolution = text
}
}
},
Kirigami.Action {
id: wbaction
text: qsTr("White balance")
iconName: "whitebalance"
Kirigami.Action {
......@@ -103,7 +104,8 @@ Kirigami.GlobalDrawer {
}
Kirigami.Action {
iconName: "images/camera_white_balance_flourescent.png"
onTriggered: settings.whiteBalanceMode = CameraImageProcessing.WhiteBalanceFluorescent
onTriggered: settings.whiteBalanceMode
= CameraImageProcessing.WhiteBalanceFluorescent
text: qsTr("Fluorescent")
}
}
......
/****************************************************************************
**
** Copyright (C) 2018 Jonah Brüchert
......@@ -36,7 +37,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
import org.kde.kirigami 2.2 as Kirigami
import Qt.labs.settings 1.0
......@@ -53,11 +53,16 @@ Kirigami.ApplicationWindow {
property int whiteBalanceMode: CameraImageProcessing.WhiteBalanceAuto
}
Component {id: cameraPage; CameraPage {}}
Component {
id: cameraPage
CameraPage {
}
}
id: root
title: qsTr("Camera")
globalDrawer: GlobalDrawer {}
globalDrawer: GlobalDrawer {
}
pageStack.initialPage: cameraPage
}
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include <QUrl>
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");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty()) {
return -1;
}
int ret = app.exec();
return ret;
}
<RCC>
<qresource prefix="/">
<file alias="main.qml">contents/ui/main.qml</file>
<file alias="CameraPage.qml">contents/ui/CameraPage.qml</file>
<file alias="GlobalDrawer.qml">contents/ui/GlobalDrawer.qml</file>
<file alias="images/camera_auto_mode.png">contents/ui/images/camera_auto_mode.png</file>
<file alias="images/camera_camera_setting.png">contents/ui/images/camera_camera_setting.png</file>
<file alias="images/camera_flash_auto.png">contents/ui/images/camera_flash_auto.png</file>
<file alias="images/camera_white_balance_cloudy.png">contents/ui/images/camera_white_balance_cloudy.png</file>
<file alias="images/camera_white_balance_flourescent.png">contents/ui/images/camera_white_balance_flourescent.png</file>
<file alias="images/camera_white_balance_incandescent.png">contents/ui/images/camera_white_balance_incandescent.png</file>
<file alias="images/camera_flash_fill.png">contents/ui/images/camera_flash_fill.png</file>
<file alias="images/camera_flash_off.png">contents/ui/images/camera_flash_off.png</file>
<file alias="images/camera_flash_redeye.png">contents/ui/images/camera_flash_redeye.png</file>
<file alias="images/camera_white_balance_sunny.png">contents/ui/images/camera_white_balance_sunny.png</file>
</qresource>
</RCC>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment