mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 19:38:48 +03:00
Remove unnecessary meta type registrations
This commit is contained in:
parent
76c5d6d2ca
commit
45391c97ff
14 changed files with 15 additions and 141 deletions
|
@ -87,12 +87,6 @@ constexpr auto MEGOLM_SESSIONS_DATA_DB("megolm_sessions_data_db");
|
||||||
using CachedReceipts = std::multimap<uint64_t, std::string, std::greater<uint64_t>>;
|
using CachedReceipts = std::multimap<uint64_t, std::string, std::greater<uint64_t>>;
|
||||||
using Receipts = std::map<std::string, std::map<std::string, 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(RoomSearchResult)
|
|
||||||
Q_DECLARE_METATYPE(RoomInfo)
|
|
||||||
Q_DECLARE_METATYPE(mtx::responses::QueryKeys)
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::unique_ptr<Cache> instance_ = nullptr;
|
std::unique_ptr<Cache> instance_ = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -4862,14 +4856,6 @@ namespace cache {
|
||||||
void
|
void
|
||||||
init(const QString &user_id)
|
init(const QString &user_id)
|
||||||
{
|
{
|
||||||
qRegisterMetaType<RoomMember>();
|
|
||||||
qRegisterMetaType<RoomSearchResult>();
|
|
||||||
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);
|
instance_ = std::make_unique<Cache>(user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,6 @@ constexpr int CHECK_CONNECTIVITY_INTERVAL = 15'000;
|
||||||
constexpr int RETRY_TIMEOUT = 5'000;
|
constexpr int RETRY_TIMEOUT = 5'000;
|
||||||
constexpr size_t MAX_ONETIME_KEYS = 50;
|
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)
|
ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, isConnected_(true)
|
, isConnected_(true)
|
||||||
|
@ -54,12 +48,6 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
|
||||||
|
|
||||||
instance_ = this;
|
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);
|
view_manager_ = new TimelineViewManager(callManager_, this);
|
||||||
|
|
||||||
connect(this,
|
connect(this,
|
||||||
|
|
|
@ -18,19 +18,12 @@
|
||||||
#include "SSOHandler.h"
|
#include "SSOHandler.h"
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(LoginPage::LoginMethod)
|
|
||||||
Q_DECLARE_METATYPE(SSOProvider)
|
|
||||||
|
|
||||||
using namespace mtx::identifiers;
|
using namespace mtx::identifiers;
|
||||||
|
|
||||||
LoginPage::LoginPage(QObject *parent)
|
LoginPage::LoginPage(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, inferredServerAddress_()
|
, 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::versionOkCb, this, &LoginPage::versionOk, Qt::QueuedConnection);
|
||||||
connect(this, &LoginPage::versionErrorCb, this, &LoginPage::versionError, Qt::QueuedConnection);
|
connect(this, &LoginPage::versionErrorCb, this, &LoginPage::versionError, Qt::QueuedConnection);
|
||||||
connect(
|
connect(
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
@ -14,45 +16,24 @@
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
#include "Cache_p.h"
|
#include "Cache_p.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
#include "Clipboard.h"
|
|
||||||
#include "ColorImageProvider.h"
|
#include "ColorImageProvider.h"
|
||||||
#include "CombinedImagePackModel.h"
|
|
||||||
#include "CompletionProxyModel.h"
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "EventAccessors.h"
|
|
||||||
#include "ImagePackListModel.h"
|
|
||||||
#include "InviteesModel.h"
|
|
||||||
#include "JdenticonProvider.h"
|
#include "JdenticonProvider.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
#include "MemberList.h"
|
#include "MemberList.h"
|
||||||
#include "MxcImageProvider.h"
|
#include "MxcImageProvider.h"
|
||||||
#include "ReadReceiptsModel.h"
|
|
||||||
#include "RoomDirectoryModel.h"
|
|
||||||
#include "RoomsModel.h"
|
|
||||||
#include "SingleImagePackModel.h"
|
|
||||||
#include "TrayIcon.h"
|
#include "TrayIcon.h"
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
#include "UsersModel.h"
|
#include "UsersModel.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "emoji/EmojiModel.h"
|
|
||||||
#include "emoji/Provider.h"
|
|
||||||
#include "encryption/DeviceVerificationFlow.h"
|
|
||||||
#include "encryption/SelfVerificationStatus.h"
|
|
||||||
#include "timeline/TimelineViewManager.h"
|
#include "timeline/TimelineViewManager.h"
|
||||||
#include "ui/NhekoGlobalObject.h"
|
#include "ui/Theme.h"
|
||||||
#include "ui/UIA.h"
|
|
||||||
#include "voip/WebRTCSession.h"
|
|
||||||
|
|
||||||
#ifdef NHEKO_DBUS_SYS
|
#ifdef NHEKO_DBUS_SYS
|
||||||
#include "dbus/NhekoDBusApi.h"
|
#include "dbus/NhekoDBusApi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents)
|
|
||||||
Q_DECLARE_METATYPE(std::vector<DeviceInfo>)
|
|
||||||
Q_DECLARE_METATYPE(std::vector<mtx::responses::PublicRoomsChunk>)
|
|
||||||
|
|
||||||
MainWindow *MainWindow::instance_ = nullptr;
|
MainWindow *MainWindow::instance_ = nullptr;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWindow *parent)
|
MainWindow::MainWindow(QWindow *parent)
|
||||||
|
@ -92,6 +73,18 @@ MainWindow::MainWindow(QWindow *parent)
|
||||||
|
|
||||||
trayIcon_->setVisible(userSettings_->tray());
|
trayIcon_->setVisible(userSettings_->tray());
|
||||||
|
|
||||||
|
#ifdef NHEKO_DBUS_SYS
|
||||||
|
if (UserSettings::instance()->exposeDBusApi()) {
|
||||||
|
if (QDBusConnection::sessionBus().isConnected() &&
|
||||||
|
QDBusConnection::sessionBus().registerService(NHEKO_DBUS_SERVICE_NAME)) {
|
||||||
|
nheko::dbus::init();
|
||||||
|
nhlog::ui()->info("Initialized D-Bus");
|
||||||
|
dbusAvailable_ = true;
|
||||||
|
} else
|
||||||
|
nhlog::ui()->warn("Could not connect to D-Bus!");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// load cache on event loop
|
// load cache on event loop
|
||||||
QTimer::singleShot(0, this, [this] {
|
QTimer::singleShot(0, this, [this] {
|
||||||
if (hasActiveUser()) {
|
if (hasActiveUser()) {
|
||||||
|
@ -129,18 +122,6 @@ MainWindow::registerQmlTypes()
|
||||||
engine()->addImageProvider(QStringLiteral("jdenticon"), new JdenticonProvider());
|
engine()->addImageProvider(QStringLiteral("jdenticon"), new JdenticonProvider());
|
||||||
|
|
||||||
QObject::connect(engine(), &QQmlEngine::quit, &QGuiApplication::quit);
|
QObject::connect(engine(), &QQmlEngine::quit, &QGuiApplication::quit);
|
||||||
|
|
||||||
#ifdef NHEKO_DBUS_SYS
|
|
||||||
if (UserSettings::instance()->exposeDBusApi()) {
|
|
||||||
if (QDBusConnection::sessionBus().isConnected() &&
|
|
||||||
QDBusConnection::sessionBus().registerService(NHEKO_DBUS_SERVICE_NAME)) {
|
|
||||||
nheko::dbus::init();
|
|
||||||
nhlog::ui()->info("Initialized D-Bus");
|
|
||||||
dbusAvailable_ = true;
|
|
||||||
} else
|
|
||||||
nhlog::ui()->warn("Could not connect to D-Bus!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -8,28 +8,6 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <QMetaType>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#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(mtx::responses::JoinedGroups)
|
|
||||||
Q_DECLARE_METATYPE(mtx::responses::GroupProfile)
|
|
||||||
|
|
||||||
// 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 {
|
namespace http {
|
||||||
|
|
||||||
mtx::http::Client *
|
mtx::http::Client *
|
||||||
|
@ -44,24 +22,4 @@ is_logged_in()
|
||||||
{
|
{
|
||||||
return !client()->access_token().empty();
|
return !client()->access_token().empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
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<mtx::responses::JoinedGroups>();
|
|
||||||
qRegisterMetaType<mtx::responses::GroupProfile>();
|
|
||||||
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
|
} // namespace http
|
||||||
|
|
|
@ -17,10 +17,6 @@ client();
|
||||||
|
|
||||||
bool
|
bool
|
||||||
is_logged_in();
|
is_logged_in();
|
||||||
|
|
||||||
//! Initialize the http module
|
|
||||||
void
|
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#include "timeline/Permissions.h"
|
#include "timeline/Permissions.h"
|
||||||
#include "timeline/TimelineModel.h"
|
#include "timeline/TimelineModel.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(mtx::common::ImageInfo)
|
|
||||||
|
|
||||||
SingleImagePackModel::SingleImagePackModel(ImagePackInfo pack_, QObject *parent)
|
SingleImagePackModel::SingleImagePackModel(ImagePackInfo pack_, QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, roomid_(std::move(pack_.source_room))
|
, roomid_(std::move(pack_.source_room))
|
||||||
|
@ -25,8 +23,6 @@ SingleImagePackModel::SingleImagePackModel(ImagePackInfo pack_, QObject *parent)
|
||||||
, old_statekey_(statekey_)
|
, old_statekey_(statekey_)
|
||||||
, pack(std::move(pack_.pack))
|
, pack(std::move(pack_.pack))
|
||||||
{
|
{
|
||||||
[[maybe_unused]] static auto imageInfoType = qRegisterMetaType<mtx::common::ImageInfo>();
|
|
||||||
|
|
||||||
if (!pack.pack)
|
if (!pack.pack)
|
||||||
pack.pack = mtx::events::msc2545::ImagePack::PackDescription{};
|
pack.pack = mtx::events::msc2545::ImagePack::PackDescription{};
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,4 @@ public:
|
||||||
// all emoji for QML purposes
|
// all emoji for QML purposes
|
||||||
static const QVector<Emoji> emoji;
|
static const QVector<Emoji> emoji;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emoji
|
} // namespace emoji
|
||||||
Q_DECLARE_METATYPE(emoji::Emoji)
|
|
||||||
|
|
|
@ -231,8 +231,6 @@ main(int argc, char *argv[])
|
||||||
app.setDesktopFileName(QStringLiteral("nheko"));
|
app.setDesktopFileName(QStringLiteral("nheko"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
http::init();
|
|
||||||
|
|
||||||
createStandardDirectory(QStandardPaths::CacheLocation);
|
createStandardDirectory(QStandardPaths::CacheLocation);
|
||||||
createStandardDirectory(QStandardPaths::AppDataLocation);
|
createStandardDirectory(QStandardPaths::AppDataLocation);
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Reaction)
|
|
||||||
|
|
||||||
QCache<EventStore::IdIndex, olm::DecryptionResult> EventStore::decryptedEvents_{1000};
|
QCache<EventStore::IdIndex, olm::DecryptionResult> EventStore::decryptedEvents_{1000};
|
||||||
QCache<EventStore::IdIndex, mtx::events::collections::TimelineEvents> EventStore::events_by_id_{
|
QCache<EventStore::IdIndex, mtx::events::collections::TimelineEvents> EventStore::events_by_id_{
|
||||||
1000};
|
1000};
|
||||||
|
@ -29,9 +27,6 @@ QCache<EventStore::Index, mtx::events::collections::TimelineEvents> EventStore::
|
||||||
EventStore::EventStore(std::string room_id, QObject *)
|
EventStore::EventStore(std::string room_id, QObject *)
|
||||||
: room_id_(std::move(room_id))
|
: room_id_(std::move(room_id))
|
||||||
{
|
{
|
||||||
static auto reactionType = qRegisterMetaType<Reaction>();
|
|
||||||
(void)reactionType;
|
|
||||||
|
|
||||||
auto range = cache::client()->getTimelineRange(room_id_);
|
auto range = cache::client()->getTimelineRange(room_id_);
|
||||||
|
|
||||||
if (range) {
|
if (range) {
|
||||||
|
|
|
@ -23,8 +23,6 @@ RoomlistModel::RoomlistModel(TimelineViewManager *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, manager(parent)
|
, manager(parent)
|
||||||
{
|
{
|
||||||
[[maybe_unused]] static auto id = qRegisterMetaType<RoomPreview>();
|
|
||||||
|
|
||||||
connect(ChatPage::instance(), &ChatPage::decryptSidebarChanged, this, [this]() {
|
connect(ChatPage::instance(), &ChatPage::decryptSidebarChanged, this, [this]() {
|
||||||
auto decrypt = ChatPage::instance()->userSettings()->decryptSidebar();
|
auto decrypt = ChatPage::instance()->userSettings()->decryptSidebar();
|
||||||
QHash<QString, QSharedPointer<TimelineModel>>::iterator i;
|
QHash<QString, QSharedPointer<TimelineModel>>::iterator i;
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "encryption/Olm.h"
|
#include "encryption/Olm.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QModelIndex)
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
inline uint // clazy:exclude=qhash-namespace
|
inline uint // clazy:exclude=qhash-namespace
|
||||||
qHash(const std::string &key, uint seed = 0)
|
qHash(const std::string &key, uint seed = 0)
|
||||||
|
|
|
@ -5,12 +5,9 @@
|
||||||
|
|
||||||
#include "Theme.h"
|
#include "Theme.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Theme)
|
|
||||||
|
|
||||||
QPalette
|
QPalette
|
||||||
Theme::paletteFromTheme(QStringView theme)
|
Theme::paletteFromTheme(QStringView theme)
|
||||||
{
|
{
|
||||||
[[maybe_unused]] static auto meta = qRegisterMetaType<Theme>("Theme");
|
|
||||||
static QPalette original;
|
static QPalette original;
|
||||||
if (theme == u"light") {
|
if (theme == u"light") {
|
||||||
static QPalette lightActive = [] {
|
static QPalette lightActive = [] {
|
||||||
|
|
|
@ -35,10 +35,6 @@ extern "C"
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::vector<mtx::events::msg::CallCandidates::Candidate>)
|
|
||||||
Q_DECLARE_METATYPE(mtx::events::msg::CallCandidates::Candidate)
|
|
||||||
Q_DECLARE_METATYPE(mtx::responses::TurnServer)
|
|
||||||
|
|
||||||
using namespace mtx::events;
|
using namespace mtx::events;
|
||||||
using namespace mtx::events::msg;
|
using namespace mtx::events::msg;
|
||||||
|
|
||||||
|
@ -75,10 +71,6 @@ CallManager::CallManager(QObject *parent)
|
||||||
, session_(WebRTCSession::instance())
|
, session_(WebRTCSession::instance())
|
||||||
, turnServerTimer_(this)
|
, turnServerTimer_(this)
|
||||||
{
|
{
|
||||||
qRegisterMetaType<std::vector<mtx::events::msg::CallCandidates::Candidate>>();
|
|
||||||
qRegisterMetaType<mtx::events::msg::CallCandidates::Candidate>();
|
|
||||||
qRegisterMetaType<mtx::responses::TurnServer>();
|
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
&session_,
|
&session_,
|
||||||
&WebRTCSession::offerCreated,
|
&WebRTCSession::offerCreated,
|
||||||
|
|
Loading…
Reference in a new issue