diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 1429ffc..4d140c5 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -1,84 +1,86 @@ set(itinerary_srcs countryinformation.cpp pkpassmanager.cpp reservationmanager.cpp timelinemodel.cpp ) ecm_qt_declare_logging_category(itinerary_srcs HEADER logging.h IDENTIFIER Log CATEGORY_NAME org.kde.itinerary ) add_library(itinerary STATIC ${itinerary_srcs}) target_link_libraries(itinerary PUBLIC KPim::Itinerary KPim::PkPass KF5::I18n Qt5::Network ) add_executable(itinerary-app main.cpp applicationcontroller.cpp localizer.cpp pkpassimageprovider.cpp qml.qrc ) target_include_directories(itinerary-app PRIVATE ${CMAKE_BINARY_DIR}) target_link_libraries(itinerary-app PRIVATE itinerary itinerary-weather Qt5::Quick KF5::Contacts ) if (ANDROID) # explicitly add runtime dependencies and transitive link dependencies, # so androiddeployqt picks them up target_link_libraries(itinerary-app PRIVATE KF5::Archive KF5::Kirigami2 Qt5::AndroidExtras Qt5::Svg KF5::Prison ) kirigami_package_breeze_icons(ICONS document-open edit-delete go-next-symbolic map-symbolic + settings-configure view-calendar-day view-refresh ) else () target_link_libraries(itinerary-app PRIVATE Qt5::Positioning) set_target_properties(itinerary-app PROPERTIES OUTPUT_NAME "itinerary") endif() qml_lint( main.qml BoardingPass.qml BusDelegate.qml BusPage.qml CountryInfoDelegate.qml DetailsPage.qml FlightDelegate.qml FlightPage.qml HotelDelegate.qml HotelPage.qml PkPassPage.qml PlaceDelegate.qml RestaurantDelegate.qml RestaurantPage.qml + SettingsPage.qml TicketTokenDelegate.qml TimelineDelegate.qml TimelinePage.qml TouristAttractionDelegate.qml TrainDelegate.qml TrainPage.qml ) install(TARGETS itinerary-app ${INSTALL_TARGETS_DEFAULT_ARGS}) if (NOT ANDROID) install(PROGRAMS org.kde.itinerary.desktop DESTINATION ${KDE_INSTALL_APPDIR}) endif() diff --git a/src/app/SettingsPage.qml b/src/app/SettingsPage.qml new file mode 100644 index 0000000..e51bc8d --- /dev/null +++ b/src/app/SettingsPage.qml @@ -0,0 +1,64 @@ +/* + Copyright (C) 2018 Volker Krause + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + 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 Library General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.1 as QQC2 +import org.kde.kirigami 2.4 as Kirigami +import org.kde.itinerary 1.0 +import "." as App + +Kirigami.ScrollablePage { + id: root + title: qsTr("Settings") + + GridLayout { + columns: 2 + width: root.width + + QQC2.Label { + text: qsTr("Home Country") + } + QQC2.ComboBox { + model: [ "TODO", "TODO" ] + } + + QQC2.Label { + text: qsTr("Weather Forecast") + } + QQC2.Switch { + id: weatherSwitch + } + QQC2.Label { + Layout.columnSpan: 2 + Layout.fillWidth: true + text: qsTr("Showing weather forecasts will query online services.") + visible: !weatherSwitch.checked + } + // ATTENTION do not remove this note, see https://api.met.no/license_data.html + QQC2.Label { + Layout.columnSpan: 2 + Layout.fillWidth: true + text: qsTr("Using data from The Norwegian Meteorological Institute under Creative Commons 4.0 BY International license.") + visible: weatherSwitch.checked + wrapMode: Text.WordWrap + onLinkActivated: Qt.openUrlExternally(link) + } + } + + onBackRequested: pageStack.pop() +} diff --git a/src/app/main.qml b/src/app/main.qml index cb44640..8d28561 100644 --- a/src/app/main.qml +++ b/src/app/main.qml @@ -1,90 +1,99 @@ /* Copyright (C) 2018 Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.0 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.0 as Kirigami import "." as App Kirigami.ApplicationWindow { title: qsTr("KDE Itinerary") header: Kirigami.ApplicationHeader {} width: 480 height: 720 FileDialog { property bool loadPass: false id: fileDialog title: qsTr("Please choose a file") folder: shortcuts.home onAccepted: { console.log(fileDialog.fileUrls); if (loadPass) _pkpassManager.importPass(fileDialog.fileUrl); else _reservationManager.importReservation(fileDialog.fileUrl); } } globalDrawer: Kirigami.GlobalDrawer { title: qsTr("KDE Itinerary") titleIcon: "map-symbolic" actions: [ Kirigami.Action { text: qsTr("Import Reservation...") iconName: "document-open" onTriggered: { fileDialog.loadPass = false; fileDialog.visible = true; } }, Kirigami.Action { text: qsTr("Import Pass...") iconName: "document-open" onTriggered: { fileDialog.loadPass = true; fileDialog.visible = true; } }, Kirigami.Action { text: qsTr("Check for Updates") iconName: "view-refresh" onTriggered: { _pkpassManager.updatePasses(); } + }, + Kirigami.Action { + text: qsTr("Settings...") + iconName: "settings-configure" + onTriggered: pageStack.push(settingsComponent) } ] } contextDrawer: Kirigami.ContextDrawer { id: contextDrawer } pageStack.initialPage: mainPageComponent Component { id: mainPageComponent App.TimelinePage {} } Component { id: pkpassComponent App.PkPassPage { pass: _pkpassManager.passObject(passId) } } + Component { + id: settingsComponent + App.SettingsPage {} + } } diff --git a/src/app/qml.qrc b/src/app/qml.qrc index ad06a20..8a5f5bf 100644 --- a/src/app/qml.qrc +++ b/src/app/qml.qrc @@ -1,24 +1,25 @@ main.qml BoardingPass.qml BusDelegate.qml BusPage.qml CountryInfoDelegate.qml DetailsPage.qml FlightDelegate.qml FlightPage.qml HotelDelegate.qml HotelPage.qml PkPassPage.qml PlaceDelegate.qml RestaurantDelegate.qml RestaurantPage.qml + SettingsPage.qml TicketTokenDelegate.qml TimelineDelegate.qml TimelinePage.qml TouristAttractionDelegate.qml TrainDelegate.qml TrainPage.qml