[PR #2431] perf: fix UI freezes, optimize rendering, add live speed indicator #2806

Open
opened 2026-10-14 21:05:25 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/2431
Author: @DevMercenary
Created: 3/31/2026
Status: 🔄 Open

Base: dev ← Head: perf/ui-optimizations-and-speed-indicator


📝 Commits (2)

  • 922a7e4 perf: fix UI freezes, optimize rendering, add live speed indicator
  • 9d31119 refactor: use async QRemoteObjectPendingCallWatcher for IPC calls

📊 Changes

13 files changed (+183 additions, -72 deletions)

View changed files

📝 client/protocols/wireguardprotocol.cpp (+10 -1)
📝 client/protocols/wireguardprotocol.h (+1 -0)
📝 client/ui/controllers/api/apiSettingsController.cpp (+0 -8)
📝 client/ui/controllers/connectionController.cpp (+31 -0)
📝 client/ui/controllers/connectionController.h (+14 -0)
📝 client/ui/qml/Components/ConnectButton.qml (+4 -5)
📝 client/ui/qml/Components/ServersListView.qml (+7 -3)
📝 client/ui/qml/Controls2/BasicButtonType.qml (+0 -8)
📝 client/ui/qml/Controls2/LabelWithButtonType.qml (+0 -12)
📝 client/ui/qml/Pages2/PageDeinstalling.qml (+1 -1)
📝 client/ui/qml/Pages2/PageHome.qml (+72 -8)
📝 client/ui/qml/Pages2/PageSetupWizardInstalling.qml (+1 -1)
📝 client/vpnconnection.cpp (+42 -25)

📄 Description

Summary

  • Fix UI freezes: removed blocking QEventLoop (1 sec freeze on reload) in apiSettingsController, replaced synchronous waitForFinished() IPC calls with async QRemoteObjectPendingCallWatcher in vpnconnection.cpp — every connection state change no longer blocks the main thread while still logging errors
  • Optimize QML rendering: reduced ConnectButton DropShadow samples from 25 to 9, disabled layer rendering during rotation animation, removed 7 unnecessary Behavior on color/opacity animations across BasicButtonType, LabelWithButtonType, PageHome
  • Add live speed indicator: download/upload speed displayed above the connect button when connected, with proper bytesChanged reporting for WireGuard/AWG protocols on desktop (was missing entirely)

Changes

C++ (performance)

File Change
apiSettingsController.cpp Remove QEventLoop + 1s QTimer::singleShot blocking delay
vpnconnection.cpp Replace blocking waitForFinished() with async QRemoteObjectPendingCallWatcher
connectionController.h/cpp Add downloadSpeed/uploadSpeed Q_PROPERTY with QElapsedTimer-based calculation
wireguardprotocol.h/cpp Add missing setBytesChanged() call + 1s periodic checkStatus() timer

QML (rendering)

File Change
ConnectButton.qml DropShadow samples 25→9, disable layer during connection animation
BasicButtonType.qml Remove 2x Behavior on color animations
LabelWithButtonType.qml Remove 5x Behavior on color/opacity animations
PageHome.qml Remove Behavior on opacity, add speed indicator widget
PageDeinstalling.qml Stop timer when progress >= 0.95
PageSetupWizardInstalling.qml Stop timer when progress >= 0.95
ServersListView.qml Cache model properties in delegate readonly property

Test plan

  • Verify no UI freeze when toggling VPN connection (Connected/Disconnected)
  • Verify IPC errors are logged asynchronously (check debug output)
  • Verify speed indicator appears above connect button when connected
  • Verify speed updates every ~1 second on WireGuard/AWG protocols
  • Verify speed indicator hides smoothly on disconnect
  • Verify ConnectButton animation still renders correctly during connection
  • Verify button hover states still work without Behavior on color animations
  • Verify progress bars still animate in install/deinstall pages

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/2431 **Author:** [@DevMercenary](https://github.com/DevMercenary) **Created:** 3/31/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `perf/ui-optimizations-and-speed-indicator` --- ### 📝 Commits (2) - [`922a7e4`](https://github.com/amnezia-vpn/amnezia-client/commit/922a7e4a3b25092de9c57d38cfa350f07d8475f1) perf: fix UI freezes, optimize rendering, add live speed indicator - [`9d31119`](https://github.com/amnezia-vpn/amnezia-client/commit/9d311196bdee7104d3249d679e50b618ad4dce0d) refactor: use async QRemoteObjectPendingCallWatcher for IPC calls ### 📊 Changes **13 files changed** (+183 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `client/protocols/wireguardprotocol.cpp` (+10 -1) 📝 `client/protocols/wireguardprotocol.h` (+1 -0) 📝 `client/ui/controllers/api/apiSettingsController.cpp` (+0 -8) 📝 `client/ui/controllers/connectionController.cpp` (+31 -0) 📝 `client/ui/controllers/connectionController.h` (+14 -0) 📝 `client/ui/qml/Components/ConnectButton.qml` (+4 -5) 📝 `client/ui/qml/Components/ServersListView.qml` (+7 -3) 📝 `client/ui/qml/Controls2/BasicButtonType.qml` (+0 -8) 📝 `client/ui/qml/Controls2/LabelWithButtonType.qml` (+0 -12) 📝 `client/ui/qml/Pages2/PageDeinstalling.qml` (+1 -1) 📝 `client/ui/qml/Pages2/PageHome.qml` (+72 -8) 📝 `client/ui/qml/Pages2/PageSetupWizardInstalling.qml` (+1 -1) 📝 `client/vpnconnection.cpp` (+42 -25) </details> ### 📄 Description ## Summary - **Fix UI freezes**: removed blocking `QEventLoop` (1 sec freeze on reload) in `apiSettingsController`, replaced synchronous `waitForFinished()` IPC calls with async `QRemoteObjectPendingCallWatcher` in `vpnconnection.cpp` — every connection state change no longer blocks the main thread while still logging errors - **Optimize QML rendering**: reduced `ConnectButton` DropShadow samples from 25 to 9, disabled layer rendering during rotation animation, removed 7 unnecessary `Behavior on color/opacity` animations across `BasicButtonType`, `LabelWithButtonType`, `PageHome` - **Add live speed indicator**: download/upload speed displayed above the connect button when connected, with proper `bytesChanged` reporting for WireGuard/AWG protocols on desktop (was missing entirely) ## Changes ### C++ (performance) | File | Change | |------|--------| | `apiSettingsController.cpp` | Remove `QEventLoop` + 1s `QTimer::singleShot` blocking delay | | `vpnconnection.cpp` | Replace blocking `waitForFinished()` with async `QRemoteObjectPendingCallWatcher` | | `connectionController.h/cpp` | Add `downloadSpeed`/`uploadSpeed` Q_PROPERTY with `QElapsedTimer`-based calculation | | `wireguardprotocol.h/cpp` | Add missing `setBytesChanged()` call + 1s periodic `checkStatus()` timer | ### QML (rendering) | File | Change | |------|--------| | `ConnectButton.qml` | DropShadow samples 25→9, disable layer during connection animation | | `BasicButtonType.qml` | Remove 2x `Behavior on color` animations | | `LabelWithButtonType.qml` | Remove 5x `Behavior on color/opacity` animations | | `PageHome.qml` | Remove `Behavior on opacity`, add speed indicator widget | | `PageDeinstalling.qml` | Stop timer when progress >= 0.95 | | `PageSetupWizardInstalling.qml` | Stop timer when progress >= 0.95 | | `ServersListView.qml` | Cache model properties in delegate `readonly property` | ## Test plan - [ ] Verify no UI freeze when toggling VPN connection (Connected/Disconnected) - [ ] Verify IPC errors are logged asynchronously (check debug output) - [ ] Verify speed indicator appears above connect button when connected - [ ] Verify speed updates every ~1 second on WireGuard/AWG protocols - [ ] Verify speed indicator hides smoothly on disconnect - [ ] Verify ConnectButton animation still renders correctly during connection - [ ] Verify button hover states still work without `Behavior on color` animations - [ ] Verify progress bars still animate in install/deinstall pages --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#2806
No description provided.