kde-widget/com.umorist47.meowrelaygui/contents/ui/Compact.qml
2026-03-17 02:26:01 +03:00

128 lines
4.5 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import org.kde.kirigami as Kirigami
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components as PlasmaComponents
import org.kde.plasma.extras as PlasmaExtras
import org.kde.plasma.plasmoid
Item{
Layout.minimumWidth: govnoLayout.implicitWidth
Layout.minimumHeight: Kirigami.Units.iconSizes.medium
Layout.maximumWidth: govnoLayout.implicitWidth
Layout.maximumHeight: Layout.minimumHeight
Layout.preferredWidth: govnoLayout.implicitWidth
Layout.preferredHeight: Layout.minimumHeight
MouseArea {
id: mouseArea
//property bool wasExpanded
Accessible.name: Plasmoid.title
Accessible.role: Accessible.Button
//Accessible.description: desc
//onPressed: wasExpanded = root.expanded
//onClicked: root.expanded = !wasExpanded
onClicked: Plasmoid.activated();
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Space:
case Qt.Key_Enter:
case Qt.Key_Return:
case Qt.Key_Select:
Plasmoid.activated();
break;
}
}
// иконки не будет без этой залупы
anchors.fill: parent
//anchors.leftMargin: 0
activeFocusOnTab: true
hoverEnabled: true
Component {
id: meowIconComponent
Kirigami.Icon {
Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5
Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
Layout.alignment: Qt.AlignVCenter
source: Qt.resolvedUrl("../images/dogfood.svg")
isMask: true
active: mouseArea.containsMouse
}
}
Component {
id: genericLabelComponent
Label {
property string labelText: "yaebalrot"
text: labelText === "yaebalrot" ? "" : labelText
color: text === "error" ? "red" : Kirigami.Theme.textColor
font.pixelSize: (parent.height * 0.6) // Responsive sizing
Layout.fillHeight: true
verticalAlignment: Text.AlignVCenter
}
}
property var configArray: Plasmoid.configuration.ExtraLayout === true ? Plasmoid.configuration.StringLayoutPlacement.split(" ") : ["meow_icon"]
RowLayout {
id: govnoLayout
anchors.fill: parent
//spacing: Kirigami.Units.smallSpacing
spacing: 0
Repeater {
model: mouseArea.configArray
Row {
id: entryWrapper
Layout.fillHeight: true
spacing: 0
// спс гемини
Item {
width: Kirigami.Units.smallSpacing // Adjust size as needed
height: parent.height
visible: modelData !== "meow_icon" &&
(index === 0 || mouseArea.configArray[index - 1] !== "meow_icon")
}
Loader {
id: govnoebanoe
height: parent.height
// Logic to choose WHICH component to spawn
sourceComponent: (modelData === "meow_icon") ? meowIconComponent : genericLabelComponent
// Logic to pass DATA to that component
Binding {
target: govnoebanoe.item // The Label we just created
property: "labelText" // The property on the Label
value: root[modelData] // The live variable in root
when: govnoebanoe.status === Loader.Ready && modelData !== "meow_icon"
}
//Layout.fillHeight: true
}
Item {
width: Kirigami.Units.smallSpacing // Adjust size as needed
height: parent.height
visible: modelData !== "meow_icon" &&
(index === mouseArea.configArray.length - 1)
}
}
}
}
// Kirigami.Icon {
// anchors.fill: parent
// source: Qt.resolvedUrl("../images/dogfood.svg")
// isMask: true
// active: mouseArea.containsMouse
// }
}
}