...
 
Commits (3)
......@@ -33,7 +33,7 @@ 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 #################
......
......@@ -4,5 +4,5 @@ set(plasma-camera_SRCS
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})
......@@ -31,79 +31,23 @@
import QtQuick 2.6
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.1 as Controls
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.6 as Kirigami
Controls.Dialog {
id: aboutDialog
modal: true
standardButtons: Controls.Dialog.Ok
onAccepted: close()
Kirigami.AboutPage {
aboutData: cameraAboutData
GridLayout {
anchors.fill: parent
flow: root.width > root.height ? GridLayout.LeftToRight : GridLayout.TopToBottom
columnSpacing: 20
rowSpacing: 20
onIsCurrentPageChanged: {
if (isCurrentPage)
applicationWindow().pageStack.globalToolBar.style = Kirigami.ApplicationHeaderStyle.ToolBar
else
applicationWindow().pageStack.globalToolBar.style = applicationWindow().headerStyle
}
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
contextualActions: [
Kirigami.Action {
text: "Close"
onTriggered: pageStack.pop()
}
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: "<i>" + i18n("Simple camera application") + "</i>"
textFormat: Text.StyledText
wrapMode: Text.WordWrap
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
}
Controls.Label {
text: "<b>" + i18n("License:") + "</b> 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 <jbb@kaidan.im>"
].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
}
}
}
]
}
......@@ -51,6 +51,8 @@ Kirigami.Page {
property var camera
title: i18n("Camera")
leftPadding: 0
rightPadding: 0
bottomPadding: 0
......
......@@ -142,7 +142,10 @@ Kirigami.GlobalDrawer {
text: i18n("About")
iconName: "help-about"
onTriggered: {
aboutDialog.open();
while (pageStack.depth > 1)
pageStack.pop()
pageStack.push(aboutPage)
}
}
]
......
......@@ -27,6 +27,6 @@ Rectangle {
Image {
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
source: "file://" + imageCapture.capturedImagePath
source: imageCapture.capturedImagePath ? "file://" + imageCapture.capturedImagePath : ""
}
}
......@@ -44,6 +44,9 @@ import QtMultimedia 5.8
Kirigami.ApplicationWindow {
id: root
readonly property int headerStyle: Kirigami.Settings.isMobile ? Kirigami.ApplicationHeaderStyle.None : Kirigami.ApplicationHeaderStyle.ToolBar
Settings {
id: settings
......@@ -62,12 +65,10 @@ Kirigami.ApplicationWindow {
}
}
// About Dialog
AboutDialog {
id: aboutDialog
focus: true
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Component {
id: aboutPage
AboutPage {}
}
Camera {
......@@ -94,10 +95,5 @@ Kirigami.ApplicationWindow {
}
pageStack.initialPage: cameraPage
pageStack.globalToolBar.style: {
if (Kirigami.Settings.isMobile)
return Kirigami.ApplicationHeaderStyle.None
else
return Kirigami.ApplicationHeaderStyle.ToolBar
}
pageStack.globalToolBar.style: applicationWindow().headerStyle
}
// Qt includes
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include <QUrl>
#include <QIcon>
// KDE includes
#include <KAboutData>
#include <KLocalizedString>
#include <KLocalizedContext>
Q_DECL_EXPORT int main(int argc, char *argv[])
{
......@@ -10,9 +18,27 @@ Q_DECL_EXPORT int main(int argc, char *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.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
if (engine.rootObjects().isEmpty()) {
......
......@@ -3,7 +3,7 @@
<file alias="main.qml">contents/ui/main.qml</file>
<file alias="GlobalDrawer.qml">contents/ui/GlobalDrawer.qml</file>
<file alias="CameraPage.qml">contents/ui/CameraPage.qml</file>
<file alias="AboutDialog.qml">contents/ui/AboutDialog.qml</file>
<file alias="AboutPage.qml">contents/ui/AboutPage.qml</file>
<file alias="ZoomControl.qml">contents/ui/ZoomControl.qml</file>
<file alias="camera_flash_off.png">contents/ui/images/camera_flash_off.png</file>
<file alias="camera_camera_setting.png">contents/ui/images/camera_camera_setting.png</file>
......