2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-04-28 08:00:28 +10:00
|
|
|
|
|
|
|
HScalingBox {
|
|
|
|
id: interfaceBox
|
|
|
|
|
|
|
|
property alias title: interfaceTitle.text
|
|
|
|
property alias buttonModel: interfaceButtonsRepeater.model
|
|
|
|
property var buttonCallbacks: []
|
|
|
|
property string enterButtonTarget: ""
|
|
|
|
|
|
|
|
default property alias body: interfaceBody.children
|
|
|
|
|
|
|
|
function clickEnterButtonTarget() {
|
2019-07-18 19:18:13 +10:00
|
|
|
for (let i = 0; i < buttonModel.length; i++) {
|
|
|
|
let btn = interfaceButtonsRepeater.itemAt(i)
|
2019-08-17 06:44:28 +10:00
|
|
|
if (btn.enabled && btn.name === enterButtonTarget) btn.clicked()
|
2019-04-28 08:00:28 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-29 02:47:51 +10:00
|
|
|
HColumnLayout {
|
2019-04-28 08:00:28 +10:00
|
|
|
anchors.fill: parent
|
|
|
|
id: mainColumn
|
|
|
|
|
|
|
|
HRowLayout {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.margins: interfaceBox.margins
|
|
|
|
|
|
|
|
HLabel {
|
|
|
|
id: interfaceTitle
|
2019-07-19 14:10:46 +10:00
|
|
|
font.pixelSize: theme.fontSize.bigger
|
2019-04-28 08:00:28 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-29 05:22:53 +10:00
|
|
|
HSpacer {}
|
2019-04-28 11:07:20 +10:00
|
|
|
|
2019-04-29 02:47:51 +10:00
|
|
|
HColumnLayout { id: interfaceBody }
|
2019-04-28 08:00:28 +10:00
|
|
|
|
2019-04-29 05:22:53 +10:00
|
|
|
HSpacer {}
|
2019-04-28 11:07:20 +10:00
|
|
|
|
2019-04-28 08:00:28 +10:00
|
|
|
HRowLayout {
|
|
|
|
Repeater {
|
|
|
|
id: interfaceButtonsRepeater
|
|
|
|
model: []
|
|
|
|
|
2019-07-11 05:03:05 +10:00
|
|
|
HUIButton {
|
2019-04-28 08:00:28 +10:00
|
|
|
property string name: modelData.name
|
|
|
|
|
|
|
|
id: button
|
|
|
|
text: modelData.text
|
|
|
|
iconName: modelData.iconName || ""
|
2019-07-19 10:39:13 +10:00
|
|
|
enabled: modelData.enabled === false ? false : true
|
2019-04-28 08:00:28 +10:00
|
|
|
onClicked: buttonCallbacks[modelData.name](button)
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
2019-07-24 16:14:34 +10:00
|
|
|
Layout.preferredHeight: theme.controls.avatar.size
|
2019-04-28 08:00:28 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|