diff --git a/.gitignore b/.gitignore index 57199135e86ee9fd411cc5c8b3799cd773d42d6a..b12187f5b0b00df5e88c066ff478b7e5af491520 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.kateproject.build *.zip *.plasmoid /build/ diff --git a/package/README b/package/README index a08f9010a6d359cceba878ffb80f3f8156478d56..8e8459d05fad633e9ebcd8266e03c15847560d3b 100644 --- a/package/README +++ b/package/README @@ -24,7 +24,7 @@ A. Command line, installs to ~/local/share/plasma/plasmoids 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 @@ -34,7 +34,6 @@ B. Command line, installs to /usr/local/share/plasma/plasmoids 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 @@ -46,7 +45,6 @@ C. CMake, installs to /usr/local/share/plasma/plasmoids 3. Run: # cmake <path to source dir> 4. Run: # make install - See README_TRANSLATIONS.txt (Step 4) for installing localisations. Custom Date Formats ------------------- diff --git a/package/contents/config/config.qml b/package/contents/config/config.qml index 3010bccfdcafd431d0f96583dfc20f2a44390f44..9f0727ff336ac9802afe4724d3a5deeebafccfdd 100644 --- a/package/contents/config/config.qml +++ b/package/contents/config/config.qml @@ -21,8 +21,20 @@ import org.kde.plasma.configuration ConfigModel { ConfigCategory { name: i18n("General") - icon: "preferences-desktop-user" + icon: "preferences-desktop-default-applications" 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" + } + } diff --git a/package/contents/config/main.xml b/package/contents/config/main.xml index 028db039b9f6821e44be197ad25914f506b0094c..483a32fce9964db3476a024ce265482b834d1f11 100644 --- a/package/contents/config/main.xml +++ b/package/contents/config/main.xml @@ -11,22 +11,43 @@ <entry name="showBackground" type="Bool"> <default>false</default> </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"> <default>true</default> </entry> <entry name="transparentShadow" type="Bool"> <default>false</default> </entry> + <entry name="shadowOpacity" type="double"> + <default>0.9</default> + </entry> <entry name="dateFormat" type="int"> <default>3</default> </entry> <entry name="dateFormatString" type="String"> <default>hh</default> </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"> <default>1</default> </entry> - <entry name="diskColor" type="String"> + <entry name="diskColor" type="Color"> <default>#ffff80</default> </entry> </group> diff --git a/package/contents/ui/LunaIcon.qml b/package/contents/ui/LunaIcon.qml index 90bdb7bc42186300090e6e5c6cd7f8490586b723..3332d07c30b6349a5bc7a53518561b1608b0cbed 100644 --- a/package/contents/ui/LunaIcon.qml +++ b/package/contents/ui/LunaIcon.qml @@ -34,6 +34,7 @@ Item { property int latitude: 90 //Degrees: 0=Equator, 90=North Pole, -90=South Pole property bool showShadow: true property bool transparentShadow: true + property real shadowOpacity: 0.9 property string lunarImage: '' property color diskColor: '#ffffff' property int lunarImageTweak: 0 @@ -86,6 +87,7 @@ Item { visible: true anchors.centerIn: parent preferredRendererType: Shape.CurveRenderer + antialiasing: true ShapePath { fillColor: diskColor @@ -94,8 +96,8 @@ Item { PathAngleArc { centerX: radius centerY: radius - radiusY: radius - radiusX: radius + radiusY: radius - 1 + radiusX: radius - 1 startAngle: 0 sweepAngle: 360 } @@ -212,8 +214,10 @@ Item { if (showShadow) { var cosTheta = Math.cos(theta / 180 * Math.PI); 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.scale(scaleTweak, scaleTweak); if (theta != 180) { context.beginPath(); context.fillStyle = '#ffffff'; @@ -234,16 +238,18 @@ Item { } ShaderEffectSource { + id: lunaMask anchors.centerIn: parent width: lunaBackground.width height: lunaBackground.height visible: false - antialiasing: false + antialiasing: true sourceItem: Shape { opacity: 1 + antialiasing: true width: lunaBackground.width height: lunaBackground.height visible: true @@ -257,8 +263,8 @@ Item { PathAngleArc { centerX: radius centerY: radius - radiusY: radius - radiusX: radius + radiusY: radius - 1 + radiusX: radius - 1 startAngle: 0 sweepAngle: 360 } @@ -274,6 +280,7 @@ Item { property variant shadow: shadow property variant mask: lunaMask property int transparent: transparentShadow + property real shadow_Opacity: shadowOpacity opacity: 1 rotation: latitude - 90 diff --git a/package/contents/ui/LunaWidget.qml b/package/contents/ui/LunaWidget.qml index fc10ad88dcec57e9548a7d8605eba68790c54820..3485c6485bc4da7d7fbdbefcb414778870319cd9 100644 --- a/package/contents/ui/LunaWidget.qml +++ b/package/contents/ui/LunaWidget.qml @@ -170,6 +170,10 @@ Item { icon.source: "go-previous" onClicked: showPreviousPhases() + QtControls.ToolTip.delay: 250 + QtControls.ToolTip.timeout: 5000 + QtControls.ToolTip.visible: hovered + QtControls.ToolTip.text: i18n("Previous Cycle") } PlasmaComponents.ToolButton { @@ -177,6 +181,10 @@ Item { icon.source: "go-jump-today" onClicked: showTodayPhases() + QtControls.ToolTip.delay: 250 + QtControls.ToolTip.timeout: 5000 + QtControls.ToolTip.visible: hovered + QtControls.ToolTip.text: i18n("Today's Cycle") } PlasmaComponents.ToolButton { @@ -184,6 +192,10 @@ Item { icon.source: "go-next" onClicked: showNextPhases() + QtControls.ToolTip.delay: 250 + QtControls.ToolTip.timeout: 5000 + QtControls.ToolTip.visible: hovered + QtControls.ToolTip.text: i18n("Next Cycle") } } diff --git a/package/contents/ui/configGeneral.qml b/package/contents/ui/configGeneral.qml index f2dca5c91e9b301ad312154b6fee66d60a7c8690..ef3a4181e011ff61133b74fc9d0fa9b621727fa8 100644 --- a/package/contents/ui/configGeneral.qml +++ b/package/contents/ui/configGeneral.qml @@ -23,8 +23,6 @@ import QtQuick import QtQuick.Controls as QtControls import QtQuick.Dialogs as QtDialogs 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.kirigami as Kirigami import org.kde.plasma.plasma5support as Plasma5Support @@ -32,28 +30,28 @@ 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 previewPhase: phase.value 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_transparentShadow: transparentShadow.checked // boolean + property alias cfg_shadowOpacity: shadowOpacity.value // real in [0,1] property alias cfg_showBackground: showBackground.checked // boolean - property alias cfg_dateFormat: dateFormat.currentIndex // code: 0= 1= 2=... - property alias cfg_dateFormatString: dateFormatString.text - property alias cfg_diskColor: diskColor.color + 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 + property bool cfg_showGrid: false + property bool cfg_showTycho: false + property bool cfg_showCopernicus: false onCfg_lunarIndexChanged: { cfg_lunarImage = imageChoices.get(cfg_lunarIndex).filename; cfg_lunarImageTweak = imageChoices.get(cfg_lunarIndex).tweak; } Component.onCompleted: { - previewPhase = LunaCalc.getCurrentPhase(true).terminator; + previewPhase = cfg_currentPhase; } PositionSource { @@ -64,7 +62,6 @@ KCM.SimpleKCM { updateInterval: 3600 * 1000 active: cfg_latitudeAuto onPositionChanged: { - // lbl_place.text = i18n(geoSource.data.location.country); cfg_latitude = Math.round(geoSource.position.coordinate.latitude); } } @@ -76,261 +73,248 @@ KCM.SimpleKCM { QtDialogs.ColorDialog { id: colorDialog - title: i18n("Pick a color for the moon") + options: QtDialogs.ColorDialog.ShowAlphaChannel + title: i18n("Moon color") visible: false - selectedColor: diskColor.color - onAccepted: diskColor.color = selectedColor + selectedColor: cfg_diskColor + onAccepted: cfg_diskColor = selectedColor } - QtLayouts.GridLayout { - columns: 2 - rowSpacing: 15 + QtLayouts.ColumnLayout { + spacing: 10 + QtLayouts.Layout.fillWidth: true - QtControls.Label { - text: i18n("Preview") - } - - QtLayouts.RowLayout { - spacing: 20 - - QtControls.Button { - id: previousButton + QtControls.Frame { + QtLayouts.Layout.fillWidth: true + QtLayouts.Layout.alignment: Qt.AlignTop - icon.source: "go-previous" - enabled: cfg_lunarIndex > 0 - onClicked: { - cfg_lunarIndex -= 1; + 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 } - } - - 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 { - id: nextButton + 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: 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 { - spacing: 20 - - QtControls.CheckBox { - id: showShadow - - text: i18n("Show shadow") + QtControls.Label { + text: i18n("Phase Preview") + QtLayouts.Layout.preferredWidth: 85 + horizontalAlignment: Text.AlignRight } - QtControls.CheckBox { - id: showGrid + QtLayouts.RowLayout { + spacing: 20 - text: i18n("Show grid") - } + QtControls.Label { + id: lbl_phase - QtControls.CheckBox { - id: showTycho + text: phase.value + "º " + QtLayouts.Layout.preferredWidth: 40 + horizontalAlignment: Text.AlignRight + } - text: i18n("Tycho") - } + QtControls.Slider { + id: phase - QtControls.CheckBox { - id: showCopernicus + QtLayouts.Layout.fillWidth: true + from: 0 + to: 360 + stepSize: 1 + } - text: i18n("Copernicus") } } } - QtControls.Label { - text: i18n("Phase Preview") - QtLayouts.Layout.preferredWidth: 85 - horizontalAlignment: Text.AlignRight - } - - QtLayouts.RowLayout { - spacing: 20 + QtLayouts.GridLayout { + columns: 2 + rowSpacing: 10 + QtLayouts.Layout.fillWidth: true - QtControls.Label { - id: lbl_phase + QtLayouts.ColumnLayout { + spacing: 10 - text: Math.abs(phase.value) + "º " - QtLayouts.Layout.preferredWidth: 40 - horizontalAlignment: Text.AlignRight - } + QtControls.Label { + text: i18n("Shadow") + horizontalAlignment: Text.AlignCenter + font.bold: true + } - QtControls.Slider { - id: phase + QtControls.Label { + text: i18n("Opacity") + QtLayouts.Layout.preferredWidth: 85 + horizontalAlignment: Text.AlignRight + } - value: lunaPreview.theta - QtLayouts.Layout.fillWidth: true - from: 0 - to: 360 - stepSize: 1 } - } - - QtControls.Label { - text: i18n("Disk Color") - visible: cfg_lunarImage === "" - } - - Rectangle { - id: diskColor + QtLayouts.ColumnLayout { + spacing: 5 + QtLayouts.Layout.fillWidth: true - width: 50 - height: 50 - color: '#808040' - border.color: '#000000' - radius: height / 2 - visible: cfg_lunarImage === "" + QtControls.CheckBox { + id: transparentShadow - MouseArea { - anchors.fill: parent - onClicked: { - colorDialog.selectedColor = diskColor.color; - colorDialog.visible = true; + text: i18n("Transparent") } - } - } + QtLayouts.RowLayout { + spacing: 20 - QtControls.Label { - text: i18n("Latitude") - } - - 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 - } + QtControls.Label { + id: lbl_shadowOpacity - } + text: Math.round(shadowOpacity.value * 100) + "%" + QtLayouts.Layout.preferredWidth: 40 + horizontalAlignment: Text.AlignRight + } - QtControls.Label { - } + QtControls.Slider { + id: shadowOpacity - QtLayouts.RowLayout { - spacing: 20 + QtLayouts.Layout.fillWidth: true + from: 0 + to: 1 + stepSize: 0.05 + } - QtControls.CheckBox { - id: latitudeAuto + } - text: i18n("Use current latitude") } QtControls.Label { - id: lbl_place - - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignRight + text: i18n("Latitude") + font.bold: true + lineHeight: 3 } - } + QtLayouts.ColumnLayout { + spacing: 5 - QtControls.Label { - text: i18n("Date Format") - } + QtLayouts.RowLayout { + spacing: 20 - QtControls.ComboBox { - id: dateFormat + QtControls.Label { + id: lbl_latitude - 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 - }); - } - } + text: Math.abs(latitude.value) + "º " + (latitude.value < 0 ? "S" : "N") + QtLayouts.Layout.preferredWidth: 40 + horizontalAlignment: Text.AlignRight + } - } + QtControls.Slider { + id: latitude - QtControls.Label { - text: i18n("Date Format String") - visible: dateFormat.currentIndex == 4 - } + QtLayouts.Layout.fillWidth: true + from: -90 + to: 90 + stepSize: 5 + onMoved: cfg_latitudeAuto = false + } - QtControls.TextField { - id: dateFormatString + } - maximumLength: 24 - visible: dateFormat.currentIndex == 4 - } + QtControls.CheckBox { + id: latitudeAuto - QtControls.Label { - text: i18n("Background") - } + text: i18n("Use current latitude") + } - QtControls.CheckBox { - id: showBackground + } - text: i18n("Show background") - } + QtControls.Label { + text: i18n("Background") + font.bold: true + } - QtControls.Label { - text: "" - } + QtControls.CheckBox { + id: showBackground - QtControls.CheckBox { - id: transparentShadow + text: i18n("Show background") + } - text: i18n("Transparent shadow") } } diff --git a/package/contents/ui/configImage.qml b/package/contents/ui/configImage.qml new file mode 100644 index 0000000000000000000000000000000000000000..d93fc347ea41a46bd6903a6fd7d3eceb52b931b3 --- /dev/null +++ b/package/contents/ui/configImage.qml @@ -0,0 +1,245 @@ +/** + 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") + } + + } + + } + + } + +} diff --git a/package/contents/ui/configPopup.qml b/package/contents/ui/configPopup.qml new file mode 100644 index 0000000000000000000000000000000000000000..e0c0864df0430e99ac6810adc6c1d3fc4613f110 --- /dev/null +++ b/package/contents/ui/configPopup.qml @@ -0,0 +1,100 @@ +/** + 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 + } + + } + + } + +} diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index 44029092a17db4f34ab8175b80495ecd0250f6ec..060d744a50cfa87589d801e0549f57d0eb655e76 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -40,9 +40,17 @@ PlasmoidItem { property int maximumHeight property int preferredWidth 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 transparentShadow: plasmoid.configuration.transparentShadow + property real shadowOpacity: plasmoid.configuration.shadowOpacity property int latitude: plasmoid.configuration.latitude property int dateFormat: plasmoid.configuration.dateFormat property string dateFormatString: plasmoid.configuration.dateFormatString @@ -67,6 +75,7 @@ PlasmoidItem { function updateDetails() { // set the correct image for the moon currentPhase = LunaCalc.getCurrentPhase(true); + plasmoid.configuration.currentPhase = currentPhase.terminator; lunaIcon.phaseNumber = 13; //currentPhase.number; lunaIcon.theta = currentPhase.terminator; lunaIcon.latitude = latitude; @@ -98,12 +107,13 @@ PlasmoidItem { lunarImage: main.lunarImage lunarImageTweak: main.lunarImageTweak transparentShadow: main.transparentShadow + shadowOpacity: main.shadowOpacity diskColor: main.diskColor anchors.fill: parent MouseArea { anchors.fill: parent - onClicked: plasmoid.expanded = !plasmoid.expanded + onClicked: expanded = !expanded } } diff --git a/package/po/es/plasma_applet_org.kde.userbase.plasma.luna3.po b/package/po/es/plasma_applet_org.kde.userbase.plasma.luna3.po index 4e21b1542714eb52c5d72d14f24c5efb25b24f04..ac15503389271703f03c3e587a5bf5a6eacaa232 100644 Binary files a/package/po/es/plasma_applet_org.kde.userbase.plasma.luna3.po and b/package/po/es/plasma_applet_org.kde.userbase.plasma.luna3.po differ diff --git a/package/po/fr/plasma_applet_org.kde.userbase.plasma.luna3.po b/package/po/fr/plasma_applet_org.kde.userbase.plasma.luna3.po index c47b2f4b5ca5918893c121c196c7b2fde3e4a9ea..c92551acd9be7d5e1e5c04c9a70ec6994f212491 100644 Binary files a/package/po/fr/plasma_applet_org.kde.userbase.plasma.luna3.po and b/package/po/fr/plasma_applet_org.kde.userbase.plasma.luna3.po differ diff --git a/package/po/hr/plasma_applet_org.kde.userbase.plasma.luna3.po b/package/po/hr/plasma_applet_org.kde.userbase.plasma.luna3.po index 731fd2605be06a3abaf2e92fe17580b8ca8acb2e..c7b267253b2f7aae0b1c827be1887e47c3a81eb2 100644 Binary files a/package/po/hr/plasma_applet_org.kde.userbase.plasma.luna3.po and b/package/po/hr/plasma_applet_org.kde.userbase.plasma.luna3.po differ diff --git a/package/po/nl/plasma_applet_org.kde.userbase.plasma.luna3.po b/package/po/nl/plasma_applet_org.kde.userbase.plasma.luna3.po index 7c9ed5f73f9e9cf07b4b2522f3d187a10a293eae..e80bdc16196d6a2759395b8511dc5e2c52906684 100644 Binary files a/package/po/nl/plasma_applet_org.kde.userbase.plasma.luna3.po and b/package/po/nl/plasma_applet_org.kde.userbase.plasma.luna3.po differ diff --git a/package/po/plasma_applet_org.kde.userbase.plasma.luna3.pot b/package/po/plasma_applet_org.kde.userbase.plasma.luna3.pot index d8e1e18b6519ae3ccaed62ea443982a965544ca2..61e692e124bc444c82dff958ab21e3c5ea664f3a 100644 Binary files a/package/po/plasma_applet_org.kde.userbase.plasma.luna3.pot and b/package/po/plasma_applet_org.kde.userbase.plasma.luna3.pot differ diff --git a/package/po/ru/plasma_applet_org.kde.userbase.plasma.luna3.po b/package/po/ru/plasma_applet_org.kde.userbase.plasma.luna3.po index 45210149b97956ea5a44dc97b9a583220f00dffa..4d36e2ce87c2cc72f18eb19981b62d0b365ad549 100644 Binary files a/package/po/ru/plasma_applet_org.kde.userbase.plasma.luna3.po and b/package/po/ru/plasma_applet_org.kde.userbase.plasma.luna3.po differ diff --git a/src/shadow.frag b/src/shadow.frag index 9f0e5d287d85c581044fb044ff83ea97d245d3c1..56a5cf54eb6b65222f4bea04e4834fd6a53714b3 100644 --- a/src/shadow.frag +++ b/src/shadow.frag @@ -5,6 +5,7 @@ layout(std140, binding = 0) uniform buf { mat4 qt_Matrix; float qt_Opacity; int transparent; + float shadow_Opacity; }; layout(binding = 1) uniform sampler2D source; @@ -13,12 +14,10 @@ layout(binding = 3) uniform sampler2D mask; void main() { 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, texture(source, 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 ; } - -