close #LINQT-1608 busy indicator when components are loading

This commit is contained in:
gaelle 2025-03-03 17:37:17 +01:00
parent 0926cc12f4
commit 5f804e2e44
5 changed files with 21 additions and 1 deletions

View file

@ -101,6 +101,7 @@ void AccountDeviceList::setDevices(QList<QSharedPointer<AccountDeviceCore>> 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) {

View file

@ -55,6 +55,7 @@ public:
signals:
void componentReady();
void devicesSet();
private:
QSharedPointer<AccountCore> mAccountCore;

View file

@ -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<AccountDeviceList>();
if (model) {
connect(model, &AccountDeviceList::devicesSet, this, &AccountDeviceProxy::devicesSet);
}
});
setSourceModels(new SortFilterList(mAccountDeviceList.get(), Qt::DescendingOrder));
}

View file

@ -48,6 +48,7 @@ protected:
signals:
void lUpdate();
void accountChanged();
void devicesSet();
private:
QString mSearchText;

View file

@ -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