From f6b4688945aa47d4c4bbbcf70145fbdc6d60cfda Mon Sep 17 00:00:00 2001 From: chatlanin Date: Wed, 25 Nov 2026 13:18:38 +0300 Subject: [PATCH] rename packagelist to updatelist and fix visible preloader --- CMakeLists.txt | 2 +- Main.qml | 1 + qml/components/PreLoader.qml | 3 - qml/lists/PackageList.qml | 104 ----------------------------------- qml/lists/UpdateList.qml | 104 +++++++++++++++++++++++++++++++++++ qml/pages/UpdatePg.qml | 6 +- 6 files changed, 109 insertions(+), 111 deletions(-) create mode 100644 qml/lists/UpdateList.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index 77a1f87..bc32bed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ qt_add_qml_module(apparchpack qml/pages/DeletePg.qml qml/console/ConsoleBar.qml qml/console/ConsolePanel.qml - qml/lists/PackageList.qml + qml/lists/UpdateList.qml qml/lists/ConsoleList.qml qml/dialogs/PasswordDialog.qml SOURCES diff --git a/Main.qml b/Main.qml index 1c822ba..eaa6679 100644 --- a/Main.qml +++ b/Main.qml @@ -87,6 +87,7 @@ ApplicationWindow { id: pgUpdate packageCount: ProcessManager.packageCount status: ProcessManager.status + visiblePreLoader: ProcessManager.status === ProcessManager.Status.Checking packages: ProcessManager.packages onUpdate: { if (ProcessManager.passwordEmpty()) diff --git a/qml/components/PreLoader.qml b/qml/components/PreLoader.qml index 7e7e4fa..97b6e1a 100644 --- a/qml/components/PreLoader.qml +++ b/qml/components/PreLoader.qml @@ -7,14 +7,11 @@ import archpack Item { id: root - property int status: 0 - ColumnLayout { anchors.centerIn: parent spacing: 8 BusyIndicator { - running: root.status != ProcessManager.Status.Null Layout.alignment: Qt.AlignHCenter implicitWidth: 24 implicitHeight: 24 diff --git a/qml/lists/PackageList.qml b/qml/lists/PackageList.qml index 8c5c103..e69de29 100644 --- a/qml/lists/PackageList.qml +++ b/qml/lists/PackageList.qml @@ -1,104 +0,0 @@ -pragma ComponentBehavior: Bound - -import QtQuick -import QtQuick.Layouts -import QtQuick.Controls -import archpack - -Item { - id: root - - property var packages: [] - - ListView { - id: listView - anchors.fill: parent - // свойство, которое обрезает всё содержимое списка по его границам. Без него элементы списка (делегаты) могут визуально «вылезать» за пределы ListView, наезжая на другие элементы интерфейса. - clip: true - spacing: 2 - model: root.packages - - ScrollBar.vertical: ScrollBar { - policy: ScrollBar.AsNeeded - width: 6 - } - - delegate: Rectangle { - id: delegate - width: listView.width - height: 32 - radius: 7 - color: modelData.updating ? "#313244" : "transparent" - - // из-зa предупреждение qmllint - required property var modelData - - Behavior on color { ColorAnimation { duration: 300 } } - - RowLayout { - anchors.fill: parent - anchors.leftMargin: 8 - anchors.rightMargin: 8 - spacing: 8 - - Text { - text: delegate.modelData.name - font.pixelSize: 13 - font.family: "monospace" - color: delegate.modelData.updated ? Theme.color2 : delegate.modelData.updating ? Theme.color7 : Theme.color3 - Layout.fillWidth: true - - Behavior on color { ColorAnimation { duration: 300 } } - } - - Text { - text: delegate.modelData.version - font.pixelSize: 11 - color: Theme.color12 - visible: delegate.modelData.version !== "" - } - - Text { - text: "○" - font.pixelSize: 16 - font.bold: true - color: Theme.color4 - horizontalAlignment: Text.AlignHCenter - Layout.preferredWidth: 18 - Layout.alignment: Qt.AlignVCenter - visible: !delegate.modelData.updating && !delegate.modelData.updated - } - - Text { - text: "⟳" - font.pixelSize: 14 - color: Theme.color7 - horizontalAlignment: Text.AlignHCenter - Layout.preferredWidth: 18 - Layout.alignment: Qt.AlignVCenter - visible: delegate.modelData.updating - - RotationAnimation on rotation { - running: delegate.modelData.updating - loops: Animation.Infinite - from: 0 - to: 360 - duration: 1000 - } - } - - Text { - text: "✓" - font.pixelSize: 16 - font.bold: true - color: Theme.color13 - horizontalAlignment: Text.AlignHCenter - Layout.preferredWidth: 18 - Layout.alignment: Qt.AlignVCenter - visible: delegate.modelData.updated && !delegate.modelData.updating - } - } - } - } -} - diff --git a/qml/lists/UpdateList.qml b/qml/lists/UpdateList.qml new file mode 100644 index 0000000..8c5c103 --- /dev/null +++ b/qml/lists/UpdateList.qml @@ -0,0 +1,104 @@ +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import archpack + +Item { + id: root + + property var packages: [] + + ListView { + id: listView + anchors.fill: parent + // свойство, которое обрезает всё содержимое списка по его границам. Без него элементы списка (делегаты) могут визуально «вылезать» за пределы ListView, наезжая на другие элементы интерфейса. + clip: true + spacing: 2 + model: root.packages + + ScrollBar.vertical: ScrollBar { + policy: ScrollBar.AsNeeded + width: 6 + } + + delegate: Rectangle { + id: delegate + width: listView.width + height: 32 + radius: 7 + color: modelData.updating ? "#313244" : "transparent" + + // из-зa предупреждение qmllint + required property var modelData + + Behavior on color { ColorAnimation { duration: 300 } } + + RowLayout { + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: 8 + spacing: 8 + + Text { + text: delegate.modelData.name + font.pixelSize: 13 + font.family: "monospace" + color: delegate.modelData.updated ? Theme.color2 : delegate.modelData.updating ? Theme.color7 : Theme.color3 + Layout.fillWidth: true + + Behavior on color { ColorAnimation { duration: 300 } } + } + + Text { + text: delegate.modelData.version + font.pixelSize: 11 + color: Theme.color12 + visible: delegate.modelData.version !== "" + } + + Text { + text: "○" + font.pixelSize: 16 + font.bold: true + color: Theme.color4 + horizontalAlignment: Text.AlignHCenter + Layout.preferredWidth: 18 + Layout.alignment: Qt.AlignVCenter + visible: !delegate.modelData.updating && !delegate.modelData.updated + } + + Text { + text: "⟳" + font.pixelSize: 14 + color: Theme.color7 + horizontalAlignment: Text.AlignHCenter + Layout.preferredWidth: 18 + Layout.alignment: Qt.AlignVCenter + visible: delegate.modelData.updating + + RotationAnimation on rotation { + running: delegate.modelData.updating + loops: Animation.Infinite + from: 0 + to: 360 + duration: 1000 + } + } + + Text { + text: "✓" + font.pixelSize: 16 + font.bold: true + color: Theme.color13 + horizontalAlignment: Text.AlignHCenter + Layout.preferredWidth: 18 + Layout.alignment: Qt.AlignVCenter + visible: delegate.modelData.updated && !delegate.modelData.updating + } + } + } + } +} + diff --git a/qml/pages/UpdatePg.qml b/qml/pages/UpdatePg.qml index faf04ce..a3343d1 100644 --- a/qml/pages/UpdatePg.qml +++ b/qml/pages/UpdatePg.qml @@ -9,6 +9,7 @@ Item { property int packageCount: 0 property int status: 0 + property bool visiblePreLoader: true property var packages: [] signal update() @@ -20,15 +21,14 @@ Item { Layout.fillWidth: true Layout.fillHeight: true - Lists.PackageList { + Lists.UpdateList { anchors.fill: parent packages: root.packages } Components.PreLoader { - visible: root.status === ProcessManager.Status.Checking + visible: root.visiblePreLoader anchors.fill: parent - status: root.status } }