Files
Button/qml/settings/BackgroundPage.qml
T
2026-06-17 04:55:15 +03:00

109 lines
3.7 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../components"
Item {
id: page
ColumnLayout {
anchors.fill: parent
anchors.margins: 8
spacing: 12
BackHeader { title: "Фон"; onBack: page.StackView.view.pop() }
RowLayout {
Layout.fillWidth: true
Text {
text: "Тип:"
color: settingsContainer.darkMode ? "white" : "black"
}
Item { Layout.fillWidth: true }
Button {
text: "Градиент"
highlighted: settingsContainer.backgroundType === "gradient"
onClicked: btnController.setBackgroundType("gradient")
}
Button {
text: "Цвет"
highlighted: settingsContainer.backgroundType === "solid"
onClicked: btnController.setBackgroundType("solid")
}
Button {
text: "Картинка"
highlighted: settingsContainer.backgroundType === "image"
onClicked: btnController.setBackgroundType("image")
}
}
GridLayout {
Layout.fillWidth: true
columns: 2
visible: settingsContainer.backgroundType !== "image"
Text { text: "Цвет 1:"; color: settingsContainer.darkMode ? "white" : "black" }
TextField {
id: c1
Layout.fillWidth: true
text: settingsContainer.backgroundColor1
onEditingFinished: btnController.setBackgroundColors(text, c2.text)
}
Text {
text: "Цвет 2:"
color: settingsContainer.darkMode ? "white" : "black"
visible: settingsContainer.backgroundType === "gradient"
}
TextField {
id: c2
Layout.fillWidth: true
text: settingsContainer.backgroundColor2
visible: settingsContainer.backgroundType === "gradient"
onEditingFinished: btnController.setBackgroundColors(c1.text, text)
}
}
CheckBox {
visible: settingsContainer.backgroundType === "gradient"
text: "Анимация"
checked: settingsContainer.backgroundAnimated
onToggled: btnController.setBackgroundAnimated(checked)
}
ColumnLayout {
visible: settingsContainer.backgroundType === "image"
Layout.fillWidth: true
Text {
text: "Имя файла фона (из папки иконок):"
color: settingsContainer.darkMode ? "white" : "black"
}
RowLayout {
Layout.fillWidth: true
ComboBox {
id: bgImageCombo
Layout.fillWidth: true
model: btnController.listIcons()
Component.onCompleted: {
var i = model.indexOf(settingsContainer.backgroundImage)
if (i >= 0) currentIndex = i
}
onActivated: btnController.setBackgroundImage(currentText)
}
Button {
text: "\u21BB"
onClicked: bgImageCombo.model = btnController.listIcons()
}
}
Text {
Layout.fillWidth: true
text: "Папка иконок:\n" + settingsContainer.iconsDir
color: settingsContainer.darkMode ? "#cccccc" : "#444444"
font.pixelSize: 11
wrapMode: Text.Wrap
}
}
Item { Layout.fillHeight: true }
}
}