From 5f804e2e44b3b3d9c2e1a35abec304d44a24536d Mon Sep 17 00:00:00 2001 From: gaelle Date: Mon, 3 Mar 2025 17:37:17 +0100 Subject: [PATCH] close #LINQT-1608 busy indicator when components are loading --- Linphone/core/account/AccountDeviceList.cpp | 1 + Linphone/core/account/AccountDeviceList.hpp | 1 + Linphone/core/account/AccountDeviceProxy.cpp | 6 ++++++ Linphone/core/account/AccountDeviceProxy.hpp | 1 + .../Settings/AccountSettingsGeneralLayout.qml | 13 ++++++++++++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Linphone/core/account/AccountDeviceList.cpp b/Linphone/core/account/AccountDeviceList.cpp index 9d554249b..ad42c20a7 100644 --- a/Linphone/core/account/AccountDeviceList.cpp +++ b/Linphone/core/account/AccountDeviceList.cpp @@ -101,6 +101,7 @@ void AccountDeviceList::setDevices(QList> devi mustBeInMainThread(log().arg(Q_FUNC_INFO)); add(devices); lDebug() << log().arg("Add %1 devices").arg(devices.size()); + emit devicesSet(); } void AccountDeviceList::deleteDevice(AccountDeviceGui *deviceGui) { diff --git a/Linphone/core/account/AccountDeviceList.hpp b/Linphone/core/account/AccountDeviceList.hpp index 88fcd81d6..246d2debf 100644 --- a/Linphone/core/account/AccountDeviceList.hpp +++ b/Linphone/core/account/AccountDeviceList.hpp @@ -55,6 +55,7 @@ public: signals: void componentReady(); + void devicesSet(); private: QSharedPointer mAccountCore; diff --git a/Linphone/core/account/AccountDeviceProxy.cpp b/Linphone/core/account/AccountDeviceProxy.cpp index a5e18a2d2..276ccaa8c 100644 --- a/Linphone/core/account/AccountDeviceProxy.cpp +++ b/Linphone/core/account/AccountDeviceProxy.cpp @@ -32,6 +32,12 @@ DEFINE_GUI_OBJECT(AccountDeviceProxy) AccountDeviceProxy::AccountDeviceProxy(QObject *parent) : LimitProxy(parent) { mAccountDeviceList = AccountDeviceList::create(); + connect(this, &AccountDeviceProxy::sourceModelChanged, this, [this] { + auto model = getListModel(); + if (model) { + connect(model, &AccountDeviceList::devicesSet, this, &AccountDeviceProxy::devicesSet); + } + }); setSourceModels(new SortFilterList(mAccountDeviceList.get(), Qt::DescendingOrder)); } diff --git a/Linphone/core/account/AccountDeviceProxy.hpp b/Linphone/core/account/AccountDeviceProxy.hpp index b4139b30d..87c81c01d 100644 --- a/Linphone/core/account/AccountDeviceProxy.hpp +++ b/Linphone/core/account/AccountDeviceProxy.hpp @@ -48,6 +48,7 @@ protected: signals: void lUpdate(); void accountChanged(); + void devicesSet(); private: QString mSearchText; diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml index eeec09a44..54a34215a 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml @@ -229,13 +229,24 @@ AbstractSettingsLayout { } contentItem: ColumnLayout { spacing: 15 * DefaultStyle.dp + BusyIndicator { + Layout.preferredWidth: 60 * DefaultStyle.dp + Layout.preferredHeight: 60 * DefaultStyle.dp + Layout.alignment: Qt.AlignHCenter + visible: devices.loading + } + Repeater { id: devices + visible: !loading + property bool loading + Component.onCompleted: loading = true model: AccountDeviceProxy { id: accountDeviceProxy account: model + onDevicesSet: devices.loading = false; } - Control.Control{ + Control.Control { Layout.fillWidth: true height: 133 * DefaultStyle.dp topPadding: 26 * DefaultStyle.dp