Beginning to make JLearner Work and a bit of Code clean up

This commit is contained in:
Hannes
2026-03-06 21:19:55 +01:00
parent 10e2a14e14
commit 47a0e11088
11 changed files with 343 additions and 9 deletions
+1
View File
@@ -82,6 +82,7 @@ declare -A MAP=(
["nemo"]="󰉋"
["org.gnome.Nautilus"]="󰉋"
["org.kde.dolphin"]="󰉋"
["xdg-desktop-portal-gtk"]="󰉋"
# Settings
["nwg-look"]="" # gtk-settings
["qt5ct"]=""
+1 -1
View File
@@ -39,7 +39,7 @@ MouseArea {
stdout: StdioCollector {
onStreamFinished: {
output.text = this.text.trim()
console.log("networkScript output:", this.text.trim())
// console.log("networkScript output:", this.text.trim())
}
}
}
+3 -3
View File
@@ -125,7 +125,7 @@ Row { // Workspace Row
triggeredOnStart: true
onTriggered: {
let src = modelData.icon;
console.log("########## icon: " + modelData.icon)
// console.log("########## icon: " + modelData.icon)
// Check if there is a "?" in the URL (custom path)
if (src.includes('goxlr')) {
@@ -136,8 +136,8 @@ Row { // Workspace Row
// Build a file:// URL pointing to the actual icon file
let segments = folderPath.split('/');
let fileName = segments[segments.length - 1] + "-icon.png";
console.log("########## filename: " + fileName)
console.log("########## icon: " + modelData.icon)
// console.log("########## filename: " + fileName)
// console.log("########## icon: " + modelData.icon)
src = "file://" + pathMatch[1] + "/" + fileName;
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ Row { // Workspace Row
stdout: StdioCollector {
onStreamFinished: {
workspaceNum.text = this.text
console.log("networkScript output:", this.text)
// console.log("workspaceScript output:", this.text)
}
}
}
+41 -1
View File
@@ -5,6 +5,7 @@ import Quickshell.Wayland
import Quickshell.Hyprland
import Quickshell.Io
import "../../colors"
import "./modules"
PanelWindow {
id: learner
@@ -18,7 +19,7 @@ PanelWindow {
id: jLearnerScope
focus: true
Keys.onReleased: {
Keys.onReleased: function(event) {
if (event.key === Qt.Key_Escape) {
console.log("Pressed Escape, closing JLearner")
jLearnerLoader.active = false
@@ -40,5 +41,44 @@ PanelWindow {
border.color: Colors.outlineVariant
clip: true
Column {
id: window
anchors.fill: parent
spacing: 10
Rectangle {
id: head
width: window.width
height: window.height * 0.1
color: "#FFFFFF"
Text {
text: "Language Learner"
anchors.centerIn: parent
font.pixelSize: 48
color: "black"
}
}
function switch_KanaVoicing() {
languageChooser.visible = false
kanaVoicing.visible = true
}
function switchModeChooser() {
languageChooser.visible = true
kanaVoicing.visible = false
}
ModeChooser {
id: languageChooser
}
KanaVoicing {
id: kanaVoicing
}
}
}
}
+1 -1
View File
@@ -20,8 +20,8 @@ Item { // container, invisible
onPressed: {
// generateThumbs.startDetached()
// generateThumbs.running = true
jLearnerLoader.active = !jLearnerLoader.active
console.log("Pressed Meta+Shift+J (Hyprland global shortcut)")
jLearnerLoader.active = !jLearnerLoader.active
}
}
+80
View File
@@ -0,0 +1,80 @@
import QtQuick
QtObject {
property var kana: [
{ hira: "あ", voice: ["a"], known: true },
{ hira: "い", voice: ["i"], known: true },
{ hira: 'う', voice: ["u"], known: true },
{ hira: 'え', voice: ["e"], known: true },
{ hira: 'お', voice: ["o"], known: true },
{ hira: 'か', voice: ["ka"], known: true },
{ hira: 'が', voice: ["ga"], known: true },
{ hira: 'き', voice: ["ki"], known: true },
{ hira: 'ぎ', voice: ["gi"], known: true },
{ hira: 'く', voice: ["ku"], known: true },
{ hira: 'ぐ', voice: ["gu"], known: true },
{ hira: 'け', voice: ["ke"], known: true },
{ hira: 'げ', voice: ["ge"], known: true },
{ hira: 'こ', voice: ["ko"], known: true },
{ hira: 'ご', voice: ["go"], known: true },
{ hira: 'さ', voice: ["sa"], known: true },
{ hira: 'ざ', voice: ["za"], known: true },
{ hira: 'し', voice: ["si", "shi"], known: true },
{ hira: 'じ', voice: ["zi", "ji"], known: true },
{ hira: 'す', voice: ["su"], known: true },
{ hira: 'ず', voice: ["zu"], known: true },
{ hira: 'せ', voice: ["se"], known: true },
{ hira: 'ぜ', voice: ["ze"], known: true },
{ hira: 'そ', voice: ["so"], known: true },
{ hira: 'ぞ', voice: ["zo"], known: true },
{ hira: 'た', voice: ["ta"], known: true },
{ hira: 'だ', voice: ["da"], known: true },
{ hira: 'ち', voice: ["ti", "shi"], known: true },
{ hira: 'ぢ', voice: ["di", "ji"], known: true },
{ hira: 'つ', voice: ["tu", "tsu"], known: true },
{ hira: 'づ', voice: ["du", "zu"], known: true },
{ hira: 'て', voice: ["te"], known: true },
{ hira: 'で', voice: ["de"], known: true },
{ hira: 'と', voice: ["to"], known: true },
{ hira: 'ど', voice: ["do"], known: true },
{ hira: 'な', voice: ["na"], known: true },
{ hira: 'に', voice: ["ni"], known: true },
{ hira: 'ぬ', voice: ["nu"], known: false },
{ hira: 'ね', voice: ["ne"], known: false },
{ hira: 'の', voice: ["no"], known: false },
{ hira: 'は', voice: ["ha"], known: false },
{ hira: 'ば', voice: ["ba"], known: false },
{ hira: 'ぱ', voice: ["pa"], known: false },
{ hira: 'ひ', voice: ["hi"], known: false },
{ hira: 'び', voice: ["bi"], known: false },
{ hira: 'ぴ', voice: ["pi"], known: false },
{ hira: 'ふ', voice: ["hu"], known: false },
{ hira: 'ぶ', voice: ["bu"], known: false },
{ hira: 'ぷ', voice: ["pu"], known: false },
{ hira: 'へ', voice: ["he"], known: false },
{ hira: 'べ', voice: ["be"], known: false },
{ hira: 'ぺ', voice: ["pe"], known: false },
{ hira: 'ほ', voice: ["ho"], known: false },
{ hira: 'ぼ', voice: ["bo"], known: false },
{ hira: 'ぽ', voice: ["po"], known: false },
{ hira: 'ま', voice: ["ma"], known: false },
{ hira: 'み', voice: ["mi"], known: false },
{ hira: 'む', voice: ["mu"], known: false },
{ hira: 'め', voice: ["me"], known: false },
{ hira: 'も', voice: ["mo"], known: false },
{ hira: 'や', voice: ["ya"], known: false },
{ hira: 'ゆ', voice: ["yu"], known: false },
{ hira: 'よ', voice: ["yo"], known: false },
{ hira: 'ら', voice: ["ra"], known: false },
{ hira: 'り', voice: ["ri"], known: false },
{ hira: 'る', voice: ["ru"], known: false },
{ hira: 'れ', voice: ["re"], known: false },
{ hira: 'ろ', voice: ["ro"], known: false },
{ hira: 'わ', voice: ["wa"], known: false },
{ hira: 'ゐ', voice: ["wi"], known: false },
{ hira: 'ゑ', voice: ["we"], known: false },
{ hira: 'を', voice: ["wo"], known: false },
{ hira: 'ん', voice: ["n"], known: true },
{ hira: 'ゔ', voice: ["vu"], known: false }
]
}
+123
View File
@@ -0,0 +1,123 @@
import QtQuick
import QtQuick.Controls
import "../../../colors"
Item { // Kana_Try
id: kanaVoicing
width: window.width
height: window.height - head.height
anchors.margins: 15
visible: false
Component.onCompleted: {
randomKnownKana()
}
KanaData {
id: kanaData
}
property var currentKana: []
property int roundNum: 0
property int maxRoundNum: 9
function randomKana() {
if (roundNum >= maxRoundNum) {
console.log("Switching back")
roundNum = 0
parent.switchModeChooser()
}
var list = kanaData.kana
currentKana = list[Math.floor(Math.random() * list.length)]
console.log("Round Num: " + roundNum + " - Choosing Kana: " + currentKana.hira)
roundNum = roundNum + 1
}
function randomKnownKana() {
if (roundNum >= maxRoundNum) {
console.log("Switching back")
roundNum = 0
parent.switchModeChooser()
}
var knownList = kanaData.kana.filter(k => k.known)
currentKana = knownList[Math.floor(Math.random() * knownList.length)]
console.log("Round Num: " + roundNum + " - Choosing Kana: " + currentKana.hira)
roundNum = roundNum + 1
}
Column {
anchors.fill: parent
spacing: 10
Rectangle {
id: kanaVoicingTextRectangale
color: "#FFFFFF"
width: parent.width
height: kanaVoicingText.height + parent.spacing/2
Text {
id: kanaVoicingText
text: "Im Spiel"
width: parent.width
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 28
color: "black"
}
}
Row {
width: parent.width
height: parent.height - kanaVoicingTextRectangale.height - parent.spacing
spacing: 15
MouseArea {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
width: (parent.width - parent.spacing) / 2
height: parent.height
onClicked: {
kanaVoicing.randomKnownKana()
}
Rectangle {
anchors.fill: parent
color: "#FFFFFF"
Text {
id: kanaVoicingKana1
text: kanaVoicing.currentKana ? kanaVoicing.currentKana.hira : ""
anchors.centerIn: parent
font.pixelSize: Math.min(parent.width / text.length * 1.2, parent.height * 0.8)
color: "black"
}
}
}
MouseArea {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
width: (parent.width - parent.spacing) / 2
height: parent.height
onClicked: {
kanaVoicing.randomKnownKana()
}
Rectangle {
anchors.fill: parent
color: "#000000"
Text {
id: kanaVoicingKana2
text: kanaVoicing.currentKana ? kanaVoicing.currentKana.hira : ""
anchors.centerIn: parent
font.pixelSize: Math.min(parent.width / text.length * 1.2, parent.height * 0.8)
color: "white"
}
}
}
}
}
}
+90
View File
@@ -0,0 +1,90 @@
import QtQuick
import QtQuick.Controls
import "../../../colors"
Item { // Chooser
id: languageChooser
width: window.width
height: window.height * 0.9
anchors.margins: 15
visible: true
function switch_KanaVoicing() {
parent.switch_KanaVoicing()
}
Column {
anchors.fill: parent
spacing: 10
Rectangle {
id: modeChooserUpperText
color: "#FFFFFF"
width: parent.width
height: mainText.height + parent.spacing/2
Text {
id: mainText
text: "Wähle ein Modus"
width: parent.width
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 28
color: "black"
}
}
Row {
width: parent.width
height: parent.height - modeChooserUpperText.height
spacing: 10
MouseArea {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
width: (parent.width - parent.spacing) / 2
height: parent.height
onClicked: {
console.log("Choosing White Window")
languageChooser.switch_KanaVoicing()
}
Rectangle {
anchors.fill: parent
color: "#FFFFFF"
Text {
text: "Weiß"
anchors.centerIn: parent
font.pixelSize: Math.min(parent.width / text.length * 1.2, parent.height * 0.8)
color: "black"
}
}
}
MouseArea {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
width: (parent.width - parent.spacing) / 2
height: parent.height
onClicked: {
console.log("Choosing Black Window")
languageChooser.switch_KanaVoicing()
}
Rectangle {
anchors.fill: parent
color: "#000000"
Text {
text: "Schwarz"
anchors.centerIn: parent
font.pixelSize: Math.min(parent.width / text.length * 1.2, parent.height * 0.8)
color: "white"
}
}
}
}
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ PanelWindow {
id: pickerScope
focus: true
Keys.onReleased: {
Keys.onReleased: function(event) {
if (event.key === Qt.Key_Escape) {
console.log("Pressed Escape, closing Wallpaper Picker")
wallpaperLoader.active = false
+1 -1
View File
@@ -28,8 +28,8 @@ Item { // container, invisible
onPressed: {
// generateThumbs.startDetached()
generateThumbs.running = true
wallpaperLoader.active = !wallpaperLoader.active
console.log("Pressed Meta+Shift+W (Hyprland global shortcut)")
wallpaperLoader.active = !wallpaperLoader.active
}
}