close #LINQT-1608 busy indicator when components are loading
This commit is contained in:
parent
0926cc12f4
commit
5f804e2e44
5 changed files with 21 additions and 1 deletions
|
|
@ -101,6 +101,7 @@ void AccountDeviceList::setDevices(QList<QSharedPointer<AccountDeviceCore>> devi
|
||||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
||||||
add(devices);
|
add(devices);
|
||||||
lDebug() << log().arg("Add %1 devices").arg(devices.size());
|
lDebug() << log().arg("Add %1 devices").arg(devices.size());
|
||||||
|
emit devicesSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountDeviceList::deleteDevice(AccountDeviceGui *deviceGui) {
|
void AccountDeviceList::deleteDevice(AccountDeviceGui *deviceGui) {
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void componentReady();
|
void componentReady();
|
||||||
|
void devicesSet();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<AccountCore> mAccountCore;
|
QSharedPointer<AccountCore> mAccountCore;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,12 @@ DEFINE_GUI_OBJECT(AccountDeviceProxy)
|
||||||
|
|
||||||
AccountDeviceProxy::AccountDeviceProxy(QObject *parent) : LimitProxy(parent) {
|
AccountDeviceProxy::AccountDeviceProxy(QObject *parent) : LimitProxy(parent) {
|
||||||
mAccountDeviceList = AccountDeviceList::create();
|
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));
|
setSourceModels(new SortFilterList(mAccountDeviceList.get(), Qt::DescendingOrder));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ protected:
|
||||||
signals:
|
signals:
|
||||||
void lUpdate();
|
void lUpdate();
|
||||||
void accountChanged();
|
void accountChanged();
|
||||||
|
void devicesSet();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mSearchText;
|
QString mSearchText;
|
||||||
|
|
|
||||||
|
|
@ -229,13 +229,24 @@ AbstractSettingsLayout {
|
||||||
}
|
}
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
spacing: 15 * DefaultStyle.dp
|
spacing: 15 * DefaultStyle.dp
|
||||||
|
BusyIndicator {
|
||||||
|
Layout.preferredWidth: 60 * DefaultStyle.dp
|
||||||
|
Layout.preferredHeight: 60 * DefaultStyle.dp
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
visible: devices.loading
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: devices
|
id: devices
|
||||||
|
visible: !loading
|
||||||
|
property bool loading
|
||||||
|
Component.onCompleted: loading = true
|
||||||
model: AccountDeviceProxy {
|
model: AccountDeviceProxy {
|
||||||
id: accountDeviceProxy
|
id: accountDeviceProxy
|
||||||
account: model
|
account: model
|
||||||
|
onDevicesSet: devices.loading = false;
|
||||||
}
|
}
|
||||||
Control.Control{
|
Control.Control {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 133 * DefaultStyle.dp
|
height: 133 * DefaultStyle.dp
|
||||||
topPadding: 26 * DefaultStyle.dp
|
topPadding: 26 * DefaultStyle.dp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue