Merge branch 'master' into kirigami2

This commit is contained in:
Carl Schwan
2020-10-03 17:48:27 +02:00
19 changed files with 74 additions and 95 deletions

View File

@@ -26,7 +26,7 @@ TextField {
states: [
State {
name: "shown"
when: textField.text.length !== 0 || textField.activeFocus
when: textField.text.length != 0 || textField.activeFocus
PropertyChanges { target: floatingPlaceholder; scale: 0.8 }
PropertyChanges { target: floatingPlaceholder; anchors.topMargin: -floatingPlaceholder.height * 0.4 }
}

View File

@@ -96,7 +96,7 @@ RowLayout {
}
Label {
readonly property int duration: content.info.duration || audio.duration || 0
readonly property int duration: content.info.duration ?? audio.duration ?? 0
Layout.fillWidth: true
@@ -193,14 +193,12 @@ RowLayout {
}
}
function openSavedFile()
{
function openSavedFile() {
if (Qt.openUrlExternally(progressInfo.localPath)) return;
if (Qt.openUrlExternally(progressInfo.localDir)) return;
}
function humanSize(duration)
{
function humanSize(duration) {
if (!duration)
return qsTr("Unknown", "Unknown duration")
if (duration < 1000)

View File

@@ -12,8 +12,14 @@ RowLayout {
default property alias innerObject : column.children
readonly property bool sentByMe: author.isLocalUser
readonly property bool replyVisible: reply || false
readonly property bool failed: marks === EventStatus.SendingFailed
readonly property bool darkBackground: !sentByMe
readonly property bool replyVisible: reply ?? false
readonly property bool failed: marks == EventStatus.SendingFailed
readonly property color authorColor: eventType == "notice" ? MPalette.primary : author.color
readonly property color replyAuthorColor: replyVisible ? reply.author.color : MPalette.accent
signal saveFileAs()
signal openExternally()
id: root

View File

@@ -4,7 +4,7 @@ import QtQuick.Layouts 1.12
import Spectral.Setting 0.1
Flow {
visible: (reaction && reaction.length > 0) || false
visible: (reaction && reaction.length > 0) ?? false
spacing: 8

View File

@@ -120,7 +120,7 @@ RowLayout {
}
Image {
readonly property bool isThumbnail: !(content.info.thumbnail_info == null || content.thumbnailMediaId == null)
readonly property bool isThumbnail: content.info.thumbnail_info && content.thumbnailMediaId
readonly property var info: isThumbnail ? content.info.thumbnail_info : content.info
anchors.fill: parent

View File

@@ -39,7 +39,7 @@ Dialog {
height: 48
source: user.avatarMediaId
hint: user.displayName || "No Name"
hint: user.displayName ?? ""
Menu {
id: contextMenu

View File

@@ -232,7 +232,7 @@ Dialog {
Layout.preferredWidth: 100
wrapMode: Label.Wrap
text: "Main Alias"
text: "Canonical Alias"
color: MPalette.lighter
}
@@ -243,12 +243,12 @@ Dialog {
enabled: canChangeCanonicalAlias
model: room.remoteAliases
model: room.aliases
currentIndex: room.remoteAliases.indexOf(room.canonicalAlias)
currentIndex: room.aliases.indexOf(room.canonicalAlias)
onCurrentIndexChanged: {
if (room.canonicalAlias != room.remoteAliases[currentIndex]) {
room.setCanonicalAlias(room.remoteAliases[currentIndex])
if (room.canonicalAlias != room.aliases[currentIndex]) {
room.setCanonicalAlias(room.aliases[currentIndex])
}
}
}
@@ -257,12 +257,14 @@ Dialog {
RowLayout {
Layout.fillWidth: true
visible: room.altAliases && room.altAliases.length
Label {
Layout.preferredWidth: 100
Layout.alignment: Qt.AlignTop
wrapMode: Label.Wrap
text: "Local Aliases"
text: "Alt Aliases"
color: MPalette.lighter
}
@@ -272,7 +274,7 @@ Dialog {
spacing: 0
Repeater {
model: room.localAliases
model: room.altAliases
delegate: RowLayout {
Layout.maximumWidth: parent.width
@@ -302,42 +304,6 @@ Dialog {
}
}
}
RowLayout {
Layout.fillWidth: true
Label {
Layout.preferredWidth: 100
Layout.alignment: Qt.AlignTop
wrapMode: Label.Wrap
text: "Remote Aliases"
color: MPalette.lighter
}
ColumnLayout {
Layout.fillWidth: true
spacing: 0
Repeater {
model: {
var localAliases = room.localAliases
var remoteAliases = room.remoteAliases
return remoteAliases.filter(n => !localAliases.includes(n))
}
delegate: Label {
width: parent.width
text: modelData
font.pixelSize: 12
color: MPalette.lighter
}
}
}
}
}
}
}

View File

@@ -135,7 +135,7 @@ Item {
glowRadius: modelData.blur/2
spread: 0.05
color: _shadowColors[index]
cornerRadius: modelData.blur + (effect.sourceItem.radius || 0)
cornerRadius: modelData.blur + (effect.sourceItem.radius ?? 0)
}
}

View File

@@ -108,11 +108,6 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true
Layout.fillHeight: true
text: name || "No Name"
font.pixelSize: 16
font.bold: unreadCount >= 0
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
Controls.Label {

View File

@@ -130,9 +130,9 @@ Control {
keyNavigationWraps: true
delegate: Control {
property string autoCompleteText: modelData.displayName || modelData.unicode
property string autoCompleteText: modelData.displayName ?? modelData.unicode
property bool isEmoji: modelData.unicode != null
readonly property bool highlighted: autoCompleteListView.currentIndex === index
readonly property bool highlighted: autoCompleteListView.currentIndex == index
height: 36
padding: 6
@@ -140,7 +140,7 @@ Control {
background: Rectangle {
visible: !isEmoji
color: highlighted ? border.color : "transparent"
border.color: isEmoji ? Material.accent : modelData.color
border.color: isEmoji ? MPalette.accent : modelData.color
border.width: 2
radius: height / 2
}
@@ -164,7 +164,7 @@ Control {
Layout.preferredHeight: 24
visible: !isEmoji
source: modelData.avatarMediaId || null
source: modelData.avatarMediaId ?? null
color: modelData.color ? Qt.darker(modelData.color, 1.1) : MPalette.accent
}