diff options
author | Frederick Yin <fkfd@fkfd.me> | 2022-04-05 11:25:57 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2022-04-05 11:25:57 +0800 |
commit | dc920a81f58d745be895817d136b144c1665481b (patch) | |
tree | cf55d9afb3a986803dc32f2f5f22d777d76a5b2e |
Initial commit
-rw-r--r-- | contents/ui/main.qml | 67 | ||||
-rw-r--r-- | metadata.desktop | 22 |
2 files changed, 89 insertions, 0 deletions
diff --git a/contents/ui/main.qml b/contents/ui/main.qml new file mode 100644 index 0000000..c78ba5e --- /dev/null +++ b/contents/ui/main.qml @@ -0,0 +1,67 @@ +import QtQuick 2.15 +import QtQuick.Layouts 1.15 +import QtQuick.Controls 2.15 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 3.0 as PlasmaComponents3 +import org.kde.plasma.extras 2.0 as PlasmaExtras + +Item { + width: PlasmaCore.Units.gridUnit * 20 + height: PlasmaCore.Units.gridUnit * 40 + + function syncCanvas() { + // TODO: networking + for (let i = 0; i < 8; i++) { + announcementsModel.append({course: `VZ${i}01`, title: "Something"}) + } + } + + Timer { + interval: 60 * 1000 + running: true; + repeat: true; + onTriggered: syncCanvas(); + } + + ColumnLayout { + id: main + anchors.fill: parent + + PlasmaExtras.Heading { + level: 1 + text: "Kanvas" + } + + PlasmaExtras.Heading { + level: 2 + text: "Announcements" + } + + ListModel { + id: announcementsModel + } + + ScrollView { + implicitHeight: PlasmaCore.Units.gridUnit * 20 + Layout.margins: PlasmaCore.Units.smallSpacing + Layout.fillWidth: true + Layout.fillHeight: true + ListView { + Layout.fillWidth: true + delegate: Text { + text: `[${course}] ${title}` + color: PlasmaCore.Theme.textColor + } + model: announcementsModel + } + } + + PlasmaComponents3.Button { + icon.name: "view-refresh" + text: i18n("Refresh") + onClicked: syncCanvas() + } + } +} diff --git a/metadata.desktop b/metadata.desktop new file mode 100644 index 0000000..0d84648 --- /dev/null +++ b/metadata.desktop @@ -0,0 +1,22 @@ +[Desktop Entry] +Comment=Canvas LMS on your desktop +Comment[x-test]=xxCanvas LMS on your desktopxx +Comment[zh_CN]=桌面上的 Canvas +Comment[zh_TW]=桌面上的 Canvas +Name=Kanvas +Name[zh_CN]=Kanvas +Name[zh_TW]=Kanvas + +Type=Application + +X-KDE-PluginInfo-Author=Frederick Yin +X-KDE-PluginInfo-Category=Online Services +X-KDE-PluginInfo-Email=fkfd@fkfd.me +X-KDE-PluginInfo-License=TBD +X-KDE-PluginInfo-Name=me.fkfd.kanvas +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://fkfd.me/ +X-KDE-ServiceTypes=Plasma/Applet + +X-Plasma-API=declarativeappletscript +X-Plasma-MainScript=ui/main.qml |