Initial commit

This commit is contained in:
Kai Folf 2023-04-07 19:32:08 +07:00
commit 5c01b363c0
No known key found for this signature in database
29 changed files with 118 additions and 0 deletions

View file

1
contents/config/main.xml Normal file
View file

@ -0,0 +1 @@

BIN
contents/images/hello/0.png Normal file

Binary file not shown.

After

(image error) Size: 7.8 KiB

BIN
contents/images/hello/1.png Normal file

Binary file not shown.

After

(image error) Size: 7.8 KiB

BIN
contents/images/hello/2.png Normal file

Binary file not shown.

After

(image error) Size: 7.8 KiB

BIN
contents/images/hello/3.png Normal file

Binary file not shown.

After

(image error) Size: 7.9 KiB

BIN
contents/images/idle/0.png Normal file

Binary file not shown.

After

(image error) Size: 7.8 KiB

BIN
contents/images/idle/1.png Normal file

Binary file not shown.

After

(image error) Size: 8.2 KiB

BIN
contents/images/idle/2.png Normal file

Binary file not shown.

After

(image error) Size: 8.2 KiB

BIN
contents/images/idle/3.png Normal file

Binary file not shown.

After

(image error) Size: 8.3 KiB

BIN
contents/images/idle/4.png Normal file

Binary file not shown.

After

(image error) Size: 8.2 KiB

BIN
contents/images/idle/5.png Normal file

Binary file not shown.

After

(image error) Size: 8.3 KiB

BIN
contents/images/idle/6.png Normal file

Binary file not shown.

After

(image error) Size: 8.2 KiB

BIN
contents/images/idle/7.png Normal file

Binary file not shown.

After

(image error) Size: 8.2 KiB

BIN
contents/images/talk/0.png Normal file

Binary file not shown.

After

(image error) Size: 9 KiB

BIN
contents/images/talk/1.png Normal file

Binary file not shown.

After

(image error) Size: 12 KiB

BIN
contents/images/talk/1.png~ Normal file

Binary file not shown.

After

(image error) Size: 9.3 KiB

BIN
contents/sounds/0.wav Normal file

Binary file not shown.

BIN
contents/sounds/1.wav Normal file

Binary file not shown.

BIN
contents/sounds/2.wav Normal file

Binary file not shown.

BIN
contents/sounds/3.wav Normal file

Binary file not shown.

BIN
contents/sounds/4.wav Normal file

Binary file not shown.

BIN
contents/sounds/5.wav Normal file

Binary file not shown.

BIN
contents/sounds/6.wav Normal file

Binary file not shown.

BIN
contents/sounds/7.wav Normal file

Binary file not shown.

View file

92
contents/ui/main.qml Normal file
View file

@ -0,0 +1,92 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import QtMultimedia 5.15
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
Item {
Plasmoid.backgroundHints: "NoBackground"
Plasmoid.fullRepresentation: Item {
Layout.minimumWidth: 100
Layout.minimumHeight: 100
Layout.preferredWidth: 200
Layout.preferredHeight: 200
property int imageIndex: 0
property int talkIndex: 0
property int soundIndex: 0
property bool isIdle: true
Item {
width: Math.min(parent.width, parent.height)
height: Math.min(parent.width, parent.height)
Image {
id: idle
anchors.fill: parent
source: "../images/idle/" + imageIndex + ".png"
visible: isIdle
}
Image {
id: hello
anchors.fill: parent
source: "../images/hello/" + (imageIndex%4) + ".png"
visible: !isIdle
}
Image {
id: talk
width: parent.width
height: parent.height
anchors.right: idle.left
anchors.rightMargin: -60
anchors.bottom: idle.top
anchors.bottomMargin: -60
source: "../images/talk/" + (talkIndex) + ".png"
visible: !isIdle
}
Timer {
interval: 100
running: true
repeat: true
onTriggered: {
// Loop 0 to 7
imageIndex = (imageIndex + 1) % 8
// Loop 0 to 1, change every 8 frames
talkIndex = imageIndex == 0 ? !talkIndex : talkIndex
}
}
Timer {
id: idleTimer
interval: 1600
running: false
repeat: false
onTriggered: {
// Set to idle
imageIndex = 0
isIdle = true
}
}
MediaPlayer {
id: mediaplayer
source: "../sounds/" + soundIndex + ".wav"
}
MouseArea {
anchors.fill: parent
onClicked: {
// Set to hello
isIdle = false
idleTimer.restart()
// Play sound
soundIndex = (soundIndex + 1) % 8
mediaplayer.play()
}
}
}
}
}

BIN
icon.png Normal file

Binary file not shown.

After

(image error) Size: 72 KiB

25
metadata.json Normal file
View file

@ -0,0 +1,25 @@
{
"KPlugin": {
"Authors": [
{
"Email": "git@fcd.im",
"Name": "Kai Folf"
}
],
"Category": "Fun and Games",
"Description": "The Sharkle widget, as featured in Night in the Woods, now on KDE Plasma!",
"Icon": "./icon.png",
"Id": "im.fcd.sharkle",
"License": "MIT",
"Name": "Sharkle",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "1.0",
"Website": "https://github.com/folfcoder/plasma-sharkle"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml",
"KPackageStructure": "Plasma/Applet",
"X-Plasma-StandAloneApp": true
}