Warning, /education/marble/src/plasma/applets/worldclock/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2016 Friedrich W. H. Kossebau <kossebau@kde.org>
0003 SPDX-License-Identifier: LGPL-2.1-or-later
0004 */
0005
0006 import QtQuick 2.1
0007 import QtQuick.Layouts 1.1
0008
0009 import org.kde.plasma.plasmoid 2.0
0010 import org.kde.plasma.core 2.0 as PlasmaCore
0011 import org.kde.plasma.components 2.0 as PlasmaComponents
0012 import org.kde.plasma.extras 2.0 as PlasmaExtras
0013
0014 import org.kde.marble.private.plasma 0.20
0015
0016 Item {
0017 id: root
0018
0019 readonly property date currentDateTime: timeDataSource.data.Local ? timeDataSource.data.Local.DateTime : new Date()
0020
0021 PlasmaCore.DataSource {
0022 id: timeDataSource
0023 engine: "time"
0024 connectedSources: ["Local"]
0025 interval: 60000
0026 intervalAlignment: PlasmaCore.Types.AlignToMinute
0027 }
0028 PlasmaCore.DataSource {
0029 id: geolocationDataSource
0030 engine: "geolocation"
0031 connectedSources: (marbleItem.centerMode === 2) ? ["location"] : []
0032 interval: 10 * 60 * 1000 // every 30 minutes, might be still too large for users on the ISS :P
0033 }
0034
0035 Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
0036
0037 Plasmoid.fullRepresentation: MarbleItem {
0038 id: marbleItem
0039
0040 readonly property int centerMode: plasmoid.configuration.centerMode
0041 readonly property double fixedLongitude: plasmoid.configuration.fixedLongitude
0042 readonly property double locationLongitude: geolocationDataSource.data.longitude || 0
0043
0044 enabled: false // do not handle input
0045 Layout.minimumWidth: units.gridUnit * 20
0046 Layout.minimumHeight: units.gridUnit * 10
0047
0048 radius: {
0049 var ratio = width/height;
0050 if (projection === MarbleItem.Equirectangular) {
0051 if (ratio > 2) {
0052 return height / 2;
0053 }
0054 return width / 4;
0055 } else {
0056 if (ratio > 1) {
0057 return height / 4;
0058 }
0059 return width / 4
0060 }
0061 }
0062
0063 // Theme settings.
0064 projection: (plasmoid.configuration.projection === 0) ? MarbleItem.Equirectangular : MarbleItem.Mercator
0065 mapThemeId: "earth/bluemarble/bluemarble.dgml"
0066
0067 // Visibility of layers/plugins.
0068 showAtmosphere: false
0069 showClouds: false
0070 showBackground: false
0071
0072 showGrid: false
0073 showCrosshairs: false
0074 showCompass: false
0075 showOverviewMap: false
0076 showScaleBar: false
0077 // TODO: showCredit: false
0078
0079 onCenterModeChanged: handleCenterModeChange()
0080 function handleCenterModeChange() {
0081 if (centerMode === 0) {
0082 marbleMap.setLockToSubSolarPoint(true);
0083 } else if (centerMode === 1) {
0084 marbleMap.setLockToSubSolarPoint(false);
0085 marbleMap.centerOn(fixedLongitude, 0.0);
0086 } else {
0087 marbleMap.setLockToSubSolarPoint(false);
0088 marbleMap.centerOn(locationLongitude, 0.0);
0089 }
0090 }
0091
0092 onFixedLongitudeChanged: {
0093 if (centerMode === 1) {
0094 marbleMap.centerOn(fixedLongitude, 0.0);
0095 }
0096 }
0097
0098 onLocationLongitudeChanged: {
0099 if (centerMode === 2) {
0100 marbleMap.centerOn(locationLongitude, 0.0);
0101 }
0102 }
0103
0104 Component.onCompleted: {
0105 marbleMap.setShowSunShading(true);
0106 marbleMap.setShowCityLights(true);
0107
0108 marbleMap.setShowPlaces(false);
0109 marbleMap.setShowOtherPlaces(false);
0110 marbleMap.setShowCities(false);
0111 marbleMap.setShowTerrain(false);
0112
0113 handleCenterModeChange();
0114 }
0115
0116 ColumnLayout {
0117 anchors.centerIn: parent
0118
0119 PlasmaExtras.Heading {
0120 id: timeLabel
0121
0122 Layout.alignment: Qt.AlignHCenter
0123
0124 level: 1
0125 text: plasmoid.configuration.showDate ? Qt.formatDateTime(currentDateTime) : Qt.formatTime(currentDateTime)
0126
0127 verticalAlignment: Text.AlignVCenter
0128 horizontalAlignment: Text.AlignHCenter
0129 }
0130 /*
0131 PlasmaExtras.Heading {
0132 id: timezoneLabel
0133
0134 Layout.alignment: Qt.AlignHCenter
0135
0136 level: 3
0137 text: "Internet"
0138
0139 visible: text.length > 0
0140 horizontalAlignment: Text.AlignHCenter
0141 }
0142 */
0143 }
0144 }
0145 }