diff --git a/timetable/CMakeLists.txt b/timetable/CMakeLists.txt index be0b2d0..9d5854f 100644 --- a/timetable/CMakeLists.txt +++ b/timetable/CMakeLists.txt @@ -1,26 +1,18 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.publictransport.timetable\") - -plasma_install_package(plasmoid org.kde.plasma.publictransport.timetable) - -set ( timetable_SRCS - plugin/timetableplugin.cpp - plugin/timetablehelper.cpp - plugin/timetablebackend.cpp -) - install (FILES timetable.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) -install (FILES plugin/qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/publictransport/timetable) +install (PROGRAMS timetable.desktop DESTINATION ${KDE_INSTALL_APPDIR}) + +qt5_add_resources(RESOURCES timetable.qrc) -add_library (timetable SHARED ${timetable_SRCS}) +add_executable (timetable main.cpp ${RESOURCES}) target_link_libraries (timetable Qt5::Core Qt5::Qml Qt5::Quick Qt5::Widgets KF5::Plasma KF5::NewStuff KF5::KDELibs4Support ) -install (TARGETS timetable DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/publictransport/timetable) +install (TARGETS timetable DESTINATION ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/timetable/plasmoid/metadata.desktop b/timetable/plasmoid/metadata.desktop deleted file mode 100644 index 788976e..0000000 --- a/timetable/plasmoid/metadata.desktop +++ /dev/null @@ -1,15 +0,0 @@ -[Desktop Entry] -Name=Publictransport Timetable -Comment=Transport timetable information -Encoding=UTF-8 -Icon=applications-rss -ServiceTypes=Plasma/Applet -Type=Service -X-KDE-PluginInfo-Author=R. Harish Navnit -X-KDE-PluginInfo-Email=harishnavnit@gmail.com -X-KDE-PluginInfo-Name=org.kde.plasma.publictransport.timetable -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Website=http://techbase.kde.org -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml diff --git a/timetable/plasmoid/contents/ui/CheckServiceproviders.qml b/timetable/qml/CheckServiceproviders.qml similarity index 100% rename from timetable/plasmoid/contents/ui/CheckServiceproviders.qml rename to timetable/qml/CheckServiceproviders.qml diff --git a/timetable/plasmoid/contents/ui/GtfsService.qml b/timetable/qml/GtfsService.qml similarity index 100% rename from timetable/plasmoid/contents/ui/GtfsService.qml rename to timetable/qml/GtfsService.qml diff --git a/timetable/plasmoid/contents/ui/GtfsServiceDelegate.qml b/timetable/qml/GtfsServiceDelegate.qml similarity index 100% rename from timetable/plasmoid/contents/ui/GtfsServiceDelegate.qml rename to timetable/qml/GtfsServiceDelegate.qml diff --git a/timetable/plasmoid/contents/ui/Timetable.qml b/timetable/qml/Timetable.qml similarity index 100% rename from timetable/plasmoid/contents/ui/Timetable.qml rename to timetable/qml/Timetable.qml diff --git a/timetable/qml/Timetable.qmlc b/timetable/qml/Timetable.qmlc new file mode 100644 index 0000000..9e5e57b Binary files /dev/null and b/timetable/qml/Timetable.qmlc differ diff --git a/timetable/plasmoid/contents/ui/TimetableDelegate.qml b/timetable/qml/TimetableDelegate.qml similarity index 100% rename from timetable/plasmoid/contents/ui/TimetableDelegate.qml rename to timetable/qml/TimetableDelegate.qml diff --git a/timetable/qml/TimetableDelegate.qmlc b/timetable/qml/TimetableDelegate.qmlc new file mode 100644 index 0000000..35c0e58 Binary files /dev/null and b/timetable/qml/TimetableDelegate.qmlc differ diff --git a/timetable/plasmoid/contents/ui/main.qml b/timetable/qml/main.qml similarity index 97% rename from timetable/plasmoid/contents/ui/main.qml rename to timetable/qml/main.qml index a948c62..c1f5489 100644 --- a/timetable/plasmoid/contents/ui/main.qml +++ b/timetable/qml/main.qml @@ -1,101 +1,105 @@ /******************************************************************** Copyright (C) 2016 R. Harish Navnit This program 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 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 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.0 import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.2 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.plasma.components 2.0 as PlasmaComponents -Item { +ApplicationWindow { id: timetableApplet + visible: true + Layout.minimumWidth: 300 Layout.minimumHeight: 200 Layout.fillWidth: true Layout.fillHeight: true LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true property string gtfsState: mainDataSource.data["ServiceProviders"][defaultProviderId()]["state"] property var defaultProviderId: (function getDefaultServiceProviderId() { var data = mainDataSource.data["ServiceProviders"] var serviceproviders = Object.keys(data) return serviceproviders[0] }) + PlasmaCore.DataSource { id: mainDataSource interval: 6000 engine: "publictransport" // At this point we don't know if service providers exist locally // Hence it's not possible to form and connect to a arrival/departure source connectedSources: ["ServiceProviders"] } PlasmaComponents.Button { id: configureButton anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter text: i18n("Configure") visible: { var data = mainDataSource.data["ServiceProviders"][defaultProviderId()]["state"] if ( data == undefined) { return true } else if (gtfsState == "gtfs_feed_import_pending") { timetableLoader.active = false return true } else { timetableLoader.active = true return false } } onClicked: { this.visible = false serviceproviderCheckLoader.active = true } } PlasmaComponents.ToolButton { id: configureShortcutButton anchors { right: parent.right rightMargin: 5 } iconSource: "configure" tooltip: i18n("Configure Settings") visible: !configureButton.visible onClicked: plasmoid.action("configure").trigger() } Loader { id: serviceproviderCheckLoader anchors.fill: parent source: "CheckServiceproviders.qml" active: false } Loader { id: timetableLoader anchors.fill: parent source: "Timetable.qml" active: false } } diff --git a/timetable/qml/main.qmlc b/timetable/qml/main.qmlc new file mode 100644 index 0000000..ae7d8a8 Binary files /dev/null and b/timetable/qml/main.qmlc differ diff --git a/timetable/timetable.desktop b/timetable/timetable.desktop new file mode 100644 index 0000000..2510276 --- /dev/null +++ b/timetable/timetable.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Timetable +Exec=timetable %i -caption "%c" +Icon=timetable +Type=Application +MimeType=application-x-publictransport-engine;application/xml; +X-DocPath=timetablemate/index.html +GenericName=Launch the Public Transport timetable application +Terminal=false +Categories=Qt;KDE;Development;IDE; diff --git a/timetable/timetable.qrc b/timetable/timetable.qrc new file mode 100644 index 0000000..a01733d --- /dev/null +++ b/timetable/timetable.qrc @@ -0,0 +1,10 @@ + + + qml/main.qml + qml/Timetable.qml + qml/TimetableDelegate.qml + qml/GtfsService.qml + qml/GtfsServiceDelegate.qml + qml/CheckServiceproviders.qml + +