UploadBars: tooltip and expand text on error/click

This commit is contained in:
miruka 2019-12-02 03:19:43 -04:00
parent e4aa3b6572
commit 92bfb02446
2 changed files with 18 additions and 2 deletions

View File

@ -221,6 +221,7 @@ class MatrixClient(nio.AsyncClient):
self.models[Upload, room_id][upload_item.uuid] = upload_item self.models[Upload, room_id][upload_item.uuid] = upload_item
try: try:
raise MatrixError(111, "Ooops!")
url, mime, crypt_dict = await self.upload( url, mime, crypt_dict = await self.upload(
path, filename=path.name, encrypt=encrypt, path, filename=path.name, encrypt=encrypt,
) )

View File

@ -37,8 +37,9 @@ Rectangle {
HRowLayout { HRowLayout {
HLabel { HLabel {
id: filenameLabel id: statusLabel
elide: Text.ElideRight elide: expand ? Text.ElideNone : Text.ElideRight
wrapMode: expand ? Text.Wrap : Text.NoWrap
color: model.status === "Error" ? color: model.status === "Error" ?
theme.colors.errorText : theme.colors.text theme.colors.errorText : theme.colors.text
@ -81,6 +82,8 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
property bool expand: model.status === "Error"
readonly property string fileName: readonly property string fileName:
model.filepath.split("/").slice(-1)[0] model.filepath.split("/").slice(-1)[0]
} }
@ -103,6 +106,18 @@ Rectangle {
Behavior on Layout.preferredWidth { HNumberAnimation {} } Behavior on Layout.preferredWidth { HNumberAnimation {} }
} }
TapHandler {
onTapped: statusLabel.expand = ! statusLabel.expand
}
HoverHandler { id: infoRowHover }
HToolTip {
id: statusToolTip
text: statusLabel.truncated ? statusLabel.text : ""
visible: text && infoRowHover.hovered
}
} }
HProgressBar { HProgressBar {