mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Reduce includes of MatrixClient.h, as it is the most expensive header
This commit is contained in:
parent
5fc1f3bd67
commit
37fbcaf07b
3 changed files with 20 additions and 8 deletions
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <mtx/common.hpp>
|
#include <mtx/common.hpp>
|
||||||
#include <mtx/responses.hpp>
|
#include <mtx/responses.hpp>
|
||||||
|
#include <mtxclient/http/errors.hpp>
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
@ -34,7 +35,6 @@
|
||||||
|
|
||||||
#include "CacheStructs.h"
|
#include "CacheStructs.h"
|
||||||
#include "CommunitiesList.h"
|
#include "CommunitiesList.h"
|
||||||
#include "MatrixClient.h"
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "notifications/Manager.h"
|
#include "notifications/Manager.h"
|
||||||
#include "popups/UserMentions.h"
|
#include "popups/UserMentions.h"
|
||||||
|
@ -56,6 +56,10 @@ constexpr int CONSENSUS_TIMEOUT = 1000;
|
||||||
constexpr int SHOW_CONTENT_TIMEOUT = 3000;
|
constexpr int SHOW_CONTENT_TIMEOUT = 3000;
|
||||||
constexpr int TYPING_REFRESH_TIMEOUT = 10000;
|
constexpr int TYPING_REFRESH_TIMEOUT = 10000;
|
||||||
|
|
||||||
|
namespace mtx::http {
|
||||||
|
using RequestErr = const std::optional<mtx::http::ClientError> &;
|
||||||
|
}
|
||||||
|
|
||||||
class ChatPage : public QWidget
|
class ChatPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
#include "MatrixClient.h"
|
||||||
#include "MxcImageProvider.h"
|
#include "MxcImageProvider.h"
|
||||||
#include "Olm.h"
|
#include "Olm.h"
|
||||||
#include "TimelineViewManager.h"
|
#include "TimelineViewManager.h"
|
||||||
|
@ -1400,6 +1401,15 @@ TimelineModel::processOnePendingMessage()
|
||||||
void
|
void
|
||||||
TimelineModel::addPendingMessage(mtx::events::collections::TimelineEvents event)
|
TimelineModel::addPendingMessage(mtx::events::collections::TimelineEvents event)
|
||||||
{
|
{
|
||||||
|
std::visit(
|
||||||
|
[](auto &msg) {
|
||||||
|
msg.type = mtx::events::EventType::RoomMessage;
|
||||||
|
msg.event_id = http::client()->generate_txn_id();
|
||||||
|
msg.sender = http::client()->user_id().to_string();
|
||||||
|
msg.origin_server_ts = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
},
|
||||||
|
event);
|
||||||
|
|
||||||
internalAddEvents({event});
|
internalAddEvents({event});
|
||||||
|
|
||||||
QString txn_id_qstr =
|
QString txn_id_qstr =
|
||||||
|
|
|
@ -8,10 +8,14 @@
|
||||||
|
|
||||||
#include <mtx/common.hpp>
|
#include <mtx/common.hpp>
|
||||||
#include <mtx/responses.hpp>
|
#include <mtx/responses.hpp>
|
||||||
|
#include <mtxclient/http/errors.hpp>
|
||||||
|
|
||||||
#include "CacheCryptoStructs.h"
|
#include "CacheCryptoStructs.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "MatrixClient.h"
|
|
||||||
|
namespace mtx::http {
|
||||||
|
using RequestErr = const std::optional<mtx::http::ClientError> &;
|
||||||
|
}
|
||||||
|
|
||||||
namespace qml_mtx_events {
|
namespace qml_mtx_events {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
|
@ -232,13 +236,7 @@ template<class T>
|
||||||
void
|
void
|
||||||
TimelineModel::sendMessage(const T &msg)
|
TimelineModel::sendMessage(const T &msg)
|
||||||
{
|
{
|
||||||
auto txn_id = http::client()->generate_txn_id();
|
|
||||||
mtx::events::RoomEvent<T> msgCopy = {};
|
mtx::events::RoomEvent<T> msgCopy = {};
|
||||||
msgCopy.content = msg;
|
msgCopy.content = msg;
|
||||||
msgCopy.type = mtx::events::EventType::RoomMessage;
|
|
||||||
msgCopy.event_id = txn_id;
|
|
||||||
msgCopy.sender = http::client()->user_id().to_string();
|
|
||||||
msgCopy.origin_server_ts = QDateTime::currentMSecsSinceEpoch();
|
|
||||||
|
|
||||||
emit newMessageToSend(msgCopy);
|
emit newMessageToSend(msgCopy);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue