Remove remaining uses of MatrixImageProvider and remove it
This commit is contained in:
@@ -20,8 +20,6 @@ add_library(neochat STATIC
|
|||||||
models/customemojimodel.h
|
models/customemojimodel.h
|
||||||
clipboard.cpp
|
clipboard.cpp
|
||||||
clipboard.h
|
clipboard.h
|
||||||
matriximageprovider.cpp
|
|
||||||
matriximageprovider.h
|
|
||||||
models/messageeventmodel.cpp
|
models/messageeventmodel.cpp
|
||||||
models/messageeventmodel.h
|
models/messageeventmodel.h
|
||||||
models/messagefiltermodel.cpp
|
models/messagefiltermodel.cpp
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ QQC2.ItemDelegate {
|
|||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
Kirigami.Heading {
|
Kirigami.Heading {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: !root.emoji.startsWith("image") && !root.isImage
|
visible: !root.emoji.startsWith("mxc") && !root.isImage
|
||||||
text: root.emoji
|
text: root.emoji
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
@@ -41,7 +41,7 @@ QQC2.ItemDelegate {
|
|||||||
}
|
}
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: root.emoji.startsWith("image") || root.isImage
|
visible: root.emoji.startsWith("mxc") || root.isImage
|
||||||
source: visible ? root.emoji : ""
|
source: visible ? root.emoji : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QNetworkDiskCache>
|
#include <QNetworkDiskCache>
|
||||||
#include <QNetworkProxyFactory>
|
#include <QNetworkProxyFactory>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
@@ -46,11 +47,10 @@
|
|||||||
#include "colorschemer.h"
|
#include "colorschemer.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "matriximageprovider.h"
|
|
||||||
#include "neochatconfig.h"
|
#include "neochatconfig.h"
|
||||||
#include "roommanager.h"
|
#include "roommanager.h"
|
||||||
#include "windowcontroller.h"
|
|
||||||
#include "sharehandler.h"
|
#include "sharehandler.h"
|
||||||
|
#include "windowcontroller.h"
|
||||||
|
|
||||||
#ifdef HAVE_RUNNER
|
#ifdef HAVE_RUNNER
|
||||||
#include "runner.h"
|
#include "runner.h"
|
||||||
@@ -286,7 +286,6 @@ int main(int argc, char *argv[])
|
|||||||
ShareHandler::instance().setText(parser.value(shareOption));
|
ShareHandler::instance().setText(parser.value(shareOption));
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.addImageProvider(QLatin1String("mxc"), MatrixImageProvider::create(&engine, &engine));
|
|
||||||
engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider);
|
engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider);
|
||||||
|
|
||||||
engine.loadFromModule("org.kde.neochat", "Main");
|
engine.loadFromModule("org.kde.neochat", "Main");
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ QVariant AccountEmoticonModel::data(const QModelIndex &index, int role) const
|
|||||||
const auto &row = index.row();
|
const auto &row = index.row();
|
||||||
const auto &image = m_images->images[row];
|
const auto &image = m_images->images[row];
|
||||||
if (role == UrlRole) {
|
if (role == UrlRole) {
|
||||||
return m_connection->makeMediaUrl(image.url);
|
return m_connection->makeMediaUrl(image.url).toString();
|
||||||
}
|
}
|
||||||
if (role == BodyRole) {
|
if (role == BodyRole) {
|
||||||
if (image.body) {
|
if (image.body) {
|
||||||
|
|||||||
@@ -153,13 +153,13 @@ QVariant CustomEmojiModel::data(const QModelIndex &idx, int role) const
|
|||||||
|
|
||||||
switch (Roles(role)) {
|
switch (Roles(role)) {
|
||||||
case Roles::ModelData:
|
case Roles::ModelData:
|
||||||
return QVariant::fromValue(Emoji(QStringLiteral("image://mxc/") + data.url.mid(6), data.name, true));
|
return QVariant::fromValue(Emoji(m_connection->makeMediaUrl(QUrl(data.url)).toString(), data.name, true));
|
||||||
case Roles::Name:
|
case Roles::Name:
|
||||||
case Roles::DisplayRole:
|
case Roles::DisplayRole:
|
||||||
case Roles::ReplacedTextRole:
|
case Roles::ReplacedTextRole:
|
||||||
return data.name;
|
return data.name;
|
||||||
case Roles::ImageURL:
|
case Roles::ImageURL:
|
||||||
return QUrl(QStringLiteral("image://mxc/") + data.url.mid(6));
|
return m_connection->makeMediaUrl(QUrl(data.url));
|
||||||
case Roles::MxcUrl:
|
case Roles::MxcUrl:
|
||||||
return m_connection->makeMediaUrl(QUrl(data.url));
|
return m_connection->makeMediaUrl(QUrl(data.url));
|
||||||
default:
|
default:
|
||||||
@@ -205,7 +205,7 @@ QVariantList CustomEmojiModel::filterModel(const QString &filter)
|
|||||||
if (!emoji.name.contains(filter, Qt::CaseInsensitive))
|
if (!emoji.name.contains(filter, Qt::CaseInsensitive))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
results << QVariant::fromValue(Emoji(QStringLiteral("image://mxc/") + emoji.url.mid(6), emoji.name, true));
|
results << QVariant::fromValue(Emoji(m_connection->makeMediaUrl(QUrl(emoji.url)).toString(), emoji.name, true));
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ Kirigami.Dialog {
|
|||||||
width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
||||||
height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
||||||
}
|
}
|
||||||
source: userDelegate.connection.localUser.avatarMediaId ? ("image://mxc/" + userDelegate.connection.localUser.avatarMediaId) : ""
|
source: userDelegate.connection.localUser.avatarMediaId ? userDelegate.connection.makeMediaUrl("mxc://" + userDelegate.connection.localUser.avatarMediaId) : ""
|
||||||
name: userDelegate.connection.localUser.displayName ?? userDelegate.connection.localUser.id
|
name: userDelegate.connection.localUser.displayName ?? userDelegate.connection.localUser.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ QQC2.ItemDelegate {
|
|||||||
visible: root.categoryVisible || filterText.length > 0
|
visible: root.categoryVisible || filterText.length > 0
|
||||||
|
|
||||||
contentItem: KirigamiComponents.Avatar {
|
contentItem: KirigamiComponents.Avatar {
|
||||||
source: root.avatar ? `image://mxc/${root.avatar}` : ""
|
source: root.avatar ? root.currentRoom.connection.makeMediaUrl("mxc://" + root.avatar) : ""
|
||||||
name: root.displayName
|
name: root.displayName
|
||||||
|
|
||||||
sourceSize {
|
sourceSize {
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ Loader {
|
|||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
KirigamiComponents.Avatar {
|
KirigamiComponents.Avatar {
|
||||||
id: avatar
|
id: avatar
|
||||||
source: room.avatarMediaId ? ("image://mxc/" + room.avatarMediaId) : ""
|
source: room.avatarMediaId ? root.connection.makeMediaUrl("mxc://" + room.avatarMediaId) : ""
|
||||||
name: room.displayName
|
name: room.displayName
|
||||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
||||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
contentItem: KirigamiComponents.Avatar {
|
contentItem: KirigamiComponents.Avatar {
|
||||||
name: root.room ? root.room.displayName : ""
|
name: root.room ? root.room.displayName : ""
|
||||||
source: root.room ? ("image://mxc/" + root.room.avatarMediaId) : ""
|
source: root.room ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: root.room.usesEncryption
|
visible: root.room.usesEncryption
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ColumnLayout {
|
|||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.large
|
Layout.preferredHeight: Kirigami.Units.iconSizes.large
|
||||||
|
|
||||||
name: root.room ? root.room.displayName : ""
|
name: root.room ? root.room.displayName : ""
|
||||||
source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : ""
|
source: root.room ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: room.usesEncryption
|
visible: room.usesEncryption
|
||||||
@@ -92,7 +92,7 @@ ColumnLayout {
|
|||||||
text: barcode.content,
|
text: barcode.content,
|
||||||
title: root.room ? root.room.displayName : "",
|
title: root.room ? root.room.displayName : "",
|
||||||
subtitle: root.room ? root.room.id : "",
|
subtitle: root.room ? root.room.id : "",
|
||||||
avatarSource: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : ""
|
avatarSource: root.room && root.room.avatarMediaId ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
||||||
});
|
});
|
||||||
map.open();
|
map.open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
onConnectionChanged: {
|
onConnectionChanged: {
|
||||||
CustomEmojiModel.connection = root.connection;
|
CustomEmojiModel.connection = root.connection;
|
||||||
MatrixImageProvider.connection = root.connection;
|
|
||||||
SpaceHierarchyCache.connection = root.connection;
|
SpaceHierarchyCache.connection = root.connection;
|
||||||
if (ShareHandler.text && root.connection) {
|
if (ShareHandler.text && root.connection) {
|
||||||
root.handleShare();
|
root.handleShare();
|
||||||
@@ -190,7 +189,6 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
CustomEmojiModel.connection = root.connection;
|
CustomEmojiModel.connection = root.connection;
|
||||||
MatrixImageProvider.connection = root.connection;
|
|
||||||
SpaceHierarchyCache.connection = root.connection;
|
SpaceHierarchyCache.connection = root.connection;
|
||||||
WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout);
|
WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout);
|
||||||
if (ShareHandler.text && root.connection) {
|
if (ShareHandler.text && root.connection) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Delegates.RoundedItemDelegate {
|
|||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
Components.Avatar {
|
Components.Avatar {
|
||||||
source: root.avatar ? "image://mxc/" + root.avatar : ""
|
source: root.avatar ? root.connection.makeMediaUrl("mxc://" + root.avatar) : ""
|
||||||
name: root.displayName
|
name: root.displayName
|
||||||
visible: Config.showAvatarInRoomDrawer
|
visible: Config.showAvatarInRoomDrawer
|
||||||
implicitHeight: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2)
|
implicitHeight: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2)
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ QQC2.Control {
|
|||||||
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
text: displayName
|
text: displayName
|
||||||
source: avatar ? ("image://mxc/" + avatar) : ""
|
source: avatar ? root.connection.makeMediaUrl("mxc://" + avatar) : ""
|
||||||
|
|
||||||
activeFocusOnTab: true
|
activeFocusOnTab: true
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ Loader {
|
|||||||
|
|
||||||
KirigamiComponents.Avatar {
|
KirigamiComponents.Avatar {
|
||||||
id: avatar
|
id: avatar
|
||||||
source: room.avatarMediaId ? ("image://mxc/" + room.avatarMediaId) : ""
|
source: room.avatarMediaId ? root.room.connection.makeMediaUrl("mxc://" + room.avatarMediaId) : ""
|
||||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
||||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ RowLayout {
|
|||||||
Layout.leftMargin: Kirigami.Units.largeSpacing
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
text: i18n("Edit this account")
|
text: i18n("Edit this account")
|
||||||
source: mediaId ? ("image://mxc/" + mediaId) : ""
|
source: mediaId ? root.connection.makeMediaUrl("mxc://" + mediaId) : ""
|
||||||
|
|
||||||
activeFocusOnTab: true
|
activeFocusOnTab: true
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ FormCard.FormCardPage {
|
|||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
source: root.connection && root.connection.localUser.avatarMediaId ? ("image://mxc/" + root.connection.localUser.avatarMediaId) : ""
|
source: root.connection && root.connection.localUser.avatarMediaId ? root.connection.makeMediaUrl("mxc://" + root.connection.localUser.avatarMediaId) : ""
|
||||||
name: root.connection.localUser.displayName
|
name: root.connection.localUser.displayName
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ FormCard.FormCardPage {
|
|||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
KirigamiComponents.Avatar {
|
KirigamiComponents.Avatar {
|
||||||
name: accountDelegate.connection.localUser.displayName
|
name: accountDelegate.connection.localUser.displayName
|
||||||
source: accountDelegate.connection.localUser.avatarMediaId ? ("image://mxc/" + accountDelegate.connection.localUser.avatarMediaId) : ""
|
source: accountDelegate.connection.localUser.avatarMediaId ? accountDelegate.connection.makeMediaUrl("mxc://" + accountDelegate.connection.localUser.avatarMediaId) : ""
|
||||||
|
|
||||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||||
implicitWidth: Kirigami.Units.iconSizes.medium
|
implicitWidth: Kirigami.Units.iconSizes.medium
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ FormCard.FormCardPage {
|
|||||||
KirigamiComponents.Avatar {
|
KirigamiComponents.Avatar {
|
||||||
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
||||||
source: userListItem.avatar ? ("image://" + userListItem.avatar) : ""
|
source: userListItem.avatar ? root.room.connection.makeMediaUrl(userListItem.avatar) : ""
|
||||||
name: userListItem.name
|
name: userListItem.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ FormCard.FormCardPage {
|
|||||||
id: avatar
|
id: avatar
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
name: room.name
|
name: room.name
|
||||||
source: room.avatarMediaId ? ("image://mxc/" + room.avatarMediaId) : ""
|
source: room.avatarMediaId ? root.connection.makeMediaUrl("mxc://" + room.avatarMediaId) : ""
|
||||||
implicitWidth: Kirigami.Units.iconSizes.enormous
|
implicitWidth: Kirigami.Units.iconSizes.enormous
|
||||||
implicitHeight: Kirigami.Units.iconSizes.enormous
|
implicitHeight: Kirigami.Units.iconSizes.enormous
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ TimelineDelegate {
|
|||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.large
|
Layout.preferredHeight: Kirigami.Units.iconSizes.large
|
||||||
|
|
||||||
name: root.room ? root.room.displayName : ""
|
name: root.room ? root.room.displayName : ""
|
||||||
source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : ""
|
source: root.room && root.room.avatarMediaId ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: room.usesEncryption
|
visible: room.usesEncryption
|
||||||
|
|||||||
Reference in New Issue
Block a user