telephant/qml/SettingsDialog.qml

104 lines
2.7 KiB
QML
Raw Normal View History

2017-08-29 05:02:56 +00:00
import QtQuick 2.4
2017-08-29 14:28:33 +00:00
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.1
2017-08-29 05:02:56 +00:00
import QtQuick.Layouts 1.3
Popup {
modal: true
focus: true
height: settingsColumn.implicitHeight + topPadding + bottomPadding
contentItem: ColumnLayout {
id: settingsColumn
spacing: 20
Label {
text: qsTr("Settings")
font.bold: true
}
RowLayout {
spacing: 10
visible: false
Label {
text: qsTr("Theme:")
}
ComboBox {
id: themeBox
property int themeIndex: -1
Layout.fillWidth: true
model: ["System", "Material", "Imagine", "Universal", "Light"]
Component.onCompleted: {
themeIndex = find(settings.theme, Qt.MatchFixedString)
if (themeIndex !== -1)
currentIndex = themeIndex
}
}
}
RowLayout {
spacing: 10
visible: themeBox.currentIndex == 1
2017-08-29 05:02:56 +00:00
Label {
text: qsTr("Style:")
}
ComboBox {
id: styleBox
property int styleIndex: -1
Layout.fillWidth: true
model: ["Light", "Dark"]
2017-08-29 05:02:56 +00:00
Component.onCompleted: {
styleIndex = find(settings.style, Qt.MatchFixedString)
if (styleIndex !== -1)
currentIndex = styleIndex
}
}
}
Label {
horizontalAlignment: Label.AlignHCenter
verticalAlignment: Label.AlignVCenter
Layout.fillWidth: true
Layout.fillHeight: true
text: qsTr("Restart required")
visible: themeBox.currentIndex !== themeBox.themeIndex ? 1.0 : 0.0
2017-08-29 05:02:56 +00:00
}
RowLayout {
spacing: 10
Button {
id: okButton
Layout.preferredWidth: 0
Layout.fillWidth: true
highlighted: true
2017-08-29 05:02:56 +00:00
text: qsTr("Ok")
onClicked: {
settings.theme = themeBox.displayText
2017-08-29 05:02:56 +00:00
settings.style = styleBox.displayText
settingsDialog.close()
}
}
Button {
id: cancelButton
Layout.preferredWidth: 0
Layout.fillWidth: true
text: qsTr("Cancel")
onClicked: {
themeBox.currentIndex = themeBox.themeIndex
2017-08-29 05:02:56 +00:00
styleBox.currentIndex = styleBox.styleIndex
settingsDialog.close()
}
}
}
}
}