Account page: spinners while profile is loading
This commit is contained in:
parent
470b0f0de2
commit
d5ea248ba1
3
TODO.md
3
TODO.md
|
@ -1,16 +1,17 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
- room settings: make letter avatar respond to name change in real time
|
||||||
- sessions page size
|
- sessions page size
|
||||||
- menu click-through padding to close it easily
|
- menu click-through padding to close it easily
|
||||||
- clear listview checked on message clear
|
- clear listview checked on message clear
|
||||||
- unregister popup/menu when destroyed without being closed
|
- unregister popup/menu when destroyed without being closed
|
||||||
- flickshortcuts
|
- flickshortcuts
|
||||||
- Account: wait until accountInfo available
|
|
||||||
- avatar upload/change component
|
- avatar upload/change component
|
||||||
- show scrollbars for a few secs if there's content to scroll on beginning
|
- show scrollbars for a few secs if there's content to scroll on beginning
|
||||||
- can leave room with a reason?
|
- can leave room with a reason?
|
||||||
- field/area focus line in popups weird
|
- field/area focus line in popups weird
|
||||||
- use new nio `restore_login()`
|
- use new nio `restore_login()`
|
||||||
|
- verify all popups and boxes work
|
||||||
|
|
||||||
## Refactoring
|
## Refactoring
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ Item {
|
||||||
property int fileType: HFileDialogOpener.FileType.All
|
property int fileType: HFileDialogOpener.FileType.All
|
||||||
|
|
||||||
|
|
||||||
TapHandler { enabled: fill; onTapped: fileDialog.open() }
|
TapHandler { enabled: opener.enabled && fill; onTapped: fileDialog.open() }
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
|
|
@ -14,6 +14,7 @@ HFlickableColumnPage {
|
||||||
|
|
||||||
property string userId
|
property string userId
|
||||||
readonly property QtObject account: ModelStore.get("accounts").find(userId)
|
readonly property QtObject account: ModelStore.get("accounts").find(userId)
|
||||||
|
readonly property bool ready: account && account.profile_updated >= new Date(1)
|
||||||
|
|
||||||
|
|
||||||
function takeFocus() {
|
function takeFocus() {
|
||||||
|
@ -95,7 +96,7 @@ HFlickableColumnPage {
|
||||||
id: avatar
|
id: avatar
|
||||||
userId: page.userId
|
userId: page.userId
|
||||||
displayName: nameField.item.text
|
displayName: nameField.item.text
|
||||||
mxc: account.avatar_url
|
mxc: account ? account.avatar_url : ""
|
||||||
toolTipMxc: ""
|
toolTipMxc: ""
|
||||||
sourceOverride: fileDialog.selectedFile || fileDialog.file
|
sourceOverride: fileDialog.selectedFile || fileDialog.file
|
||||||
|
|
||||||
|
@ -105,13 +106,18 @@ HFlickableColumnPage {
|
||||||
Layout.preferredHeight: width
|
Layout.preferredHeight: width
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
z: 10
|
z: 10
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
opacity: ! fileDialog.dialog.visible &&
|
opacity:
|
||||||
((! avatar.mxc && ! avatar.changed) || avatar.hovered) ?
|
! fileDialog.dialog.visible &&
|
||||||
1 : 0
|
(
|
||||||
|
(! avatar.mxc && ! avatar.changed) ||
|
||||||
|
avatar.hovered ||
|
||||||
|
! ready
|
||||||
|
) ?
|
||||||
|
1 : 0
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
color: utils.hsluv(
|
color: utils.hsluv(
|
||||||
0, 0, 0, (! avatar.mxc && overlayHover.hovered) ? 0.8 : 0.7,
|
0, 0, 0, (! avatar.mxc && overlayHover.hovered) ? 0.8 : 0.7,
|
||||||
)
|
)
|
||||||
|
@ -123,16 +129,34 @@ HFlickableColumnPage {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
enabled: ready
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
cursorShape:
|
cursorShape:
|
||||||
overlayHover.hovered ?
|
overlayHover.hovered ?
|
||||||
Qt.PointingHandCursor : Qt.ArrowCursor
|
Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HLoader {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: avatar.width / 3
|
||||||
|
height: width
|
||||||
|
|
||||||
|
source: "../../Base/HBusyIndicator.qml"
|
||||||
|
active: ! ready
|
||||||
|
opacity: active ? 1 : 0
|
||||||
|
visible: opacity > 0
|
||||||
|
|
||||||
|
Behavior on opacity { HNumberAnimation {} }
|
||||||
|
}
|
||||||
|
|
||||||
HColumnLayout {
|
HColumnLayout {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: currentSpacing
|
spacing: currentSpacing
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
opacity: ready ? 1 : 0
|
||||||
|
visible: opacity > 0
|
||||||
|
|
||||||
|
Behavior on opacity { HNumberAnimation {} }
|
||||||
|
|
||||||
HIcon {
|
HIcon {
|
||||||
svgName: "upload-avatar"
|
svgName: "upload-avatar"
|
||||||
|
@ -165,9 +189,10 @@ HFlickableColumnPage {
|
||||||
|
|
||||||
HFileDialogOpener {
|
HFileDialogOpener {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
enabled: ready
|
||||||
fileType: HFileDialogOpener.FileType.Images
|
fileType: HFileDialogOpener.FileType.Images
|
||||||
dialog.title: qsTr("Select profile picture for %1")
|
dialog.title: qsTr("Select profile picture for %1")
|
||||||
.arg(account.display_name)
|
.arg(account ? account.display_name : "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,13 +208,15 @@ HFlickableColumnPage {
|
||||||
|
|
||||||
HLabeledItem {
|
HLabeledItem {
|
||||||
id: nameField
|
id: nameField
|
||||||
|
loading: ! ready
|
||||||
label.text: qsTr("Display name:")
|
label.text: qsTr("Display name:")
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
HTextField {
|
HTextField {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
defaultText: account.display_name
|
enabled: ready
|
||||||
|
defaultText: ready ? account.display_name : ""
|
||||||
maximumLength: 255
|
maximumLength: 255
|
||||||
|
|
||||||
// TODO: Qt 5.14+: use a Binding enabled when text not empty
|
// TODO: Qt 5.14+: use a Binding enabled when text not empty
|
||||||
|
@ -239,7 +266,7 @@ HFlickableColumnPage {
|
||||||
defaultText: aliasField.currentAlias
|
defaultText: aliasField.currentAlias
|
||||||
placeholderText: qsTr("e.g. %1").arg((
|
placeholderText: qsTr("e.g. %1").arg((
|
||||||
nameField.item.text ||
|
nameField.item.text ||
|
||||||
account.display_name ||
|
(ready && account.display_name) ||
|
||||||
userId.substring(1)
|
userId.substring(1)
|
||||||
)[0])
|
)[0])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user