Clean up includes
This commit is contained in:
@@ -2,17 +2,13 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "actionshandler.h"
|
||||
#include "controller.h"
|
||||
|
||||
#include <csapi/joining.h>
|
||||
#include <events/roommessageevent.h>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <QDebug>
|
||||
#include <QStringBuilder>
|
||||
|
||||
#include "controller.h"
|
||||
#include "customemojimodel.h"
|
||||
#include "neochatroom.h"
|
||||
#include "roommanager.h"
|
||||
|
||||
ActionsHandler::ActionsHandler(QObject *parent)
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "neochatroom.h"
|
||||
#include <connection.h>
|
||||
|
||||
using namespace Quotient;
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
}
|
||||
|
||||
class NeoChatRoom;
|
||||
class CustomEmojiModel;
|
||||
|
||||
/// \brief Handles user interactions with NeoChat (joining room, creating room,
|
||||
@@ -19,7 +20,7 @@ class ActionsHandler : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
/// \brief The connection that will handle sending the message.
|
||||
Q_PROPERTY(Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
|
||||
/// \brief The connection that will handle sending the message.
|
||||
Q_PROPERTY(NeoChatRoom *room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
@@ -34,8 +35,8 @@ public:
|
||||
explicit ActionsHandler(QObject *parent = nullptr);
|
||||
~ActionsHandler();
|
||||
|
||||
[[nodiscard]] Connection *connection() const;
|
||||
void setConnection(Connection *connection);
|
||||
[[nodiscard]] Quotient::Connection *connection() const;
|
||||
void setConnection(Quotient::Connection *connection);
|
||||
|
||||
[[nodiscard]] NeoChatRoom *room() const;
|
||||
void setRoom(NeoChatRoom *room);
|
||||
@@ -68,6 +69,6 @@ public Q_SLOTS:
|
||||
void postEdit(const QString &text);
|
||||
|
||||
private:
|
||||
Connection *m_connection = nullptr;
|
||||
Quotient::Connection *m_connection = nullptr;
|
||||
NeoChatRoom *m_room = nullptr;
|
||||
};
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include "blurhash.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
uint8_t *decode(const char *blurhash, int width, int height, int punch, int nChannels);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "chatboxhelper.h"
|
||||
#include <QDebug>
|
||||
|
||||
ChatBoxHelper::ChatBoxHelper(QObject *parent)
|
||||
: QObject(parent)
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QFont>
|
||||
#include <QObject>
|
||||
#include <QQuickTextDocument>
|
||||
#include <QTextCursor>
|
||||
#include <QUrl>
|
||||
|
||||
class QTextDocument;
|
||||
class QQuickTextDocument;
|
||||
class NeoChatRoom;
|
||||
class Controller;
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QPair>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "messageeventmodel.h"
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
class CollapseStateProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QIdentityProxyModel>
|
||||
#include <QObject>
|
||||
|
||||
class QAbstractItemModel;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include "actionshandler.h"
|
||||
#include "commandmodel.h"
|
||||
|
||||
QVariantList CommandModel::filterModel(const QString &filter)
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <utility>
|
||||
|
||||
struct Command {
|
||||
Command(const QString &p, const QString &a, const QString &h)
|
||||
|
||||
@@ -14,23 +14,16 @@
|
||||
#include <KWindowEffects>
|
||||
#endif
|
||||
|
||||
#include <QAuthenticator>
|
||||
#include <QClipboard>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QGuiApplication>
|
||||
#include <QMovie>
|
||||
#include <QNetworkReply>
|
||||
#include <QPixmap>
|
||||
#include <QImageReader>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickTextDocument>
|
||||
#include <QQuickWindow>
|
||||
#include <QStandardPaths>
|
||||
#include <QStringBuilder>
|
||||
#include <QSysInfo>
|
||||
#include <QTextDocument>
|
||||
#include <QTimer>
|
||||
#include <utility>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
@@ -40,24 +33,18 @@
|
||||
#include "neochataccountregistry.h"
|
||||
#endif
|
||||
|
||||
#include <csapi/account-data.h>
|
||||
#include <connection.h>
|
||||
#include <csapi/content-repo.h>
|
||||
#include <csapi/joining.h>
|
||||
#include <csapi/logout.h>
|
||||
#include <csapi/profile.h>
|
||||
#include <events/eventcontent.h>
|
||||
#include <qt_connection_util.h>
|
||||
#include <settings.h>
|
||||
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatroom.h"
|
||||
#include "neochatuser.h"
|
||||
#include "roommanager.h"
|
||||
#include "utils.h"
|
||||
#include "windowcontroller.h"
|
||||
|
||||
#include <KStandardShortcut>
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
#include "trayicon.h"
|
||||
#elif !defined(Q_OS_ANDROID)
|
||||
|
||||
@@ -9,13 +9,8 @@
|
||||
#include <KAboutData>
|
||||
#include <KFormat>
|
||||
|
||||
class QKeySequences;
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/list_public_rooms.h>
|
||||
#include <room.h>
|
||||
#include <jobs/basejob.h>
|
||||
#include <settings.h>
|
||||
#include <user.h>
|
||||
|
||||
class NeoChatRoom;
|
||||
class NeoChatUser;
|
||||
@@ -23,19 +18,22 @@ class TrayIcon;
|
||||
class QWindow;
|
||||
class QQuickTextDocument;
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
}
|
||||
|
||||
namespace QKeychain
|
||||
{
|
||||
class ReadPasswordJob;
|
||||
}
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
class Controller : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int accountCount READ accountCount NOTIFY accountCountChanged)
|
||||
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed NOTIFY quitOnLastWindowClosedChanged)
|
||||
Q_PROPERTY(Connection *activeConnection READ activeConnection WRITE setActiveConnection NOTIFY activeConnectionChanged)
|
||||
Q_PROPERTY(Quotient::Connection *activeConnection READ activeConnection WRITE setActiveConnection NOTIFY activeConnectionChanged)
|
||||
Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged)
|
||||
Q_PROPERTY(KAboutData aboutData READ aboutData WRITE setAboutData NOTIFY aboutDataChanged)
|
||||
Q_PROPERTY(bool supportSystemTray READ supportSystemTray CONSTANT)
|
||||
@@ -46,11 +44,11 @@ class Controller : public QObject
|
||||
public:
|
||||
static Controller &instance();
|
||||
|
||||
void setActiveConnection(Connection *connection);
|
||||
[[nodiscard]] Connection *activeConnection() const;
|
||||
void setActiveConnection(Quotient::Connection *connection);
|
||||
[[nodiscard]] Quotient::Connection *activeConnection() const;
|
||||
|
||||
void addConnection(Connection *c);
|
||||
void dropConnection(Connection *c);
|
||||
void addConnection(Quotient::Connection *c);
|
||||
void dropConnection(Quotient::Connection *c);
|
||||
|
||||
Q_INVOKABLE void loginWithAccessToken(const QString &, const QString &, const QString &, const QString &);
|
||||
|
||||
@@ -71,8 +69,8 @@ public:
|
||||
|
||||
[[nodiscard]] bool supportSystemTray() const;
|
||||
|
||||
bool saveAccessTokenToFile(const AccountSettings &account, const QByteArray &accessToken);
|
||||
bool saveAccessTokenToKeyChain(const AccountSettings &account, const QByteArray &accessToken);
|
||||
bool saveAccessTokenToFile(const Quotient::AccountSettings &account, const QByteArray &accessToken);
|
||||
bool saveAccessTokenToKeyChain(const Quotient::AccountSettings &account, const QByteArray &accessToken);
|
||||
|
||||
enum PasswordStatus {
|
||||
Success,
|
||||
@@ -101,12 +99,12 @@ public:
|
||||
private:
|
||||
explicit Controller(QObject *parent = nullptr);
|
||||
|
||||
QPointer<Connection> m_connection;
|
||||
QPointer<Quotient::Connection> m_connection;
|
||||
bool m_busy = false;
|
||||
TrayIcon *m_trayIcon = nullptr;
|
||||
|
||||
static QByteArray loadAccessTokenFromFile(const AccountSettings &account);
|
||||
QKeychain::ReadPasswordJob *loadAccessTokenFromKeyChain(const AccountSettings &account);
|
||||
static QByteArray loadAccessTokenFromFile(const Quotient::AccountSettings &account);
|
||||
QKeychain::ReadPasswordJob *loadAccessTokenFromKeyChain(const Quotient::AccountSettings &account);
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings() const;
|
||||
@@ -140,7 +138,7 @@ Q_SIGNALS:
|
||||
void userConsentRequired(QUrl url);
|
||||
void testConnectionResult(const QString &connection, bool usable);
|
||||
void isOnlineChanged(bool isOnline);
|
||||
void keyVerificationRequest(int timeLeft, Connection *connection, const QString &transactionId, const QString &deviceId);
|
||||
void keyVerificationRequest(int timeLeft, Quotient::Connection *connection, const QString &transactionId, const QString &deviceId);
|
||||
void keyVerificationStart();
|
||||
void keyVerificationAccept(const QString &commitment);
|
||||
void keyVerificationKey(const QString &sas);
|
||||
@@ -153,14 +151,14 @@ public Q_SLOTS:
|
||||
};
|
||||
|
||||
// TODO libQuotient 0.7: Drop
|
||||
class NeochatChangePasswordJob : public BaseJob
|
||||
class NeochatChangePasswordJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
explicit NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Omittable<QJsonObject> &auth = none);
|
||||
explicit NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Quotient::Omittable<QJsonObject> &auth = Quotient::none);
|
||||
};
|
||||
|
||||
class NeochatDeleteDeviceJob : public BaseJob
|
||||
class NeochatDeleteDeviceJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
explicit NeochatDeleteDeviceJob(const QString &deviceId, const Omittable<QJsonObject> &auth = none);
|
||||
explicit NeochatDeleteDeviceJob(const QString &deviceId, const Quotient::Omittable<QJsonObject> &auth = Quotient::none);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <csapi/account-data.h>
|
||||
#include <csapi/content-repo.h>
|
||||
#include <csapi/profile.h>
|
||||
|
||||
#include "customemojimodel_p.h"
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include "customemojimodel_p.h"
|
||||
#include "emojimodel.h"
|
||||
|
||||
#include <connection.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
enum Roles {
|
||||
Name,
|
||||
ImageURL,
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "connection.h"
|
||||
|
||||
using namespace Quotient;
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
}
|
||||
|
||||
class CustomEmojiModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
|
||||
public:
|
||||
// constructors
|
||||
@@ -32,8 +32,8 @@ public:
|
||||
|
||||
// property setters
|
||||
|
||||
Connection *connection() const;
|
||||
void setConnection(Connection *it);
|
||||
Quotient::Connection *connection() const;
|
||||
void setConnection(Quotient::Connection *it);
|
||||
Q_SIGNAL void connectionChanged();
|
||||
|
||||
// QML functions
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "customemojimodel.h"
|
||||
#include <QRegularExpression>
|
||||
#include <connection.h>
|
||||
|
||||
struct CustomEmoji {
|
||||
QString name; // with :semicolons:
|
||||
@@ -12,6 +14,6 @@ struct CustomEmoji {
|
||||
};
|
||||
|
||||
struct CustomEmojiModel::Private {
|
||||
Connection *conn = nullptr;
|
||||
Quotient::Connection *conn = nullptr;
|
||||
QList<CustomEmoji> emojies;
|
||||
};
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
#include "controller.h"
|
||||
#include <connection.h>
|
||||
#include <user.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
DevicesModel::DevicesModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
#include <csapi/definitions/client_device.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
@@ -18,7 +16,7 @@ class DevicesModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(Connection *connection READ connection NOTIFY connectionChanged)
|
||||
Q_PROPERTY(Quotient::Connection *connection READ connection NOTIFY connectionChanged)
|
||||
|
||||
public:
|
||||
enum Roles {
|
||||
@@ -38,7 +36,7 @@ public:
|
||||
Q_INVOKABLE void logout(int index, const QString &password);
|
||||
Q_INVOKABLE void setName(int index, const QString &name);
|
||||
|
||||
Connection *connection() const;
|
||||
Quotient::Connection *connection() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void connectionChanged();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QVariant>
|
||||
|
||||
#include "emojimodel.h"
|
||||
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <utility>
|
||||
|
||||
struct Emoji {
|
||||
Emoji(QString u, QString s, bool isCustom = false)
|
||||
@@ -85,5 +82,6 @@ private:
|
||||
static const QVariantList symbols;
|
||||
static const QVariantList flags;
|
||||
|
||||
// TODO: Port away from QSettings
|
||||
QSettings m_settings;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <events/stateevent.h>
|
||||
#include <quotient_common.h>
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
@@ -34,4 +33,4 @@ public:
|
||||
QJsonArray allow() const;
|
||||
};
|
||||
REGISTER_EVENT_TYPE(JoinRulesEvent)
|
||||
} // namespace Quotient
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
|
||||
#include "controller.h"
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/content-repo.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
LinkPreviewer::LinkPreviewer(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_loaded(false)
|
||||
|
||||
@@ -3,12 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/content-repo.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
using namespace Quotient;
|
||||
#include <QUrl>
|
||||
|
||||
class LinkPreviewer : public QObject
|
||||
{
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
Login::Login(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
12
src/login.h
12
src/login.h
@@ -4,12 +4,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/wellknown.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
}
|
||||
class Login : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
QString m_deviceName;
|
||||
bool m_supportsSso = false;
|
||||
bool m_supportsPassword = false;
|
||||
Connection *m_connection = nullptr;
|
||||
Quotient::Connection *m_connection = nullptr;
|
||||
QUrl m_ssoUrl;
|
||||
bool m_testing = false;
|
||||
bool m_isLoggingIn = false;
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include "controller.h"
|
||||
#include <connection.h>
|
||||
|
||||
using Quotient::BaseJob;
|
||||
using namespace Quotient;
|
||||
|
||||
ThumbnailResponse::ThumbnailResponse(QString id, QSize size)
|
||||
: mediaId(std::move(id))
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
|
||||
#include <QQuickAsyncImageProvider>
|
||||
|
||||
#include <connection.h>
|
||||
#include <jobs/mediathumbnailjob.h>
|
||||
|
||||
#include <QAtomicPointer>
|
||||
#include <QReadWriteLock>
|
||||
|
||||
namespace Quotient
|
||||
|
||||
@@ -23,8 +23,11 @@
|
||||
#include <KFormat>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include "neochatuser.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
QHash<int, QByteArray> MessageEventModel::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <QAbstractListModel>
|
||||
|
||||
#include "neochatroom.h"
|
||||
#include <room.h>
|
||||
|
||||
class MessageEventModel : public QAbstractListModel
|
||||
{
|
||||
@@ -94,7 +93,7 @@ private:
|
||||
int refreshEventRoles(const QString &eventId, const QVector<int> &roles = {});
|
||||
void moveReadMarker(const QString &toEventId);
|
||||
|
||||
std::vector<event_ptr_tt<RoomEvent>> m_extraEvents;
|
||||
std::vector<Quotient::event_ptr_tt<Quotient::RoomEvent>> m_extraEvents;
|
||||
|
||||
Q_SIGNALS:
|
||||
void roomChanged();
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "messageeventmodel.h"
|
||||
#include "neochatconfig.h"
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
MessageFilterModel::MessageFilterModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
|
||||
@@ -18,36 +18,34 @@
|
||||
#include <qcoro/task.h>
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/account-data.h>
|
||||
#include <csapi/content-repo.h>
|
||||
#include <csapi/leaving.h>
|
||||
#include <csapi/pushrules.h>
|
||||
#include <csapi/redaction.h>
|
||||
#include <csapi/report_content.h>
|
||||
#include <csapi/room_state.h>
|
||||
#include <csapi/rooms.h>
|
||||
#include <csapi/typing.h>
|
||||
#include <events/accountdataevents.h>
|
||||
#include <events/eventcontent.h>
|
||||
#include <events/encryptionevent.h>
|
||||
#include <events/reactionevent.h>
|
||||
#include <events/redactionevent.h>
|
||||
#include <events/roomavatarevent.h>
|
||||
#include <events/roomcanonicalaliasevent.h>
|
||||
#include <events/roomcreateevent.h>
|
||||
#include <events/roommessageevent.h>
|
||||
#include <events/roommemberevent.h>
|
||||
#include <events/roompowerlevelsevent.h>
|
||||
#include <events/typingevent.h>
|
||||
#include <events/simplestateevents.h>
|
||||
#include <jobs/downloadfilejob.h>
|
||||
#include <qt_connection_util.h>
|
||||
#include <user.h>
|
||||
#include <csapi/report_content.h>
|
||||
#include <events/eventcontent.h>
|
||||
|
||||
#include "controller.h"
|
||||
#include "joinrulesevent.h"
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatuser.h"
|
||||
#include "notificationsmanager.h"
|
||||
#include "stickerevent.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinState)
|
||||
: Room(connection, std::move(roomId), joinState)
|
||||
{
|
||||
|
||||
@@ -3,26 +3,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "joinrulesevent.h"
|
||||
#include <events/encryptionevent.h>
|
||||
#include <events/redactionevent.h>
|
||||
#include <events/roomavatarevent.h>
|
||||
#include <events/roomcreateevent.h>
|
||||
#include <events/roommemberevent.h>
|
||||
#include <events/roommessageevent.h>
|
||||
#include <events/simplestateevents.h>
|
||||
#include <room.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
|
||||
#include <events/roomevent.h>
|
||||
#include <qcoro/task.h>
|
||||
|
||||
#include "neochatuser.h"
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
class PushNotificationState : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -38,7 +24,7 @@ public:
|
||||
Q_ENUM(State);
|
||||
};
|
||||
|
||||
class NeoChatRoom : public Room
|
||||
class NeoChatRoom : public Quotient::Room
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariantList usersTyping READ getUsersTyping NOTIFY typingChanged)
|
||||
@@ -55,7 +41,7 @@ class NeoChatRoom : public Room
|
||||
pushNotificationStateChanged)
|
||||
|
||||
public:
|
||||
explicit NeoChatRoom(Connection *connection, QString roomId, JoinState joinState = {});
|
||||
explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {});
|
||||
|
||||
[[nodiscard]] QVariantList getUsersTyping() const;
|
||||
|
||||
@@ -64,7 +50,7 @@ public:
|
||||
/// This function respect the showLeaveJoinEvent setting and discard
|
||||
/// other not interesting events. This function can return an empty pointer
|
||||
/// when the room is empty of RoomMessageEvent.
|
||||
[[nodiscard]] const RoomMessageEvent *lastEvent(bool ignoreStateEvent = false) const;
|
||||
[[nodiscard]] const Quotient::RoomMessageEvent *lastEvent(bool ignoreStateEvent = false) const;
|
||||
|
||||
/// Convenient way to get the last event but in a string format.
|
||||
///
|
||||
@@ -134,7 +120,7 @@ public:
|
||||
|
||||
[[nodiscard]] QString avatarMediaId() const;
|
||||
|
||||
[[nodiscard]] QString eventToString(const RoomEvent &evt, Qt::TextFormat format = Qt::PlainText, bool removeReply = true) const;
|
||||
[[nodiscard]] QString eventToString(const Quotient::RoomEvent &evt, Qt::TextFormat format = Qt::PlainText, bool removeReply = true) const;
|
||||
|
||||
Q_INVOKABLE [[nodiscard]] bool containsUser(const QString &userID) const;
|
||||
Q_INVOKABLE [[nodiscard]] bool isUserBanned(const QString &user) const;
|
||||
@@ -172,7 +158,7 @@ private:
|
||||
|
||||
void onAddNewTimelineEvents(timeline_iter_t from) override;
|
||||
void onAddHistoricalTimelineEvents(rev_iter_t from) override;
|
||||
void onRedaction(const RoomEvent &prevEvent, const RoomEvent &after) override;
|
||||
void onRedaction(const Quotient::RoomEvent &prevEvent, const Quotient::RoomEvent &after) override;
|
||||
|
||||
static QString markdownToHTML(const QString &markdown);
|
||||
QCoro::Task<void> doDeleteMessagesByUser(const QString &user);
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <connection.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
NeoChatUser::NeoChatUser(QString userId, Connection *connection)
|
||||
: User(std::move(userId), connection)
|
||||
{
|
||||
|
||||
@@ -7,16 +7,14 @@
|
||||
|
||||
#include <user.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
class NeoChatUser : public User
|
||||
class NeoChatUser : public Quotient::User
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
|
||||
// Only valid for the local user
|
||||
Q_PROPERTY(QString accountLabel READ accountLabel WRITE setAccountLabel NOTIFY accountLabelChanged)
|
||||
public:
|
||||
NeoChatUser(QString userId, Connection *connection);
|
||||
NeoChatUser(QString userId, Quotient::Connection *connection);
|
||||
|
||||
public Q_SLOTS:
|
||||
QColor color();
|
||||
|
||||
@@ -5,25 +5,25 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
|
||||
#include "knotifications_version.h"
|
||||
#include <KLocalizedString>
|
||||
#include <KNotification>
|
||||
#ifdef HAVE_WINDOWSYSTEM
|
||||
#include <KWindowSystem>
|
||||
#endif
|
||||
#include <KNotificationReplyAction>
|
||||
|
||||
#include "csapi/pushrules.h"
|
||||
#include "jobs/basejob.h"
|
||||
#include <connection.h>
|
||||
#include <csapi/pushrules.h>
|
||||
#include <jobs/basejob.h>
|
||||
#include <user.h>
|
||||
|
||||
#include "controller.h"
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatroom.h"
|
||||
#include "roommanager.h"
|
||||
#include "windowcontroller.h"
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
NotificationsManager &NotificationsManager::instance()
|
||||
{
|
||||
static NotificationsManager _instance;
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
#include <QImage>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
|
||||
#include <KNotification>
|
||||
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatroom.h"
|
||||
class KNotification;
|
||||
class NeoChatRoom;
|
||||
|
||||
class NotificationsManager : public QObject
|
||||
{
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include "publicroomlistmodel.h"
|
||||
|
||||
#include <connection.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
PublicRoomListModel::PublicRoomListModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
|
||||
@@ -6,15 +6,17 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <QObject>
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/list_public_rooms.h>
|
||||
|
||||
using namespace Quotient;
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
}
|
||||
|
||||
class PublicRoomListModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
Q_PROPERTY(QString server READ server WRITE setServer NOTIFY serverChanged)
|
||||
Q_PROPERTY(QString keyword READ keyword WRITE setKeyword NOTIFY keywordChanged)
|
||||
Q_PROPERTY(bool hasMore READ hasMore NOTIFY hasMoreChanged)
|
||||
@@ -39,11 +41,11 @@ public:
|
||||
|
||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
[[nodiscard]] Connection *connection() const
|
||||
[[nodiscard]] Quotient::Connection *connection() const
|
||||
{
|
||||
return m_connection;
|
||||
}
|
||||
void setConnection(Connection *conn);
|
||||
void setConnection(Quotient::Connection *conn);
|
||||
|
||||
[[nodiscard]] QString server() const
|
||||
{
|
||||
@@ -62,16 +64,16 @@ public:
|
||||
Q_INVOKABLE void next(int count = 50);
|
||||
|
||||
private:
|
||||
Connection *m_connection = nullptr;
|
||||
Quotient::Connection *m_connection = nullptr;
|
||||
QString m_server;
|
||||
QString m_keyword;
|
||||
|
||||
bool attempted = false;
|
||||
QString nextBatch;
|
||||
|
||||
QVector<PublicRoomsChunk> rooms;
|
||||
QVector<Quotient::PublicRoomsChunk> rooms;
|
||||
|
||||
QueryPublicRoomsJob *job = nullptr;
|
||||
Quotient::QueryPublicRoomsJob *job = nullptr;
|
||||
|
||||
Q_SIGNALS:
|
||||
void connectionChanged();
|
||||
|
||||
@@ -4,29 +4,26 @@
|
||||
#include "roomlistmodel.h"
|
||||
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatroom.h"
|
||||
#include "notificationsmanager.h"
|
||||
#include "roommanager.h"
|
||||
#include "user.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "events/roomevent.h"
|
||||
|
||||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#ifndef Q_OS_ANDROID
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusMessage>
|
||||
#endif
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <QGuiApplication>
|
||||
#include <utility>
|
||||
|
||||
#include "notificationsmanager.h"
|
||||
#include "roommanager.h"
|
||||
#include <csapi/notifications.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
Q_DECLARE_METATYPE(Quotient::JoinState)
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
|
||||
@@ -3,15 +3,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <connection.h>
|
||||
#include <events/roomevent.h>
|
||||
#include <room.h>
|
||||
|
||||
#include "neochatroom.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
using namespace Quotient;
|
||||
class NeoChatRoom;
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
class Room;
|
||||
}
|
||||
|
||||
class NeoChatRoomType : public QObject
|
||||
{
|
||||
@@ -32,7 +34,7 @@ public:
|
||||
class RoomListModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
Q_PROPERTY(int notificationCount READ notificationCount NOTIFY notificationCountChanged)
|
||||
|
||||
public:
|
||||
@@ -60,11 +62,11 @@ public:
|
||||
RoomListModel(QObject *parent = nullptr);
|
||||
~RoomListModel() override;
|
||||
|
||||
[[nodiscard]] Connection *connection() const
|
||||
[[nodiscard]] Quotient::Connection *connection() const
|
||||
{
|
||||
return m_connection;
|
||||
}
|
||||
void setConnection(Connection *connection);
|
||||
void setConnection(Quotient::Connection *connection);
|
||||
void doResetModel();
|
||||
|
||||
Q_INVOKABLE [[nodiscard]] NeoChatRoom *roomAt(int row) const;
|
||||
@@ -95,7 +97,7 @@ private Q_SLOTS:
|
||||
void refreshNotificationCount();
|
||||
|
||||
private:
|
||||
Connection *m_connection = nullptr;
|
||||
Quotient::Connection *m_connection = nullptr;
|
||||
QList<NeoChatRoom *> m_rooms;
|
||||
|
||||
QMap<int, bool> m_categoryVisibility;
|
||||
|
||||
@@ -6,13 +6,11 @@
|
||||
#include "controller.h"
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatroom.h"
|
||||
#include <KConfigGroup>
|
||||
#include <KLocalizedString>
|
||||
#include <QDesktopServices>
|
||||
#include <QStandardPaths>
|
||||
#include <csapi/joining.h>
|
||||
#include <qt_connection_util.h>
|
||||
#include <utility>
|
||||
#include <user.h>
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
#include <KIO/OpenUrlJob>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// SPDX-FileCopyrightText: 2022 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
#include <QDBusMetaType>
|
||||
|
||||
#include "controller.h"
|
||||
#include "neochatroom.h"
|
||||
#include "roomlistmodel.h"
|
||||
#include "roommanager.h"
|
||||
#include "runner.h"
|
||||
#include "windowcontroller.h"
|
||||
|
||||
RemoteImage Runner::serializeImage(const QImage &image)
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#endif
|
||||
#include "neochatroom.h"
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
SpaceHierarchyCache::SpaceHierarchyCache(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
|
||||
@@ -40,4 +40,4 @@ private:
|
||||
EventContent::ImageContent m_imageContent;
|
||||
};
|
||||
REGISTER_EVENT_TYPE(StickerEvent)
|
||||
} // namespace Quotient
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
#include "userdirectorylistmodel.h"
|
||||
|
||||
#include <connection.h>
|
||||
#include <room.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
UserDirectoryListModel::UserDirectoryListModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <QObject>
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/users.h>
|
||||
|
||||
using namespace Quotient;
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
}
|
||||
|
||||
class UserDirectoryListModel : public QAbstractListModel
|
||||
{
|
||||
@@ -33,11 +35,11 @@ public:
|
||||
|
||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
[[nodiscard]] Connection *connection() const
|
||||
[[nodiscard]] Quotient::Connection *connection() const
|
||||
{
|
||||
return m_connection;
|
||||
}
|
||||
void setConnection(Connection *conn);
|
||||
void setConnection(Quotient::Connection *conn);
|
||||
|
||||
[[nodiscard]] QString keyword() const
|
||||
{
|
||||
@@ -53,15 +55,15 @@ public:
|
||||
Q_INVOKABLE void search(int count = 50);
|
||||
|
||||
private:
|
||||
Connection *m_connection = nullptr;
|
||||
Quotient::Connection *m_connection = nullptr;
|
||||
QString m_keyword;
|
||||
bool m_limited = false;
|
||||
|
||||
bool attempted = false;
|
||||
|
||||
QVector<SearchUserDirectoryJob::User> users;
|
||||
QVector<Quotient::SearchUserDirectoryJob::User> users;
|
||||
|
||||
SearchUserDirectoryJob *job = nullptr;
|
||||
Quotient::SearchUserDirectoryJob *job = nullptr;
|
||||
|
||||
Q_SIGNALS:
|
||||
void connectionChanged();
|
||||
|
||||
@@ -5,15 +5,12 @@
|
||||
|
||||
#include <connection.h>
|
||||
#include <events/roompowerlevelsevent.h>
|
||||
#include <room.h>
|
||||
#include <user.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QElapsedTimer>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "neochatroom.h"
|
||||
#include "neochatuser.h"
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
UserListModel::UserListModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_currentRoom(nullptr)
|
||||
@@ -26,7 +23,6 @@ void UserListModel::setRoom(Quotient::Room *room)
|
||||
return;
|
||||
}
|
||||
|
||||
using namespace Quotient;
|
||||
beginResetModel();
|
||||
if (m_currentRoom) {
|
||||
m_currentRoom->disconnect(this);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <room.h>
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QObject>
|
||||
|
||||
@@ -13,7 +11,7 @@ namespace Quotient
|
||||
class Connection;
|
||||
class Room;
|
||||
class User;
|
||||
} // namespace Quotient
|
||||
}
|
||||
|
||||
class UserType : public QObject
|
||||
{
|
||||
|
||||
12
src/utils.h
12
src/utils.h
@@ -3,17 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <room.h>
|
||||
#include <user.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
|
||||
#include <events/redactionevent.h>
|
||||
#include <events/roomavatarevent.h>
|
||||
#include <events/roommemberevent.h>
|
||||
#include <events/simplestateevents.h>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
@@ -23,4 +13,4 @@ static const QRegularExpression codePillRegExp{"<pre><code[^>]*>(.*?)</code></pr
|
||||
static const QRegularExpression userPillRegExp{"(<a href=\"https://matrix.to/#/@.*?:.*?\">.*?</a>)", QRegularExpression::DotMatchesEverythingOption};
|
||||
static const QRegularExpression strikethroughRegExp{"<del>(.*?)</del>", QRegularExpression::DotMatchesEverythingOption};
|
||||
static const QRegularExpression mxcImageRegExp{R"AAA(<img(.*?)src="mxc:\/\/(.*?)\/(.*?)"(.*?)>)AAA"};
|
||||
} // namespace utils
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user