a
This commit is contained in:
@@ -10,7 +10,9 @@ Item {
|
||||
// Per-button trigger config (from the model). Default: hold-to-activate.
|
||||
readonly property string triggerModeResolved: (typeof triggerMode !== "undefined" && triggerMode) ? triggerMode : "hold"
|
||||
readonly property int holdMsResolved: (typeof holdMs !== "undefined" && holdMs > 0) ? holdMs : 800
|
||||
readonly property bool inputBlocked: status !== 0
|
||||
readonly property bool latchOn: typeof latchResetEnabled !== "undefined" && latchResetEnabled
|
||||
readonly property bool inputBlocked: status === 3 || status === 2
|
||||
|| (status !== 0 && !latchOn)
|
||||
|
||||
// Resolved feedback colour/width for the current status (ok / error).
|
||||
readonly property color okColor: settingsContainer.feedbackOkColor
|
||||
|
||||
@@ -99,7 +99,6 @@ Dialog {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
placeholderText: "Новый пароль"
|
||||
echoMode: TextInput.Password
|
||||
onAccepted: changePwdDialog.accept()
|
||||
}
|
||||
Text {
|
||||
|
||||
@@ -10,7 +10,7 @@ Dialog {
|
||||
title: editId === "" ? "Новая кнопка" : "Редактирование"
|
||||
anchors.centerIn: parent
|
||||
width: Math.min(520, parent ? parent.width * 0.95 : 520)
|
||||
height: Math.min(560, parent ? parent.height * 0.9 : 560)
|
||||
height: Math.min(680, parent ? parent.height * 0.9 : 680)
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
readonly property color panelBg: "#161628"
|
||||
@@ -48,6 +48,10 @@ Dialog {
|
||||
typeCombo.currentIndex = 0
|
||||
holdSwitch.checked = true
|
||||
holdSlider.value = 800
|
||||
latchSwitch.checked = true
|
||||
resetUrlF.text = ""
|
||||
successMatchF.text = "OK"
|
||||
fireAndForgetSwitch.checked = false
|
||||
responseCheckSwitch.checked = false
|
||||
responseCheckWasEnabled = false
|
||||
open()
|
||||
@@ -72,6 +76,10 @@ Dialog {
|
||||
typeCombo.currentIndex = (o.actionType === "http_post") ? 1 : 0
|
||||
holdSwitch.checked = (o.triggerMode !== "click")
|
||||
holdSlider.value = (o.holdMs && o.holdMs > 0) ? o.holdMs : 800
|
||||
latchSwitch.checked = !!o.latchResetEnabled
|
||||
resetUrlF.text = o.latchResetUrl || ""
|
||||
successMatchF.text = o.latchSuccessMatch || "OK"
|
||||
fireAndForgetSwitch.checked = !!o.latchFireAndForget
|
||||
responseCheckSwitch.checked = !!o.responseCheckEnabled
|
||||
responseCheckWasEnabled = responseCheckSwitch.checked
|
||||
open()
|
||||
@@ -116,6 +124,52 @@ Dialog {
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "URL"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Text { text: "Сброс повторным нажатием:"; color: editorDialog.panelFg }
|
||||
Switch { id: latchSwitch; checked: true }
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
visible: latchSwitch.checked
|
||||
text: "Первое нажатие — URL выше. Успех, если в ответе есть указанный текст или HTTP < 400. Зелёный статус держится до повторного нажатия."
|
||||
color: "#aaaaaa"
|
||||
font.pixelSize: 10
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
TextField {
|
||||
id: resetUrlF
|
||||
Layout.fillWidth: true
|
||||
visible: latchSwitch.checked
|
||||
placeholderText: "URL сброса"
|
||||
}
|
||||
TextField {
|
||||
id: successMatchF
|
||||
Layout.fillWidth: true
|
||||
visible: latchSwitch.checked
|
||||
placeholderText: "Успех если в ответе (OK)"
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: latchSwitch.checked
|
||||
Text {
|
||||
text: "Мгновенный отклик:"
|
||||
color: editorDialog.panelFg
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
Switch { id: fireAndForgetSwitch }
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
visible: latchSwitch.checked && fireAndForgetSwitch.checked
|
||||
text: "Статус обновляется сразу после нажатия; команда на сервер уходит параллельно."
|
||||
color: "#aaaaaa"
|
||||
font.pixelSize: 10
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: successF
|
||||
Layout.fillWidth: true
|
||||
@@ -177,6 +231,7 @@ Dialog {
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: !latchSwitch.checked
|
||||
Text { text: "Расширенная проверка:"; color: editorDialog.panelFg }
|
||||
Switch { id: responseCheckSwitch }
|
||||
Text {
|
||||
@@ -193,17 +248,23 @@ Dialog {
|
||||
onAccepted: {
|
||||
var mode = holdSwitch.checked ? "hold" : "click"
|
||||
var hold = Math.round(holdSlider.value)
|
||||
var latchOn = latchSwitch.checked
|
||||
var resetUrl = resetUrlF.text.trim()
|
||||
var successMatch = successMatchF.text.trim() || "OK"
|
||||
var fireAndForget = latchOn && fireAndForgetSwitch.checked
|
||||
if (editId === "") {
|
||||
btnController.addButton(labelF.text, iconCombo.currentText,
|
||||
typeCombo.currentText, urlF.text,
|
||||
successF.text, errorF.text, pendingF.text,
|
||||
colorF.text, mode, hold)
|
||||
colorF.text, mode, hold,
|
||||
latchOn, resetUrl, successMatch, fireAndForget)
|
||||
} else {
|
||||
btnController.updateButton(editId, labelF.text, iconCombo.currentText,
|
||||
typeCombo.currentText, urlF.text,
|
||||
successF.text, errorF.text, pendingF.text,
|
||||
colorF.text, mode, hold)
|
||||
if (responseCheckSwitch.checked !== responseCheckWasEnabled)
|
||||
colorF.text, mode, hold,
|
||||
latchOn, resetUrl, successMatch, fireAndForget)
|
||||
if (!latchOn && responseCheckSwitch.checked !== responseCheckWasEnabled)
|
||||
btnController.setResponseCheckEnabled(editId, responseCheckSwitch.checked)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user