mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-21 18:50:47 +03:00
Make a few headers forward declarations
This commit is contained in:
parent
06927cd3c2
commit
aef9617d1e
39 changed files with 198 additions and 118 deletions
|
@ -444,6 +444,7 @@ set(SRC_FILES
|
|||
src/BlurhashProvider.h
|
||||
src/Cache.cpp
|
||||
src/Cache.h
|
||||
src/CacheCryptoStructs.cpp
|
||||
src/CacheCryptoStructs.h
|
||||
src/CacheStructs.h
|
||||
src/Cache_p.h
|
||||
|
@ -603,7 +604,7 @@ if(USE_BUNDLED_MTXCLIENT)
|
|||
FetchContent_Declare(
|
||||
MatrixClient
|
||||
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
|
||||
GIT_TAG 188ecb899744e55842c1debaa4597cdc5184be8a
|
||||
GIT_TAG 4fb7d678aeea197d16b52bfb1dc35b506673bb52
|
||||
)
|
||||
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
|
||||
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
|
||||
|
|
|
@ -223,7 +223,7 @@ modules:
|
|||
buildsystem: cmake-ninja
|
||||
name: mtxclient
|
||||
sources:
|
||||
- commit: 188ecb899744e55842c1debaa4597cdc5184be8a
|
||||
- commit: 4fb7d678aeea197d16b52bfb1dc35b506673bb52
|
||||
#tag: v0.9.2
|
||||
type: git
|
||||
url: https://github.com/Nheko-Reborn/mtxclient.git
|
||||
|
|
|
@ -6296,3 +6296,5 @@ NHEKO_CACHE_GET_STATE_EVENT_DEFINITION(mtx::events::state::policy_rule::ServerRu
|
|||
NHEKO_CACHE_GET_STATE_EVENT_DEFINITION(mtx::events::state::space::Child)
|
||||
NHEKO_CACHE_GET_STATE_EVENT_DEFINITION(mtx::events::state::space::Parent)
|
||||
NHEKO_CACHE_GET_STATE_EVENT_DEFINITION(mtx::events::msc2545::ImagePack)
|
||||
|
||||
#include "moc_Cache_p.cpp"
|
||||
|
|
15
src/CacheCryptoStructs.cpp
Normal file
15
src/CacheCryptoStructs.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
// SPDX-FileCopyrightText: Nheko Contributors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "CacheCryptoStructs.h"
|
||||
|
||||
#include <mtx/events/encrypted.hpp>
|
||||
|
||||
MegolmSessionIndex::MegolmSessionIndex(std::string room_id_, const mtx::events::msg::Encrypted &e)
|
||||
: room_id(std::move(room_id_))
|
||||
, session_id(e.session_id)
|
||||
{
|
||||
}
|
||||
|
||||
#include "moc_CacheCryptoStructs.cpp"
|
|
@ -11,10 +11,13 @@
|
|||
#include <mutex>
|
||||
#include <set>
|
||||
|
||||
#include <mtx/events/encrypted.hpp>
|
||||
#include <mtx/responses/crypto.hpp>
|
||||
#include <mtxclient/crypto/objects.hpp>
|
||||
|
||||
namespace mtx::events::msg {
|
||||
struct Encrypted;
|
||||
}
|
||||
|
||||
namespace crypto {
|
||||
Q_NAMESPACE
|
||||
QML_NAMED_ELEMENT(Crypto)
|
||||
|
@ -96,11 +99,7 @@ from_json(const nlohmann::json &obj, DevicePublicKeys &msg);
|
|||
struct MegolmSessionIndex
|
||||
{
|
||||
MegolmSessionIndex() = default;
|
||||
MegolmSessionIndex(std::string room_id_, const mtx::events::msg::Encrypted &e)
|
||||
: room_id(std::move(room_id_))
|
||||
, session_id(e.session_id)
|
||||
{
|
||||
}
|
||||
MegolmSessionIndex(std::string room_id_, const mtx::events::msg::Encrypted &e);
|
||||
|
||||
//! The room in which this session exists.
|
||||
std::string room_id;
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
#include <mtx/responses/notifications.hpp>
|
||||
#include <mtx/responses/sync.hpp>
|
||||
#include <mtxclient/crypto/types.hpp>
|
||||
#include <mtxclient/http/client.hpp>
|
||||
#include <mtxclient/http/errors.hpp>
|
||||
|
||||
#include "CacheCryptoStructs.h"
|
||||
#include "CacheStructs.h"
|
||||
|
||||
namespace mtx::responses {
|
||||
struct Messages;
|
||||
struct StateEvents;
|
||||
}
|
||||
|
||||
class Cache final : public QObject
|
||||
|
@ -51,8 +52,9 @@ public:
|
|||
lmdb::dbi &db,
|
||||
const std::vector<std::string> &user_ids,
|
||||
const std::string &sync_token);
|
||||
void query_keys(const std::string &user_id,
|
||||
std::function<void(const UserKeyCache &, mtx::http::RequestErr)> cb);
|
||||
void query_keys(
|
||||
const std::string &user_id,
|
||||
std::function<void(const UserKeyCache &, const std::optional<mtx::http::ClientError> &)> cb);
|
||||
|
||||
// device & user verification cache
|
||||
std::optional<UserKeyCache> userKeys(const std::string &user_id);
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "notifications/Manager.h"
|
||||
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "timeline/TimelineViewManager.h"
|
||||
|
||||
ChatPage *ChatPage::instance_ = nullptr;
|
||||
|
|
|
@ -17,32 +17,6 @@ struct TimelineEvents;
|
|||
struct StateEvents;
|
||||
}
|
||||
|
||||
namespace nheko {
|
||||
struct nonesuch
|
||||
{
|
||||
~nonesuch() = delete;
|
||||
nonesuch(nonesuch const &) = delete;
|
||||
void operator=(nonesuch const &) = delete;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template<class Default, class AlwaysVoid, template<class...> class Op, class... Args>
|
||||
struct detector
|
||||
{
|
||||
using value_t = std::false_type;
|
||||
using type = Default;
|
||||
};
|
||||
|
||||
template<class Default, template<class...> class Op, class... Args>
|
||||
struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
|
||||
{
|
||||
using value_t = std::true_type;
|
||||
using type = Op<Args...>;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
}
|
||||
|
||||
namespace mtx::accessors {
|
||||
const std::string &
|
||||
event_id(const mtx::events::collections::TimelineEvents &event);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "Logging.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "mtx/responses/profile.hpp"
|
||||
#include "timeline/TimelineModel.h"
|
||||
|
||||
InviteesModel::InviteesModel(TimelineModel *room, QObject *parent)
|
||||
: QAbstractListModel{parent}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <QQmlEngine>
|
||||
#include <QVector>
|
||||
|
||||
#include "timeline/TimelineModel.h"
|
||||
class TimelineModel;
|
||||
|
||||
class Invitee final : public QObject
|
||||
{
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include <QQuickImageResponse>
|
||||
#include <QThreadPool>
|
||||
|
||||
#include <mtx/common.hpp>
|
||||
|
||||
class JdenticonRunnable final
|
||||
: public QObject
|
||||
, public QRunnable
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "Utils.h"
|
||||
#include "dock/Dock.h"
|
||||
#include "encryption/DeviceVerificationFlow.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "timeline/TimelineViewManager.h"
|
||||
#include "ui/Theme.h"
|
||||
#include "voip/CallManager.h"
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "Cache_p.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Logging.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "timeline/TimelineViewManager.h"
|
||||
|
||||
MemberListBackend::MemberListBackend(const QString &room_id, QObject *parent)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <optional>
|
||||
|
||||
#include <mtx/common.hpp>
|
||||
#include <mtxclient/crypto/client.hpp>
|
||||
|
||||
#include <QByteArray>
|
||||
|
@ -87,7 +88,7 @@ MxcImageProvider::requestImageResponse(const QString &id, const QSize &requested
|
|||
}
|
||||
|
||||
void
|
||||
MxcImageProvider::addEncryptionInfo(mtx::crypto::EncryptedFile info)
|
||||
MxcImageProvider::addEncryptionInfo(const mtx::crypto::EncryptedFile &info)
|
||||
{
|
||||
infos.insert(QString::fromStdString(info.url), info);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
|
||||
#include <functional>
|
||||
|
||||
#include <mtx/common.hpp>
|
||||
namespace mtx::crypto {
|
||||
struct EncryptedFile;
|
||||
}
|
||||
|
||||
class MxcImageRunnable final : public QObject
|
||||
{
|
||||
|
@ -81,7 +83,7 @@ public slots:
|
|||
QQuickImageResponse *
|
||||
requestImageResponse(const QString &id, const QSize &requestedSize) override;
|
||||
|
||||
static void addEncryptionInfo(mtx::crypto::EncryptedFile info);
|
||||
static void addEncryptionInfo(const mtx::crypto::EncryptedFile &info);
|
||||
static void download(const QString &id,
|
||||
const QSize &requestedSize,
|
||||
std::function<void(QString, QSize, QImage, QString)> then,
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
#include <QQmlEngine>
|
||||
#include <QString>
|
||||
|
||||
#include <mtx/user_interactive.hpp>
|
||||
#include <mtxclient/http/client.hpp>
|
||||
|
||||
class RegisterPage : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <mtx/requests.hpp>
|
||||
|
||||
#include "Cache.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Logging.h"
|
||||
|
|
|
@ -47,5 +47,7 @@ private:
|
|||
QAction *viewAction_;
|
||||
QAction *quitAction_;
|
||||
|
||||
#if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN)
|
||||
MsgCountComposedIcon *icon_;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "MainWindow.h"
|
||||
#include "MxcImageProvider.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "Cache_p.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Logging.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "Utils.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
|
||||
|
|
|
@ -5,13 +5,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include <mtx/responses/crypto.hpp>
|
||||
#include <mtxclient/crypto/client.hpp>
|
||||
|
||||
#include "CacheCryptoStructs.h"
|
||||
#include "Logging.h"
|
||||
#include "MatrixClient.h"
|
||||
|
||||
class QTimer;
|
||||
class TimelineModel;
|
||||
|
@ -152,8 +150,6 @@ public:
|
|||
bool isSelfVerification() const;
|
||||
bool isMultiDeviceVerification() const { return deviceIds.size() > 1; }
|
||||
|
||||
void callback_fn(const UserKeyCache &res, mtx::http::RequestErr err, std::string user_id);
|
||||
|
||||
public slots:
|
||||
//! unverifies a device
|
||||
void unverify();
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#include "Cache.h"
|
||||
#include "ChatPage.h"
|
||||
#include "DeviceVerificationFlow.h"
|
||||
#include "Logging.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "timeline/TimelineViewManager.h"
|
||||
|
||||
VerificationManager::VerificationManager(TimelineViewManager *o)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <QtCore/QObject>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
#include "TimelineModel.h"
|
||||
class TimelineModel;
|
||||
|
||||
class EventDelegateChooserAttachedType : public QObject
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "TimelineViewManager.h"
|
||||
#include "UserSettingsPage.h"
|
||||
#include "Utils.h"
|
||||
#include "ui/UserProfile.h"
|
||||
|
||||
#include "blurhash.hpp"
|
||||
|
||||
|
|
|
@ -945,6 +945,34 @@ FilteredRoomlistModel::FilteredRoomlistModel(RoomlistModel *model, QObject *pare
|
|||
sort(0);
|
||||
}
|
||||
|
||||
FilteredRoomlistModel *
|
||||
FilteredRoomlistModel::create(QQmlEngine *qmlEngine, QJSEngine *)
|
||||
{
|
||||
// The instance has to exist before it is used. We cannot replace it.
|
||||
Q_ASSERT(instance_);
|
||||
|
||||
// The engine has to have the same thread affinity as the singleton.
|
||||
Q_ASSERT(qmlEngine->thread() == instance_->thread());
|
||||
|
||||
// There can only be one engine accessing the singleton.
|
||||
static QJSEngine *s_engine = nullptr;
|
||||
if (s_engine)
|
||||
Q_ASSERT(qmlEngine == s_engine);
|
||||
else
|
||||
s_engine = qmlEngine;
|
||||
|
||||
QJSEngine::setObjectOwnership(instance_, QJSEngine::CppOwnership);
|
||||
return instance_;
|
||||
}
|
||||
|
||||
TimelineModel *
|
||||
FilteredRoomlistModel::getRoomById(const QString &id) const
|
||||
{
|
||||
auto r = roomlistmodel->getRoomById(id).data();
|
||||
QQmlEngine::setObjectOwnership(r, QQmlEngine::CppOwnership);
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
FilteredRoomlistModel::updateHiddenTagsAndSpaces()
|
||||
{
|
||||
|
|
|
@ -15,12 +15,11 @@
|
|||
|
||||
#include <mtx/responses/sync.hpp>
|
||||
|
||||
#include "TimelineModel.h"
|
||||
|
||||
#ifdef NHEKO_DBUS_SYS
|
||||
#include "dbus/NhekoDBusBackend.h"
|
||||
#endif
|
||||
|
||||
class TimelineModel;
|
||||
class TimelineViewManager;
|
||||
|
||||
class RoomPreview
|
||||
|
@ -178,24 +177,7 @@ class FilteredRoomlistModel final : public QSortFilterProxyModel
|
|||
public:
|
||||
FilteredRoomlistModel(RoomlistModel *model, QObject *parent = nullptr);
|
||||
|
||||
static FilteredRoomlistModel *create(QQmlEngine *qmlEngine, QJSEngine *)
|
||||
{
|
||||
// The instance has to exist before it is used. We cannot replace it.
|
||||
Q_ASSERT(instance_);
|
||||
|
||||
// The engine has to have the same thread affinity as the singleton.
|
||||
Q_ASSERT(qmlEngine->thread() == instance_->thread());
|
||||
|
||||
// There can only be one engine accessing the singleton.
|
||||
static QJSEngine *s_engine = nullptr;
|
||||
if (s_engine)
|
||||
Q_ASSERT(qmlEngine == s_engine);
|
||||
else
|
||||
s_engine = qmlEngine;
|
||||
|
||||
QJSEngine::setObjectOwnership(instance_, QJSEngine::CppOwnership);
|
||||
return instance_;
|
||||
}
|
||||
static FilteredRoomlistModel *create(QQmlEngine *qmlEngine, QJSEngine *);
|
||||
|
||||
static FilteredRoomlistModel *instance() { return instance_; }
|
||||
|
||||
|
@ -218,12 +200,7 @@ public slots:
|
|||
RoomPreview currentRoomPreview() const { return roomlistmodel->currentRoomPreview(); }
|
||||
void setCurrentRoom(QString roomid) { roomlistmodel->setCurrentRoom(std::move(roomid)); }
|
||||
void resetCurrentRoom() { roomlistmodel->resetCurrentRoom(); }
|
||||
TimelineModel *getRoomById(const QString &id) const
|
||||
{
|
||||
auto r = roomlistmodel->getRoomById(id).data();
|
||||
QQmlEngine::setObjectOwnership(r, QQmlEngine::CppOwnership);
|
||||
return r;
|
||||
}
|
||||
TimelineModel *getRoomById(const QString &id) const;
|
||||
RoomPreview getRoomPreviewById(QString roomid) const
|
||||
{
|
||||
return roomlistmodel->getRoomPreviewById(roomid);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QEvent>
|
||||
|
||||
#include "Logging.h"
|
||||
#include "TimelineModel.h"
|
||||
|
||||
/// Searching currently can be done incrementally. For that we define a specific role to filter on
|
||||
/// and then process that role in chunk. This is the `FilterRole`. Of course we need to then also
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include <mtx/events/power_levels.hpp>
|
||||
|
||||
#include "TimelineModel.h"
|
||||
class TimelineModel;
|
||||
|
||||
class TimelineFilter : public QSortFilterProxyModel
|
||||
{
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
#include "Logging.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "ReadReceiptsModel.h"
|
||||
#include "RoomlistModel.h"
|
||||
#include "TimelineViewManager.h"
|
||||
#include "Utils.h"
|
||||
#include "encryption/Olm.h"
|
||||
#include "ui/UserProfile.h"
|
||||
|
||||
namespace std {
|
||||
inline uint // clazy:exclude=qhash-namespace
|
||||
|
@ -1703,7 +1706,8 @@ TimelineModel::checkAfterFetch()
|
|||
|
||||
template<typename T>
|
||||
void
|
||||
TimelineModel::sendEncryptedMessage(mtx::events::RoomEvent<T> msg, mtx::events::EventType eventType)
|
||||
TimelineModel::sendEncryptedMessage(const mtx::events::RoomEvent<T> &msg,
|
||||
mtx::events::EventType eventType)
|
||||
{
|
||||
const auto room_id = room_id_.toStdString();
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "InputBar.h"
|
||||
#include "Permissions.h"
|
||||
#include "Reaction.h"
|
||||
#include "ReadReceiptsModel.h"
|
||||
#include "ui/RoomSummary.h"
|
||||
|
||||
namespace mtx::http {
|
||||
|
@ -33,6 +32,7 @@ struct ClaimKeys;
|
|||
struct StateEvents;
|
||||
}
|
||||
struct RelatedInfo;
|
||||
class ReadReceiptsProxy;
|
||||
|
||||
namespace qml_mtx_events {
|
||||
Q_NAMESPACE
|
||||
|
@ -516,7 +516,8 @@ signals:
|
|||
|
||||
private:
|
||||
template<typename T>
|
||||
void sendEncryptedMessage(mtx::events::RoomEvent<T> msg, mtx::events::EventType eventType);
|
||||
void
|
||||
sendEncryptedMessage(const mtx::events::RoomEvent<T> &msg, mtx::events::EventType eventType);
|
||||
void readEvent(const std::string &id);
|
||||
|
||||
void setPaginationInProgress(const bool paginationInProgress);
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QMimeData>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickTextDocument>
|
||||
#include <QStandardPaths>
|
||||
#include <QString>
|
||||
|
||||
|
@ -24,17 +26,48 @@
|
|||
#include "Logging.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "MemberList.h"
|
||||
#include "RoomsModel.h"
|
||||
#include "TimelineModel.h"
|
||||
#include "UserSettingsPage.h"
|
||||
#include "UsersModel.h"
|
||||
#include "Utils.h"
|
||||
#include "encryption/VerificationManager.h"
|
||||
#include "timeline/CommunitiesModel.h"
|
||||
#include "timeline/PresenceEmitter.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "ui/RoomSettings.h"
|
||||
#include "ui/UserProfile.h"
|
||||
#include "voip/CallManager.h"
|
||||
#include "voip/WebRTCSession.h"
|
||||
|
||||
namespace {
|
||||
struct nonesuch
|
||||
{
|
||||
~nonesuch() = delete;
|
||||
nonesuch(nonesuch const &) = delete;
|
||||
void operator=(nonesuch const &) = delete;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template<class Default, class AlwaysVoid, template<class...> class Op, class... Args>
|
||||
struct detector
|
||||
{
|
||||
using value_t = std::false_type;
|
||||
using type = Default;
|
||||
};
|
||||
|
||||
template<class Default, template<class...> class Op, class... Args>
|
||||
struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
|
||||
{
|
||||
using value_t = std::true_type;
|
||||
using type = Op<Args...>;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<template<class...> class Op, class... Args>
|
||||
using is_detected = typename nheko::detail::detector<nheko::nonesuch, void, Op, Args...>::value_t;
|
||||
using is_detected = typename detail::detector<nonesuch, void, Op, Args...>::value_t;
|
||||
|
||||
template<class Content>
|
||||
using file_t = decltype(Content::file);
|
||||
|
@ -88,7 +121,7 @@ TimelineViewManager::updateColorPalette()
|
|||
QColor
|
||||
TimelineViewManager::userColor(QString id, QColor background)
|
||||
{
|
||||
QPair<QString, quint64> idx{id, background.rgba64()};
|
||||
std::pair<QString, quint64> idx{id, background.rgba64()};
|
||||
if (!userColors.contains(idx))
|
||||
userColors.insert(idx, QColor(utils::generateContrastingHexColor(id, background)));
|
||||
return userColors.value(idx);
|
||||
|
@ -148,6 +181,32 @@ TimelineViewManager::TimelineViewManager(CallManager *, ChatPage *parent)
|
|||
});
|
||||
}
|
||||
|
||||
TimelineViewManager *
|
||||
TimelineViewManager::create(QQmlEngine *qmlEngine, QJSEngine *)
|
||||
{
|
||||
// The instance has to exist before it is used. We cannot replace it.
|
||||
Q_ASSERT(instance_);
|
||||
|
||||
// The engine has to have the same thread affinity as the singleton.
|
||||
Q_ASSERT(qmlEngine->thread() == instance_->thread());
|
||||
|
||||
// There can only be one engine accessing the singleton.
|
||||
static QJSEngine *s_engine = nullptr;
|
||||
if (s_engine)
|
||||
Q_ASSERT(qmlEngine == s_engine);
|
||||
else
|
||||
s_engine = qmlEngine;
|
||||
|
||||
QJSEngine::setObjectOwnership(instance_, QJSEngine::CppOwnership);
|
||||
return instance_;
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::clearAll()
|
||||
{
|
||||
rooms_->clear();
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::openRoomMembers(TimelineModel *room)
|
||||
{
|
||||
|
|
|
@ -5,19 +5,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <QHash>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickTextDocument>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include <mtx/common.hpp>
|
||||
#include <mtx/responses/messages.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "InviteesModel.h"
|
||||
#include "MemberList.h"
|
||||
#include "timeline/CommunitiesModel.h"
|
||||
#include "timeline/PresenceEmitter.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "ui/RoomSettings.h"
|
||||
#include "ui/UserProfile.h"
|
||||
class QQuickItem;
|
||||
class QQuickTextDocument;
|
||||
|
||||
class UserSettings;
|
||||
class ChatPage;
|
||||
|
@ -25,9 +18,32 @@ class ImagePackListModel;
|
|||
class TimelineModel;
|
||||
class CallManager;
|
||||
class VerificationManager;
|
||||
class InviteesModel;
|
||||
class MemberList;
|
||||
class CommunitiesModel;
|
||||
class RoomlistModel;
|
||||
class PresenceEmitter;
|
||||
class UserProfile;
|
||||
class RoomSettings;
|
||||
class FilteredRoomlistModel;
|
||||
class QAbstractItemModel;
|
||||
|
||||
namespace mtx::responses {
|
||||
struct Sync;
|
||||
struct AccountData;
|
||||
}
|
||||
|
||||
namespace mtx::events::voip {
|
||||
struct CallInvite;
|
||||
struct CallCandidates;
|
||||
struct CallAnswer;
|
||||
struct CallHangUp;
|
||||
struct CallSelectAnswer;
|
||||
struct CallReject;
|
||||
struct CallNegotiate;
|
||||
}
|
||||
namespace mtx::events::collections {
|
||||
struct TimelineEvents;
|
||||
}
|
||||
|
||||
class TimelineViewManager final : public QObject
|
||||
|
@ -45,24 +61,7 @@ class TimelineViewManager final : public QObject
|
|||
public:
|
||||
TimelineViewManager(CallManager *callManager, ChatPage *parent = nullptr);
|
||||
|
||||
static TimelineViewManager *create(QQmlEngine *qmlEngine, QJSEngine *)
|
||||
{
|
||||
// The instance has to exist before it is used. We cannot replace it.
|
||||
Q_ASSERT(instance_);
|
||||
|
||||
// The engine has to have the same thread affinity as the singleton.
|
||||
Q_ASSERT(qmlEngine->thread() == instance_->thread());
|
||||
|
||||
// There can only be one engine accessing the singleton.
|
||||
static QJSEngine *s_engine = nullptr;
|
||||
if (s_engine)
|
||||
Q_ASSERT(qmlEngine == s_engine);
|
||||
else
|
||||
s_engine = qmlEngine;
|
||||
|
||||
QJSEngine::setObjectOwnership(instance_, QJSEngine::CppOwnership);
|
||||
return instance_;
|
||||
}
|
||||
static TimelineViewManager *create(QQmlEngine *qmlEngine, QJSEngine *);
|
||||
|
||||
static TimelineViewManager *instance() { return TimelineViewManager::instance_; }
|
||||
|
||||
|
@ -72,7 +71,7 @@ public:
|
|||
|
||||
VerificationManager *verificationManager() { return verificationManager_; }
|
||||
|
||||
void clearAll() { rooms_->clear(); }
|
||||
void clearAll();
|
||||
|
||||
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
|
||||
bool isConnected() const { return isConnected_; }
|
||||
|
@ -158,7 +157,7 @@ private:
|
|||
VerificationManager *verificationManager_ = nullptr;
|
||||
PresenceEmitter *presenceEmitter = nullptr;
|
||||
|
||||
QHash<QPair<QString, quint64>, QColor> userColors;
|
||||
QHash<std::pair<QString, quint64>, QColor> userColors;
|
||||
|
||||
inline static TimelineViewManager *instance_ = nullptr;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <QObject>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include "timeline/TimelineModel.h"
|
||||
class TimelineModel;
|
||||
|
||||
// This is an AnimatedImage, that can draw encrypted images
|
||||
class MxcAnimatedImage : public QQuickItem
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "EventAccessors.h"
|
||||
#include "Logging.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "timeline/TimelineViewManager.h"
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "ChatPage.h"
|
||||
#include "timeline/InputBar.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "timeline/TimelineViewManager.h"
|
||||
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
#include <QUrl>
|
||||
#include <QWindow>
|
||||
|
||||
#include <mtx/requests.hpp>
|
||||
|
||||
#include "Cache_p.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Logging.h"
|
||||
#include "UserSettingsPage.h"
|
||||
#include "Utils.h"
|
||||
#include "voip/WebRTCSession.h"
|
||||
|
||||
#if XCB_AVAILABLE
|
||||
#include <xcb/xproto.h>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QInputDialog>
|
||||
#include <QTimer>
|
||||
|
||||
#include <mtx/requests.hpp>
|
||||
#include <mtx/responses/common.hpp>
|
||||
|
||||
#include "Logging.h"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "UserProfile.h"
|
||||
#include "Utils.h"
|
||||
#include "encryption/VerificationManager.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "timeline/TimelineViewManager.h"
|
||||
#include "ui/UIA.h"
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
#include <mtx/responses/common.hpp>
|
||||
|
||||
#include "CacheCryptoStructs.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
#include "CacheStructs.h"
|
||||
|
||||
class TimelineModel;
|
||||
|
||||
namespace verification {
|
||||
Q_NAMESPACE
|
||||
|
|
Loading…
Reference in a new issue