summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-10 23:25:29 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-10 23:25:29 (GMT)
commit44d080ff9b218e22e745ff002c4474b9bea1ceed (patch)
tree4772a9964841d231f15a3a908211879096a40861
parent36c94290337a4fc3682f36986bfc5223714f2dec (diff)
Plasma wallpaper/worldclock: add option to center on current location
-rw-r--r--src/plasma/applets/worldclock/package/contents/config/main.xml1
-rw-r--r--src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml3
-rw-r--r--src/plasma/applets/worldclock/package/contents/ui/main.qml25
-rw-r--r--src/plasma/wallpapers/worldmap/contents/config/main.xml1
-rw-r--r--src/plasma/wallpapers/worldmap/contents/ui/config.qml3
-rw-r--r--src/plasma/wallpapers/worldmap/contents/ui/main.qml20
6 files changed, 44 insertions, 9 deletions
diff --git a/src/plasma/applets/worldclock/package/contents/config/main.xml b/src/plasma/applets/worldclock/package/contents/config/main.xml
index 0e9dcb5..2d2683c 100644
--- a/src/plasma/applets/worldclock/package/contents/config/main.xml
+++ b/src/plasma/applets/worldclock/package/contents/config/main.xml
@@ -18,6 +18,7 @@
<choices>
<choice name="Daylight" />
<choice name="Longitude" />
+ <choice name="Position" />
</choices>
<default>Daylight</default>
</entry>
diff --git a/src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml b/src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml
index f78d981..5505794 100644
--- a/src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml
+++ b/src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml
@@ -72,7 +72,8 @@ ColumnLayout {
Layout.column: 1
model: [
i18n("Daylight"),
- i18n("Longitude")
+ i18n("Longitude"),
+ i18n("Location")
]
onCurrentIndexChanged: {
cfg_centerMode = currentIndex;
diff --git a/src/plasma/applets/worldclock/package/contents/ui/main.qml b/src/plasma/applets/worldclock/package/contents/ui/main.qml
index 0f14dce..54ebde8 100644
--- a/src/plasma/applets/worldclock/package/contents/ui/main.qml
+++ b/src/plasma/applets/worldclock/package/contents/ui/main.qml
@@ -28,18 +28,21 @@ import org.kde.marble.private.plasma 0.20
Item {
id: root
- readonly property date currentDateTime: dataSource.data.Local ? dataSource.data.Local.DateTime : new Date()
-
- Plasmoid.toolTipMainText: Qt.formatTime(currentDateTime)
- Plasmoid.toolTipSubText: Qt.formatDate(currentDateTime, Qt.locale().dateFormat(Locale.LongFormat))
+ readonly property date currentDateTime: timeDataSource.data.Local ? timeDataSource.data.Local.DateTime : new Date()
PlasmaCore.DataSource {
- id: dataSource
+ id: timeDataSource
engine: "time"
connectedSources: ["Local"]
interval: 60000
intervalAlignment: PlasmaCore.Types.AlignToMinute
}
+ PlasmaCore.DataSource {
+ id: geolocationDataSource
+ engine: "geolocation"
+ connectedSources: (marbleItem.centerMode === 2) ? ["location"] : []
+ interval: 10 * 60 * 1000 // every 30 minutes, might be still too large for users on the ISS :P
+ }
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
@@ -48,6 +51,7 @@ Item {
readonly property int centerMode: plasmoid.configuration.centerMode
readonly property double fixedLongitude: plasmoid.configuration.fixedLongitude
+ readonly property double locationLongitude: geolocationDataSource.data.longitude
enabled: false // do not handle input
Layout.minimumWidth: units.gridUnit * 20
@@ -88,9 +92,12 @@ Item {
function handleCenterModeChange() {
if (centerMode === 0) {
marbleMap.setLockToSubSolarPoint(true);
- } else {
+ } else if (centerMode === 1) {
marbleMap.setLockToSubSolarPoint(false);
marbleMap.centerOn(fixedLongitude, 0.0);
+ } else {
+ marbleMap.setLockToSubSolarPoint(false);
+ marbleMap.centerOn(locationLongitude, 0.0);
}
}
@@ -100,6 +107,12 @@ Item {
}
}
+ onLocationLongitudeChanged: {
+ if (centerMode === 2) {
+ marbleMap.centerOn(locationLongitude, 0.0);
+ }
+ }
+
Component.onCompleted: {
marbleMap.setShowSunShading(true);
marbleMap.setShowCityLights(true);
diff --git a/src/plasma/wallpapers/worldmap/contents/config/main.xml b/src/plasma/wallpapers/worldmap/contents/config/main.xml
index 74e54a0..25e182d 100644
--- a/src/plasma/wallpapers/worldmap/contents/config/main.xml
+++ b/src/plasma/wallpapers/worldmap/contents/config/main.xml
@@ -18,6 +18,7 @@
<choices>
<choice name="Daylight" />
<choice name="Longitude" />
+ <choice name="Position" />
</choices>
<default>Daylight</default>
</entry>
diff --git a/src/plasma/wallpapers/worldmap/contents/ui/config.qml b/src/plasma/wallpapers/worldmap/contents/ui/config.qml
index 17d27b8..cd8b67b 100644
--- a/src/plasma/wallpapers/worldmap/contents/ui/config.qml
+++ b/src/plasma/wallpapers/worldmap/contents/ui/config.qml
@@ -79,7 +79,8 @@ ColumnLayout {
id: centerModeComboBox
model: [
i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Daylight"),
- i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Longitude")
+ i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Longitude"),
+ i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Location")
]
onCurrentIndexChanged: {
cfg_centerMode = currentIndex;
diff --git a/src/plasma/wallpapers/worldmap/contents/ui/main.qml b/src/plasma/wallpapers/worldmap/contents/ui/main.qml
index d9d4ee3..553aa53 100644
--- a/src/plasma/wallpapers/worldmap/contents/ui/main.qml
+++ b/src/plasma/wallpapers/worldmap/contents/ui/main.qml
@@ -17,6 +17,7 @@
import QtQuick 2.1
+import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.marble.private.plasma 0.20
@@ -26,6 +27,7 @@ MarbleItem {
readonly property int centerMode: wallpaper.configuration.centerMode
readonly property double fixedLongitude: wallpaper.configuration.fixedLongitude
+ readonly property double locationLongitude: geolocationDataSource.data.longitude
enabled: false // do not handle input
@@ -63,9 +65,12 @@ MarbleItem {
function handleCenterModeChange() {
if (centerMode === 0) {
marbleMap.setLockToSubSolarPoint(true);
- } else {
+ } else if (centerMode === 1) {
marbleMap.setLockToSubSolarPoint(false);
marbleMap.centerOn(fixedLongitude, 0.0);
+ } else {
+ marbleMap.setLockToSubSolarPoint(false);
+ marbleMap.centerOn(locationLongitude, 0.0);
}
}
@@ -75,6 +80,12 @@ MarbleItem {
}
}
+ onLocationLongitudeChanged: {
+ if (centerMode === 2) {
+ marbleMap.centerOn(locationLongitude, 0.0);
+ }
+ }
+
Component.onCompleted: {
marbleMap.setShowSunShading(true);
marbleMap.setShowCityLights(true);
@@ -86,4 +97,11 @@ MarbleItem {
handleCenterModeChange();
}
+
+ PlasmaCore.DataSource {
+ id: geolocationDataSource
+ engine: "geolocation"
+ connectedSources: (marbleItem.centerMode === 2) ? ["location"] : []
+ interval: 10 * 60 * 1000 // every 30 minutes, might be still too large for users on the ISS :P
+ }
}