diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e66ce4..5babce9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ qt_add_qml_module(apparchpack qml/components/Title.qml qml/components/Line.qml qml/components/Tabs.qml + qml/components/SettingsMenu.qml qml/components/pages/UpdatePg.qml qml/components/pages/InstallPg.qml qml/components/pages/DeletePg.qml diff --git a/Main.qml b/Main.qml index 2e93ed6..3af1b6d 100644 --- a/Main.qml +++ b/Main.qml @@ -18,6 +18,8 @@ ApplicationWindow { visible: true color: Theme.color1 + property string packageManager: "yay" + ColumnLayout { id: mainLayout anchors.fill: parent diff --git a/qml/buttons/SettingsBtn.qml b/qml/buttons/SettingsBtn.qml index d0fbdf1..0f572ce 100644 --- a/qml/buttons/SettingsBtn.qml +++ b/qml/buttons/SettingsBtn.qml @@ -2,6 +2,7 @@ pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls +import "../components" as Components Item { id: root @@ -38,6 +39,12 @@ Item { radius: 3 color: button.down ? Theme.color4 : button.hovered ? Theme.color5 : Theme.colorTransparent } + + onClicked: menu.opened ? menu.close() : menu.open() + } + + Components.SettingsMenu { + id: menu } } diff --git a/qml/components/SettingsMenu.qml b/qml/components/SettingsMenu.qml new file mode 100644 index 0000000..fd4c678 --- /dev/null +++ b/qml/components/SettingsMenu.qml @@ -0,0 +1,115 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls + +Popup { + id: root + + property int parentWidth: 0 + property int parentHeight: 0 + + x: parentWidth - width + y: parentHeight + 6 + + width: 190 + padding: 12 + modal: false + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside + + background: Rectangle { + color: Theme.color1 + radius: 3 + border.width: 1 + border.color: Theme.color4 + } + + component RadioBtn: RadioButton { + id: radio + + padding: 8 + + contentItem: Text { + text: radio.text + color: Theme.color2 + font.pixelSize: 13 + leftPadding: 24 + verticalAlignment: Text.AlignVCenter + } + + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + x: 8 + y: (radio.height - height) / 2 + radius: 3 + color: Theme.colorTransparent + border.width: 1 + border.color: radio.checked ? Theme.color6 : Theme.color3 + + Rectangle { + anchors.centerIn: parent + width: 8 + height: 8 + radius: 3 + color: Theme.color6 + visible: radio.checked + } + } + } + + contentItem: ColumnLayout { + spacing: 6 + + Label { + text: "Способ обновления" + color: Theme.color3 + font.pixelSize: 11 + Layout.fillWidth: true + } + + RadioBtn { + id: yayRadio + text: "yay" + } + + RadioBtn { + id: pacmanRadio + text: "pacman" + } + + Rectangle { + Layout.fillWidth: true + Layout.topMargin: 2 + Layout.preferredHeight: 1 + color: Theme.color4 + } + + // Пункт меню «История»: открывает список завершённых заданий. + Button { + id: historyButton + text: "История" + Layout.fillWidth: true + leftPadding: 8 + rightPadding: 8 + topPadding: 8 + bottomPadding: 8 + + onClicked: { + root.close() + } + + background: Rectangle { + radius: 3 + color: historyButton.down ? Theme.color4 : historyButton.hovered ? Theme.color5 : Theme.colorTransparent + } + + contentItem: Text { + text: historyButton.text + font.pixelSize: 13 + color: Theme.color2 + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + } + } +}