Added delay button

This commit is contained in:
2026-06-18 04:07:53 +03:00
parent 70513c1136
commit 21fb4704a6
11 changed files with 268 additions and 9 deletions
+40 -2
View File
@@ -21,6 +21,8 @@ Dialog {
iconCombo.model = btnController.listIcons()
iconCombo.currentIndex = 0
typeCombo.currentIndex = 0
holdSwitch.checked = true
holdSlider.value = 800
open()
}
@@ -39,6 +41,8 @@ Dialog {
var idx = iconCombo.model.indexOf(fname)
iconCombo.currentIndex = idx >= 0 ? idx : 0
typeCombo.currentIndex = (o.actionType === "http_post") ? 1 : 0
holdSwitch.checked = (o.triggerMode !== "click")
holdSlider.value = (o.holdMs && o.holdMs > 0) ? o.holdMs : 800
open()
}
@@ -100,17 +104,51 @@ Dialog {
border.color: "#80ffffff"; border.width: 1
}
}
RowLayout {
Layout.fillWidth: true
Text { text: "Срабатывание:"; color: settingsContainer.darkMode ? "white" : "black" }
Switch {
id: holdSwitch
checked: true
}
Text {
text: holdSwitch.checked ? "Удержание" : "Клик"
color: settingsContainer.darkMode ? "#cccccc" : "#444444"
}
Item { Layout.fillWidth: true }
}
RowLayout {
Layout.fillWidth: true
visible: holdSwitch.checked
Text {
text: "Длительность: " + Math.round(holdSlider.value) + " мс"
color: settingsContainer.darkMode ? "white" : "black"
Layout.preferredWidth: 180
}
Slider {
id: holdSlider
Layout.fillWidth: true
from: 200; to: 3000; stepSize: 50
value: 800
}
}
}
onAccepted: {
var mode = holdSwitch.checked ? "hold" : "click"
var hold = Math.round(holdSlider.value)
if (editId === "") {
btnController.addButton(labelF.text, iconCombo.currentText,
typeCombo.currentText, urlF.text,
successF.text, errorF.text, colorF.text)
successF.text, errorF.text, colorF.text,
mode, hold)
} else {
btnController.updateButton(editId, labelF.text, iconCombo.currentText,
typeCombo.currentText, urlF.text,
successF.text, errorF.text, colorF.text)
successF.text, errorF.text, colorF.text,
mode, hold)
}
}
}