hyprsysteminfo/qml/main.qml

279 lines
7.9 KiB
QML
Raw Normal View History

2024-10-13 17:48:22 +02:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ApplicationWindow {
property var _width: 720
property var _height: 440
2024-10-13 17:48:22 +02:00
property var _first_panel_height: 120
minimumWidth: _width
maximumWidth: _width
width: _width
minimumHeight: _height
maximumHeight: _height
height: _height
visible: true
SystemPalette {
id: system
colorGroup: SystemPalette.Active
}
ColumnLayout {
id: mainLayout
anchors.margins: 4
anchors {
top: parent.top
left: parent.left
right: parent.right
bottom: parent.bottom
}
RowLayout {
// First panel hyprland and distro info
Layout.fillWidth: true
Layout.preferredHeight: _first_panel_height
Layout.alignment: Qt.AlignHCenter
RowLayout {
id: distroLogoName
Layout.preferredWidth: _width / 2 - 40
spacing: 10
Image {
visible: hsi.hasSystemLogoName()
source: "image://systemIcons/" + hsi.getSystemLogoName()
sourceSize.width: _first_panel_height - 10
sourceSize.height: _first_panel_height - 10
Layout.preferredWidth: _first_panel_height - 10
Layout.preferredHeight: _first_panel_height - 10
Layout.alignment: Qt.AlignCenter
smooth: true
}
ColumnLayout {
spacing: 2
Text {
text: hsi.getSystemName()
Layout.alignment: Qt.AlignHCenter
color: system.windowText
}
Text {
text: hsi.getSystemURL()
Layout.alignment: Qt.AlignHCenter
color: system.windowText
}
Text {
text: hsi.getSystemKernel()
Layout.alignment: Qt.AlignHCenter
color: system.windowText
}
}
}
Rectangle {
visible: hsi.hasHyprland()
color: Qt.darker(system.text, 1.5)
Layout.preferredWidth: 1
Layout.preferredHeight: _first_panel_height - 40
Layout.leftMargin: 20
Layout.rightMargin: 20
Layout.alignment: Qt.AlignVCenter
}
RowLayout {
id: hyprlandInfo
visible: hsi.hasHyprland()
Layout.preferredWidth: _width / 2 - 40
spacing: 10
Image {
source: "qrc:/resource/hyprlandlogo.svg"
sourceSize.width: _first_panel_height - 10
sourceSize.height: _first_panel_height - 10
Layout.preferredWidth: _first_panel_height - 10
Layout.preferredHeight: _first_panel_height - 10
Layout.alignment: Qt.AlignCenter
smooth: true
}
ColumnLayout {
spacing: 2
Text {
text: "Hyprland"
Layout.alignment: Qt.AlignHCenter
color: system.windowText
}
Text {
text: hsi.getHyprlandVersion()
Layout.alignment: Qt.AlignHCenter
color: system.windowText
}
Text {
visible: hsi.getHyprlandVersion() != hsi.getHyprlandVersionLong()
2024-10-13 17:48:22 +02:00
text: hsi.getHyprlandVersionLong()
Layout.alignment: Qt.AlignHCenter
color: system.windowText
}
}
}
}
Rectangle {
color: Qt.darker(system.text, 1.5)
Layout.preferredHeight: 1
Layout.fillWidth: true
Layout.leftMargin: 180
Layout.rightMargin: 180
Layout.topMargin: 10
Layout.bottomMargin: 10
}
ColumnLayout {
spacing: 6
Layout.leftMargin: 60
Layout.rightMargin: 60
2024-10-13 22:15:37 +02:00
Text {
2024-10-13 22:37:49 +02:00
visible: hsi.getUserAt().length > 0
2024-10-13 22:15:37 +02:00
text: "User: " + hsi.getUserAt()
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
}
Text {
2024-10-13 22:37:49 +02:00
visible: hsi.getModel().length > 0
2024-10-13 22:15:37 +02:00
text: "Model: " + hsi.getModel()
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
}
2024-10-13 17:48:22 +02:00
Text {
text: "CPU: " + hsi.getCPUInfo()
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
}
2024-10-13 17:54:23 +02:00
Repeater {
model: hsi.getGPUInfoCount()
Text {
required property int index
text: "GPU: " + hsi.getGPUInfo(index)
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
}
2024-10-13 17:48:22 +02:00
}
Text {
text: "Memory: " + hsi.getRAMInfo()
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
2024-10-13 22:15:37 +02:00
}
Text {
text: "DE: " + hsi.getDE()
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
}
Text {
text: "Uptime: " + hsi.getUptime()
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
}
Text {
text: "Displays: " + hsi.getDisplays()
Layout.maximumWidth: _width - 120
color: system.windowText
elide: Text.ElideRight
textFormat: Text.PlainText
wrapMode: Text.NoWrap
2024-10-13 17:48:22 +02:00
}
}
Rectangle {
color: "transparent"
Layout.fillWidth: true
Layout.fillHeight: true
}
Rectangle {
visible: hsi.hasHyprland()
2024-10-13 17:48:22 +02:00
color: Qt.darker(system.text, 1.5)
Layout.preferredHeight: 1
Layout.fillWidth: true
Layout.leftMargin: 180
Layout.rightMargin: 180
Layout.topMargin: 10
Layout.bottomMargin: 10
}
RowLayout {
visible: hsi.hasHyprland()
2024-10-13 17:48:22 +02:00
spacing: 6
Layout.leftMargin: 20
Layout.rightMargin: 20
Button {
text: "Copy Hyprland System Info"
2024-10-13 17:50:24 +02:00
onClicked: (e) => {
hsi.copySystemInfo();
}
2024-10-13 17:48:22 +02:00
}
Button {
text: "Copy Hyprland Version"
2024-10-13 17:50:24 +02:00
onClicked: (e) => {
hsi.copyVersion();
}
2024-10-13 17:48:22 +02:00
}
}
}
}