summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-06-02 00:24:26 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-06-08 22:32:07 +0200
commitb518f6902e909b22e1623f96249a3ab1424ced59 (patch)
tree97fe4bdf0f2ffb1e35904c1d2111c6e566984d7c
parentSelect Qt6 in cmake (diff)
downloadnheko-b518f6902e909b22e1623f96249a3ab1424ced59.tar.xz
Make Nheko compile on Qt6
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/Cache.cpp15
-rw-r--r--src/ChatPage.cpp12
-rw-r--r--src/CompletionProxyModel.cpp2
-rw-r--r--src/GridImagePackModel.cpp10
-rw-r--r--src/InviteesModel.h2
-rw-r--r--src/JdenticonProvider.h6
-rw-r--r--src/LoginPage.cpp7
-rw-r--r--src/MainWindow.cpp33
-rw-r--r--src/MatrixClient.cpp23
-rw-r--r--src/MxcImageProvider.cpp8
-rw-r--r--src/MxcImageProvider.h6
-rw-r--r--src/SingleImagePackModel.cpp2
-rw-r--r--src/UserSettingsPage.cpp20
-rw-r--r--src/Utils.cpp2
-rw-r--r--src/dbus/NhekoDBusApi.h1
-rw-r--r--src/emoji/Provider.h1
-rw-r--r--src/main.cpp14
-rw-r--r--src/timeline/CommunitiesModel.cpp3
-rw-r--r--src/timeline/DelegateChooser.cpp4
-rw-r--r--src/timeline/DelegateChooser.h4
-rw-r--r--src/timeline/EventStore.cpp14
-rw-r--r--src/timeline/EventStore.h9
-rw-r--r--src/timeline/InputBar.cpp86
-rw-r--r--src/timeline/InputBar.h20
-rw-r--r--src/timeline/RoomlistModel.cpp3
-rw-r--r--src/timeline/TimelineModel.cpp1
-rw-r--r--src/timeline/TimelineModel.h4
-rw-r--r--src/timeline/TimelineViewManager.cpp2
-rw-r--r--src/timeline/TimelineViewManager.h8
-rw-r--r--src/ui/MxcAnimatedImage.cpp4
-rw-r--r--src/ui/MxcAnimatedImage.h2
-rw-r--r--src/ui/MxcMediaProxy.cpp65
-rw-r--r--src/ui/MxcMediaProxy.h13
-rw-r--r--src/ui/NhekoGlobalObject.cpp28
-rw-r--r--src/ui/Theme.cpp2
-rw-r--r--src/voip/CallManager.cpp27
-rw-r--r--src/voip/ScreenCastPortal.cpp1
-rw-r--r--src/voip/WebRTCSession.cpp6
39 files changed, 110 insertions, 363 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a9478c97..87eb8474 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -239,7 +239,7 @@ endif()
 #
 # Discover Qt dependencies.
 #
-find_package(Qt6 6.5 COMPONENTS Core Widgets LinguistTools Svg Multimedia Qml QuickControls2 REQUIRED)
+find_package(Qt6 6.5 COMPONENTS Core Widgets Gui LinguistTools Svg Multimedia Qml QuickControls2 REQUIRED)
 #find_package(Qt6QuickCompiler)
 find_package(Qt6DBus)
 
@@ -747,6 +747,7 @@ target_link_libraries(nheko PRIVATE
 	spdlog::spdlog
 	Qt::Widgets
 	Qt::Svg
+	Qt::Gui
 	Qt::Multimedia
 	Qt::Qml
 	Qt::QuickControls2
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 44f2ecb0..1c29d530 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -93,11 +93,6 @@ static constexpr auto MEGOLM_SESSIONS_DATA_DB("megolm_sessions_data_db");
 using CachedReceipts = std::multimap<uint64_t, std::string, std::greater<uint64_t>>;
 using Receipts       = std::map<std::string, std::map<std::string, uint64_t>>;
 
-Q_DECLARE_METATYPE(RoomMember)
-Q_DECLARE_METATYPE(mtx::responses::Timeline)
-Q_DECLARE_METATYPE(RoomInfo)
-Q_DECLARE_METATYPE(mtx::responses::QueryKeys)
-
 namespace {
 std::unique_ptr<Cache> instance_ = nullptr;
 }
@@ -4429,7 +4424,8 @@ Cache::displayName(const QString &room_id, const QString &user_id)
 static bool
 isDisplaynameSafe(const std::string &s)
 {
-    for (QChar c : QString::fromStdString(s).toStdU32String()) {
+    for (std::uint32_t cc : QString::fromStdString(s).toStdU32String()) {
+        auto c = QChar(cc);
         if (c.isPrint() && !c.isSpace())
             return false;
     }
@@ -5293,13 +5289,6 @@ namespace cache {
 void
 init(const QString &user_id)
 {
-    qRegisterMetaType<RoomMember>();
-    qRegisterMetaType<RoomInfo>();
-    qRegisterMetaType<QMap<QString, RoomInfo>>();
-    qRegisterMetaType<std::map<QString, RoomInfo>>();
-    qRegisterMetaType<std::map<QString, mtx::responses::Timeline>>();
-    qRegisterMetaType<mtx::responses::QueryKeys>();
-
     instance_ = std::make_unique<Cache>(user_id);
 }
 
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 8feabfd0..c305a54a 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -36,12 +36,6 @@ static constexpr int CHECK_CONNECTIVITY_INTERVAL = 15'000;
 static constexpr int RETRY_TIMEOUT               = 5'000;
 static constexpr size_t MAX_ONETIME_KEYS         = 50;
 
-Q_DECLARE_METATYPE(std::optional<mtx::crypto::EncryptedFile>)
-Q_DECLARE_METATYPE(std::optional<RelatedInfo>)
-Q_DECLARE_METATYPE(mtx::presence::PresenceState)
-Q_DECLARE_METATYPE(mtx::secret_storage::AesHmacSha2KeyDescription)
-Q_DECLARE_METATYPE(SecretsToDecrypt)
-
 ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
   : QObject(parent)
   , isConnected_(true)
@@ -53,12 +47,6 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
 
     instance_ = this;
 
-    qRegisterMetaType<std::optional<mtx::crypto::EncryptedFile>>();
-    qRegisterMetaType<std::optional<RelatedInfo>>();
-    qRegisterMetaType<mtx::presence::PresenceState>();
-    qRegisterMetaType<mtx::secret_storage::AesHmacSha2KeyDescription>();
-    qRegisterMetaType<SecretsToDecrypt>();
-
     view_manager_ = new TimelineViewManager(callManager_, this);
 
     connect(this,
diff --git a/src/CompletionProxyModel.cpp b/src/CompletionProxyModel.cpp
index 638b5fb4..eea1e6aa 100644
--- a/src/CompletionProxyModel.cpp
+++ b/src/CompletionProxyModel.cpp
@@ -29,7 +29,7 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
             finder.toNextBoundary();
             auto end = finder.position();
 
-            auto ref = str.midRef(start, end - start).trimmed();
+            auto ref = QStringView(str).mid(start, end - start).trimmed();
             if (!ref.isEmpty())
                 trie_.insert<ElementRank::second>(ref.toUcs4(), id);
         } while (finder.position() < str.size());
diff --git a/src/GridImagePackModel.cpp b/src/GridImagePackModel.cpp
index bd39405e..4260b6d6 100644
--- a/src/GridImagePackModel.cpp
+++ b/src/GridImagePackModel.cpp
@@ -13,10 +13,6 @@
 #include "Cache_p.h"
 #include "emoji/Provider.h"
 
-Q_DECLARE_METATYPE(StickerImage)
-Q_DECLARE_METATYPE(TextEmoji)
-Q_DECLARE_METATYPE(SectionDescription)
-Q_DECLARE_METATYPE(QList<SectionDescription>)
 
 QString
 emoji::categoryToName(emoji::Emoji::Category cat)
@@ -73,10 +69,6 @@ GridImagePackModel::GridImagePackModel(const std::string &roomId, bool stickers,
   , room_id(roomId)
   , columns(stickers ? 3 : 7)
 {
-    [[maybe_unused]] static auto id  = qRegisterMetaType<StickerImage>();
-    [[maybe_unused]] static auto id2 = qRegisterMetaType<TextEmoji>();
-    [[maybe_unused]] static auto id3 = qRegisterMetaType<SectionDescription>();
-    [[maybe_unused]] static auto id4 = qRegisterMetaType<QList<SectionDescription>>();
 
     if (!stickers) {
         for (const auto &category : {
@@ -144,7 +136,7 @@ GridImagePackModel::GridImagePackModel(const std::string &roomId, bool stickers,
             finder.toNextBoundary();
             auto end = finder.position();
 
-            auto ref = str.midRef(start, end - start).trimmed();
+            auto ref = QStringView(str).mid(start, end - start).trimmed();
             if (!ref.isEmpty())
                 trie_.insert<ElementRank::second>(ref.toUcs4(), id);
         } while (finder.position() < str.size());
diff --git a/src/InviteesModel.h b/src/InviteesModel.h
index ab8fbdb4..3f417bd1 100644
--- a/src/InviteesModel.h
+++ b/src/InviteesModel.h
@@ -8,7 +8,7 @@
 #include <QAbstractListModel>
 #include <QVector>
 
-class TimelineModel;
+#include "timeline/TimelineModel.h"
 
 class Invitee final : public QObject
 {
diff --git a/src/JdenticonProvider.h b/src/JdenticonProvider.h
index 5a475ded..b4a9ba62 100644
--- a/src/JdenticonProvider.h
+++ b/src/JdenticonProvider.h
@@ -54,10 +54,6 @@ public:
 
 class JdenticonProvider
   :
-#if QT_VERSION < 0x60000
-  public QObject
-  ,
-#endif
   public QQuickAsyncImageProvider
 {
     Q_OBJECT
@@ -77,7 +73,7 @@ public slots:
         if (queryStart != -1) {
             id_            = id.left(queryStart);
             auto query     = id.mid(queryStart + 1);
-            auto queryBits = query.splitRef('&');
+            auto queryBits = QStringView(query).split('&');
 
             for (const auto &b : queryBits) {
                 if (b.startsWith(QStringView(u"radius="))) {
diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp
index 95b46d04..8d6a69cf 100644
--- a/src/LoginPage.cpp
+++ b/src/LoginPage.cpp
@@ -19,19 +19,12 @@
 #include "SSOHandler.h"
 #include "UserSettingsPage.h"
 
-Q_DECLARE_METATYPE(LoginPage::LoginMethod)
-Q_DECLARE_METATYPE(SSOProvider)
-
 using namespace mtx::identifiers;
 
 LoginPage::LoginPage(QObject *parent)
   : QObject(parent)
   , inferredServerAddress_()
 {
-    [[maybe_unused]] static auto ignored =
-      qRegisterMetaType<LoginPage::LoginMethod>("LoginPage::LoginMethod");
-    [[maybe_unused]] static auto ignored2 = qRegisterMetaType<SSOProvider>();
-
     connect(this, &LoginPage::versionOkCb, this, &LoginPage::versionOk, Qt::QueuedConnection);
     connect(this, &LoginPage::versionErrorCb, this, &LoginPage::versionError, Qt::QueuedConnection);
     connect(
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index a8cc66b7..4159006e 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -7,6 +7,7 @@
 
 #include <mtx/requests.hpp>
 #include <mtx/responses/login.hpp>
+#include <mtx/events/collections.hpp>
 
 #include "AliasEditModel.h"
 #include "BlurhashProvider.h"
@@ -63,13 +64,6 @@
 #include "dbus/NhekoDBusApi.h"
 #endif
 
-Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents)
-Q_DECLARE_METATYPE(std::vector<DeviceInfo>)
-Q_DECLARE_METATYPE(std::vector<mtx::responses::PublicRoomsChunk>)
-Q_DECLARE_METATYPE(mtx::responses::PublicRoom)
-Q_DECLARE_METATYPE(mtx::responses::Profile)
-Q_DECLARE_METATYPE(mtx::responses::User)
-
 MainWindow *MainWindow::instance_ = nullptr;
 
 MainWindow::MainWindow(QWindow *parent)
@@ -138,27 +132,8 @@ MainWindow::MainWindow(QWindow *parent)
 void
 MainWindow::registerQmlTypes()
 {
-    qRegisterMetaType<mtx::events::msg::KeyVerificationAccept>();
-    qRegisterMetaType<mtx::events::msg::KeyVerificationCancel>();
-    qRegisterMetaType<mtx::events::msg::KeyVerificationDone>();
-    qRegisterMetaType<mtx::events::msg::KeyVerificationKey>();
-    qRegisterMetaType<mtx::events::msg::KeyVerificationMac>();
-    qRegisterMetaType<mtx::events::msg::KeyVerificationReady>();
-    qRegisterMetaType<mtx::events::msg::KeyVerificationRequest>();
-    qRegisterMetaType<mtx::events::msg::KeyVerificationStart>();
-    qRegisterMetaType<mtx::responses::PublicRoom>();
-    qRegisterMetaType<mtx::responses::User>();
-    qRegisterMetaType<mtx::responses::Profile>();
-    qRegisterMetaType<CombinedImagePackModel *>();
-    qRegisterMetaType<GridImagePackModel *>();
-    qRegisterMetaType<RoomSettingsAllowedRoomsModel *>();
-    qRegisterMetaType<mtx::events::collections::TimelineEvents>();
-    qRegisterMetaType<std::vector<DeviceInfo>>();
-
-    qRegisterMetaType<std::vector<mtx::responses::PublicRoomsChunk>>();
-    qRegisterMetaType<std::vector<mtx::responses::User>>();
-
-    qRegisterMetaType<mtx::responses::User>();
+
+
     qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject,
                                      "im.nheko",
                                      1,
@@ -278,8 +253,6 @@ MainWindow::registerQmlTypes()
 
     qmlRegisterSingletonInstance("im.nheko", 1, 0, "Settings", userSettings_.data());
 
-    qRegisterMetaType<mtx::events::collections::TimelineEvents>();
-    qRegisterMetaType<std::vector<DeviceInfo>>();
 
     qmlRegisterUncreatableType<FilteredCommunitiesModel>(
       "im.nheko",
diff --git a/src/MatrixClient.cpp b/src/MatrixClient.cpp
index 1452257a..55542a75 100644
--- a/src/MatrixClient.cpp
+++ b/src/MatrixClient.cpp
@@ -15,18 +15,7 @@
 #include "nlohmann/json.hpp"
 #include <mtx/responses.hpp>
 
-Q_DECLARE_METATYPE(mtx::responses::Login)
-Q_DECLARE_METATYPE(mtx::responses::Messages)
-Q_DECLARE_METATYPE(mtx::responses::Notifications)
-Q_DECLARE_METATYPE(mtx::responses::Rooms)
-Q_DECLARE_METATYPE(mtx::responses::Sync)
-Q_DECLARE_METATYPE(mtx::responses::StateEvents)
 
-// Q_DECLARE_METATYPE(nlohmann::json)
-Q_DECLARE_METATYPE(std::string)
-Q_DECLARE_METATYPE(std::vector<std::string>)
-Q_DECLARE_METATYPE(std::vector<QString>)
-Q_DECLARE_METATYPE(std::set<QString>)
 
 namespace http {
 
@@ -52,18 +41,6 @@ is_logged_in()
 void
 init()
 {
-    qRegisterMetaType<mtx::responses::Login>();
-    qRegisterMetaType<mtx::responses::Messages>();
-    qRegisterMetaType<mtx::responses::Notifications>();
-    qRegisterMetaType<mtx::responses::Rooms>();
-    qRegisterMetaType<mtx::responses::Sync>();
-    qRegisterMetaType<mtx::responses::StateEvents>();
-    qRegisterMetaType<std::string>();
-    // qRegisterMetaType<nlohmann::json>();
-    qRegisterMetaType<std::vector<std::string>>();
-    qRegisterMetaType<std::vector<QString>>();
-    qRegisterMetaType<std::map<QString, bool>>("std::map<QString, bool>");
-    qRegisterMetaType<std::set<QString>>();
 }
 
 } // namespace http
diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp
index cb21fa0d..47e0344f 100644
--- a/src/MxcImageProvider.cpp
+++ b/src/MxcImageProvider.cpp
@@ -24,12 +24,8 @@
 
 QHash<QString, mtx::crypto::EncryptedFile> infos;
 
-MxcImageProvider::MxcImageProvider(QObject *parent)
-#if QT_VERSION < 0x60000
-  : QObject(parent)
-#else
-  : QQuickAsyncImageProvider(parent)
-#endif
+MxcImageProvider::MxcImageProvider()
+  : QQuickAsyncImageProvider()
 {
     auto timer = new QTimer(this);
     timer->setInterval(std::chrono::hours(1));
diff --git a/src/MxcImageProvider.h b/src/MxcImageProvider.h
index 8096a7dc..b67e2f8d 100644
--- a/src/MxcImageProvider.h
+++ b/src/MxcImageProvider.h
@@ -72,16 +72,12 @@ public:
 
 class MxcImageProvider
   :
-#if QT_VERSION < 0x60000
-  public QObject
-  ,
-#endif
   public QQuickAsyncImageProvider
 {
     Q_OBJECT
 
 public:
-    MxcImageProvider(QObject *parent = nullptr);
+    MxcImageProvider();
 
 public slots:
     QQuickImageResponse *
diff --git a/src/SingleImagePackModel.cpp b/src/SingleImagePackModel.cpp
index 99338f2e..47e11f0e 100644
--- a/src/SingleImagePackModel.cpp
+++ b/src/SingleImagePackModel.cpp
@@ -20,7 +20,6 @@
 #include "timeline/Permissions.h"
 #include "timeline/TimelineModel.h"
 
-Q_DECLARE_METATYPE(mtx::common::ImageInfo)
 
 SingleImagePackModel::SingleImagePackModel(ImagePackInfo pack_, QObject *parent)
   : QAbstractListModel(parent)
@@ -30,7 +29,6 @@ SingleImagePackModel::SingleImagePackModel(ImagePackInfo pack_, QObject *parent)
   , pack(std::move(pack_.pack))
   , fromSpace_(pack_.from_space)
 {
-    [[maybe_unused]] static auto imageInfoType = qRegisterMetaType<mtx::common::ImageInfo>();
 
     if (!pack.pack)
         pack.pack = mtx::events::msc2545::ImagePack::PackDescription{};
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index d5b7289c..7e7cead3 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -1585,8 +1585,6 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
                 l.push_back(QString::fromStdString(d));
             return l;
         };
-        static QFontDatabase fontDb;
-
         switch (index.row()) {
         case Theme:
             return QStringList{
@@ -1605,9 +1603,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
               i->camera().toStdString(), i->cameraResolution().toStdString()));
 
         case Font:
-            return fontDb.families();
+            return QFontDatabase::families();
         case EmojiFont:
-            return fontDb.families(QFontDatabase::WritingSystem::Symbol);
+            return QFontDatabase::families(QFontDatabase::WritingSystem::Symbol);
         case Ringtone: {
             QStringList l{
               QStringLiteral("Mute"),
@@ -1651,8 +1649,6 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
 bool
 UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int role)
 {
-    static QFontDatabase fontDb;
-
     auto i = UserSettings::instance();
     if (role == Value) {
         switch (index.row()) {
@@ -1677,7 +1673,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case ScaleFactor: {
-            if (value.canConvert(QMetaType::Double)) {
+            if (value.canConvert(QMetaType::fromType<double>())) {
                 utils::setScaleFactor(static_cast<float>(value.toDouble()));
                 return true;
             } else
@@ -1782,7 +1778,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case TimelineMaxWidth: {
-            if (value.canConvert(QMetaType::Int)) {
+            if (value.canConvert(QMetaType::fromType<int>())) {
                 i->setTimelineMaxWidth(value.toInt());
                 return true;
             } else
@@ -1880,7 +1876,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case PrivacyScreenTimeout: {
-            if (value.canConvert(QMetaType::Int)) {
+            if (value.canConvert(QMetaType::fromType<int>())) {
                 i->setPrivacyScreenTimeout(value.toInt());
                 return true;
             } else
@@ -1894,7 +1890,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case FontSize: {
-            if (value.canConvert(QMetaType::Double)) {
+            if (value.canConvert(QMetaType::fromType<double>())) {
                 i->setFontSize(value.toDouble());
                 return true;
             } else
@@ -1902,7 +1898,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
         }
         case Font: {
             if (value.userType() == QMetaType::Int) {
-                i->setFontFamily(fontDb.families().at(value.toInt()));
+                i->setFontFamily(QFontDatabase::families().at(value.toInt()));
                 return true;
             } else
                 return false;
@@ -1910,7 +1906,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
         case EmojiFont: {
             if (value.userType() == QMetaType::Int) {
                 i->setEmojiFontFamily(
-                  fontDb.families(QFontDatabase::WritingSystem::Symbol).at(value.toInt()));
+                  QFontDatabase::families(QFontDatabase::WritingSystem::Symbol).at(value.toInt()));
                 return true;
             } else
                 return false;
diff --git a/src/Utils.cpp b/src/Utils.cpp
index c9a6fb55..2249379d 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -290,7 +290,7 @@ utils::firstChar(const QString &input)
             return QString::fromUcs4(&c, 1).toUpper();
     }
 
-    return QString::fromUcs4(&input.toUcs4().at(0), 1).toUpper();
+    return QString::fromUcs4(&input.toStdU32String().at(0), 1).toUpper();
 }
 
 QString
diff --git a/src/dbus/NhekoDBusApi.h b/src/dbus/NhekoDBusApi.h
index 5a34f0b7..ce265a17 100644
--- a/src/dbus/NhekoDBusApi.h
+++ b/src/dbus/NhekoDBusApi.h
@@ -92,7 +92,6 @@ operator<<(QDBusArgument &arg, const RoomInfoItem &item);
 const QDBusArgument &
 operator>>(const QDBusArgument &arg, RoomInfoItem &item);
 } // nheko::dbus
-Q_DECLARE_METATYPE(nheko::dbus::RoomInfoItem)
 
 QDBusArgument &
 operator<<(QDBusArgument &arg, const QImage &image);
diff --git a/src/emoji/Provider.h b/src/emoji/Provider.h
index 5d8000a4..d0441ad3 100644
--- a/src/emoji/Provider.h
+++ b/src/emoji/Provider.h
@@ -94,4 +94,3 @@ public:
 QString
 categoryToName(emoji::Emoji::Category cat);
 } // namespace emoji
-Q_DECLARE_METATYPE(emoji::Emoji)
diff --git a/src/main.cpp b/src/main.cpp
index 90e1cb4c..99e11bf9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -154,8 +154,6 @@ main(int argc, char *argv[])
     QCoreApplication::setApplicationVersion(nheko::version);
     QCoreApplication::setOrganizationName(QStringLiteral("nheko"));
     QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
-    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
-    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
 
     // Disable the qml disk cache by default to prevent crashes on updates. See
     // https://github.com/Nheko-Reborn/nheko/issues/1383
@@ -332,16 +330,16 @@ main(int argc, char *argv[])
         QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedKingdom));
 
     QTranslator qtTranslator;
-    qtTranslator.load(QLocale(),
+    if(qtTranslator.load(QLocale(),
                       QStringLiteral("qt"),
                       QStringLiteral("_"),
-                      QLibraryInfo::location(QLibraryInfo::TranslationsPath));
-    app.installTranslator(&qtTranslator);
+                      QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
+        app.installTranslator(&qtTranslator);
 
     QTranslator appTranslator;
-    appTranslator.load(
-      QLocale(), QStringLiteral("nheko"), QStringLiteral("_"), QStringLiteral(":/translations"));
-    app.installTranslator(&appTranslator);
+    if(appTranslator.load(
+      QLocale(), QStringLiteral("nheko"), QStringLiteral("_"), QStringLiteral(":/translations")))
+        app.installTranslator(&appTranslator);
 
     MainWindow w;
     // QQuickView w;
diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp
index c563639b..dc09a95e 100644
--- a/src/timeline/CommunitiesModel.cpp
+++ b/src/timeline/CommunitiesModel.cpp
@@ -17,15 +17,12 @@
 #include "Utils.h"
 #include "timeline/TimelineModel.h"
 
-Q_DECLARE_METATYPE(SpaceItem)
 
 CommunitiesModel::CommunitiesModel(QObject *parent)
   : QAbstractListModel(parent)
   , hiddenTagIds_{UserSettings::instance()->hiddenTags()}
   , mutedTagIds_{UserSettings::instance()->mutedTags()}
 {
-    static auto ignore = qRegisterMetaType<SpaceItem>();
-    (void)ignore;
 }
 
 QHash<int, QByteArray>
diff --git a/src/timeline/DelegateChooser.cpp b/src/timeline/DelegateChooser.cpp
index 7f80d5f6..91b2194b 100644
--- a/src/timeline/DelegateChooser.cpp
+++ b/src/timeline/DelegateChooser.cpp
@@ -77,13 +77,13 @@ DelegateChooser::appendChoice(QQmlListProperty<DelegateChoice> *p, DelegateChoic
     dc->choices_.append(c);
 }
 
-int
+qsizetype
 DelegateChooser::choiceCount(QQmlListProperty<DelegateChoice> *p)
 {
     return static_cast<DelegateChooser *>(p->object)->choices_.count();
 }
 DelegateChoice *
-DelegateChooser::choice(QQmlListProperty<DelegateChoice> *p, int index)
+DelegateChooser::choice(QQmlListProperty<DelegateChoice> *p, qsizetype index)
 {
     return static_cast<DelegateChooser *>(p->object)->choices_.at(index);
 }
diff --git a/src/timeline/DelegateChooser.h b/src/timeline/DelegateChooser.h
index 8f72e73b..c27f2c43 100644
--- a/src/timeline/DelegateChooser.h
+++ b/src/timeline/DelegateChooser.h
@@ -86,7 +86,7 @@ private:
     DelegateIncubator incubator{*this};
 
     static void appendChoice(QQmlListProperty<DelegateChoice> *, DelegateChoice *);
-    static int choiceCount(QQmlListProperty<DelegateChoice> *);
-    static DelegateChoice *choice(QQmlListProperty<DelegateChoice> *, int index);
+    static qsizetype choiceCount(QQmlListProperty<DelegateChoice> *);
+    static DelegateChoice *choice(QQmlListProperty<DelegateChoice> *, qsizetype index);
     static void clearChoices(QQmlListProperty<DelegateChoice> *);
 };
diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp
index 5cdb372a..d373cf55 100644
--- a/src/timeline/EventStore.cpp
+++ b/src/timeline/EventStore.cpp
@@ -15,11 +15,9 @@
 #include "EventAccessors.h"
 #include "Logging.h"
 #include "MatrixClient.h"
-#include "TimelineModel.h"
 #include "UserSettingsPage.h"
 #include "Utils.h"
 
-Q_DECLARE_METATYPE(Reaction)
 
 QCache<EventStore::IdIndex, olm::DecryptionResult> EventStore::decryptedEvents_{1000};
 QCache<EventStore::IdIndex, mtx::events::collections::TimelineEvents> EventStore::events_by_id_{
@@ -29,8 +27,6 @@ QCache<EventStore::Index, mtx::events::collections::TimelineEvents> EventStore::
 EventStore::EventStore(std::string room_id, QObject *)
   : room_id_(std::move(room_id))
 {
-    static auto reactionType = qRegisterMetaType<Reaction>();
-    (void)reactionType;
 
     auto range = cache::client()->getTimelineRange(room_id_);
 
@@ -293,12 +289,12 @@ EventStore::EventStore(std::string room_id, QObject *)
 }
 
 void
-EventStore::addPending(mtx::events::collections::TimelineEvents event)
+EventStore::addPending(const mtx::events::collections::TimelineEvents& event)
 {
     if (this->thread() != QThread::currentThread())
         nhlog::db()->warn("{} called from a different thread!", __func__);
 
-    cache::client()->savePendingMessage(this->room_id_, {event});
+    cache::client()->savePendingMessage(this->room_id_, event);
     mtx::responses::Timeline events;
     events.limited = false;
     events.events.emplace_back(event);
@@ -761,11 +757,11 @@ EventStore::decryptEvent(const IdIndex &idx,
 }
 
 void
-EventStore::refetchOnlineKeyBackupKeys(TimelineModel *room)
+EventStore::refetchOnlineKeyBackupKeys()
 {
-    for (const auto &[session_id, request] : room->events.pending_key_requests) {
+    for (const auto &[session_id, request] : this->pending_key_requests) {
         (void)request;
-        olm::lookup_keybackup(room->events.room_id_, session_id);
+        olm::lookup_keybackup(this->room_id_, session_id);
     }
 }
 
diff --git a/src/timeline/EventStore.h b/src/timeline/EventStore.h
index bf905fc6..f2f9e2d7 100644
--- a/src/timeline/EventStore.h
+++ b/src/timeline/EventStore.h
@@ -14,12 +14,11 @@
 #include <mtx/events/collections.hpp>
 #include <mtx/responses/messages.hpp>
 #include <mtx/responses/sync.hpp>
+#include <mtx/common.hpp>
 
 #include "Reaction.h"
 #include "encryption/Olm.h"
 
-class TimelineModel;
-
 class EventStore final : public QObject
 {
     Q_OBJECT
@@ -27,7 +26,7 @@ class EventStore final : public QObject
 public:
     EventStore(std::string room_id, QObject *parent);
 
-    static void refetchOnlineKeyBackupKeys(TimelineModel *room);
+    void refetchOnlineKeyBackupKeys();
 
     // taken from QtPrivate::QHashCombine
     static uint hashCombine(uint hash, uint seed)
@@ -108,7 +107,7 @@ signals:
     void newEncryptedImage(mtx::crypto::EncryptedFile encryptionInfo);
     void eventFetched(std::string id,
                       std::string relatedTo,
-                      mtx::events::collections::TimelineEvents timeline);
+                      const mtx::events::collections::TimelineEvents& timeline);
     void oldMessagesRetrieved(const mtx::responses::Messages &);
     void fetchedMore();
 
@@ -120,7 +119,7 @@ signals:
     void updateFlowEventId(std::string event_id);
 
 public slots:
-    void addPending(mtx::events::collections::TimelineEvents event);
+    void addPending(const mtx::events::collections::TimelineEvents& event);
     void receivedSessionKey(const std::string &session_id);
     void clearTimeline();
     void enableKeyRequests(bool suppressKeyRequests_);
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index 0c2e3752..2fd2d21a 100644
--- a/src/timeline/InputBar.cpp
+++ b/src/timeline/InputBar.cpp
@@ -16,6 +16,8 @@
 #include <QMimeDatabase>
 #include <QStandardPaths>
 #include <QTextBoundaryFinder>
+#include <QVideoFrame>
+#include <QVideoSink>
 
 #include <QRegularExpression>
 #include <mtx/responses/common.hpp>
@@ -75,55 +77,6 @@ MediaUpload::thumbnailDataUrl() const
 }
 
 bool
-InputVideoSurface::present(const QVideoFrame &frame)
-{
-    QImage::Format format = QVideoFrame::imageFormatFromPixelFormat(frame.pixelFormat());
-
-    if (format == QImage::Format_Invalid) {
-        emit newImage({});
-        return false;
-    } else {
-        QVideoFrame frametodraw(frame);
-
-        if (!frametodraw.map(QAbstractVideoBuffer::ReadOnly)) {
-            emit newImage({});
-            return false;
-        }
-
-        // this is a shallow operation. it just refer the frame buffer
-        QImage image(qAsConst(frametodraw).bits(),
-                     frametodraw.width(),
-                     frametodraw.height(),
-                     frametodraw.bytesPerLine(),
-                     format);
-        image.detach();
-
-        frametodraw.unmap();
-
-        emit newImage(std::move(image));
-        return true;
-    }
-}
-
-QList<QVideoFrame::PixelFormat>
-InputVideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
-{
-    if (type == QAbstractVideoBuffer::NoHandle) {
-        return {
-          QVideoFrame::Format_ARGB32,
-          QVideoFrame::Format_ARGB32_Premultiplied,
-          QVideoFrame::Format_RGB24,
-          QVideoFrame::Format_BGR24,
-          QVideoFrame::Format_RGB32,
-          QVideoFrame::Format_RGB565,
-          QVideoFrame::Format_RGB555,
-        };
-    } else {
-        return {};
-    }
-}
-
-bool
 InputBar::tryPasteAttachment(bool fromMouse)
 {
     const QMimeData *md = nullptr;
@@ -536,7 +489,7 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow
         if (!related.quoted_user.startsWith("@room:")) {
             QString body;
             bool firstLine = true;
-            auto lines     = related.quoted_body.splitRef(u'\n');
+            auto lines     = QStringView(related.quoted_body).split(u'\n');
             for (auto line : qAsConst(lines)) {
                 if (firstLine) {
                     firstLine = false;
@@ -1036,21 +989,20 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
         blurhash_ =
           QString::fromStdString(blurhash::encode(data_.data(), img.width(), img.height(), 4, 3));
     } else if (mimeClass_ == u"video" || mimeClass_ == u"audio") {
-        auto mediaPlayer = new QMediaPlayer(
-          this,
-          mimeClass_ == u"video" ? QFlags{QMediaPlayer::VideoSurface} : QMediaPlayer::Flags{});
-        mediaPlayer->setMuted(true);
+        auto mediaPlayer = new QMediaPlayer( this);
+        mediaPlayer->setAudioOutput(nullptr);
 
         if (mimeClass_ == u"video") {
-            auto newSurface = new InputVideoSurface(this);
+            auto newSurface = new QVideoSink(this);
             connect(
-              newSurface, &InputVideoSurface::newImage, this, [this, mediaPlayer](QImage img) {
+              newSurface, &QVideoSink::videoFrameChanged, this, [this, mediaPlayer](const QVideoFrame& frame) {
+              QImage img = frame.toImage();
                   if (img.size().isEmpty())
                       return;
 
                   mediaPlayer->stop();
 
-                  auto orientation = mediaPlayer->metaData(QMediaMetaData::Orientation).toInt();
+                  auto orientation = mediaPlayer->metaData().value(QMediaMetaData::Orientation).toInt();
                   if (orientation == 90 || orientation == 270 || orientation == 180) {
                       img =
                         img.transformed(QTransform().rotate(orientation), Qt::SmoothTransformation);
@@ -1081,11 +1033,11 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
         }
 
         connect(mediaPlayer,
-                qOverload<QMediaPlayer::Error>(&QMediaPlayer::error),
+&QMediaPlayer::error,
                 this,
-                [mediaPlayer](QMediaPlayer::Error error) {
+                [mediaPlayer]() {
                     nhlog::ui()->debug("Media player error {} and errorStr {}",
-                                       error,
+                                       mediaPlayer->error(),
                                        mediaPlayer->errorString().toStdString());
                 });
         connect(mediaPlayer,
@@ -1095,19 +1047,19 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
                       "Media player status {} and error {}", status, mediaPlayer->error());
                 });
         connect(mediaPlayer,
-                qOverload<const QString &, const QVariant &>(&QMediaPlayer::metaDataChanged),
+&QMediaPlayer::metaDataChanged,
                 this,
-                [this, mediaPlayer](const QString &t, const QVariant &) {
-                    nhlog::ui()->debug("Got metadata {}", t.toStdString());
+                [this, mediaPlayer]() {
+                    nhlog::ui()->debug("Got metadata {}");
 
                     if (mediaPlayer->duration() > 0)
                         this->duration_ = mediaPlayer->duration();
 
-                    auto dimensions = mediaPlayer->metaData(QMediaMetaData::Resolution).toSize();
+                    auto dimensions = mediaPlayer->metaData().value(QMediaMetaData::Resolution).toSize();
                     if (!dimensions.isEmpty()) {
                         dimensions_ = dimensions;
                         auto orientation =
-                          mediaPlayer->metaData(QMediaMetaData::Orientation).toInt();
+                          mediaPlayer->metaData().value(QMediaMetaData::Orientation).toInt();
                         if (orientation == 90 || orientation == 270) {
                             dimensions_.transpose();
                         }
@@ -1125,8 +1077,8 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
 
         auto originalFile = qobject_cast<QFile *>(source.get());
 
-        mediaPlayer->setMedia(
-          QMediaContent(originalFile ? originalFile->fileName() : originalFilename_), source.get());
+        mediaPlayer->setSourceDevice(source.get(),
+          QUrl(originalFile ? originalFile->fileName() : originalFilename_));
 
         mediaPlayer->play();
     }
diff --git a/src/timeline/InputBar.h b/src/timeline/InputBar.h
index 1f1d6fe1..f03e6019 100644
--- a/src/timeline/InputBar.h
+++ b/src/timeline/InputBar.h
@@ -4,7 +4,6 @@
 
 #pragma once
 
-#include <QAbstractVideoSurface>
 #include <QIODevice>
 #include <QImage>
 #include <QObject>
@@ -41,25 +40,6 @@ enum class MarkdownOverride
     CMARK,
 };
 
-class InputVideoSurface final : public QAbstractVideoSurface
-{
-    Q_OBJECT
-
-public:
-    InputVideoSurface(QObject *parent)
-      : QAbstractVideoSurface(parent)
-    {
-    }
-
-    bool present(const QVideoFrame &frame) override;
-
-    QList<QVideoFrame::PixelFormat>
-    supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const override;
-
-signals:
-    void newImage(QImage img);
-};
-
 class MediaUpload final : public QObject
 {
     Q_OBJECT
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index 6bd02a17..b55cbabd 100644
--- a/src/timeline/RoomlistModel.cpp
+++ b/src/timeline/RoomlistModel.cpp
@@ -28,7 +28,6 @@ RoomlistModel::RoomlistModel(TimelineViewManager *parent)
   : QAbstractListModel(parent)
   , manager(parent)
 {
-    [[maybe_unused]] static auto id = qRegisterMetaType<RoomPreview>();
 
     connect(ChatPage::instance(), &ChatPage::decryptSidebarChanged, this, [this]() {
         auto decrypt = ChatPage::instance()->userSettings()->decryptSidebar();
@@ -819,7 +818,7 @@ RoomlistModel::refetchOnlineKeyBackupKeys()
         auto ptr = i.value();
 
         if (!ptr.isNull()) {
-            EventStore::refetchOnlineKeyBackupKeys(ptr.data());
+            ptr->refetchOnlineKeyBackupKeys();
         }
     }
 }
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 5996bea8..a4659f33 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -31,7 +31,6 @@
 #include "Utils.h"
 #include "encryption/Olm.h"
 
-Q_DECLARE_METATYPE(QModelIndex)
 
 namespace std {
 inline uint // clazy:exclude=qhash-namespace
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index b0d81441..02a5ee80 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -374,6 +374,8 @@ public:
             return std::nullopt;
     }
 
+    void refetchOnlineKeyBackupKeys() { events.refetchOnlineKeyBackupKeys(); };
+
 public slots:
     void setCurrentIndex(int index);
     int currentIndex() const { return idToIndex(currentId); }
@@ -537,8 +539,6 @@ private:
 
     std::unique_ptr<RoomSummary, DeleteLaterDeleter> parentSummary = nullptr;
     bool parentChecked                                             = false;
-
-    friend void EventStore::refetchOnlineKeyBackupKeys(TimelineModel *room);
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(TimelineModel::SpecialEffects)
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index e062dde2..a3b91ce7 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -280,7 +280,7 @@ TimelineViewManager::saveMedia(QString mxcUrl)
 {
     const QString downloadsFolder =
       QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
-    const QString openLocation = downloadsFolder + "/" + mxcUrl.splitRef(u'/').constLast();
+    const QString openLocation = downloadsFolder + "/" + mxcUrl.split(u'/').constLast();
 
     const QString filename = QFileDialog::getSaveFileName(nullptr, {}, openLocation);
 
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index e3279e21..303e2af2 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -131,11 +131,3 @@ private:
 
     QHash<QPair<QString, quint64>, QColor> userColors;
 };
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationAccept)
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationCancel)
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationDone)
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationKey)
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationMac)
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationReady)
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationRequest)
-Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationStart)
diff --git a/src/ui/MxcAnimatedImage.cpp b/src/ui/MxcAnimatedImage.cpp
index 7544537d..14f5dbd8 100644
--- a/src/ui/MxcAnimatedImage.cpp
+++ b/src/ui/MxcAnimatedImage.cpp
@@ -152,9 +152,9 @@ MxcAnimatedImage::startDownload()
 }
 
 void
-MxcAnimatedImage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+MxcAnimatedImage::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
 {
-    QQuickItem::geometryChanged(newGeometry, oldGeometry);
+    QQuickItem::geometryChange(newGeometry, oldGeometry);
 
     if (newGeometry.size() != oldGeometry.size()) {
         if (height() != 0 && width() != 0) {
diff --git a/src/ui/MxcAnimatedImage.h b/src/ui/MxcAnimatedImage.h
index a32de6ee..bc53e711 100644
--- a/src/ui/MxcAnimatedImage.h
+++ b/src/ui/MxcAnimatedImage.h
@@ -59,7 +59,7 @@ public:
         }
     }
 
-    void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+    void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
     QSGNode *updatePaintNode(QSGNode *oldNode,
                              QQuickItem::UpdatePaintNodeData *updatePaintNodeData) override;
 
diff --git a/src/ui/MxcMediaProxy.cpp b/src/ui/MxcMediaProxy.cpp
index 9a439c30..e10cb846 100644
--- a/src/ui/MxcMediaProxy.cpp
+++ b/src/ui/MxcMediaProxy.cpp
@@ -8,17 +8,11 @@
 #include <QFile>
 #include <QFileInfo>
 #include <QMediaMetaData>
-#include <QMediaObject>
 #include <QMediaPlayer>
 #include <QMimeDatabase>
 #include <QStandardPaths>
 #include <QUrl>
 
-#if defined(Q_OS_MACOS)
-// TODO (red_sky): Remove for Qt6.  See other ifdef below
-#include <QTemporaryFile>
-#endif
-
 #include "ChatPage.h"
 #include "EventAccessors.h"
 #include "Logging.h"
@@ -32,19 +26,18 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
     connect(this, &MxcMediaProxy::eventIdChanged, &MxcMediaProxy::startDownload);
     connect(this, &MxcMediaProxy::roomChanged, &MxcMediaProxy::startDownload);
     connect(this,
-            qOverload<QMediaPlayer::Error>(&MxcMediaProxy::error),
-            [this](QMediaPlayer::Error error) {
+            &MxcMediaProxy::error,
+            [this]() {
                 nhlog::ui()->info("Media player error {} and errorStr {}",
-                                  error,
+                                  error(),
                                   this->errorString().toStdString());
             });
     connect(this, &MxcMediaProxy::mediaStatusChanged, [this](QMediaPlayer::MediaStatus status) {
         nhlog::ui()->info("Media player status {} and error {}", status, this->error());
     });
     connect(this,
-            qOverload<const QString &, const QVariant &>(&MxcMediaProxy::metaDataChanged),
-            [this](const QString &t, const QVariant &) {
-                if (t == QMediaMetaData::Orientation)
+            &MxcMediaProxy::metaDataChanged,
+            [this]() {
                     emit orientationChanged();
             });
 
@@ -53,28 +46,12 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
             this,
             &MxcMediaProxy::pause);
 }
-void
-MxcMediaProxy::setVideoSurface(QAbstractVideoSurface *surface)
-{
-    if (surface != m_surface) {
-        qDebug() << "Changing surface";
-        m_surface = surface;
-        setVideoOutput(m_surface);
-        emit videoSurfaceChanged();
-    }
-}
-
-QAbstractVideoSurface *
-MxcMediaProxy::getVideoSurface()
-{
-    return m_surface;
-}
 
 int
 MxcMediaProxy::orientation() const
 {
-    nhlog::ui()->debug("metadata: {}", availableMetaData().join(QStringLiteral(",")).toStdString());
-    auto orientation = metaData(QMediaMetaData::Orientation).toInt();
+    //nhlog::ui()->debug("metadata: {}", availableMetaData().join(QStringLiteral(",")).toStdString());
+    auto orientation = metaData().value(QMediaMetaData::Orientation).toInt();
     nhlog::ui()->debug("Video orientation: {}", orientation);
     return orientation;
 }
@@ -135,34 +112,10 @@ MxcMediaProxy::startDownload()
         buffer.open(QIODevice::ReadOnly);
         buffer.reset();
 
-        QTimer::singleShot(0, this, [this, filename, suffix, encryptionInfo] {
-#if defined(Q_OS_MACOS)
-            if (encryptionInfo) {
-                // macOS has issues reading from a buffer in setMedia for whatever reason.
-                // Instead, write the buffer to a temporary file and read from that.
-                // This should be fixed in Qt6, so update this when we do that!
-                // TODO: REMOVE IN QT6
-                QTemporaryFile tempFile;
-                tempFile.setFileTemplate(tempFile.fileTemplate() + QLatin1Char('.') + suffix);
-                tempFile.open();
-                tempFile.write(buffer.data());
-                tempFile.close();
-                nhlog::ui()->debug("Playing media from temp buffer file: {}.  Remove in QT6!",
-                                   filename.filePath().toStdString());
-                this->setMedia(QUrl::fromLocalFile(tempFile.fileName()));
-            } else {
-                nhlog::ui()->info(
-                  "Playing buffer with size: {}, {}", buffer.bytesAvailable(), buffer.isOpen());
-                this->setMedia(QUrl::fromLocalFile(filename.filePath()));
-            }
-#else
-            Q_UNUSED(suffix)
-            Q_UNUSED(encryptionInfo)
-
+        QTimer::singleShot(0, this, [this, filename] {
             nhlog::ui()->info(
               "Playing buffer with size: {}, {}", buffer.bytesAvailable(), buffer.isOpen());
-            this->setMedia(QMediaContent(filename.fileName()), &buffer);
-#endif
+            this->setSourceDevice(&buffer, QUrl(filename.fileName()));
             emit loadedChanged();
         });
     };
diff --git a/src/ui/MxcMediaProxy.h b/src/ui/MxcMediaProxy.h
index 48de5a4f..7b7947e9 100644
--- a/src/ui/MxcMediaProxy.h
+++ b/src/ui/MxcMediaProxy.h
@@ -4,9 +4,9 @@
 
 #pragma once
 
-#include <QAbstractVideoSurface>
+#include <QVideoSink>
 #include <QBuffer>
-#include <QMediaContent>
+#include <QUrl>
 #include <QMediaPlayer>
 #include <QObject>
 #include <QPointer>
@@ -23,8 +23,6 @@ class MxcMediaProxy : public QMediaPlayer
     Q_OBJECT
     Q_PROPERTY(TimelineModel *roomm READ room WRITE setRoom NOTIFY roomChanged REQUIRED)
     Q_PROPERTY(QString eventId READ eventId WRITE setEventId NOTIFY eventIdChanged)
-    Q_PROPERTY(QAbstractVideoSurface *videoSurface READ getVideoSurface WRITE setVideoSurface NOTIFY
-                 videoSurfaceChanged)
     Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
     Q_PROPERTY(int orientation READ orientation NOTIFY orientationChanged)
 
@@ -44,16 +42,13 @@ public:
         room_ = room;
         emit roomChanged();
     }
-    void setVideoSurface(QAbstractVideoSurface *surface);
-    QAbstractVideoSurface *getVideoSurface();
-
     int orientation() const;
 
 signals:
     void roomChanged();
     void eventIdChanged();
     void loadedChanged();
-    void newBuffer(QMediaContent, QIODevice *buf);
+    void newBuffer(QUrl, QIODevice *buf);
 
     void orientationChanged();
     void videoSurfaceChanged();
@@ -66,5 +61,5 @@ private:
     QString eventId_;
     QString filename_;
     QBuffer buffer;
-    QAbstractVideoSurface *m_surface = nullptr;
+    QObject *m_surface = nullptr;
 };
diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp
index a6f9abe7..8f410dae 100644
--- a/src/ui/NhekoGlobalObject.cpp
+++ b/src/ui/NhekoGlobalObject.cpp
@@ -5,16 +5,12 @@
 #include "NhekoGlobalObject.h"
 
 #include <QApplication>
+#include <QGuiApplication>
 #include <QDesktopServices>
 #include <QStyle>
 #include <QUrl>
 #include <QWindow>
 
-// for some reason that is not installed in our macOS env...
-#ifndef Q_OS_MAC
-#include <QtPlatformHeaders/QXcbWindowFunctions>
-#endif
-
 #include "Cache_p.h"
 #include "ChatPage.h"
 #include "Logging.h"
@@ -22,6 +18,8 @@
 #include "Utils.h"
 #include "voip/WebRTCSession.h"
 
+#include <xcb/xproto.h>
+
 Nheko::Nheko()
 {
     connect(
@@ -186,7 +184,21 @@ Nheko::createRoom(bool space,
 void
 Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString newRole) const
 {
-#ifndef Q_OS_MAC
-    QXcbWindowFunctions::setWmWindowRole(win, newRole.toUtf8());
-#endif
+    const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
+
+    if (!x11Interface) return;
+
+    auto connection = x11Interface->connection();
+
+    auto role = newRole.toStdString();
+
+    char WM_WINDOW_ROLE[] = "WM_WINDOW_ROLE";
+    auto cookie = xcb_intern_atom(connection, false, std::size(WM_WINDOW_ROLE) - 1, WM_WINDOW_ROLE);
+    xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookie, nullptr);
+    auto atom = reply ->atom;
+    free(reply);
+
+        xcb_change_property(connection, XCB_PROP_MODE_REPLACE, win->winId(),
+                        atom, XCB_ATOM_STRING, 8,
+                        role.size(), role.data());
 }
diff --git a/src/ui/Theme.cpp b/src/ui/Theme.cpp
index 48cb8bce..8cf38548 100644
--- a/src/ui/Theme.cpp
+++ b/src/ui/Theme.cpp
@@ -4,12 +4,10 @@
 
 #include "Theme.h"
 
-Q_DECLARE_METATYPE(Theme)
 
 QPalette
 Theme::paletteFromTheme(QStringView theme)
 {
-    [[maybe_unused]] static auto meta = qRegisterMetaType<Theme>("Theme");
     static QPalette original;
     if (theme == u"light") {
         static QPalette lightActive = [] {
diff --git a/src/voip/CallManager.cpp b/src/voip/CallManager.cpp
index 993937f0..0ef14db9 100644
--- a/src/voip/CallManager.cpp
+++ b/src/voip/CallManager.cpp
@@ -10,7 +10,6 @@
 #include <memory>
 
 #include <QGuiApplication>
-#include <QMediaPlaylist>
 #include <QUrl>
 
 #include "Cache.h"
@@ -42,9 +41,6 @@ extern "C"
 }
 #endif
 
-Q_DECLARE_METATYPE(std::vector<mtx::events::voip::CallCandidates::Candidate>)
-Q_DECLARE_METATYPE(mtx::events::voip::CallCandidates::Candidate)
-Q_DECLARE_METATYPE(mtx::responses::TurnServer)
 
 using namespace mtx::events;
 using namespace mtx::events::voip;
@@ -64,9 +60,6 @@ CallManager::CallManager(QObject *parent)
   , session_(WebRTCSession::instance())
   , turnServerTimer_(this)
 {
-    qRegisterMetaType<std::vector<mtx::events::voip::CallCandidates::Candidate>>();
-    qRegisterMetaType<mtx::events::voip::CallCandidates::Candidate>();
-    qRegisterMetaType<mtx::responses::TurnServer>();
 
 #ifdef GSTREAMER_AVAILABLE
     std::string errorMessage;
@@ -180,11 +173,11 @@ CallManager::CallManager(QObject *parent)
       });
 
     connect(&player_,
-            QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error),
+            &QMediaPlayer::error,
             this,
-            [this](QMediaPlayer::Error error) {
+            [this]() {
                 stopRingtone();
-                switch (error) {
+                switch (player_.error()) {
                 case QMediaPlayer::FormatError:
                 case QMediaPlayer::ResourceError:
                     nhlog::ui()->error("WebRTC: valid ringtone file not found");
@@ -827,19 +820,17 @@ CallManager::retrieveTurnServer()
 void
 CallManager::playRingtone(const QUrl &ringtone, bool repeat)
 {
-    static QMediaPlaylist playlist;
-    playlist.clear();
-    playlist.setPlaybackMode(repeat ? QMediaPlaylist::CurrentItemInLoop
-                                    : QMediaPlaylist::CurrentItemOnce);
-    playlist.addMedia(ringtone);
-    player_.setVolume(100);
-    player_.setPlaylist(&playlist);
+     player_.setLoops(repeat ? QMediaPlayer::Infinite :
+                                   1);
+    player_.setSource(ringtone);
+    //player_.audioOutput()->setVolume(100);
+    player_.play();
 }
 
 void
 CallManager::stopRingtone()
 {
-    player_.setPlaylist(nullptr);
+    player_.stop();
 }
 
 bool
diff --git a/src/voip/ScreenCastPortal.cpp b/src/voip/ScreenCastPortal.cpp
index 31cddba0..e0433387 100644
--- a/src/voip/ScreenCastPortal.cpp
+++ b/src/voip/ScreenCastPortal.cpp
@@ -438,7 +438,6 @@ struct PipeWireStream
     QVariantMap map;
 };
 
-Q_DECLARE_METATYPE(PipeWireStream)
 
 const QDBusArgument &
 operator>>(const QDBusArgument &argument, PipeWireStream &stream)
diff --git a/src/voip/WebRTCSession.cpp b/src/voip/WebRTCSession.cpp
index c0cab4ac..c8bc9cb5 100644
--- a/src/voip/WebRTCSession.cpp
+++ b/src/voip/WebRTCSession.cpp
@@ -41,9 +41,6 @@ extern "C"
 // https://github.com/vector-im/riot-web/issues/10173
 #define STUN_SERVER "stun://turn.matrix.org:3478"
 
-Q_DECLARE_METATYPE(webrtc::CallType)
-Q_DECLARE_METATYPE(webrtc::ScreenShareType)
-Q_DECLARE_METATYPE(webrtc::State)
 
 using webrtc::CallType;
 using webrtc::ScreenShareType;
@@ -52,7 +49,6 @@ using webrtc::State;
 WebRTCSession::WebRTCSession()
   : devices_(CallDevices::instance())
 {
-    qRegisterMetaType<webrtc::CallType>();
     qmlRegisterUncreatableMetaObject(webrtc::staticMetaObject,
                                      "im.nheko",
                                      1,
@@ -60,7 +56,6 @@ WebRTCSession::WebRTCSession()
                                      "CallType",
                                      QStringLiteral("Can't instantiate enum"));
 
-    qRegisterMetaType<webrtc::ScreenShareType>();
     qmlRegisterUncreatableMetaObject(webrtc::staticMetaObject,
                                      "im.nheko",
                                      1,
@@ -68,7 +63,6 @@ WebRTCSession::WebRTCSession()
                                      "ScreenShareType",
                                      QStringLiteral("Can't instantiate enum"));
 
-    qRegisterMetaType<webrtc::State>();
     qmlRegisterUncreatableMetaObject(webrtc::staticMetaObject,
                                      "im.nheko",
                                      1,