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

Rework config UI

parent b5c06f5e
No related branches found
No related tags found
No related merge requests found
Showing
with 614 additions and 225 deletions
.kateproject.build
*.zip *.zip
*.plasmoid *.plasmoid
/build/ /build/
......
...@@ -24,7 +24,7 @@ A. Command line, installs to ~/local/share/plasma/plasmoids ...@@ -24,7 +24,7 @@ A. Command line, installs to ~/local/share/plasma/plasmoids
Uninstall: $ plasmapkg2 -r org.kde.userbase.plasma.Luna3 Uninstall: $ plasmapkg2 -r org.kde.userbase.plasma.Luna3
See README_TRANSLATIONS.txt (Step 4) for installing localisations. See README_TRANSLATIONS.md (Step 4) for installing localizations.
B. Command line, installs to /usr/local/share/plasma/plasmoids B. Command line, installs to /usr/local/share/plasma/plasmoids
...@@ -34,7 +34,6 @@ B. Command line, installs to /usr/local/share/plasma/plasmoids ...@@ -34,7 +34,6 @@ B. Command line, installs to /usr/local/share/plasma/plasmoids
Uninstall: # plasmapkg2 -g -r org.kde.userbase.plasma.Luna3 Uninstall: # plasmapkg2 -g -r org.kde.userbase.plasma.Luna3
See README_TRANSLATIONS.txt (Step 4) for installing localisations.
C. CMake, installs to /usr/local/share/plasma/plasmoids C. CMake, installs to /usr/local/share/plasma/plasmoids
...@@ -46,7 +45,6 @@ C. CMake, installs to /usr/local/share/plasma/plasmoids ...@@ -46,7 +45,6 @@ C. CMake, installs to /usr/local/share/plasma/plasmoids
3. Run: # cmake <path to source dir> 3. Run: # cmake <path to source dir>
4. Run: # make install 4. Run: # make install
See README_TRANSLATIONS.txt (Step 4) for installing localisations.
Custom Date Formats Custom Date Formats
------------------- -------------------
......
...@@ -21,8 +21,20 @@ import org.kde.plasma.configuration ...@@ -21,8 +21,20 @@ import org.kde.plasma.configuration
ConfigModel { ConfigModel {
ConfigCategory { ConfigCategory {
name: i18n("General") name: i18n("General")
icon: "preferences-desktop-user" icon: "preferences-desktop-default-applications"
source: "configGeneral.qml" source: "configGeneral.qml"
} }
ConfigCategory {
name: i18n("Custom Image")
icon: "preferences-desktop-color"
source: "configImage.qml"
}
ConfigCategory {
name: i18n("Date Popup")
icon: "preferences-system-time"
source: "configPopup.qml"
}
} }
...@@ -11,22 +11,43 @@ ...@@ -11,22 +11,43 @@
<entry name="showBackground" type="Bool"> <entry name="showBackground" type="Bool">
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="showGrid" type="Bool">
<default>false</default>
</entry>
<entry name="showTycho" type="Bool">
<default>false</default>
</entry>
<entry name="showCopernicus" type="Bool">
<default>false</default>
</entry>
<entry name="showShadow" type="Bool"> <entry name="showShadow" type="Bool">
<default>true</default> <default>true</default>
</entry> </entry>
<entry name="transparentShadow" type="Bool"> <entry name="transparentShadow" type="Bool">
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="shadowOpacity" type="double">
<default>0.9</default>
</entry>
<entry name="dateFormat" type="int"> <entry name="dateFormat" type="int">
<default>3</default> <default>3</default>
</entry> </entry>
<entry name="dateFormatString" type="String"> <entry name="dateFormatString" type="String">
<default>hh</default> <default>hh</default>
</entry> </entry>
<entry name="currentPhase" type="int">
<default>0</default>
</entry>
<entry name="currentPhaseText" type="String">
<default>Processing</default>
</entry>
<entry name="currentPhaseSubText" type="String">
<default>PROCESSING</default>
</entry>
<entry name="lunarIndex" type="int"> <entry name="lunarIndex" type="int">
<default>1</default> <default>1</default>
</entry> </entry>
<entry name="diskColor" type="String"> <entry name="diskColor" type="Color">
<default>#ffff80</default> <default>#ffff80</default>
</entry> </entry>
</group> </group>
......
...@@ -34,6 +34,7 @@ Item { ...@@ -34,6 +34,7 @@ Item {
property int latitude: 90 //Degrees: 0=Equator, 90=North Pole, -90=South Pole property int latitude: 90 //Degrees: 0=Equator, 90=North Pole, -90=South Pole
property bool showShadow: true property bool showShadow: true
property bool transparentShadow: true property bool transparentShadow: true
property real shadowOpacity: 0.9
property string lunarImage: '' property string lunarImage: ''
property color diskColor: '#ffffff' property color diskColor: '#ffffff'
property int lunarImageTweak: 0 property int lunarImageTweak: 0
...@@ -86,6 +87,7 @@ Item { ...@@ -86,6 +87,7 @@ Item {
visible: true visible: true
anchors.centerIn: parent anchors.centerIn: parent
preferredRendererType: Shape.CurveRenderer preferredRendererType: Shape.CurveRenderer
antialiasing: true
ShapePath { ShapePath {
fillColor: diskColor fillColor: diskColor
...@@ -94,8 +96,8 @@ Item { ...@@ -94,8 +96,8 @@ Item {
PathAngleArc { PathAngleArc {
centerX: radius centerX: radius
centerY: radius centerY: radius
radiusY: radius radiusY: radius - 1
radiusX: radius radiusX: radius - 1
startAngle: 0 startAngle: 0
sweepAngle: 360 sweepAngle: 360
} }
...@@ -212,8 +214,10 @@ Item { ...@@ -212,8 +214,10 @@ Item {
if (showShadow) { if (showShadow) {
var cosTheta = Math.cos(theta / 180 * Math.PI); var cosTheta = Math.cos(theta / 180 * Math.PI);
var counterclockwisep = (theta < 180); var counterclockwisep = (theta < 180);
context.globalAlpha = 0.9; var scaleTweak = 1.001 + 0.003 * (1 - Math.abs(cosTheta)); //Qt distorts Canvas with scale(), causing a line of pixels to appear around the shadow. Tweak the scale until this gets fixed.
context.globalAlpha = 1;
context.translate(radius, radius); context.translate(radius, radius);
context.scale(scaleTweak, scaleTweak);
if (theta != 180) { if (theta != 180) {
context.beginPath(); context.beginPath();
context.fillStyle = '#ffffff'; context.fillStyle = '#ffffff';
...@@ -234,16 +238,18 @@ Item { ...@@ -234,16 +238,18 @@ Item {
} }
ShaderEffectSource { ShaderEffectSource {
id: lunaMask id: lunaMask
anchors.centerIn: parent anchors.centerIn: parent
width: lunaBackground.width width: lunaBackground.width
height: lunaBackground.height height: lunaBackground.height
visible: false visible: false
antialiasing: false antialiasing: true
sourceItem: Shape { sourceItem: Shape {
opacity: 1 opacity: 1
antialiasing: true
width: lunaBackground.width width: lunaBackground.width
height: lunaBackground.height height: lunaBackground.height
visible: true visible: true
...@@ -257,8 +263,8 @@ Item { ...@@ -257,8 +263,8 @@ Item {
PathAngleArc { PathAngleArc {
centerX: radius centerX: radius
centerY: radius centerY: radius
radiusY: radius radiusY: radius - 1
radiusX: radius radiusX: radius - 1
startAngle: 0 startAngle: 0
sweepAngle: 360 sweepAngle: 360
} }
...@@ -274,6 +280,7 @@ Item { ...@@ -274,6 +280,7 @@ Item {
property variant shadow: shadow property variant shadow: shadow
property variant mask: lunaMask property variant mask: lunaMask
property int transparent: transparentShadow property int transparent: transparentShadow
property real shadow_Opacity: shadowOpacity
opacity: 1 opacity: 1
rotation: latitude - 90 rotation: latitude - 90
......
...@@ -170,6 +170,10 @@ Item { ...@@ -170,6 +170,10 @@ Item {
icon.source: "go-previous" icon.source: "go-previous"
onClicked: showPreviousPhases() onClicked: showPreviousPhases()
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: hovered
QtControls.ToolTip.text: i18n("Previous Cycle")
} }
PlasmaComponents.ToolButton { PlasmaComponents.ToolButton {
...@@ -177,6 +181,10 @@ Item { ...@@ -177,6 +181,10 @@ Item {
icon.source: "go-jump-today" icon.source: "go-jump-today"
onClicked: showTodayPhases() onClicked: showTodayPhases()
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: hovered
QtControls.ToolTip.text: i18n("Today's Cycle")
} }
PlasmaComponents.ToolButton { PlasmaComponents.ToolButton {
...@@ -184,6 +192,10 @@ Item { ...@@ -184,6 +192,10 @@ Item {
icon.source: "go-next" icon.source: "go-next"
onClicked: showNextPhases() onClicked: showNextPhases()
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: hovered
QtControls.ToolTip.text: i18n("Next Cycle")
} }
} }
......
...@@ -23,8 +23,6 @@ import QtQuick ...@@ -23,8 +23,6 @@ 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
...@@ -32,28 +30,28 @@ import org.kde.plasma.plasma5support as Plasma5Support ...@@ -32,28 +30,28 @@ import org.kde.plasma.plasma5support as Plasma5Support
KCM.SimpleKCM { KCM.SimpleKCM {
id: generalPage id: generalPage
property int cfg_currentPhase: 0 // Degrees: 0= new moon, 90= first quarter, 180= full moon, 270= third quarter
property alias previewPhase: phase.value 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_transparentShadow: transparentShadow.checked // boolean property alias cfg_transparentShadow: transparentShadow.checked // boolean
property alias cfg_shadowOpacity: shadowOpacity.value // real in [0,1]
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_diskColor: lunaPreview.diskColor
property alias cfg_dateFormatString: dateFormatString.text
property alias cfg_diskColor: diskColor.color
property int cfg_lunarIndex: 0 // index into imageChoices property int cfg_lunarIndex: 0 // index into imageChoices
property string cfg_lunarImage: '' // filename (from imageChoices) property string cfg_lunarImage: '' // filename (from imageChoices)
property int cfg_lunarImageTweak: 0 // rotation angle adjustment for the image (from imageChoices) property int cfg_lunarImageTweak: 0 // rotation angle adjustment for the image (from imageChoices)
property alias cfg_showShadow: showShadow.checked property alias cfg_showShadow: showShadow.checked
property alias cfg_showGrid: showGrid.checked property bool cfg_showGrid: false
property alias cfg_showTycho: showTycho.checked property bool cfg_showTycho: false
property alias cfg_showCopernicus: showCopernicus.checked property bool cfg_showCopernicus: false
onCfg_lunarIndexChanged: { onCfg_lunarIndexChanged: {
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: { Component.onCompleted: {
previewPhase = LunaCalc.getCurrentPhase(true).terminator; previewPhase = cfg_currentPhase;
} }
PositionSource { PositionSource {
...@@ -64,7 +62,6 @@ KCM.SimpleKCM { ...@@ -64,7 +62,6 @@ KCM.SimpleKCM {
updateInterval: 3600 * 1000 updateInterval: 3600 * 1000
active: cfg_latitudeAuto active: cfg_latitudeAuto
onPositionChanged: { onPositionChanged: {
// lbl_place.text = i18n(geoSource.data.location.country);
cfg_latitude = Math.round(geoSource.position.coordinate.latitude); cfg_latitude = Math.round(geoSource.position.coordinate.latitude);
} }
} }
...@@ -76,261 +73,248 @@ KCM.SimpleKCM { ...@@ -76,261 +73,248 @@ KCM.SimpleKCM {
QtDialogs.ColorDialog { QtDialogs.ColorDialog {
id: colorDialog id: colorDialog
title: i18n("Pick a color for the moon") options: QtDialogs.ColorDialog.ShowAlphaChannel
title: i18n("Moon color")
visible: false visible: false
selectedColor: diskColor.color selectedColor: cfg_diskColor
onAccepted: diskColor.color = selectedColor onAccepted: cfg_diskColor = selectedColor
} }
QtLayouts.GridLayout { QtLayouts.ColumnLayout {
columns: 2 spacing: 10
rowSpacing: 15 QtLayouts.Layout.fillWidth: true
QtControls.Label { QtControls.Frame {
text: i18n("Preview") QtLayouts.Layout.fillWidth: true
} QtLayouts.Layout.alignment: Qt.AlignTop
QtLayouts.RowLayout {
spacing: 20
QtControls.Button {
id: previousButton
icon.source: "go-previous" QtLayouts.GridLayout {
enabled: cfg_lunarIndex > 0 anchors.fill: parent
onClicked: { columns: 2
cfg_lunarIndex -= 1; rowSpacing: 0
QtLayouts.Layout.alignment: Qt.AlignTop
QtControls.Label {
text: i18n("Preview")
font.bold: true
QtLayouts.Layout.alignment: Qt.AlignTop
} }
}
LunaIcon {
id: lunaPreview
width: 200
height: 200
latitude: cfg_latitude
theta: previewPhase
showShadow: cfg_showShadow
transparentShadow: false
lunarImage: cfg_lunarImage
lunarImageTweak: cfg_lunarImageTweak
diskColor: cfg_diskColor
showGrid: cfg_showGrid
showTycho: cfg_showTycho
showCopernicus: cfg_showCopernicus
}
QtControls.Button { QtLayouts.RowLayout {
id: nextButton spacing: 20
QtLayouts.Layout.alignment: Qt.AlignLeft
QtControls.Button {
id: previousButton
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: hovered
QtControls.ToolTip.text: i18n("Previous Image")
icon.source: "go-previous"
enabled: cfg_lunarIndex > 0
onClicked: {
cfg_lunarIndex -= 1;
}
}
LunaIcon {
id: lunaPreview
width: 200
height: 200
latitude: cfg_latitude
theta: previewPhase
showShadow: cfg_showShadow
transparentShadow: cfg_transparentShadow
shadowOpacity: cfg_shadowOpacity
lunarImage: cfg_lunarImage
lunarImageTweak: cfg_lunarImageTweak
diskColor: cfg_diskColor
showGrid: cfg_showGrid
showTycho: cfg_showTycho
showCopernicus: cfg_showCopernicus
MouseArea {
anchors.fill: parent
visible: cfg_lunarImage === ""
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: visible && hovered
QtControls.ToolTip.text: i18n("Pick Color")
onClicked: {
colorDialog.visible = true;
}
}
}
QtControls.Button {
id: nextButton
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: hovered
QtControls.ToolTip.text: i18n("Next Image")
icon.source: "go-next"
enabled: cfg_lunarIndex < imageChoices.count - 1
onClicked: {
cfg_lunarIndex += 1;
}
}
QtLayouts.ColumnLayout {
spacing: 20
QtControls.CheckBox {
id: showShadow
text: i18n("Show shadow")
}
}
icon.source: "go-next"
enabled: cfg_lunarIndex < imageChoices.count - 1
onClicked: {
cfg_lunarIndex += 1;
} }
}
QtLayouts.ColumnLayout { QtControls.Label {
spacing: 20 text: i18n("Phase Preview")
QtLayouts.Layout.preferredWidth: 85
QtControls.CheckBox { horizontalAlignment: Text.AlignRight
id: showShadow
text: i18n("Show shadow")
} }
QtControls.CheckBox { QtLayouts.RowLayout {
id: showGrid spacing: 20
text: i18n("Show grid") QtControls.Label {
} id: lbl_phase
QtControls.CheckBox { text: phase.value + "º "
id: showTycho QtLayouts.Layout.preferredWidth: 40
horizontalAlignment: Text.AlignRight
}
text: i18n("Tycho") QtControls.Slider {
} id: phase
QtControls.CheckBox { QtLayouts.Layout.fillWidth: true
id: showCopernicus from: 0
to: 360
stepSize: 1
}
text: i18n("Copernicus")
} }
} }
} }
QtControls.Label { QtLayouts.GridLayout {
text: i18n("Phase Preview") columns: 2
QtLayouts.Layout.preferredWidth: 85 rowSpacing: 10
horizontalAlignment: Text.AlignRight QtLayouts.Layout.fillWidth: true
}
QtLayouts.RowLayout {
spacing: 20
QtControls.Label { QtLayouts.ColumnLayout {
id: lbl_phase spacing: 10
text: Math.abs(phase.value) + "º " QtControls.Label {
QtLayouts.Layout.preferredWidth: 40 text: i18n("Shadow")
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignCenter
} font.bold: true
}
QtControls.Slider { QtControls.Label {
id: phase text: i18n("Opacity")
QtLayouts.Layout.preferredWidth: 85
horizontalAlignment: Text.AlignRight
}
value: lunaPreview.theta
QtLayouts.Layout.fillWidth: true
from: 0
to: 360
stepSize: 1
} }
} QtLayouts.ColumnLayout {
spacing: 5
QtControls.Label { QtLayouts.Layout.fillWidth: true
text: i18n("Disk Color")
visible: cfg_lunarImage === ""
}
Rectangle {
id: diskColor
width: 50 QtControls.CheckBox {
height: 50 id: transparentShadow
color: '#808040'
border.color: '#000000'
radius: height / 2
visible: cfg_lunarImage === ""
MouseArea { text: i18n("Transparent")
anchors.fill: parent
onClicked: {
colorDialog.selectedColor = diskColor.color;
colorDialog.visible = true;
} }
}
} QtLayouts.RowLayout {
spacing: 20
QtControls.Label { QtControls.Label {
text: i18n("Latitude") id: lbl_shadowOpacity
}
QtLayouts.RowLayout {
spacing: 20
QtControls.Label {
id: lbl_latitude
text: Math.abs(latitude.value) + "º " + (latitude.value < 0 ? "S" : "N")
QtLayouts.Layout.preferredWidth: 40
horizontalAlignment: Text.AlignRight
}
QtControls.Slider {
id: latitude
QtLayouts.Layout.fillWidth: true
from: -90
to: 90
stepSize: 5
enabled: !cfg_latitudeAuto
}
} text: Math.round(shadowOpacity.value * 100) + "%"
QtLayouts.Layout.preferredWidth: 40
horizontalAlignment: Text.AlignRight
}
QtControls.Label { QtControls.Slider {
} id: shadowOpacity
QtLayouts.RowLayout { QtLayouts.Layout.fillWidth: true
spacing: 20 from: 0
to: 1
stepSize: 0.05
}
QtControls.CheckBox { }
id: latitudeAuto
text: i18n("Use current latitude")
} }
QtControls.Label { QtControls.Label {
id: lbl_place text: i18n("Latitude")
font.bold: true
QtLayouts.Layout.fillWidth: true lineHeight: 3
horizontalAlignment: Text.AlignRight
} }
} QtLayouts.ColumnLayout {
spacing: 5
QtControls.Label { QtLayouts.RowLayout {
text: i18n("Date Format") spacing: 20
}
QtControls.ComboBox { QtControls.Label {
id: dateFormat id: lbl_latitude
QtLayouts.Layout.fillWidth: true text: Math.abs(latitude.value) + "º " + (latitude.value < 0 ? "S" : "N")
textRole: "key" QtLayouts.Layout.preferredWidth: 40
horizontalAlignment: Text.AlignRight
model: ListModel { }
dynamicRoles: true
Component.onCompleted: {
append({
"key": i18n("Text date"),
"value": 0
});
append({
"key": i18n("Short date"),
"value": 1
});
append({
"key": i18n("Long date"),
"value": 2
});
append({
"key": i18n("ISO date"),
"value": 3
});
append({
"key": i18n("Custom"),
"value": 4
});
}
}
} QtControls.Slider {
id: latitude
QtControls.Label { QtLayouts.Layout.fillWidth: true
text: i18n("Date Format String") from: -90
visible: dateFormat.currentIndex == 4 to: 90
} stepSize: 5
onMoved: cfg_latitudeAuto = false
}
QtControls.TextField { }
id: dateFormatString
maximumLength: 24 QtControls.CheckBox {
visible: dateFormat.currentIndex == 4 id: latitudeAuto
}
QtControls.Label { text: i18n("Use current latitude")
text: i18n("Background") }
}
QtControls.CheckBox { }
id: showBackground
text: i18n("Show background") QtControls.Label {
} text: i18n("Background")
font.bold: true
}
QtControls.Label { QtControls.CheckBox {
text: "" id: showBackground
}
QtControls.CheckBox { text: i18n("Show background")
id: transparentShadow }
text: i18n("Transparent shadow")
} }
} }
......
/**
Copyright (C) 2024 Samuel Jimenez <therealsamueljimenez@gmail.com>
Ported the Luna Plasmoid to Plasma 6.
Copyright 2016 Bill Binder <dxtwjb@gmail.com>
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 3 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 <http://www.gnu.org/licenses/>.
*/
import QtPositioning
import QtQuick
import QtQuick.Controls as QtControls
import QtQuick.Dialogs as QtDialogs
import QtQuick.Layouts as QtLayouts
import org.kde.kcmutils as KCM
import org.kde.kirigami as Kirigami
import org.kde.plasma.plasma5support as Plasma5Support
KCM.SimpleKCM {
id: generalPage
property int cfg_currentPhase: 0 // Degrees: 0= new moon, 90= first quarter, 180= full moon, 270= third quarter
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 bool cfg_transparentShadow: true // boolean
property real cfg_shadowOpacity: 0.9 // real in [0,1]
property alias cfg_diskColor: lunaPreview.diskColor
property int cfg_lunarIndex: 0 // index into imageChoices
property string cfg_lunarImage: '' // filename (from imageChoices)
property int cfg_lunarImageTweak: 0 // rotation angle adjustment for the image (from imageChoices)
property alias cfg_showShadow: showShadow.checked
property alias cfg_showGrid: showGrid.checked
property alias cfg_showTycho: showTycho.checked
property alias cfg_showCopernicus: showCopernicus.checked
onCfg_lunarIndexChanged: {
cfg_lunarImage = imageChoices.get(cfg_lunarIndex).filename;
cfg_lunarImageTweak = imageChoices.get(cfg_lunarIndex).tweak;
}
PositionSource {
id: geoSource
readonly property bool locating: geoSource.active && geoSource.sourceError == PositionSource.NoError && !(geoSource.position.latitudeValid)
updateInterval: 3600 * 1000
active: cfg_latitudeAuto
onPositionChanged: {
cfg_latitude = Math.round(geoSource.position.coordinate.latitude);
}
}
ImageChoices {
id: imageChoices
}
QtDialogs.ColorDialog {
id: colorDialog
options: QtDialogs.ColorDialog.ShowAlphaChannel
title: i18n("Moon color")
visible: false
selectedColor: cfg_diskColor
onAccepted: cfg_diskColor = selectedColor
}
QtLayouts.ColumnLayout {
spacing: 5
QtLayouts.Layout.fillWidth: true
QtControls.Frame {
QtLayouts.Layout.fillWidth: true
QtLayouts.Layout.alignment: Qt.AlignTop
QtLayouts.GridLayout {
anchors.fill: parent
columns: 2
rowSpacing: 0
QtLayouts.Layout.alignment: Qt.AlignTop
QtControls.Label {
text: i18n("Preview")
font.bold: true
QtLayouts.Layout.alignment: Qt.AlignTop
}
QtLayouts.RowLayout {
spacing: 20
QtLayouts.Layout.alignment: Qt.AlignLeft
QtControls.Button {
id: previousButton
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: hovered
QtControls.ToolTip.text: i18n("Previous Image")
icon.source: "go-previous"
enabled: cfg_lunarIndex > 0
onClicked: {
cfg_lunarIndex -= 1;
}
}
LunaIcon {
id: lunaPreview
width: 200
height: 200
latitude: cfg_latitude
theta: cfg_currentPhase
showShadow: cfg_showShadow
transparentShadow: cfg_transparentShadow
shadowOpacity: cfg_shadowOpacity
lunarImage: cfg_lunarImage
lunarImageTweak: cfg_lunarImageTweak
diskColor: cfg_diskColor
showGrid: cfg_showGrid
showTycho: cfg_showTycho
showCopernicus: cfg_showCopernicus
MouseArea {
anchors.fill: parent
visible: cfg_lunarImage === ""
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: visible && hovered
QtControls.ToolTip.text: i18n("Pick Color")
onClicked: {
colorDialog.visible = true;
}
}
}
QtControls.Button {
id: nextButton
QtControls.ToolTip.delay: 250
QtControls.ToolTip.timeout: 5000
QtControls.ToolTip.visible: hovered
QtControls.ToolTip.text: i18n("Next Image")
icon.source: "go-next"
enabled: cfg_lunarIndex < imageChoices.count - 1
onClicked: {
cfg_lunarIndex += 1;
}
}
QtLayouts.ColumnLayout {
spacing: 20
QtControls.CheckBox {
id: showShadow
text: i18n("Show shadow")
}
QtControls.CheckBox {
id: showGrid
text: i18n("Show grid")
}
QtControls.CheckBox {
id: showTycho
text: i18n("Tycho")
}
QtControls.CheckBox {
id: showCopernicus
text: i18n("Copernicus")
}
}
}
}
}
QtLayouts.GridLayout {
columns: 2
rowSpacing: 15
QtLayouts.Layout.fillWidth: true
QtControls.Label {
text: i18n("Latitude")
font.bold: true
lineHeight: 3
}
QtLayouts.ColumnLayout {
spacing: 5
QtLayouts.RowLayout {
spacing: 20
QtControls.Label {
id: lbl_latitude
text: Math.abs(latitude.value) + "º " + (latitude.value < 0 ? "S" : "N")
QtLayouts.Layout.preferredWidth: 40
horizontalAlignment: Text.AlignRight
}
QtControls.Slider {
id: latitude
QtLayouts.Layout.fillWidth: true
from: -90
to: 90
stepSize: 5
onMoved: cfg_latitudeAuto = false
}
}
QtControls.CheckBox {
id: latitudeAuto
text: i18n("Use current latitude")
}
}
}
}
}
/**
Copyright (C) 2024 Samuel Jimenez <therealsamueljimenez@gmail.com>
Ported the Luna Plasmoid to Plasma 6.
Copyright 2016 Bill Binder <dxtwjb@gmail.com>
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 3 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 <http://www.gnu.org/licenses/>.
*/
import QtPositioning
import QtQuick
import QtQuick.Controls as QtControls
import QtQuick.Dialogs as QtDialogs
import QtQuick.Layouts as QtLayouts
import org.kde.kcmutils as KCM
import org.kde.kirigami as Kirigami
import org.kde.plasma.plasma5support as Plasma5Support
KCM.SimpleKCM {
id: generalPage
property alias cfg_dateFormat: dateFormat.currentIndex // code: 0= 1= 2=...
property alias cfg_dateFormatString: dateFormatString.text
QtLayouts.ColumnLayout {
spacing: 5
QtLayouts.Layout.fillWidth: true
QtLayouts.GridLayout {
columns: 2
rowSpacing: 15
QtLayouts.Layout.fillWidth: true
QtControls.Label {
text: i18n("Date Format")
font.bold: true
}
QtControls.ComboBox {
id: dateFormat
QtLayouts.Layout.fillWidth: true
textRole: "key"
model: ListModel {
dynamicRoles: true
Component.onCompleted: {
append({
"key": i18n("Text date"),
"value": 0
});
append({
"key": i18n("Short date"),
"value": 1
});
append({
"key": i18n("Long date"),
"value": 2
});
append({
"key": i18n("ISO date"),
"value": 3
});
append({
"key": i18n("Custom"),
"value": 4
});
}
}
}
QtControls.Label {
text: i18n("Date Format String")
visible: dateFormat.currentIndex == 4
}
QtControls.TextField {
id: dateFormatString
maximumLength: 24
visible: dateFormat.currentIndex == 4
}
}
}
}
...@@ -40,9 +40,17 @@ PlasmoidItem { ...@@ -40,9 +40,17 @@ PlasmoidItem {
property int maximumHeight property int maximumHeight
property int preferredWidth property int preferredWidth
property int preferredHeight property int preferredHeight
property var currentPhase property var currentPhase: {
terminator:
plasmoid.configuration.currentPhase;
text:
plasmoid.configuration.currentPhaseText;
subText:
plasmoid.configuration.currentPhaseSubText;
}
property bool showBackground: plasmoid.configuration.showBackground property bool showBackground: plasmoid.configuration.showBackground
property bool transparentShadow: plasmoid.configuration.transparentShadow property bool transparentShadow: plasmoid.configuration.transparentShadow
property real shadowOpacity: plasmoid.configuration.shadowOpacity
property int latitude: plasmoid.configuration.latitude property int latitude: plasmoid.configuration.latitude
property int dateFormat: plasmoid.configuration.dateFormat property int dateFormat: plasmoid.configuration.dateFormat
property string dateFormatString: plasmoid.configuration.dateFormatString property string dateFormatString: plasmoid.configuration.dateFormatString
...@@ -67,6 +75,7 @@ PlasmoidItem { ...@@ -67,6 +75,7 @@ PlasmoidItem {
function updateDetails() { function updateDetails() {
// set the correct image for the moon // set the correct image for the moon
currentPhase = LunaCalc.getCurrentPhase(true); currentPhase = LunaCalc.getCurrentPhase(true);
plasmoid.configuration.currentPhase = currentPhase.terminator;
lunaIcon.phaseNumber = 13; //currentPhase.number; lunaIcon.phaseNumber = 13; //currentPhase.number;
lunaIcon.theta = currentPhase.terminator; lunaIcon.theta = currentPhase.terminator;
lunaIcon.latitude = latitude; lunaIcon.latitude = latitude;
...@@ -98,12 +107,13 @@ PlasmoidItem { ...@@ -98,12 +107,13 @@ PlasmoidItem {
lunarImage: main.lunarImage lunarImage: main.lunarImage
lunarImageTweak: main.lunarImageTweak lunarImageTweak: main.lunarImageTweak
transparentShadow: main.transparentShadow transparentShadow: main.transparentShadow
shadowOpacity: main.shadowOpacity
diskColor: main.diskColor diskColor: main.diskColor
anchors.fill: parent anchors.fill: parent
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: plasmoid.expanded = !plasmoid.expanded onClicked: expanded = !expanded
} }
} }
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -5,6 +5,7 @@ layout(std140, binding = 0) uniform buf { ...@@ -5,6 +5,7 @@ layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix; mat4 qt_Matrix;
float qt_Opacity; float qt_Opacity;
int transparent; int transparent;
float shadow_Opacity;
}; };
layout(binding = 1) uniform sampler2D source; layout(binding = 1) uniform sampler2D source;
...@@ -13,12 +14,10 @@ layout(binding = 3) uniform sampler2D mask; ...@@ -13,12 +14,10 @@ layout(binding = 3) uniform sampler2D mask;
void main() { void main() {
fragColor = vec4( fragColor = vec4(
((1 - transparent)* texture(source, qt_TexCoord0) * (1- texture(shadow, qt_TexCoord0)) ((1 - transparent) * texture(source, qt_TexCoord0) * (1 - shadow_Opacity * texture(shadow, qt_TexCoord0))
+ transparent * texture(source, qt_TexCoord0)).rgb, + transparent * texture(source, qt_TexCoord0)).rgb,
texture(source, qt_TexCoord0).a) texture(source, qt_TexCoord0).a)
* texture(mask, qt_TexCoord0).a * texture(mask, qt_TexCoord0).a
* (1 - texture(shadow, qt_TexCoord0).a * transparent) * (1 - shadow_Opacity * texture(shadow, qt_TexCoord0).a * transparent)
* qt_Opacity ; * qt_Opacity ;
} }
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