diff --git a/imports/Spectral/Component/Timeline/ImageDelegate.qml b/imports/Spectral/Component/Timeline/ImageDelegate.qml
index 6f03100..34b81b5 100644
--- a/imports/Spectral/Component/Timeline/ImageDelegate.qml
+++ b/imports/Spectral/Component/Timeline/ImageDelegate.qml
@@ -3,6 +3,7 @@ import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.4
import QtGraphicalEffects 1.0
+import Qt.labs.platform 1.0 as Platform
import Spectral 0.1
import Spectral.Setting 0.1
@@ -14,13 +15,15 @@ ColumnLayout {
readonly property bool avatarVisible: !sentByMe && (aboveAuthor !== author || aboveSection !== section || aboveEventType === "state" || aboveEventType === "emote" || aboveEventType === "other")
readonly property bool sentByMe: author === currentRoom.localUser
- signal saveFileAs()
- signal openExternally()
+ property bool openOnFinished: false
+ readonly property bool downloaded: progressInfo && progressInfo.completed
id: root
spacing: 0
+ onDownloadedChanged: if (downloaded && openOnFinished) openSavedFile()
+
Label {
Layout.leftMargin: 48
@@ -72,7 +75,6 @@ ColumnLayout {
id: img
source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url)
- sourceSize.width: Math.min(256, messageListView.width)
layer.enabled: true
layer.effect: OpacityMask {
@@ -88,13 +90,65 @@ ColumnLayout {
id: messageMouseArea
- onSecondaryClicked: {
- messageContextMenu.root = root
- messageContextMenu.model = model
- messageContextMenu.selectedText = ""
- messageContextMenu.popup()
+ onSecondaryClicked: messageContextMenu.popup()
+
+ Menu {
+ id: messageContextMenu
+
+ MenuItem {
+ text: "View Source"
+
+ onTriggered: {
+ sourceDialog.sourceText = toolTip
+ sourceDialog.open()
+ }
+ }
+ MenuItem {
+ text: "Open Externally"
+
+ onTriggered: downloadAndOpen()
+ }
+ MenuItem {
+ text: "Save As"
+
+ onTriggered: saveFileAs()
+ }
+ MenuItem {
+ text: "Reply"
+
+ onTriggered: {
+ roomPanelInput.replyUser = author
+ roomPanelInput.replyEventID = eventId
+ roomPanelInput.replyContent = message
+ roomPanelInput.isReply = true
+ roomPanelInput.focus()
+ }
+ }
+ MenuItem {
+ text: "Redact"
+
+ onTriggered: currentRoom.redactEvent(eventId)
+ }
}
}
}
}
+
+ function saveFileAs() { currentRoom.saveFileAs(eventId) }
+
+ function downloadAndOpen()
+ {
+ if (downloaded) openSavedFile()
+ else
+ {
+ openOnFinished = true
+ currentRoom.downloadFile(eventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_") + (message || ".tmp"))
+ }
+ }
+
+ function openSavedFile()
+ {
+ if (Qt.openUrlExternally(progressInfo.localPath)) return;
+ if (Qt.openUrlExternally(progressInfo.localDir)) return;
+ }
}
diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml
index 0fe10c3..5b7ac4e 100644
--- a/imports/Spectral/Component/Timeline/MessageDelegate.qml
+++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml
@@ -80,11 +80,37 @@ ColumnLayout {
id: messageMouseArea
- onSecondaryClicked: {
- messageContextMenu.root = root
- messageContextMenu.model = model
- messageContextMenu.selectedText = contentLabel.selectedText
- messageContextMenu.popup()
+ onSecondaryClicked: messageContextMenu.popup()
+
+ Menu {
+ readonly property string selectedText: contentLabel.selectedText
+
+ id: messageContextMenu
+
+ MenuItem {
+ text: "View Source"
+
+ onTriggered: {
+ sourceDialog.sourceText = toolTip
+ sourceDialog.open()
+ }
+ }
+ MenuItem {
+ text: "Reply"
+
+ onTriggered: {
+ roomPanelInput.replyUser = author
+ roomPanelInput.replyEventID = eventId
+ roomPanelInput.replyContent = messageContextMenu.selectedText || message
+ roomPanelInput.isReply = true
+ roomPanelInput.focus()
+ }
+ }
+ MenuItem {
+ text: "Redact"
+
+ onTriggered: currentRoom.redactEvent(eventId)
+ }
}
}
}
diff --git a/imports/Spectral/Font/CommonFont.qml b/imports/Spectral/Font/CommonFont.qml
index efe053d..371004d 100644
--- a/imports/Spectral/Font/CommonFont.qml
+++ b/imports/Spectral/Font/CommonFont.qml
@@ -2,9 +2,4 @@ pragma Singleton
import QtQuick 2.12
import QtQuick.Controls 2.4
-Item {
- property alias font: materialLabel.font
- Label {
- id: materialLabel
- }
-}
+Label {}
diff --git a/imports/Spectral/Menu/MessageContextMenu.qml b/imports/Spectral/Menu/MessageContextMenu.qml
deleted file mode 100644
index 802e07b..0000000
--- a/imports/Spectral/Menu/MessageContextMenu.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-import QtQuick 2.12
-import QtQuick.Controls 2.4
-
-Menu {
- property var root: null
- property var model: null
- property string selectedText
-
- readonly property bool isFile: model && (model.eventType === "video" || model.eventType === "audio" || model.eventType === "file" || model.eventType === "image")
-
- id: messageContextMenu
-
- MenuItem {
- text: "View Source"
-
- onTriggered: {
- sourceDialog.sourceText = model.toolTip
- sourceDialog.open()
- }
- }
- MenuItem {
- visible: isFile
- height: visible ? undefined : 0
- text: "Open Externally"
-
- onTriggered: root.openExternally()
- }
- MenuItem {
- visible: isFile
- height: visible ? undefined : 0
- text: "Save As"
-
- onTriggered: root.saveFileAs()
- }
- MenuItem {
- height: visible ? undefined : 0
- text: "Reply"
-
- onTriggered: {
- roomPanelInput.replyUser = model.author
- roomPanelInput.replyEventID = model.eventId
- roomPanelInput.replyContent = selectedText != "" ? selectedText : model.message
- roomPanelInput.isReply = true
- roomPanelInput.focus()
- }
- }
- MenuItem {
- visible: model && model.author === currentRoom.localUser
- height: visible ? undefined : 0
- text: "Redact"
-
- onTriggered: currentRoom.redactEvent(model.eventId)
- }
-}
diff --git a/imports/Spectral/Menu/RoomContextMenu.qml b/imports/Spectral/Menu/RoomContextMenu.qml
deleted file mode 100644
index 497f79a..0000000
--- a/imports/Spectral/Menu/RoomContextMenu.qml
+++ /dev/null
@@ -1,35 +0,0 @@
-import QtQuick 2.12
-import QtQuick.Controls 2.4
-import Spectral 0.1
-
-Menu {
- property var model: null
-
- id: roomListMenu
-
- MenuItem {
- text: "Favourite"
- checkable: true
- checked: model && model.category === RoomType.Favorite
-
- onTriggered: model.category === RoomType.Favorite ? model.currentRoom.removeTag("m.favourite") : model.currentRoom.addTag("m.favourite", 1.0)
- }
- MenuItem {
- text: "Deprioritize"
- checkable: true
- checked: model && model.category === RoomType.Deprioritized
-
- onTriggered: model.category === RoomType.Deprioritized ? model.currentRoom.removeTag("m.lowpriority") : model.currentRoom.addTag("m.lowpriority", 1.0)
- }
- MenuSeparator {}
- MenuItem {
- text: "Mark as Read"
-
- onTriggered: model.currentRoom.markAllMessagesAsRead()
- }
- MenuItem {
- text: "Leave Room"
-
- onTriggered: model.currentRoom.forget()
- }
-}
diff --git a/imports/Spectral/Menu/qmldir b/imports/Spectral/Menu/qmldir
deleted file mode 100644
index 6892ba8..0000000
--- a/imports/Spectral/Menu/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module Spectral.Menu
-MessageContextMenu 2.0 MessageContextMenu.qml
-RoomContextMenu 2.0 RoomContextMenu.qml
diff --git a/imports/Spectral/Panel/RoomListPanel.qml b/imports/Spectral/Panel/RoomListPanel.qml
index 2ee2792..9a6cdb7 100644
--- a/imports/Spectral/Panel/RoomListPanel.qml
+++ b/imports/Spectral/Panel/RoomListPanel.qml
@@ -5,7 +5,6 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.4
import Spectral.Component 2.0
-import Spectral.Menu 2.0
import Spectral.Effect 2.0
import Spectral 0.1
@@ -489,11 +488,8 @@ Rectangle {
stepSize: 25
snapMode: Slider.SnapAlways
- ToolTip {
- Material.foreground: "white"
- visible: parent.pressed
- text: parent.value
- }
+ ToolTip.visible: pressed
+ ToolTip.text: value
onMoved: controller.setDpi(value)
}
@@ -804,10 +800,7 @@ Rectangle {
RippleEffect {
anchors.fill: parent
- onSecondaryClicked: {
- roomContextMenu.model = model
- roomContextMenu.popup()
- }
+ onSecondaryClicked: roomContextMenu.popup()
onPrimaryClicked: {
if (category === RoomType.Invited) {
inviteDialog.currentRoom = currentRoom
@@ -823,6 +816,36 @@ Rectangle {
}
}
}
+
+ Menu {
+ id: roomContextMenu
+
+ MenuItem {
+ text: "Favourite"
+ checkable: true
+ checked: category === RoomType.Favorite
+
+ onTriggered: category === RoomType.Favorite ? currentRoom.removeTag("m.favourite") : currentRoom.addTag("m.favourite", 1.0)
+ }
+ MenuItem {
+ text: "Deprioritize"
+ checkable: true
+ checked: category === RoomType.Deprioritized
+
+ onTriggered: category === RoomType.Deprioritized ? currentRoom.removeTag("m.lowpriority") : currentRoom.addTag("m.lowpriority", 1.0)
+ }
+ MenuSeparator {}
+ MenuItem {
+ text: "Mark as Read"
+
+ onTriggered: currentRoom.markAllMessagesAsRead()
+ }
+ MenuItem {
+ text: "Leave Room"
+
+ onTriggered: currentRoom.forget()
+ }
+ }
}
section.property: "display"
@@ -837,10 +860,6 @@ Rectangle {
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
-
- RoomContextMenu {
- id: roomContextMenu
- }
}
}
diff --git a/imports/Spectral/Panel/RoomPanel.qml b/imports/Spectral/Panel/RoomPanel.qml
index db01b53..465710f 100644
--- a/imports/Spectral/Panel/RoomPanel.qml
+++ b/imports/Spectral/Panel/RoomPanel.qml
@@ -7,7 +7,6 @@ import Qt.labs.qmlmodels 1.0
import Spectral.Component 2.0
import Spectral.Component.Emoji 2.0
import Spectral.Component.Timeline 2.0
-import Spectral.Menu 2.0
import Spectral.Effect 2.0
import Spectral 0.1
@@ -266,10 +265,6 @@ Item {
onClicked: messageListView.positionViewAtBeginning()
}
- MessageContextMenu {
- id: messageContextMenu
- }
-
Popup {
property string sourceText
diff --git a/imports/Spectral/Panel/RoomPanelInput.qml b/imports/Spectral/Panel/RoomPanelInput.qml
index e6ecec6..112da6e 100644
--- a/imports/Spectral/Panel/RoomPanelInput.qml
+++ b/imports/Spectral/Panel/RoomPanelInput.qml
@@ -251,13 +251,8 @@ Control {
onTriggered: currentRoom.sendTypingNotification(true)
}
- ToolTip {
- visible: currentRoom
- && currentRoom.hasUsersTyping
- text: currentRoom ? currentRoom.usersTyping : ""
-
- Material.foreground: "white"
- }
+ ToolTip.visible: currentRoom && currentRoom.hasUsersTyping
+ ToolTip.text: currentRoom ? currentRoom.usersTyping : ""
Keys.onReturnPressed: {
if (event.modifiers & Qt.ShiftModifier) {
diff --git a/qml/main.qml b/qml/main.qml
index 228c610..9f4f93a 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -26,9 +26,6 @@ ApplicationWindow {
visible: true
title: qsTr("Spectral")
- Material.foreground: MSettings.darkTheme ? "#FFFFFF" : "#1D333E"
- Material.background: MSettings.darkTheme ? "#303030" : "#FFFFFF"
-
Platform.SystemTrayIcon {
visible: MSettings.showTray
iconSource: "qrc:/assets/img/icon.png"
@@ -132,7 +129,6 @@ ApplicationWindow {
ToolTip {
id: loginButtonTooltip
- Material.foreground: "white"
}
}
diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf
index c594d10..de25d2b 100644
--- a/qtquickcontrols2.conf
+++ b/qtquickcontrols2.conf
@@ -10,6 +10,5 @@ Theme=Light
Variant=Dense
Primary=#344955
Accent=#673AB7
-Foreground=#1D333E
Background=#FFFFFF
Font/Family="Roboto,Noto Sans,Noto Color Emoji"
diff --git a/res.qrc b/res.qrc
index a1b0934..78e1f6d 100644
--- a/res.qrc
+++ b/res.qrc
@@ -14,9 +14,6 @@
imports/Spectral/Component/qmldir
imports/Spectral/Effect/ElevationEffect.qml
imports/Spectral/Effect/qmldir
- imports/Spectral/Menu/MessageContextMenu.qml
- imports/Spectral/Menu/qmldir
- imports/Spectral/Menu/RoomContextMenu.qml
imports/Spectral/Page/qmldir
assets/font/material.ttf
assets/img/icon.icns