diff --git a/src/qml/Base/HInteractiveRectangle.qml b/src/qml/Base/HInteractiveRectangle.qml deleted file mode 100644 index 72e9b215..00000000 --- a/src/qml/Base/HInteractiveRectangle.qml +++ /dev/null @@ -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 } -} diff --git a/src/qml/Base/HRateLimiter.qml b/src/qml/Base/HRateLimiter.qml deleted file mode 100644 index 217b607b..00000000 --- a/src/qml/Base/HRateLimiter.qml +++ /dev/null @@ -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 - } -} diff --git a/src/qml/Chat/RoomSidePane/MembersView.qml b/src/qml/Chat/RoomSidePane/MembersView.qml index e7612ded..2895daaf 100644 --- a/src/qml/Chat/RoomSidePane/MembersView.qml +++ b/src/qml/Chat/RoomSidePane/MembersView.qml @@ -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