Run qmlformat

This commit is contained in:
Tobias Fella
2024-02-20 18:11:23 +01:00
parent f2c12c582e
commit a10da64378
18 changed files with 120 additions and 100 deletions

View File

@@ -57,7 +57,7 @@ ColumnLayout {
*/
readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed
onDownloadedChanged: if (downloaded) {
audio.play()
audio.play();
}
/**
@@ -93,7 +93,7 @@ ColumnLayout {
target: playButton
icon.name: "media-playback-stop"
onClicked: {
root.room.cancelFileTransfer(root.eventId)
root.room.cancelFileTransfer(root.eventId);
}
}
},
@@ -105,7 +105,7 @@ ColumnLayout {
icon.name: "media-playback-start"
onClicked: {
audio.source = root.fileTransferInfo.localPath;
audio.play()
audio.play();
}
}
},

View File

@@ -106,7 +106,7 @@ QQC2.Control {
/**
* @brief Request a context menu be show for the message.
*/
signal showMessageMenu()
signal showMessageMenu
contentItem: ColumnLayout {
id: contentColumn
@@ -152,8 +152,12 @@ QQC2.Control {
timeline: root.timeline
maxContentWidth: root.maxContentWidth
onReplyClicked: (eventId) => {root.replyClicked(eventId)}
onSelectedTextChanged: (selectedText) => {root.selectedTextChanged(selectedText);}
onReplyClicked: eventId => {
root.replyClicked(eventId);
}
onSelectedTextChanged: selectedText => {
root.selectedTextChanged(selectedText);
}
onShowMessageMenu: root.showMessageMenu()
}
}

View File

@@ -94,7 +94,10 @@ Loader {
text: i18n("Remove")
icon.name: "edit-delete-remove"
icon.color: "red"
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, {
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Remove Message"),
width: Kirigami.Units.gridUnit * 25
})
@@ -106,7 +109,7 @@ Loader {
onTriggered: {
currentRoom.mainCache.replyId = eventId;
currentRoom.editCache.editId = "";
RoomManager.requestFullScreenClose()
RoomManager.requestFullScreenClose();
}
}
@@ -114,7 +117,10 @@ Loader {
text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report")
icon.name: "dialog-warning-symbolic"
visible: !author.isLocalUser
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, {
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Report Message"),
width: Kirigami.Units.gridUnit * 25
})
@@ -139,12 +145,14 @@ Loader {
icon.name: modelData.icon.name
onTriggered: modelData.trigger()
}
onObjectAdded: (index, object) => {menuItem.insertItem(0, object)}
onObjectAdded: (index, object) => {
menuItem.insertItem(0, object);
}
}
}
onObjectAdded: (index, object) => {
object.visible = false;
menu.addMenu(object)
menu.addMenu(object);
}
}
@@ -153,7 +161,7 @@ Loader {
QQC2.MenuItem {
visible: modelData.visible
action: modelData
onClicked: root.item.close();
onClicked: root.item.close()
}
}
QQC2.Menu {
@@ -161,7 +169,7 @@ Loader {
title: i18n("Search for '%1'", webshortcutmodel.trunkatedSearchText)
property bool isVisible: webshortcutmodel.enabled
Component.onCompleted: {
webshortcutmenu.parent.visible = isVisible
webshortcutmenu.parent.visible = isVisible;
}
onIsVisibleChanged: webshortcutmenu.parent.visible = isVisible
Instantiator {
@@ -238,7 +246,7 @@ Loader {
visible: modelData.visible
text: modelData.text
onClicked: {
modelData.triggered()
modelData.triggered();
root.item.close();
}
}
@@ -274,7 +282,7 @@ Loader {
Layout.fillWidth: true
wrapMode: Text.WordWrap
onLinkActivated: RoomManager.resolveResource(link, "join");
onLinkActivated: RoomManager.resolveResource(link, "join")
}
}
}
@@ -320,7 +328,7 @@ Loader {
visible: modelData.visible
text: modelData.text
onClicked: {
modelData.triggered()
modelData.triggered();
root.item.close();
}
}
@@ -360,4 +368,3 @@ Loader {
}
}
}

View File

@@ -59,7 +59,7 @@ ColumnLayout {
*/
readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed
onDownloadedChanged: {
itineraryModel.path = root.fileTransferInfo.localPath
itineraryModel.path = root.fileTransferInfo.localPath;
if (autoOpenFile) {
openSavedFile();
}
@@ -76,9 +76,9 @@ ColumnLayout {
property real maxContentWidth: -1
function saveFileAs() {
const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay)
dialog.open()
dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId)
const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay);
dialog.open();
dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId);
}
function openSavedFile() {
@@ -209,10 +209,10 @@ ColumnLayout {
fileMode: FileDialog.SaveFile
folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
onAccepted: {
Config.lastSaveDirectory = folder
Config.save()
Config.lastSaveDirectory = folder;
Config.save();
if (autoOpenFile) {
UrlHelper.copyTo(root.fileTransferInfo.localPath, file)
UrlHelper.copyTo(root.fileTransferInfo.localPath, file);
} else {
root.room.download(root.eventId, file);
}
@@ -239,9 +239,9 @@ ColumnLayout {
text: model.name
}
QQC2.Label {
text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : ""
visible: model.coach
opacity: 0.7
text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : ""
visible: model.coach
opacity: 0.7
}
}
RowLayout {
@@ -260,7 +260,7 @@ ColumnLayout {
}
ColumnLayout {
QQC2.Label {
text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "")
text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "")
}
QQC2.Label {
text: model.arrivalTime

View File

@@ -129,32 +129,34 @@ Item {
acceptedButtons: Qt.LeftButton
gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds
onTapped: {
root.QQC2.ToolTip.hide()
root.QQC2.ToolTip.hide();
if (root.mediaInfo.animated) {
_private.imageItem.paused = true
_private.imageItem.paused = true;
}
root.timeline.interactive = false
root.timeline.interactive = false;
// We need to make sure the index is that of the MediaMessageFilterModel.
if (root.timeline.model instanceof MessageFilterModel) {
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index))
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index));
} else {
RoomManager.maximizeMedia(root.index)
RoomManager.maximizeMedia(root.index);
}
}
}
function downloadAndOpen() {
if (_private.downloaded) {
openSavedFile()
openSavedFile();
} else {
openOnFinished = true
root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId))
openOnFinished = true;
root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId));
}
}
function openSavedFile() {
if (UrlHelper.openUrl(root.fileTransferInfo.localPath)) return;
if (UrlHelper.openUrl(root.fileTransferInfo.localDir)) return;
if (UrlHelper.openUrl(root.fileTransferInfo.localPath))
return;
if (UrlHelper.openUrl(root.fileTransferInfo.localDir))
return;
}
MediaSizeHelper {

View File

@@ -64,8 +64,10 @@ ColumnLayout {
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: {
let map = fullScreenMap.createObject(parent, {liveLocationModel: liveLocationModel});
map.open()
let map = fullScreenMap.createObject(parent, {
liveLocationModel: liveLocationModel
});
map.open();
}
onLongPressed: openMessageContext("")
}
@@ -76,7 +78,7 @@ ColumnLayout {
Connections {
target: mapView.map
function onCopyrightLinkActivated() {
Qt.openUrlExternally(link)
Qt.openUrlExternally(link);
}
}
}

View File

@@ -49,11 +49,10 @@ RowLayout {
level: 2
text: {
switch (root.type) {
case LoadComponent.Reply:
return i18n("Loading reply");
case LoadComponent.LinkPreview:
return i18n("Loading URL preview");
case LoadComponent.Reply:
return i18n("Loading reply");
case LoadComponent.LinkPreview:
return i18n("Loading URL preview");
}
}
}

View File

@@ -88,8 +88,13 @@ ColumnLayout {
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: {
let map = fullScreenMap.createObject(parent, {latitude: root.latitude, longitude: root.longitude, asset: root.asset, author: root.author});
map.open()
let map = fullScreenMap.createObject(parent, {
latitude: root.latitude,
longitude: root.longitude,
asset: root.asset,
author: root.author
});
map.open();
}
onLongPressed: openMessageContext("")
}
@@ -100,13 +105,13 @@ ColumnLayout {
Connections {
target: mapView.map
function onCopyrightLinkActivated() {
Qt.openUrlExternally(link)
Qt.openUrlExternally(link);
}
}
}
Component {
id: fullScreenMap
FullScreenMap { }
FullScreenMap {}
}
TextComponent {

View File

@@ -48,7 +48,7 @@ DelegateChooser {
/**
* @brief Request a context menu be show for the message.
*/
signal showMessageMenu()
signal showMessageMenu
role: "componentType"
@@ -56,7 +56,7 @@ DelegateChooser {
roleValue: MessageComponentType.Text
delegate: TextComponent {
maxContentWidth: root.maxContentWidth
onSelectedTextChanged: root.selectedTextChanged(selectedText);
onSelectedTextChanged: root.selectedTextChanged(selectedText)
onShowMessageMenu: root.showMessageMenu()
}
}
@@ -129,7 +129,9 @@ DelegateChooser {
roleValue: MessageComponentType.Reply
delegate: ReplyComponent {
maxContentWidth: root.maxContentWidth
onReplyClicked: (eventId) => {root.replyClicked(eventId)}
onReplyClicked: eventId => {
root.replyClicked(eventId);
}
}
}

View File

@@ -333,7 +333,9 @@ TimelineDelegate {
onReplyClicked: eventId => {
root.replyClicked(eventId);
}
onSelectedTextChanged: (selectedText) => {root.selectedText = selectedText;}
onSelectedTextChanged: selectedText => {
root.selectedText = selectedText;
}
onShowMessageMenu: _private.showMessageMenu()
showBackground: root.cardBackground && !Config.compactLayout
@@ -407,7 +409,7 @@ TimelineDelegate {
property bool showUserMessageOnRight: Config.showLocalMessagesOnRight && root.author.isLocalUser && !Config.compactLayout && !root.alwaysMaxWidth
function showMessageMenu() {
RoomManager.viewEventMenu(root.eventId, root.room, root.selectedText)
RoomManager.viewEventMenu(root.eventId, root.room, root.selectedText);
}
}
}

View File

@@ -69,7 +69,7 @@ ColumnLayout {
}
}
Label {
visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded
visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded
text: i18np("Based on votes by %1 user", "Based on votes by %1 users", root.pollHandler.answerCount) + (root.pollHandler.hasEnded ? (" " + i18nc("as in 'this vote has ended'", "(Ended)")) : "")
font.pointSize: questionLabel.font.pointSize * 0.8
}

View File

@@ -15,7 +15,6 @@ Kirigami.Dialog {
property var connection
parent: applicationWindow().overlay
leftPadding: 0
@@ -47,22 +46,21 @@ Kirigami.Dialog {
}
}
}
}
FormCard.FormDelegateSeparator {}
FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Join")
onClicked: {
SpaceHierarchyCache.recommendedSpaceHidden = true
RoomManager.resolveResource(SpaceHierarchyCache.recommendedSpaceId, "join")
root.close()
SpaceHierarchyCache.recommendedSpaceHidden = true;
RoomManager.resolveResource(SpaceHierarchyCache.recommendedSpaceId, "join");
root.close();
}
}
FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Ignore")
onClicked: {
SpaceHierarchyCache.recommendedSpaceHidden = true
root.close()
SpaceHierarchyCache.recommendedSpaceHidden = true;
root.close();
}
}
}

View File

@@ -33,7 +33,7 @@ Delegates.RoundedItemDelegate {
Accessible.name: root.displayName
Accessible.onPressAction: clicked()
onClicked: RoomManager.resolveResource(currentRoom.id);
onClicked: RoomManager.resolveResource(currentRoom.id)
onPressAndHold: createRoomListContextMenu()
Keys.onSpacePressed: clicked()
@@ -42,7 +42,7 @@ Delegates.RoundedItemDelegate {
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: (eventPoint, button) => root.createRoomListContextMenu();
onTapped: (eventPoint, button) => root.createRoomListContextMenu()
}
contentItem: RowLayout {

View File

@@ -173,7 +173,7 @@ Kirigami.Page {
required property TreeView treeView
required property bool current
onCurrentChanged: if (current) {
forceActiveFocus(Qt.TabFocusReason)
forceActiveFocus(Qt.TabFocusReason);
}
implicitWidth: treeView.width

View File

@@ -19,7 +19,7 @@ QQC2.ItemDelegate {
required property int row
required property bool current
onCurrentChanged: if (current) {
collapseButton.forceActiveFocus(Qt.TabFocusReason)
collapseButton.forceActiveFocus(Qt.TabFocusReason);
}
required property bool selected

View File

@@ -26,7 +26,7 @@ QQC2.Control {
target: RoomManager
function onConnectionChanged() {
// We need to rebind as any previous change will have been overwritten.
selectedSpaceId = RoomManager.lastSpaceId
selectedSpaceId = RoomManager.lastSpaceId;
}
}
@@ -267,7 +267,7 @@ QQC2.Control {
onClicked: {
recommendedSpaceDialogComponent.createObject(QQC2.ApplicationWindow.overlay, {
connection: root.connection
}).open()
}).open();
}
Component {
id: recommendedSpaceDialogComponent

View File

@@ -53,7 +53,7 @@ TextEdit {
/**
* @brief Request a context menu be show for the message.
*/
signal showMessageMenu()
signal showMessageMenu
Layout.fillWidth: true
Layout.fillHeight: true
@@ -122,8 +122,8 @@ a{
textFormat: Text.RichText
onLinkActivated: link => {
spoilerRevealed = true
RoomManager.resolveResource(link, "join")
spoilerRevealed = true;
RoomManager.resolveResource(link, "join");
}
onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") {
applicationWindow().hoverLinkIndicator.text = hoveredLink;

View File

@@ -59,12 +59,11 @@ Video {
readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed
onDownloadedChanged: {
if (downloaded) {
root.source = root.fileTransferInfo.localPath
root.source = root.fileTransferInfo.localPath;
}
if (downloaded && playOnFinished) {
playSavedFile()
playOnFinished = false
playSavedFile();
playOnFinished = false;
}
}
@@ -220,19 +219,19 @@ Video {
onClicked: {
if (root.volume > 0) {
root.volume = 0
root.volume = 0;
} else {
if (unmuteVolume === 0) {
root.volume = 1
root.volume = 1;
} else {
root.volume = unmuteVolume
root.volume = unmuteVolume;
}
}
}
onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) {
videoControlTimer.restart()
volumePopupTimer.restart()
videoControlTimer.restart();
volumePopupTimer.restart();
}
}
@@ -256,13 +255,13 @@ Video {
to: 1
value: root.volume
onMoved: {
root.volume = value
volumeButton.unmuteVolume = value
root.volume = value;
volumeButton.unmuteVolume = value;
}
onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) {
rooteoControlTimer.restart()
volumePopupTimer.restart()
rooteoControlTimer.restart();
volumePopupTimer.restart();
}
}
}
@@ -274,8 +273,8 @@ Video {
id: volumePopupHoverHandler
onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) {
videoControlTimer.restart()
volumePopupTimer.restart()
videoControlTimer.restart();
volumePopupTimer.restart();
}
}
}
@@ -303,13 +302,13 @@ Video {
text: i18n("Maximize")
icon.name: "view-fullscreen"
onTriggered: {
root.timeline.interactive = false
root.pause()
root.timeline.interactive = false;
root.pause();
// We need to make sure the index is that of the MediaMessageFilterModel.
if (root.timeline.model instanceof MessageFilterModel) {
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index))
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index));
} else {
RoomManager.maximizeMedia(root.index)
RoomManager.maximizeMedia(root.index);
}
}
}
@@ -339,7 +338,7 @@ Video {
id: videoHoverHandler
onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) {
videoControlTimer.restart()
videoControlTimer.restart();
}
}
}
@@ -349,12 +348,12 @@ Video {
gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds
onTapped: if (root.fileTransferInfo.completed) {
if (root.playbackState == MediaPlayer.PlayingState) {
root.pause()
root.pause();
} else {
root.play()
root.play();
}
} else {
root.downloadAndPlay()
root.downloadAndPlay();
}
}
@@ -367,15 +366,15 @@ Video {
function downloadAndPlay() {
if (root.downloaded) {
playSavedFile()
playSavedFile();
} else {
playOnFinished = true
root.room.downloadFile(root.eventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId))
playOnFinished = true;
root.room.downloadFile(root.eventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId));
}
}
function playSavedFile() {
root.stop()
root.play()
root.stop();
root.play();
}
}