diff --git a/TODO.md b/TODO.md index 90fc92e9..806276fc 100644 --- a/TODO.md +++ b/TODO.md @@ -30,8 +30,6 @@ - Is auto-sizing actually needed, or can we just set a default manual size? - Reducable room sidepane, swipe to show full-window - - When qml syntax highlighting supports ES6 string interpolation, use that - - Fixes - CPU usage - `code` not colored in room subtitle diff --git a/src/qml/Base/HIcon.qml b/src/qml/Base/HIcon.qml index edca1a50..8717a526 100644 --- a/src/qml/Base/HIcon.qml +++ b/src/qml/Base/HIcon.qml @@ -8,12 +8,7 @@ Image { fillMode: Image.PreserveAspectFit visible: Boolean(svgName) - source: - svgName ? - ("../../icons/" + (theme ? theme.icons.preferredPack : "thin") + - "/" + svgName + ".svg") : - "" - + source: svgName ? `../../icons/${iconPack}/${svgName}.svg` : "" sourceSize.width: svgName ? dimension : 0 sourceSize.height: svgName ? dimension : 0 @@ -21,6 +16,7 @@ Image { property string svgName: "" property int dimension: 20 property color colorize: theme.icons.colorize + property string iconPack: theme ? theme.icons.preferredPack : "thin" layer.enabled: ! Qt.colorEqual(colorize, "transparent") diff --git a/src/qml/Chat/RoomHeader.qml b/src/qml/Chat/RoomHeader.qml index af788c99..30b1977d 100644 --- a/src/qml/Chat/RoomHeader.qml +++ b/src/qml/Chat/RoomHeader.qml @@ -68,13 +68,13 @@ Rectangle { } HToolTip { - text: name && topic ? (name + "
" + topic) : (name || topic) + text: name && topic ? (`${name}
${topic}`) : (name || topic) label.textFormat: Text.StyledText visible: text && (nameHover.hovered || topicHover.hovered) readonly property string name: roomName.truncated ? - ("" + chatPage.roomInfo.display_name + "") : "" + (`${chatPage.roomInfo.display_name}`) : "" readonly property string topic: roomTopic.truncated ? chatPage.roomInfo.topic : "" } diff --git a/src/qml/Chat/Timeline/EventContent.qml b/src/qml/Chat/Timeline/EventContent.qml index 1748213e..e1836392 100644 --- a/src/qml/Chat/Timeline/EventContent.qml +++ b/src/qml/Chat/Timeline/EventContent.qml @@ -19,7 +19,7 @@ HRowLayout { readonly property string timeText: Utils.formatTime(model.date, false) readonly property string localEchoText: model.is_local_echo ? - " " : + ` ` : "" readonly property bool pureMedia: ! contentText && linksRepeater.count @@ -97,15 +97,14 @@ HRowLayout { // For some reason, if there's only one space, // times will be on their own lines most of the time. " " + - "" + // Local echo icon (model.is_local_echo ? - " " : "") + ` ` : "") transform: Translate { x: xOffset } diff --git a/src/qml/Dialogs/SendFilePicker.qml b/src/qml/Dialogs/SendFilePicker.qml index 19039061..4b1e6b06 100644 --- a/src/qml/Dialogs/SendFilePicker.qml +++ b/src/qml/Dialogs/SendFilePicker.qml @@ -15,7 +15,7 @@ HFileDialogOpener { if (destroyWhenDone) destroy() }, (type, args, error, traceback) => { - console.error("python:\n" + traceback) + console.error(`python:\n${traceback}`) if (destroyWhenDone) destroy() }) } diff --git a/src/qml/Pages/AddChat/EncryptCheckBox.qml b/src/qml/Pages/AddChat/EncryptCheckBox.qml index 3d4dab56..083eedac 100644 --- a/src/qml/Pages/AddChat/EncryptCheckBox.qml +++ b/src/qml/Pages/AddChat/EncryptCheckBox.qml @@ -6,7 +6,7 @@ HCheckBox { subtitle.text: qsTr("Protect the room against eavesdropper. Only you " + "and those you trust can read the conversation.") + - "
" + + `
` + qsTr("Cannot be disabled later!") + "" subtitle.textFormat: Text.StyledText diff --git a/src/qml/SidePane/RoomDelegate.qml b/src/qml/SidePane/RoomDelegate.qml index e8f3017d..f02edfd3 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -83,9 +83,7 @@ HTileDelegate { return text.replace( /< *span +class=['"]?quote['"]? *>(.+?)<\/ *span *>/g, - '$1', + `$1`, ) } diff --git a/src/qml/UI.qml b/src/qml/UI.qml index e6ef1122..5ebe5aa5 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -116,7 +116,7 @@ Item { } function showPage(name, properties={}) { - let path = "Pages/" + name + ".qml" + let path = `Pages/${name}.qml` _show(path, properties) window.uiState.page = path diff --git a/src/qml/event_handlers.js b/src/qml/event_handlers.js index ea8d4672..e1609de1 100644 --- a/src/qml/event_handlers.js +++ b/src/qml/event_handlers.js @@ -23,7 +23,7 @@ function onCoroutineDone(uuid, result, error, traceback) { onError ? onError(type, args, error, traceback) : - console.error("python: " + uuid + "\n" + traceback) + console.error(`python: ${uuid}\n${traceback}`) } else if (onSuccess) { onSuccess(result) } diff --git a/src/qml/utils.js b/src/qml/utils.js index ee232e32..46aa7072 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -85,7 +85,7 @@ function nameColor(name) { function coloredNameHtml(name, userId, displayText=null, disambiguate=false) { // substring: remove leading @ - return "" + + return `` + escapeHtml(displayText || name || userId) + "" } @@ -210,11 +210,11 @@ function formatDuration(milliseconds) { let minutes = Math.floor((totalSeconds % 3600) / 60) let seconds = Math.floor(totalSeconds % 60) - if (seconds < 10) seconds = "0" + seconds - if (hours < 1) return minutes + ":" + seconds + if (seconds < 10) seconds = `0${seconds}` + if (hours < 1) return `${minutes}:${seconds}` - if (minutes < 10) minutes = "0" + minutes - return hours + ":" + minutes + ":" + seconds + if (minutes < 10) minutes = `0${minutes}` + return `${hours}:${minutes}:${seconds}` }