Clean up FileDelegate.
This commit is contained in:
parent
5700c967ae
commit
2cddd4face
|
@ -14,7 +14,7 @@ import Spectral.Menu.Timeline 2.0
|
||||||
import Spectral.Font 0.1
|
import Spectral.Font 0.1
|
||||||
import Spectral.Effect 2.0
|
import Spectral.Effect 2.0
|
||||||
|
|
||||||
ColumnLayout {
|
RowLayout {
|
||||||
readonly property bool avatarVisible: !sentByMe && showAuthor
|
readonly property bool avatarVisible: !sentByMe && showAuthor
|
||||||
readonly property bool sentByMe: author === currentRoom.localUser
|
readonly property bool sentByMe: author === currentRoom.localUser
|
||||||
|
|
||||||
|
@ -23,32 +23,16 @@ ColumnLayout {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
spacing: 0
|
spacing: 4
|
||||||
|
|
||||||
onDownloadedChanged: if (downloaded && openOnFinished) openSavedFile()
|
onDownloadedChanged: if (downloaded && openOnFinished) openSavedFile()
|
||||||
|
|
||||||
Label {
|
|
||||||
Layout.leftMargin: 48
|
|
||||||
|
|
||||||
text: author.displayName
|
|
||||||
|
|
||||||
visible: avatarVisible
|
|
||||||
|
|
||||||
font.pixelSize: 13
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
z: -5
|
z: -5
|
||||||
|
|
||||||
id: messageRow
|
|
||||||
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
Avatar {
|
Avatar {
|
||||||
Layout.preferredWidth: 36
|
Layout.preferredWidth: 36
|
||||||
Layout.preferredHeight: 36
|
Layout.preferredHeight: 36
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignBottom
|
||||||
|
|
||||||
visible: avatarVisible
|
visible: avatarVisible
|
||||||
hint: author.displayName
|
hint: author.displayName
|
||||||
|
@ -77,7 +61,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Control {
|
Control {
|
||||||
Layout.maximumWidth: messageListView.width - (!sentByMe ? 36 + messageRow.spacing : 0) - 48
|
Layout.maximumWidth: messageListView.width - (!sentByMe ? 36 + root.spacing : 0) - 48
|
||||||
|
|
||||||
padding: 12
|
padding: 12
|
||||||
|
|
||||||
|
@ -92,17 +76,21 @@ ColumnLayout {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Label {
|
Label {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: display
|
text: display
|
||||||
|
wrapMode: Label.Wrap
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
font.capitalization: Font.AllUppercase
|
font.capitalization: Font.AllUppercase
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: progressInfo.active ? (humanSize(progressInfo.progress) + "/" + humanSize(progressInfo.total)) : humanSize(content.info ? content.info.size : 0)
|
text: progressInfo.active ? (humanSize(progressInfo.progress) + "/" + humanSize(progressInfo.total)) : humanSize(content.info ? content.info.size : 0)
|
||||||
color: MPalette.lighter
|
color: MPalette.lighter
|
||||||
|
wrapMode: Label.Wrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +196,6 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function saveFileAs() {
|
function saveFileAs() {
|
||||||
var folderDialog = openFolderDialog.createObject(ApplicationWindow.overlay)
|
var folderDialog = openFolderDialog.createObject(ApplicationWindow.overlay)
|
||||||
|
@ -238,7 +225,6 @@ ColumnLayout {
|
||||||
if (Qt.openUrlExternally(progressInfo.localDir)) return;
|
if (Qt.openUrlExternally(progressInfo.localDir)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function humanSize(bytes)
|
function humanSize(bytes)
|
||||||
{
|
{
|
||||||
if (!bytes)
|
if (!bytes)
|
||||||
|
|
Loading…
Reference in New Issue