summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-10 14:17:13 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-10 14:17:13 (GMT)
commit9b6dcacf3277d1f3d9eff5548d03f77cbd41600a (patch)
tree598c3fd785bbd9fb53d31d4c22f56b45196e55ee
parentfd108c6f18f98d53b186efd49f7068dc80eee6b9 (diff)
Plasma wallpaper/worldclock: add option to center on longitude
-rw-r--r--src/plasma/applets/worldclock/package/contents/config/main.xml16
-rw-r--r--src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml51
-rw-r--r--src/plasma/applets/worldclock/package/contents/ui/main.qml24
-rw-r--r--src/plasma/wallpapers/worldmap/contents/config/main.xml12
-rw-r--r--src/plasma/wallpapers/worldmap/contents/ui/config.qml58
-rw-r--r--src/plasma/wallpapers/worldmap/contents/ui/main.qml24
6 files changed, 169 insertions, 16 deletions
diff --git a/src/plasma/applets/worldclock/package/contents/config/main.xml b/src/plasma/applets/worldclock/package/contents/config/main.xml
index 0c62518..a2ca70a 100644
--- a/src/plasma/applets/worldclock/package/contents/config/main.xml
+++ b/src/plasma/applets/worldclock/package/contents/config/main.xml
@@ -14,19 +14,23 @@
<default>Equirectangular</default>
</entry>
- <entry name="showDate" type="Bool">
- <default>false</default>
+ <entry name="centerMode" type="Enum">
+ <choices>
+ <choice name="Daylight" />
+ <choice name="Longitude" />
+ </choices>
+ <default>Daylight</default>
</entry>
- <!-- TODO: readd later
- <entry name="rotation" type="int">
- <default>-20</default>
+ <entry name="centerLongitude" type="double">
+ <default>0</default>
</entry>
- <entry name="centerSun" type="Bool">
+ <entry name="showDate" type="Bool">
<default>false</default>
</entry>
+ <!-- TODO: readd later
<entry name="customTimeZone" type="Bool">
<default>false</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 29fc967..2577b6b 100644
--- a/src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml
+++ b/src/plasma/applets/worldclock/package/contents/ui/configMapDisplay.qml
@@ -23,6 +23,8 @@ ColumnLayout {
id: mapDisplayPage
property int cfg_projection: plasmoid.configuration.projection // Enum needs manual set/get for now
+ property int cfg_centerMode: plasmoid.configuration.centerMode // Enum needs manual set/get for now
+ property alias cfg_centerLongitude: longitudeSpinBox.value
property alias cfg_showDate: showDateCheckBox.checked
GridLayout {
@@ -40,6 +42,8 @@ ColumnLayout {
QtControls.ComboBox {
id: projectionComboBox
+ Layout.row: 0
+ Layout.column: 1
model: [
i18n("Equirectangular"),
i18n("Mercator")
@@ -53,6 +57,53 @@ ColumnLayout {
}
QtControls.Label {
+ Layout.row: 1
+ Layout.column: 0
+ Layout.alignment: Qt.AlignRight
+ anchors {
+ verticalCenter: centerModeComboBox.verticalCenter
+ }
+ text: i18n("Center on:")
+ }
+
+ QtControls.ComboBox {
+ id: centerModeComboBox
+ Layout.row: 1
+ Layout.column: 1
+ model: [
+ i18n("Daylight"),
+ i18n("Longitude")
+ ]
+ onCurrentIndexChanged: {
+ cfg_centerMode = currentIndex;
+ }
+ Component.onCompleted: {
+ currentIndex = plasmoid.configuration.centerMode;
+ }
+ }
+
+ QtControls.Label {
+ Layout.row: 3
+ Layout.column: 0
+ Layout.alignment: Qt.AlignRight
+ anchors {
+ verticalCenter: longitudeSpinBox.verticalCenter
+ }
+ enabled: (cfg_centerMode === 1)
+ text: i18n("Longitude:")
+ }
+
+ QtControls.SpinBox {
+ Layout.row: 3
+ Layout.column: 1
+ enabled: (cfg_centerMode === 1)
+ id: longitudeSpinBox
+ maximumValue: 180.0
+ minimumValue: -180.0
+ decimals: 5
+ }
+
+ QtControls.Label {
Layout.row: 4
Layout.column: 0
Layout.alignment: Qt.AlignRight
diff --git a/src/plasma/applets/worldclock/package/contents/ui/main.qml b/src/plasma/applets/worldclock/package/contents/ui/main.qml
index b52a80b..0ab3e5a 100644
--- a/src/plasma/applets/worldclock/package/contents/ui/main.qml
+++ b/src/plasma/applets/worldclock/package/contents/ui/main.qml
@@ -46,6 +46,9 @@ Item {
Plasmoid.fullRepresentation: MarbleItem {
id: marbleItem
+ readonly property int centerMode: plasmoid.configuration.centerMode
+ readonly property double centerLongitude: plasmoid.configuration.centerLongitude
+
enabled: false // do not handle input
Layout.minimumWidth: units.gridUnit * 20
Layout.minimumHeight: units.gridUnit * 10
@@ -81,6 +84,22 @@ Item {
showScaleBar: false
// TODO: showCredit: false
+ onCenterModeChanged: handleCenterModeChange()
+ function handleCenterModeChange() {
+ if (centerMode === 0) {
+ marbleMap.setLockToSubSolarPoint(true);
+ } else {
+ marbleMap.setLockToSubSolarPoint(false);
+ marbleMap.centerOn(centerLongitude, 0.0);
+ }
+ }
+
+ onCenterLongitudeChanged: {
+ if (centerMode === 1) {
+ marbleMap.centerOn(centerLongitude, 0.0);
+ }
+ }
+
Component.onCompleted: {
marbleMap.setShowSunShading(true);
marbleMap.setShowCityLights(true);
@@ -90,10 +109,7 @@ Item {
marbleMap.setShowCities(false);
marbleMap.setShowTerrain(false);
- // will depend on plasmoid.configuration.centerSun
- marbleMap.setLockToSubSolarPoint(true);
- marbleMap.setCenterLatitude(0);
- marbleMap.setSubSolarPointIconVisible(true);
+ handleCenterModeChange();
}
ColumnLayout {
diff --git a/src/plasma/wallpapers/worldmap/contents/config/main.xml b/src/plasma/wallpapers/worldmap/contents/config/main.xml
index 3132a10..744bcd8 100644
--- a/src/plasma/wallpapers/worldmap/contents/config/main.xml
+++ b/src/plasma/wallpapers/worldmap/contents/config/main.xml
@@ -13,6 +13,18 @@
</choices>
<default>Equirectangular</default>
</entry>
+
+ <entry name="centerMode" type="Enum">
+ <choices>
+ <choice name="Daylight" />
+ <choice name="Longitude" />
+ </choices>
+ <default>Daylight</default>
+ </entry>
+
+ <entry name="centerLongitude" type="double">
+ <default>0</default>
+ </entry>
</group>
</kcfg>
diff --git a/src/plasma/wallpapers/worldmap/contents/ui/config.qml b/src/plasma/wallpapers/worldmap/contents/ui/config.qml
index 93d467e..a0ca31d 100644
--- a/src/plasma/wallpapers/worldmap/contents/ui/config.qml
+++ b/src/plasma/wallpapers/worldmap/contents/ui/config.qml
@@ -25,7 +25,9 @@ import org.kde.plasma.core 2.0 as PlasmaCore
ColumnLayout {
id: root
- property int cfg_projection: plasmoid.configuration.projection // Enum needs manual set/get for now
+ property int cfg_projection: wallpaper.configuration.projection // Enum needs manual set/get for now
+ property int cfg_centerMode: wallpaper.configuration.centerMode // Enum needs manual set/get for now
+ property alias cfg_centerLongitude: longitudeSpinBox.value
RowLayout {
spacing: units.largeSpacing / 2
@@ -55,10 +57,62 @@ ColumnLayout {
cfg_projection = currentIndex;
}
Component.onCompleted: {
- currentIndex = plasmoid.configuration.projection;
+ currentIndex = wallpaper.configuration.projection;
}
}
}
+ RowLayout {
+ spacing: units.largeSpacing / 2
+
+ QtControls.Label {
+ Layout.minimumWidth: width
+ Layout.maximumWidth: width
+ width: formAlignment - units.largeSpacing
+ horizontalAlignment: Text.AlignRight
+ anchors {
+ verticalCenter: centerModeComboBox.verticalCenter
+ }
+ text: i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Center on:")
+ }
+
+ QtControls.ComboBox {
+ id: centerModeComboBox
+ model: [
+ i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Daylight"),
+ i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Longitude")
+ ]
+ onCurrentIndexChanged: {
+ cfg_centerMode = currentIndex;
+ }
+ Component.onCompleted: {
+ currentIndex = wallpaper.configuration.centerMode;
+ }
+ }
+
+ }
+ RowLayout {
+ spacing: units.largeSpacing / 2
+
+ QtControls.Label {
+ Layout.minimumWidth: width
+ Layout.maximumWidth: width
+ width: formAlignment - units.largeSpacing
+ horizontalAlignment: Text.AlignRight
+ anchors {
+ verticalCenter: longitudeSpinBox.verticalCenter
+ }
+ enabled: (cfg_centerMode === 1)
+ text: i18nd("plasma_wallpaper_org.kde.plasma.worldmap", "Longitude:")
+ }
+
+ QtControls.SpinBox {
+ enabled: (cfg_centerMode === 1)
+ id: longitudeSpinBox
+ maximumValue: 180.0
+ minimumValue: -180.0
+ decimals: 5
+ }
+ }
Item { // tighten layout
Layout.fillHeight: true
diff --git a/src/plasma/wallpapers/worldmap/contents/ui/main.qml b/src/plasma/wallpapers/worldmap/contents/ui/main.qml
index 8d3152b..cd202c4 100644
--- a/src/plasma/wallpapers/worldmap/contents/ui/main.qml
+++ b/src/plasma/wallpapers/worldmap/contents/ui/main.qml
@@ -24,6 +24,9 @@ import org.kde.marble.private.plasma 0.20
MarbleItem {
id: marbleItem
+ readonly property int centerMode: wallpaper.configuration.centerMode
+ readonly property double centerLongitude: wallpaper.configuration.centerLongitude
+
enabled: false // do not handle input
radius: {
@@ -56,6 +59,22 @@ MarbleItem {
showOverviewMap: false
showScaleBar: false
+ onCenterModeChanged: handleCenterModeChange()
+ function handleCenterModeChange() {
+ if (centerMode === 0) {
+ marbleMap.setLockToSubSolarPoint(true);
+ } else {
+ marbleMap.setLockToSubSolarPoint(false);
+ marbleMap.centerOn(centerLongitude, 0.0);
+ }
+ }
+
+ onCenterLongitudeChanged: {
+ if (centerMode === 1) {
+ marbleMap.centerOn(centerLongitude, 0.0);
+ }
+ }
+
Component.onCompleted: {
marbleMap.setShowSunShading(true);
marbleMap.setShowCityLights(true);
@@ -65,9 +84,6 @@ MarbleItem {
marbleMap.setShowTerrain(false);
marbleMap.setShowOtherPlaces(false);
- // will depend on wallpaper.configuration.centerSun
- marbleMap.setLockToSubSolarPoint(true);
- marbleMap.setCenterLatitude(0);
- marbleMap.setSubSolarPointIconVisible(true);
+ handleCenterModeChange();
}
}