Reformat code.

This commit is contained in:
Black Hat
2018-09-04 21:13:14 +08:00
parent 412b5201bf
commit aa29f5252d
17 changed files with 139 additions and 90 deletions

View File

@@ -6,22 +6,22 @@ Item {
property alias sourceSize: baseImage.sourceSize.width
readonly property bool loading: baseImage.status == Image.Loading
signal clicked()
id: rekt
signal clicked()
width: loading ? 128 : baseImage.implicitWidth
height: loading ? progressBar.height : baseImage.implicitHeight
Image {
id: baseImage
}
id: rekt
Image { id: baseImage }
ProgressBar {
id: progressBar
width: parent.width
visible: loading
id: progressBar
indeterminate: true
}

View File

@@ -11,5 +11,6 @@ Label {
wrapMode: Label.Wrap
linkColor: coloredBackground ? "white" : Material.accent
textFormat: MSettings.richText ? Text.RichText : Text.StyledText
onLinkActivated: Qt.openUrlExternally(link)
}

View File

@@ -6,6 +6,7 @@ MouseArea {
signal secondaryClicked()
acceptedButtons: MSettings.pressAndHold ? Qt.LeftButton : (Qt.LeftButton | Qt.RightButton)
onClicked: mouse.button == Qt.RightButton ? secondaryClicked() : primaryClicked()
onPressAndHold: MSettings.pressAndHold ? secondaryClicked() : {}
}

View File

@@ -11,20 +11,18 @@ Item {
z: -2
height: parent.height
width: progressInfo.active && !progressInfo.completed ? progressInfo.progress / progressInfo.total * parent.width : 0
color: Material.accent
opacity: 0.4
}
onDownloadedChanged: downloaded && openOnFinished ? openSavedFile() : {}
onDownloadedChanged: if (downloaded && openOnFinished) openSavedFile()
function saveFileAs() {
currentRoom.saveFileAs(eventId)
}
function saveFileAs() { currentRoom.saveFileAs(eventId) }
function downloadAndOpen()
{
if (downloaded)
openSavedFile()
if (downloaded) openSavedFile()
else
{
openOnFinished = true
@@ -34,10 +32,7 @@ Item {
function openSavedFile()
{
if (Qt.openUrlExternally(progressInfo.localPath))
return;
if (Qt.openUrlExternally(progressInfo.localDir))
return;
if (Qt.openUrlExternally(progressInfo.localPath)) return;
if (Qt.openUrlExternally(progressInfo.localDir)) return;
}
}

View File

@@ -52,6 +52,7 @@ Popup {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 2
color: Material.accent
}

View File

@@ -12,13 +12,11 @@ Control {
padding: 12
background: Rectangle {
color: colored ? Material.accent : highlighted ? Material.primary : backgroundColor
}
AutoMouseArea {
anchors.fill: parent
onSecondaryClicked: Qt.createComponent("qrc:/qml/menu/MessageContextMenu.qml").createObject(this)
}
background: Rectangle { color: colored ? Material.accent : highlighted ? Material.primary : backgroundColor }
}

View File

@@ -13,9 +13,11 @@ Item {
id: item
Image {
id: avatar
width: item.width
height: item.width
id: avatar
visible: showImage
source: item.source
@@ -40,6 +42,7 @@ Item {
Label {
anchors.fill: parent
color: "white"
visible: showInitial
text: showInitial ? getInitials(displayText)[0] : ""

View File

@@ -10,8 +10,9 @@ Item {
id: item
Text {
id: iconText
anchors.fill: parent
id: iconText
font.pointSize: 16
font.family: materialFont.name
color: item.color

View File

@@ -14,10 +14,10 @@ RowLayout {
signal saveFileAs()
signal openExternally()
id: messageRow
z: -5
id: messageRow
Layout.alignment: sentByMe ? Qt.AlignRight : Qt.AlignLeft
spacing: 6
@@ -100,14 +100,16 @@ RowLayout {
id: imageComponent
DownloadableContent {
id: downloadable
width: messageImage.width
height: messageImage.height
id: downloadable
AutoImage {
id: messageImage
z: -4
id: messageImage
sourceSize: 128
source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url)