Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore

This file was deleted.

24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,34 @@

This plasmoid displays the current phase of the moon.

If you click on it, a dialog appears which shows the dates of the important moon
If you click on it, a dialog appears which shows the dates of the important moon
phases in the same month (last new moon, first quarter, full moon, third quarter
and next new moon).

The format in which these dates are shown can be customized.

You can navigate to previous or future moon phases by clicking the arrow buttons or by
pressing the arrow keys. Clicking the middle button or pressing the "Home" key
You can navigate to previous or future moon phases by clicking the arrow buttons or by
pressing the arrow keys. Clicking the middle button or pressing the "Home" key
returns to the current dates.

This is a port to Plasma 5 of:
This is a port to Plasma 6 of:

* Luna QML
* Version 1.4
* <https://store.kde.org/p/1002036/>

## Installation

Currently, the existing installation tools need updating.

Alternatively, you can copy the contents of the `package` directory to `$HOME/.local/share/plasma/plasmoids/org.kde.userbase.plasma.luna-ii/`.

## Development

In order to test the applet during development, install the `plasma-sdk` package.

Then, run the applet with:

```
$ plasmoidviewer -a <path-to-repository>/package/ -l topedge -f horizontal
```
4 changes: 2 additions & 2 deletions package/contents/config/config.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.1
import QtQuick

import org.kde.plasma.configuration 2.0
import org.kde.plasma.configuration

ConfigModel {
ConfigCategory {
Expand Down
2 changes: 1 addition & 1 deletion package/contents/ui/ImageChoices.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.1 as QtQuick
import QtQuick as QtQuick

/*lunarIndex
Defines the list of images of the moon.
Expand Down
42 changes: 19 additions & 23 deletions package/contents/ui/LunaIcon.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

*/

import QtQuick 2.1
import QtGraphicalEffects 1.12
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import QtQuick
import Qt5Compat.GraphicalEffects as GE
import org.kde.ksvg as KSvg
import org.kde.plasma.plasmoid

import "../code/shadowcalcs.js" as ShadowCalcs

Expand All @@ -44,25 +44,21 @@ Item {
// Degrees. 0= new moon, 90= first quarter, 180= full moon, 270= third quarter
property int theta: 45

PlasmaCore.Svg {
id: lunaSvg
imagePath: lunarImage === '' ? '' : plasmoid.file("data", lunarImage)
}

PlasmaCore.SvgItem {
KSvg.SvgItem {
id: lunaSvgItem
visible: false
visible: false

anchors.centerIn: parent
width: Math.min(parent.width, parent.height)
height: Math.min(parent.width, parent.height)

svg: lunaSvg
// TODO: KF6. How to find and load the svg images??
imagePath: Qt.resolvedUrl(`../data/${lunarImage}`)

// Rotation to compensate the moon's image basic position to a north pole view
// FIXME: Somehow it does not work when applied to OpacityMask or Blend
transformOrigin: Item.Center
rotation: -lunarImageTweak
rotation: -lunarImageTweak
}

Canvas {
Expand Down Expand Up @@ -101,11 +97,18 @@ Item {
context.globalAlpha = 0.9
context.fillStyle = '#000000'

//console.log("Angle: " + theta.toString())

var ct = Math.cos(theta/180*Math.PI)
var radius = ShadowCalcs.setup(Math.floor(shadow.height/2))

//console.log("radius: " + radius.toString())

function radians(deg) {
return deg / 180.0 * Math.PI;
}

function marker(latitude,longitude) {
function marker(latitude, longitude) {
var dy = radius * Math.sin(radians(latitude))
var dx = radius * Math.cos(radians(latitude)) * Math.sin(radians(longitude))
//console.log("dx: " + dx.toString())
Expand Down Expand Up @@ -142,13 +145,6 @@ Item {
context.stroke()
}

//console.log("Angle: " + theta.toString())

var ct = Math.cos(theta/180*Math.PI)
var radius = ShadowCalcs.setup(Math.floor(shadow.height/2))

//console.log("radius: " + radius.toString())

context.translate(radius,radius)

// These two determine which side of the centre meridan to draw
Expand Down Expand Up @@ -196,7 +192,7 @@ Item {
}

// Shadow acts as a transparecy mask
OpacityMask {
GE.OpacityMask {
anchors.fill: lunaSvgItem
source: lunaSvgItem
maskSource: shadow
Expand All @@ -206,7 +202,7 @@ Item {
}

// Shadow is printed on top of the moon image
Blend {
GE.Blend {
anchors.fill: lunaSvgItem
source: lunaSvgItem
foregroundSource: shadow
Expand Down
14 changes: 7 additions & 7 deletions package/contents/ui/LunaWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

*/

import QtQuick 2.7
import QtQuick.Layouts 1.2 as QtLayouts
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.plasmoid 2.0
import QtQuick
import QtQuick.Layouts as QtLayouts
import org.kde.plasma.components as PlasmaComponents
import org.kde.plasma.plasmoid

import "../code/phases.js" as Phases
import "../code/lunacalc.js" as LunaCalc
Expand Down Expand Up @@ -152,17 +152,17 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.ToolButton {
id: previousButton
iconSource: "go-previous"
icon.name: "go-previous"
onClicked: showPreviousPhases();
}
PlasmaComponents.ToolButton {
id: todayButton
iconSource: "go-jump-today"
icon.name: "go-jump-today"
onClicked: showTodayPhases();
}
PlasmaComponents.ToolButton {
id: nextButton
iconSource: "go-next"
icon.name: "go-next"
onClicked: showNextPhases();
}
}
Expand Down
23 changes: 11 additions & 12 deletions package/contents/ui/configGeneral.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.1
import QtQuick.Controls 1.2 as QtControls
import QtQuick.Layouts 1.2 as QtLayouts
import QtQuick.Dialogs 1.0 as QtDialogs
import QtQuick
import QtQuick.Controls as QtControls
import QtQuick.Layouts as QtLayouts
import QtQuick.Dialogs as QtDialogs

import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components as PlasmaComponents
import org.kde.plasma.plasma5support as P5Support


Item {
Expand Down Expand Up @@ -61,7 +61,7 @@ Item {
id: imageChoices
}

PlasmaCore.DataSource {
P5Support.DataSource {
id: geoSource
engine: "geolocation"
connectedSources: ["location"]
Expand Down Expand Up @@ -94,7 +94,7 @@ Item {

PlasmaComponents.ToolButton {
id: previousButton
iconSource: "go-previous"
icon.name: "go-previous"
enabled: cfg_lunarIndex > 0
onClicked: {
cfg_lunarIndex -= 1
Expand All @@ -118,7 +118,7 @@ Item {

PlasmaComponents.ToolButton {
id: nextButton
iconSource: "go-next"
icon.name: "go-next"
enabled: cfg_lunarIndex < imageChoices.count-1
onClicked: {
cfg_lunarIndex += 1
Expand Down Expand Up @@ -184,10 +184,9 @@ Item {
QtControls.Slider {
id: latitude
QtLayouts.Layout.fillWidth: true
minimumValue: -90.0
maximumValue: 90.0
from: -90.0
to: 90.0
stepSize: 5.0
tickmarksEnabled: true
enabled: !cfg_latitudeAuto
}
}
Expand Down
25 changes: 11 additions & 14 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@

*/

import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import QtQuick.Layouts 1.2 as QtLayouts
import QtQuick.Controls 1.2 as QtControls
import org.kde.plasma.components 2.0 as PlasmaComponents
import QtQuick
import org.kde.plasma.plasmoid
import QtQuick.Layouts as QtLayouts

import "../code/phases.js" as Phases
import "../code/lunacalc.js" as LunaCalc

Item {
PlasmoidItem {
id: main
property int minimumWidth
property int minimumHeight
Expand All @@ -50,13 +47,13 @@ Item {
property int lunarImageTweak: 0

Plasmoid.backgroundHints: showBackground ? "DefaultBackground" : "NoBackground"
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation

Plasmoid.icon: ""
Plasmoid.toolTipMainText: currentPhase.text
Plasmoid.toolTipSubText: currentPhase.subText

Plasmoid.compactRepresentation: Item {
preferredRepresentation: compactRepresentation
toolTipMainText: currentPhase.text
toolTipSubText: currentPhase.subText

compactRepresentation: Item {
id: compact

property int latitude: main.latitude
Expand Down Expand Up @@ -104,13 +101,13 @@ Item {

MouseArea {
anchors.fill: parent
onClicked: plasmoid.expanded = !plasmoid.expanded
onClicked: main.expanded = !main.expanded
}
}

}

Plasmoid.fullRepresentation: Item {
fullRepresentation: Item {
id: full

QtLayouts.Layout.preferredWidth: lunaWidget.QtLayouts.Layout.minimumWidth
Expand Down
79 changes: 0 additions & 79 deletions package/metadata.desktop

This file was deleted.

Loading