Remove HInteractiveRectangle and HRateLimiter

This commit is contained in:
miruka 2019-08-28 11:59:49 -04:00
parent b1e1ea30d2
commit 3a5d8bff9e
3 changed files with 6 additions and 89 deletions

View File

@ -1,37 +0,0 @@
import QtQuick 2.12
Rectangle {
id: rectangle
property bool checkable: false // TODO
property bool checked: false
property bool hovered: false
readonly property alias pressed: tap.pressed
readonly property QtObject _ir: theme.controls.interactiveRectangle
color: _ir.background
Rectangle {
anchors.fill: parent
visible: opacity > 0
Behavior on opacity { HNumberAnimation { factor: 0.5 } }
opacity: pressed ? _ir.pressedOpacity :
checked ? _ir.checkedOpacity :
hovered ? _ir.hoveredOpacity :
0
color: pressed ? _ir.pressedOverlay :
checked ? _ir.checkedOverlay :
hovered ? _ir.hoveredOverlay :
"transparent"
}
HoverHandler {
id: hover
onHoveredChanged: rectangle.hovered = hovered
}
TapHandler { id: tap }
}

View File

@ -1,46 +0,0 @@
import QtQuick 2.12
QtObject {
property int cooldown: 250
property bool extendOnRequestWhileCooldownActive: false
property bool firePending: false
readonly property Timer timer: Timer {
property bool extended: false
interval: cooldown
onTriggered: {
if (firePending) {
if (extendOnRequestWhileCooldownActive && ! extended) {
firePending = false
extended = true
running = true
return
}
fired()
firePending = false
extended = false
} else if (extended) {
fired()
extended = false
}
}
}
signal requestFire()
signal fired()
onRequestFire: {
if (timer.running) {
firePending = true
return
}
fired()
firePending = false
timer.running = true
}
}

View File

@ -15,7 +15,7 @@ HColumnLayout {
modelSources[["Member", chatPage.roomId]] || []
onOriginSourceChanged: filterLimiter.requestFire()
onOriginSourceChanged: filterLimiter.restart()
function filterSource() {
@ -26,17 +26,17 @@ HColumnLayout {
model: HListModel {
keyField: "user_id"
source: originSource
source: memberList.originSource
}
delegate: MemberDelegate {
width: memberList.width
}
HRateLimiter {
Timer {
id: filterLimiter
cooldown: 16
onFired: memberList.filterSource()
interval: 16
onTriggered: memberList.filterSource()
}
}
@ -50,7 +50,7 @@ HColumnLayout {
backgroundColor: theme.chat.roomSidePane.filterMembers.background
bordered: false
onTextChanged: filterLimiter.requestFire()
onTextChanged: filterLimiter.restart()
Layout.fillWidth: true
Layout.fillHeight: true