diff --git a/CMakeLists.txt b/CMakeLists.txt index 5babce9..df8001f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,8 @@ qt_add_qml_module(apparchpack qml/components/pages/UpdatePg.qml qml/components/pages/InstallPg.qml qml/components/pages/DeletePg.qml + qml/components/console/ConsoleBar.qml + qml/components/console/ConsolePanel.qml SOURCES cpp/utils/utils.hpp cpp/utils/utils.cpp diff --git a/Main.qml b/Main.qml index 3af1b6d..d7d9759 100644 --- a/Main.qml +++ b/Main.qml @@ -19,6 +19,7 @@ ApplicationWindow { color: Theme.color1 property string packageManager: "yay" + property bool consoleOpen: false ColumnLayout { id: mainLayout @@ -67,5 +68,13 @@ ApplicationWindow { id: pgDelete } } + + readonly property string consoleTitle: tabs.currentIndex === 0 ? "Консоль обновления" : tabs.currentIndex === 1 ? "Консоль установки" : "Консоль удаления" + + Components.ConsoleBar { + title: consoleTitle + consoleOpen: consoleOpen + } + Components.ConsolePanel {} } } diff --git a/qml/components/console/ConsoleBar.qml b/qml/components/console/ConsoleBar.qml new file mode 100644 index 0000000..8d57f45 --- /dev/null +++ b/qml/components/console/ConsoleBar.qml @@ -0,0 +1,53 @@ +import QtQuick +import QtQuick.Layouts + +Rectangle { + id: root + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 26 + color: barMouse.containsMouse ? "#313244" : "#1e1e2e" + z: 50 + + property string title: "" + property bool consoleOpen: false + + Rectangle { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: 1 + color: "#313244" + } + + RowLayout { + anchors.fill: parent + anchors.leftMargin: 12 + anchors.rightMargin: 12 + spacing: 8 + + Text { + text: root.consoleOpen ? "▼ Скрыть консоль" : "▲ " + root.title + color: "#a6adc8" + font.pixelSize: 11 + } + + Item { Layout.fillWidth: true } + + Text { + text: "root.consoleStatus" + color: "#f9e2af" + font.pixelSize: 11 + } + } + + MouseArea { + id: barMouse + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + // onClicked: root.consoleOpen = !root.consoleOpen + } +} + diff --git a/qml/components/console/ConsolePanel.qml b/qml/components/console/ConsolePanel.qml new file mode 100644 index 0000000..08573f1 --- /dev/null +++ b/qml/components/console/ConsolePanel.qml @@ -0,0 +1,99 @@ +import QtQuick +import QtQuick.Layouts + +Rectangle { + id: root + anchors.left: parent.left + anchors.right: parent.right + // anchors.bottom: consoleBar.top + visible: height > 0 + clip: true + color: "#1e1e2e" + z: 40 + + property string title: "" + + Behavior on height { NumberAnimation { duration: 250; easing.type: Easing.InOutQuad } } + Behavior on opacity { NumberAnimation { duration: 180 } } + + MouseArea { + anchors.fill: parent + } + + Rectangle { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: 1 + color: "#313244" + } + + ColumnLayout { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + + RowLayout { + Layout.fillWidth: true + spacing: 6 + + Text { + text: root.title + color: "#cdd6f4" + font.pixelSize: 13 + font.bold: true + } + + Item { Layout.fillWidth: true } + + Text { + text: "root.consoleStatus" + color: "#f9e2af" + font.pixelSize: 11 + } + } + + Rectangle { + Layout.fillWidth: true + height: 1 + color: "#313244" + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + + // ListView { + // id: logView + // anchors.fill: parent + // clip: true + // model: root.consoleLog + // onModelChanged: positionViewAtEnd() + // spacing: 2 + // onCountChanged: positionViewAtEnd() + // + // ScrollBar.vertical: ScrollBar { + // policy: ScrollBar.AsNeeded + // width: 6 + // } + // + // delegate: Text { + // width: logView.width + // text: modelData + // color: "#a6adc8" + // font.family: "monospace" + // font.pixelSize: 11 + // wrapMode: Text.WrapAnywhere + // } + // } + // + // Text { + // anchors.centerIn: parent + // text: root.consolePlaceholder + // color: "#585b70" + // font.pixelSize: 12 + // visible: root.consoleLog.length === 0 + // } + } + } +}