Skip to content
Snippets Groups Projects
Commit d960da68 authored by samuel's avatar samuel
Browse files

Rework phase preview

parent 1fbb1796
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
along with this program; if not, see <http://www.gnu.org/licenses/>. along with this program; if not, see <http://www.gnu.org/licenses/>.
*/ */
import QtQuick 2.1 import QtQuick
import org.kde.plasma.configuration import org.kde.plasma.configuration
ConfigModel { ConfigModel {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<default>90</default> <default>90</default>
</entry> </entry>
<entry name="latitudeAuto" type="Bool"> <entry name="latitudeAuto" type="Bool">
<default>false</default> <default>true</default>
</entry> </entry>
<entry name="showBackground" type="Bool"> <entry name="showBackground" type="Bool">
<default>false</default> <default>false</default>
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<default>3</default> <default>3</default>
</entry> </entry>
<entry name="dateFormatString" type="String"> <entry name="dateFormatString" type="String">
<default>hh</default>
</entry> </entry>
<entry name="lunarIndex" type="int"> <entry name="lunarIndex" type="int">
<default>1</default> <default>1</default>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
*/ */
import QtQuick 2.14 import QtQuick
import QtQuick.Shapes import QtQuick.Shapes
import org.kde.ksvg as KSvg import org.kde.ksvg as KSvg
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
import QtQuick 2.7 import QtQuick
import QtQuick.Controls as QtControls import QtQuick.Controls as QtControls
import QtQuick.Layouts as QtLayouts import QtQuick.Layouts as QtLayouts
import "code/lunacalc.js" as LunaCalc import "code/lunacalc.js" as LunaCalc
......
...@@ -19,10 +19,12 @@ ...@@ -19,10 +19,12 @@
*/ */
import QtPositioning import QtPositioning
import QtQuick 2.7 import QtQuick
import QtQuick.Controls as QtControls import QtQuick.Controls as QtControls
import QtQuick.Dialogs as QtDialogs import QtQuick.Dialogs as QtDialogs
import QtQuick.Layouts as QtLayouts import QtQuick.Layouts as QtLayouts
import "code/lunacalc.js" as LunaCalc
import "code/phases.js" as Phases
import org.kde.kcmutils as KCM import org.kde.kcmutils as KCM
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.plasma.plasma5support as Plasma5Support import org.kde.plasma.plasma5support as Plasma5Support
...@@ -30,9 +32,9 @@ import org.kde.plasma.plasma5support as Plasma5Support ...@@ -30,9 +32,9 @@ import org.kde.plasma.plasma5support as Plasma5Support
KCM.SimpleKCM { KCM.SimpleKCM {
id: generalPage id: generalPage
property alias previewPhase: phase.value
property alias cfg_latitudeAuto: latitudeAuto.checked // 0=Equator, +90=North Pole, -90=South Pole property alias cfg_latitudeAuto: latitudeAuto.checked // 0=Equator, +90=North Pole, -90=South Pole
property alias cfg_latitude: latitude.value // 0=Equator, +90=North Pole, -90=South Pole property alias cfg_latitude: latitude.value // 0=Equator, +90=North Pole, -90=South Pole
property alias cfg_phase: phase.value
property alias cfg_transparentShadow: transparentShadow.checked // boolean property alias cfg_transparentShadow: transparentShadow.checked // boolean
property alias cfg_showBackground: showBackground.checked // boolean property alias cfg_showBackground: showBackground.checked // boolean
property alias cfg_dateFormat: dateFormat.currentIndex // code: 0= 1= 2=... property alias cfg_dateFormat: dateFormat.currentIndex // code: 0= 1= 2=...
...@@ -50,6 +52,9 @@ KCM.SimpleKCM { ...@@ -50,6 +52,9 @@ KCM.SimpleKCM {
cfg_lunarImage = imageChoices.get(cfg_lunarIndex).filename; cfg_lunarImage = imageChoices.get(cfg_lunarIndex).filename;
cfg_lunarImageTweak = imageChoices.get(cfg_lunarIndex).tweak; cfg_lunarImageTweak = imageChoices.get(cfg_lunarIndex).tweak;
} }
Component.onCompleted: {
previewPhase = LunaCalc.getCurrentPhase(true).terminator;
}
PositionSource { PositionSource {
id: geoSource id: geoSource
...@@ -60,7 +65,7 @@ KCM.SimpleKCM { ...@@ -60,7 +65,7 @@ KCM.SimpleKCM {
active: cfg_latitudeAuto active: cfg_latitudeAuto
onPositionChanged: { onPositionChanged: {
// lbl_place.text = i18n(geoSource.data.location.country); // lbl_place.text = i18n(geoSource.data.location.country);
cfg_latitude = Math.round(geoSource.position.coordinate.latitude * 100) / 100; cfg_latitude = Math.round(geoSource.position.coordinate.latitude);
} }
} }
...@@ -104,7 +109,7 @@ KCM.SimpleKCM { ...@@ -104,7 +109,7 @@ KCM.SimpleKCM {
width: 200 width: 200
height: 200 height: 200
latitude: cfg_latitude latitude: cfg_latitude
theta: cfg_phase theta: previewPhase
showShadow: cfg_showShadow showShadow: cfg_showShadow
transparentShadow: false transparentShadow: false
lunarImage: cfg_lunarImage lunarImage: cfg_lunarImage
...@@ -156,6 +161,35 @@ KCM.SimpleKCM { ...@@ -156,6 +161,35 @@ KCM.SimpleKCM {
} }
QtControls.Label {
text: i18n("Phase Preview")
QtLayouts.Layout.preferredWidth: 85
horizontalAlignment: Text.AlignRight
}
QtLayouts.RowLayout {
spacing: 20
QtControls.Label {
id: lbl_phase
text: Math.abs(phase.value) + "º "
QtLayouts.Layout.preferredWidth: 40
horizontalAlignment: Text.AlignRight
}
QtControls.Slider {
id: phase
value: lunaPreview.theta
QtLayouts.Layout.fillWidth: true
from: 0
to: 360
stepSize: 1
}
}
QtControls.Label { QtControls.Label {
text: i18n("Disk Color") text: i18n("Disk Color")
visible: cfg_lunarImage === "" visible: cfg_lunarImage === ""
...@@ -229,35 +263,6 @@ KCM.SimpleKCM { ...@@ -229,35 +263,6 @@ KCM.SimpleKCM {
} }
QtControls.Label {
text: i18n("Phase Preview")
QtLayouts.Layout.preferredWidth: 85
horizontalAlignment: Text.AlignRight
}
QtLayouts.RowLayout {
spacing: 20
QtControls.Label {
id: lbl_phase
text: Math.abs(phase.value) + "º "
QtLayouts.Layout.preferredWidth: 40
horizontalAlignment: Text.AlignRight
}
QtControls.Slider {
id: phase
value: lunaPreview.theta
QtLayouts.Layout.fillWidth: true
from: 0
to: 360
stepSize: 1
}
}
QtControls.Label { QtControls.Label {
text: i18n("Date Format") text: i18n("Date Format")
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
*/ */
import QtQuick 2.7 import QtQuick
import QtQuick.Controls as QtControls import QtQuick.Controls as QtControls
import QtQuick.Layouts as QtLayouts import QtQuick.Layouts as QtLayouts
import "code/lunacalc.js" as LunaCalc import "code/lunacalc.js" as LunaCalc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment