121 lines
3.0 KiB
QML
121 lines
3.0 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
import "qml/components" as Components
|
|
import "qml/pages" as Pages
|
|
import "qml/buttons" as Buttons
|
|
import "qml/dialogs" as Dialogs
|
|
|
|
ApplicationWindow {
|
|
id: root
|
|
title: "Arch Linux Updater"
|
|
width: 740
|
|
height: 960
|
|
minimumWidth: 740
|
|
minimumHeight: 560
|
|
maximumWidth: 1080
|
|
maximumHeight: 1460
|
|
visible: true
|
|
color: Theme.color1
|
|
|
|
property string packageManager: "yay"
|
|
property string sessionPassword: ""
|
|
property bool consoleOpen: false
|
|
|
|
Component.onCompleted: ProcessManager.checkUpdates()
|
|
|
|
ColumnLayout {
|
|
id: mainLayout
|
|
anchors.fill: parent
|
|
anchors.margins: Theme.baseMargins
|
|
anchors.bottomMargin: Theme.baseMargins + consoleBar.height
|
|
spacing: Theme.baseSpacing
|
|
|
|
RowLayout {
|
|
id: headerLayout
|
|
Layout.maximumWidth: Number.POSITIVE_INFINITY
|
|
|
|
Components.Title {
|
|
id: title
|
|
Layout.maximumWidth: Number.POSITIVE_INFINITY
|
|
Layout.alignment: Qt.AlignBottom
|
|
status: ProcessManager.status
|
|
packageCount: ProcessManager.packageCount
|
|
}
|
|
|
|
Buttons.SettingsBtn {
|
|
id: settingsButton
|
|
Layout.alignment: Qt.AlignBottom
|
|
}
|
|
}
|
|
|
|
Components.Line { id: line }
|
|
|
|
Components.Tabs {
|
|
id: tabs
|
|
parentWidth: mainLayout.width
|
|
}
|
|
|
|
StackLayout {
|
|
id: pages
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
currentIndex: tabs.currentIndex
|
|
|
|
Pages.UpdatePg {
|
|
id: pgUpdate
|
|
packageCount: ProcessManager.packageCount
|
|
status: ProcessManager.status
|
|
packages: ProcessManager.packages
|
|
onUpdate: {
|
|
if (ProcessManager.hasPassword())
|
|
{
|
|
passwordDialog.open();
|
|
return;
|
|
}
|
|
ProcessManager.update();
|
|
}
|
|
}
|
|
|
|
Pages.InstallPg {
|
|
id: pgInstall
|
|
}
|
|
|
|
Pages.DeletePg {
|
|
id: pgDelete
|
|
}
|
|
}
|
|
}
|
|
|
|
readonly property string consoleTitle: tabs.currentIndex === 0 ? "Консоль обновления" : tabs.currentIndex === 1 ? "Консоль установки" : "Консоль удаления"
|
|
readonly property string consoleStatus: Utils.statusConsole(tabs.currentIndex, ProcessManager.status)
|
|
// readonly property var consoleLog: tabs.currentIndex === 0 ? ProcessManager.updateLog : tabs.currentIndex === 1 ? UpdateManager.installLog : UpdateManager.removalLog
|
|
readonly property var consoleLog: tabs.currentIndex === 0 ? ProcessManager.updateLog : []
|
|
|
|
Components.ConsoleBar {
|
|
id: consoleBar
|
|
title: root.consoleTitle
|
|
consoleOpen: root.consoleOpen
|
|
status: root.consoleStatus
|
|
onToggled: root.consoleOpen = !root.consoleOpen
|
|
}
|
|
|
|
Components.ConsolePanel {
|
|
id: consolePanel
|
|
anchors.bottom: consoleBar.top
|
|
consoleOpen: root.consoleOpen
|
|
status: root.consoleStatus
|
|
title: root.consoleTitle
|
|
consoleLogData: root.consoleLog
|
|
}
|
|
|
|
Dialogs.PasswordDialog {
|
|
id: passwordDialog
|
|
onPasswordEntered: (password) => {
|
|
ProcessManager.setPassword(password);
|
|
ProcessManager.update();
|
|
}
|
|
}
|
|
}
|