refactor: make use of `StatusRoundImage`'s built-in loading indicator

Closes #89
This commit is contained in:
Pascal Precht 2021-05-28 14:00:24 +02:00 committed by Michał Cieślak
parent 60d3bdaff4
commit 93a0b2ae21
3 changed files with 6 additions and 42 deletions

View File

@ -81,26 +81,12 @@ Rectangle {
width: parent.width width: parent.width
height: parent.height height: parent.height
image.source: statusChatListItem.image.source image.source: statusChatListItem.image.source
showLoadingIndicator: true
} }
Loader { Loader {
sourceComponent: { sourceComponent: statusLetterIdenticonCmp
switch (statusRoundedImage.image.status) { active: statusRoundedImage.image.status === Image.Error
case Image.Loading:
return statusLoadingIndicator
break;
case Image.Error:
return statusLetterIdenticonCmp
break;
}
}
}
Component {
id: statusLoadingIndicator
StatusLoadingIndicator {
color: Theme.palette.directColor6
}
} }
} }
} }

View File

@ -68,28 +68,13 @@ Rectangle {
width: parent.width width: parent.width
height: parent.height height: parent.height
image.source: statusChatInfoButton.image.source image.source: statusChatInfoButton.image.source
showLoadingIndicator: true
} }
Loader { Loader {
sourceComponent: { sourceComponent: statusLetterIdenticonComponent
switch (statusRoundImage.image.status) {
case Image.Loading:
return statusLoadingIndicator
break;
case Image.Error:
return statusLetterIdenticonComponent
break;
}
}
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
active: statusRoundImage.image.status === Image.Loading || statusRoundImage.image.status === Image.Error active: statusRoundImage.image.status === Image.Error
}
Component {
id: statusLoadingIndicator
StatusLoadingIndicator {
color: Theme.palette.directColor6
}
} }
} }
} }

View File

@ -57,13 +57,6 @@ TabButton {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
active: statusRoundImage.image.status === Image.Error active: statusRoundImage.image.status === Image.Error
} }
Component {
id: statusLoadingIndicator
StatusLoadingIndicator {
color: Theme.palette.directColor6
}
}
} }
} }