Clean up includes

This commit is contained in:
Tobias Fella
2022-10-08 19:03:49 +02:00
parent 6756e1fd45
commit 22448ea9ae
49 changed files with 168 additions and 208 deletions

View File

@@ -2,17 +2,13 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
#include "actionshandler.h" #include "actionshandler.h"
#include "controller.h"
#include <csapi/joining.h>
#include <events/roommessageevent.h>
#include <KLocalizedString> #include <KLocalizedString>
#include <QDebug>
#include <QStringBuilder> #include <QStringBuilder>
#include "controller.h" #include "controller.h"
#include "customemojimodel.h" #include "customemojimodel.h"
#include "neochatroom.h"
#include "roommanager.h" #include "roommanager.h"
ActionsHandler::ActionsHandler(QObject *parent) ActionsHandler::ActionsHandler(QObject *parent)

View File

@@ -5,11 +5,12 @@
#include <QObject> #include <QObject>
#include "neochatroom.h" namespace Quotient
#include <connection.h> {
class Connection;
using namespace Quotient; }
class NeoChatRoom;
class CustomEmojiModel; class CustomEmojiModel;
/// \brief Handles user interactions with NeoChat (joining room, creating room, /// \brief Handles user interactions with NeoChat (joining room, creating room,
@@ -19,7 +20,7 @@ class ActionsHandler : public QObject
Q_OBJECT Q_OBJECT
/// \brief The connection that will handle sending the message. /// \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. /// \brief The connection that will handle sending the message.
Q_PROPERTY(NeoChatRoom *room READ room WRITE setRoom NOTIFY roomChanged) Q_PROPERTY(NeoChatRoom *room READ room WRITE setRoom NOTIFY roomChanged)
@@ -34,8 +35,8 @@ public:
explicit ActionsHandler(QObject *parent = nullptr); explicit ActionsHandler(QObject *parent = nullptr);
~ActionsHandler(); ~ActionsHandler();
[[nodiscard]] Connection *connection() const; [[nodiscard]] Quotient::Connection *connection() const;
void setConnection(Connection *connection); void setConnection(Quotient::Connection *connection);
[[nodiscard]] NeoChatRoom *room() const; [[nodiscard]] NeoChatRoom *room() const;
void setRoom(NeoChatRoom *room); void setRoom(NeoChatRoom *room);
@@ -68,6 +69,6 @@ public Q_SLOTS:
void postEdit(const QString &text); void postEdit(const QString &text);
private: private:
Connection *m_connection = nullptr; Quotient::Connection *m_connection = nullptr;
NeoChatRoom *m_room = nullptr; NeoChatRoom *m_room = nullptr;
}; };

View File

@@ -3,6 +3,10 @@
#include "blurhash.h" #include "blurhash.h"
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <vector> #include <vector>
namespace namespace

View File

@@ -3,11 +3,7 @@
#pragma once #pragma once
#include <math.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#include <string.h>
uint8_t *decode(const char *blurhash, int width, int height, int punch, int nChannels); uint8_t *decode(const char *blurhash, int width, int height, int punch, int nChannels);

View File

@@ -2,7 +2,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
#include "chatboxhelper.h" #include "chatboxhelper.h"
#include <QDebug>
ChatBoxHelper::ChatBoxHelper(QObject *parent) ChatBoxHelper::ChatBoxHelper(QObject *parent)
: QObject(parent) : QObject(parent)

View File

@@ -3,13 +3,11 @@
#pragma once #pragma once
#include <QFont>
#include <QObject> #include <QObject>
#include <QQuickTextDocument>
#include <QTextCursor> #include <QTextCursor>
#include <QUrl>
class QTextDocument; class QTextDocument;
class QQuickTextDocument;
class NeoChatRoom; class NeoChatRoom;
class Controller; class Controller;

View File

@@ -3,10 +3,8 @@
#pragma once #pragma once
#include <QPair>
#include <QSortFilterProxyModel>
#include "messageeventmodel.h" #include "messageeventmodel.h"
#include <QSortFilterProxyModel>
class CollapseStateProxyModel : public QSortFilterProxyModel class CollapseStateProxyModel : public QSortFilterProxyModel
{ {

View File

@@ -3,7 +3,6 @@
#pragma once #pragma once
#include <QIdentityProxyModel>
#include <QObject> #include <QObject>
class QAbstractItemModel; class QAbstractItemModel;

View File

@@ -3,7 +3,6 @@
#include <KLocalizedString> #include <KLocalizedString>
#include "actionshandler.h"
#include "commandmodel.h" #include "commandmodel.h"
QVariantList CommandModel::filterModel(const QString &filter) QVariantList CommandModel::filterModel(const QString &filter)

View File

@@ -4,9 +4,6 @@
#pragma once #pragma once
#include <QObject> #include <QObject>
#include <QVariant>
#include <QVector>
#include <utility>
struct Command { struct Command {
Command(const QString &p, const QString &a, const QString &h) Command(const QString &p, const QString &a, const QString &h)

View File

@@ -14,23 +14,16 @@
#include <KWindowEffects> #include <KWindowEffects>
#endif #endif
#include <QAuthenticator>
#include <QClipboard>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QGuiApplication> #include <QGuiApplication>
#include <QMovie> #include <QImageReader>
#include <QNetworkReply>
#include <QPixmap>
#include <QQuickItem> #include <QQuickItem>
#include <QQuickTextDocument> #include <QQuickTextDocument>
#include <QQuickWindow> #include <QQuickWindow>
#include <QStandardPaths> #include <QStandardPaths>
#include <QStringBuilder> #include <QStringBuilder>
#include <QSysInfo>
#include <QTextDocument>
#include <QTimer> #include <QTimer>
#include <utility>
#include <signal.h> #include <signal.h>
@@ -40,24 +33,18 @@
#include "neochataccountregistry.h" #include "neochataccountregistry.h"
#endif #endif
#include <csapi/account-data.h> #include <connection.h>
#include <csapi/content-repo.h> #include <csapi/content-repo.h>
#include <csapi/joining.h>
#include <csapi/logout.h> #include <csapi/logout.h>
#include <csapi/profile.h> #include <csapi/profile.h>
#include <events/eventcontent.h>
#include <qt_connection_util.h> #include <qt_connection_util.h>
#include <settings.h>
#include "neochatconfig.h" #include "neochatconfig.h"
#include "neochatroom.h" #include "neochatroom.h"
#include "neochatuser.h" #include "neochatuser.h"
#include "roommanager.h" #include "roommanager.h"
#include "utils.h"
#include "windowcontroller.h" #include "windowcontroller.h"
#include <KStandardShortcut>
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
#include "trayicon.h" #include "trayicon.h"
#elif !defined(Q_OS_ANDROID) #elif !defined(Q_OS_ANDROID)

View File

@@ -9,13 +9,8 @@
#include <KAboutData> #include <KAboutData>
#include <KFormat> #include <KFormat>
class QKeySequences; #include <jobs/basejob.h>
#include <connection.h>
#include <csapi/list_public_rooms.h>
#include <room.h>
#include <settings.h> #include <settings.h>
#include <user.h>
class NeoChatRoom; class NeoChatRoom;
class NeoChatUser; class NeoChatUser;
@@ -23,19 +18,22 @@ class TrayIcon;
class QWindow; class QWindow;
class QQuickTextDocument; class QQuickTextDocument;
namespace Quotient
{
class Connection;
}
namespace QKeychain namespace QKeychain
{ {
class ReadPasswordJob; class ReadPasswordJob;
} }
using namespace Quotient;
class Controller : public QObject class Controller : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(int accountCount READ accountCount NOTIFY accountCountChanged) Q_PROPERTY(int accountCount READ accountCount NOTIFY accountCountChanged)
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed NOTIFY quitOnLastWindowClosedChanged) 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(bool busy READ busy WRITE setBusy NOTIFY busyChanged)
Q_PROPERTY(KAboutData aboutData READ aboutData WRITE setAboutData NOTIFY aboutDataChanged) Q_PROPERTY(KAboutData aboutData READ aboutData WRITE setAboutData NOTIFY aboutDataChanged)
Q_PROPERTY(bool supportSystemTray READ supportSystemTray CONSTANT) Q_PROPERTY(bool supportSystemTray READ supportSystemTray CONSTANT)
@@ -46,11 +44,11 @@ class Controller : public QObject
public: public:
static Controller &instance(); static Controller &instance();
void setActiveConnection(Connection *connection); void setActiveConnection(Quotient::Connection *connection);
[[nodiscard]] Connection *activeConnection() const; [[nodiscard]] Quotient::Connection *activeConnection() const;
void addConnection(Connection *c); void addConnection(Quotient::Connection *c);
void dropConnection(Connection *c); void dropConnection(Quotient::Connection *c);
Q_INVOKABLE void loginWithAccessToken(const QString &, const QString &, const QString &, const QString &); Q_INVOKABLE void loginWithAccessToken(const QString &, const QString &, const QString &, const QString &);
@@ -71,8 +69,8 @@ public:
[[nodiscard]] bool supportSystemTray() const; [[nodiscard]] bool supportSystemTray() const;
bool saveAccessTokenToFile(const AccountSettings &account, const QByteArray &accessToken); bool saveAccessTokenToFile(const Quotient::AccountSettings &account, const QByteArray &accessToken);
bool saveAccessTokenToKeyChain(const AccountSettings &account, const QByteArray &accessToken); bool saveAccessTokenToKeyChain(const Quotient::AccountSettings &account, const QByteArray &accessToken);
enum PasswordStatus { enum PasswordStatus {
Success, Success,
@@ -101,12 +99,12 @@ public:
private: private:
explicit Controller(QObject *parent = nullptr); explicit Controller(QObject *parent = nullptr);
QPointer<Connection> m_connection; QPointer<Quotient::Connection> m_connection;
bool m_busy = false; bool m_busy = false;
TrayIcon *m_trayIcon = nullptr; TrayIcon *m_trayIcon = nullptr;
static QByteArray loadAccessTokenFromFile(const AccountSettings &account); static QByteArray loadAccessTokenFromFile(const Quotient::AccountSettings &account);
QKeychain::ReadPasswordJob *loadAccessTokenFromKeyChain(const AccountSettings &account); QKeychain::ReadPasswordJob *loadAccessTokenFromKeyChain(const Quotient::AccountSettings &account);
void loadSettings(); void loadSettings();
void saveSettings() const; void saveSettings() const;
@@ -140,7 +138,7 @@ Q_SIGNALS:
void userConsentRequired(QUrl url); void userConsentRequired(QUrl url);
void testConnectionResult(const QString &connection, bool usable); void testConnectionResult(const QString &connection, bool usable);
void isOnlineChanged(bool isOnline); 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 keyVerificationStart();
void keyVerificationAccept(const QString &commitment); void keyVerificationAccept(const QString &commitment);
void keyVerificationKey(const QString &sas); void keyVerificationKey(const QString &sas);
@@ -153,14 +151,14 @@ public Q_SLOTS:
}; };
// TODO libQuotient 0.7: Drop // TODO libQuotient 0.7: Drop
class NeochatChangePasswordJob : public BaseJob class NeochatChangePasswordJob : public Quotient::BaseJob
{ {
public: 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: public:
explicit NeochatDeleteDeviceJob(const QString &deviceId, const Omittable<QJsonObject> &auth = none); explicit NeochatDeleteDeviceJob(const QString &deviceId, const Quotient::Omittable<QJsonObject> &auth = Quotient::none);
}; };

View File

@@ -3,7 +3,6 @@
#include <csapi/account-data.h> #include <csapi/account-data.h>
#include <csapi/content-repo.h> #include <csapi/content-repo.h>
#include <csapi/profile.h>
#include "customemojimodel_p.h" #include "customemojimodel_p.h"

View File

@@ -4,6 +4,10 @@
#include "customemojimodel_p.h" #include "customemojimodel_p.h"
#include "emojimodel.h" #include "emojimodel.h"
#include <connection.h>
using namespace Quotient;
enum Roles { enum Roles {
Name, Name,
ImageURL, ImageURL,

View File

@@ -4,18 +4,18 @@
#pragma once #pragma once
#include <QAbstractListModel> #include <QAbstractListModel>
#include <memory> #include <memory>
#include "connection.h" namespace Quotient
{
using namespace Quotient; class Connection;
}
class CustomEmojiModel : public QAbstractListModel class CustomEmojiModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged) Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
public: public:
// constructors // constructors
@@ -32,8 +32,8 @@ public:
// property setters // property setters
Connection *connection() const; Quotient::Connection *connection() const;
void setConnection(Connection *it); void setConnection(Quotient::Connection *it);
Q_SIGNAL void connectionChanged(); Q_SIGNAL void connectionChanged();
// QML functions // QML functions

View File

@@ -4,6 +4,8 @@
#pragma once #pragma once
#include "customemojimodel.h" #include "customemojimodel.h"
#include <QRegularExpression>
#include <connection.h>
struct CustomEmoji { struct CustomEmoji {
QString name; // with :semicolons: QString name; // with :semicolons:
@@ -12,6 +14,6 @@ struct CustomEmoji {
}; };
struct CustomEmojiModel::Private { struct CustomEmojiModel::Private {
Connection *conn = nullptr; Quotient::Connection *conn = nullptr;
QList<CustomEmoji> emojies; QList<CustomEmoji> emojies;
}; };

View File

@@ -7,6 +7,9 @@
#include "controller.h" #include "controller.h"
#include <connection.h> #include <connection.h>
#include <user.h>
using namespace Quotient;
DevicesModel::DevicesModel(QObject *parent) DevicesModel::DevicesModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)

View File

@@ -7,8 +7,6 @@
#include <csapi/definitions/client_device.h> #include <csapi/definitions/client_device.h>
using namespace Quotient;
namespace Quotient namespace Quotient
{ {
class Connection; class Connection;
@@ -18,7 +16,7 @@ class DevicesModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(Connection *connection READ connection NOTIFY connectionChanged) Q_PROPERTY(Quotient::Connection *connection READ connection NOTIFY connectionChanged)
public: public:
enum Roles { enum Roles {
@@ -38,7 +36,7 @@ public:
Q_INVOKABLE void logout(int index, const QString &password); Q_INVOKABLE void logout(int index, const QString &password);
Q_INVOKABLE void setName(int index, const QString &name); Q_INVOKABLE void setName(int index, const QString &name);
Connection *connection() const; Quotient::Connection *connection() const;
Q_SIGNALS: Q_SIGNALS:
void connectionChanged(); void connectionChanged();

View File

@@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr> // SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
#include <QByteArray> #include <QVariant>
#include <QDebug>
#include "emojimodel.h" #include "emojimodel.h"

View File

@@ -5,9 +5,6 @@
#include <QObject> #include <QObject>
#include <QSettings> #include <QSettings>
#include <QVariant>
#include <QVector>
#include <utility>
struct Emoji { struct Emoji {
Emoji(QString u, QString s, bool isCustom = false) Emoji(QString u, QString s, bool isCustom = false)
@@ -85,5 +82,6 @@ private:
static const QVariantList symbols; static const QVariantList symbols;
static const QVariantList flags; static const QVariantList flags;
// TODO: Port away from QSettings
QSettings m_settings; QSettings m_settings;
}; };

View File

@@ -4,7 +4,6 @@
#pragma once #pragma once
#include <events/stateevent.h> #include <events/stateevent.h>
#include <quotient_common.h>
namespace Quotient namespace Quotient
{ {
@@ -34,4 +33,4 @@ public:
QJsonArray allow() const; QJsonArray allow() const;
}; };
REGISTER_EVENT_TYPE(JoinRulesEvent) REGISTER_EVENT_TYPE(JoinRulesEvent)
} // namespace Quotient }

View File

@@ -5,6 +5,11 @@
#include "controller.h" #include "controller.h"
#include <connection.h>
#include <csapi/content-repo.h>
using namespace Quotient;
LinkPreviewer::LinkPreviewer(QObject *parent) LinkPreviewer::LinkPreviewer(QObject *parent)
: QObject(parent) : QObject(parent)
, m_loaded(false) , m_loaded(false)

View File

@@ -3,12 +3,8 @@
#pragma once #pragma once
#include <connection.h>
#include <csapi/content-repo.h>
#include <QObject> #include <QObject>
#include <QUrl>
using namespace Quotient;
class LinkPreviewer : public QObject class LinkPreviewer : public QObject
{ {

View File

@@ -12,6 +12,8 @@
#include <KLocalizedString> #include <KLocalizedString>
using namespace Quotient;
Login::Login(QObject *parent) Login::Login(QObject *parent)
: QObject(parent) : QObject(parent)
{ {

View File

@@ -4,12 +4,12 @@
#pragma once #pragma once
#include <QObject> #include <QObject>
#include <QUrl>
#include <connection.h> namespace Quotient
#include <csapi/wellknown.h> {
class Connection;
using namespace Quotient; }
class Login : public QObject class Login : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -74,7 +74,7 @@ private:
QString m_deviceName; QString m_deviceName;
bool m_supportsSso = false; bool m_supportsSso = false;
bool m_supportsPassword = false; bool m_supportsPassword = false;
Connection *m_connection = nullptr; Quotient::Connection *m_connection = nullptr;
QUrl m_ssoUrl; QUrl m_ssoUrl;
bool m_testing = false; bool m_testing = false;
bool m_isLoggingIn = false; bool m_isLoggingIn = false;

View File

@@ -13,8 +13,9 @@
#include <KLocalizedString> #include <KLocalizedString>
#include "controller.h" #include "controller.h"
#include <connection.h>
using Quotient::BaseJob; using namespace Quotient;
ThumbnailResponse::ThumbnailResponse(QString id, QSize size) ThumbnailResponse::ThumbnailResponse(QString id, QSize size)
: mediaId(std::move(id)) : mediaId(std::move(id))

View File

@@ -6,10 +6,8 @@
#include <QQuickAsyncImageProvider> #include <QQuickAsyncImageProvider>
#include <connection.h>
#include <jobs/mediathumbnailjob.h> #include <jobs/mediathumbnailjob.h>
#include <QAtomicPointer>
#include <QReadWriteLock> #include <QReadWriteLock>
namespace Quotient namespace Quotient

View File

@@ -23,8 +23,11 @@
#include <KFormat> #include <KFormat>
#include <KLocalizedString> #include <KLocalizedString>
#include "neochatuser.h"
#include "utils.h" #include "utils.h"
using namespace Quotient;
QHash<int, QByteArray> MessageEventModel::roleNames() const QHash<int, QByteArray> MessageEventModel::roleNames() const
{ {
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();

View File

@@ -6,7 +6,6 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include "neochatroom.h" #include "neochatroom.h"
#include <room.h>
class MessageEventModel : public QAbstractListModel class MessageEventModel : public QAbstractListModel
{ {
@@ -94,7 +93,7 @@ private:
int refreshEventRoles(const QString &eventId, const QVector<int> &roles = {}); int refreshEventRoles(const QString &eventId, const QVector<int> &roles = {});
void moveReadMarker(const QString &toEventId); 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: Q_SIGNALS:
void roomChanged(); void roomChanged();

View File

@@ -6,6 +6,8 @@
#include "messageeventmodel.h" #include "messageeventmodel.h"
#include "neochatconfig.h" #include "neochatconfig.h"
using namespace Quotient;
MessageFilterModel::MessageFilterModel(QObject *parent) MessageFilterModel::MessageFilterModel(QObject *parent)
: QSortFilterProxyModel(parent) : QSortFilterProxyModel(parent)
{ {

View File

@@ -18,36 +18,34 @@
#include <qcoro/task.h> #include <qcoro/task.h>
#include <connection.h> #include <connection.h>
#include <csapi/account-data.h>
#include <csapi/content-repo.h>
#include <csapi/leaving.h>
#include <csapi/pushrules.h> #include <csapi/pushrules.h>
#include <csapi/redaction.h> #include <csapi/redaction.h>
#include <csapi/report_content.h>
#include <csapi/room_state.h> #include <csapi/room_state.h>
#include <csapi/rooms.h>
#include <csapi/typing.h> #include <csapi/typing.h>
#include <events/accountdataevents.h> #include <events/encryptionevent.h>
#include <events/eventcontent.h>
#include <events/reactionevent.h> #include <events/reactionevent.h>
#include <events/redactionevent.h>
#include <events/roomavatarevent.h>
#include <events/roomcanonicalaliasevent.h> #include <events/roomcanonicalaliasevent.h>
#include <events/roomcreateevent.h> #include <events/roommemberevent.h>
#include <events/roommessageevent.h>
#include <events/roompowerlevelsevent.h> #include <events/roompowerlevelsevent.h>
#include <events/typingevent.h> #include <events/simplestateevents.h>
#include <jobs/downloadfilejob.h> #include <jobs/downloadfilejob.h>
#include <qt_connection_util.h> #include <qt_connection_util.h>
#include <user.h>
#include <csapi/report_content.h>
#include <events/eventcontent.h>
#include "controller.h" #include "controller.h"
#include "joinrulesevent.h"
#include "neochatconfig.h" #include "neochatconfig.h"
#include "neochatuser.h"
#include "notificationsmanager.h" #include "notificationsmanager.h"
#include "stickerevent.h" #include "stickerevent.h"
#include "utils.h" #include "utils.h"
#include <KLocalizedString> #include <KLocalizedString>
using namespace Quotient;
NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinState) NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinState)
: Room(connection, std::move(roomId), joinState) : Room(connection, std::move(roomId), joinState)
{ {

View File

@@ -3,26 +3,12 @@
#pragma once #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 <room.h>
#include <QObject> #include <QObject>
#include <QPointer> #include <events/roomevent.h>
#include <QTimer>
#include <qcoro/task.h> #include <qcoro/task.h>
#include "neochatuser.h"
using namespace Quotient;
class PushNotificationState : public QObject class PushNotificationState : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -38,7 +24,7 @@ public:
Q_ENUM(State); Q_ENUM(State);
}; };
class NeoChatRoom : public Room class NeoChatRoom : public Quotient::Room
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QVariantList usersTyping READ getUsersTyping NOTIFY typingChanged) Q_PROPERTY(QVariantList usersTyping READ getUsersTyping NOTIFY typingChanged)
@@ -55,7 +41,7 @@ class NeoChatRoom : public Room
pushNotificationStateChanged) pushNotificationStateChanged)
public: public:
explicit NeoChatRoom(Connection *connection, QString roomId, JoinState joinState = {}); explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {});
[[nodiscard]] QVariantList getUsersTyping() const; [[nodiscard]] QVariantList getUsersTyping() const;
@@ -64,7 +50,7 @@ public:
/// This function respect the showLeaveJoinEvent setting and discard /// This function respect the showLeaveJoinEvent setting and discard
/// other not interesting events. This function can return an empty pointer /// other not interesting events. This function can return an empty pointer
/// when the room is empty of RoomMessageEvent. /// 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. /// Convenient way to get the last event but in a string format.
/// ///
@@ -134,7 +120,7 @@ public:
[[nodiscard]] QString avatarMediaId() const; [[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 containsUser(const QString &userID) const;
Q_INVOKABLE [[nodiscard]] bool isUserBanned(const QString &user) const; Q_INVOKABLE [[nodiscard]] bool isUserBanned(const QString &user) const;
@@ -172,7 +158,7 @@ private:
void onAddNewTimelineEvents(timeline_iter_t from) override; void onAddNewTimelineEvents(timeline_iter_t from) override;
void onAddHistoricalTimelineEvents(rev_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); static QString markdownToHTML(const QString &markdown);
QCoro::Task<void> doDeleteMessagesByUser(const QString &user); QCoro::Task<void> doDeleteMessagesByUser(const QString &user);

View File

@@ -9,6 +9,8 @@
#include <connection.h> #include <connection.h>
using namespace Quotient;
NeoChatUser::NeoChatUser(QString userId, Connection *connection) NeoChatUser::NeoChatUser(QString userId, Connection *connection)
: User(std::move(userId), connection) : User(std::move(userId), connection)
{ {

View File

@@ -7,16 +7,14 @@
#include <user.h> #include <user.h>
using namespace Quotient; class NeoChatUser : public Quotient::User
class NeoChatUser : public User
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
// Only valid for the local user // Only valid for the local user
Q_PROPERTY(QString accountLabel READ accountLabel WRITE setAccountLabel NOTIFY accountLabelChanged) Q_PROPERTY(QString accountLabel READ accountLabel WRITE setAccountLabel NOTIFY accountLabelChanged)
public: public:
NeoChatUser(QString userId, Connection *connection); NeoChatUser(QString userId, Quotient::Connection *connection);
public Q_SLOTS: public Q_SLOTS:
QColor color(); QColor color();

View File

@@ -5,25 +5,25 @@
#include <memory> #include <memory>
#include <QDebug>
#include <QImage> #include <QImage>
#include "knotifications_version.h"
#include <KLocalizedString> #include <KLocalizedString>
#include <KNotification> #include <KNotification>
#ifdef HAVE_WINDOWSYSTEM
#include <KWindowSystem>
#endif
#include <KNotificationReplyAction> #include <KNotificationReplyAction>
#include "csapi/pushrules.h" #include <connection.h>
#include "jobs/basejob.h" #include <csapi/pushrules.h>
#include <jobs/basejob.h>
#include <user.h>
#include "controller.h" #include "controller.h"
#include "neochatconfig.h" #include "neochatconfig.h"
#include "neochatroom.h"
#include "roommanager.h" #include "roommanager.h"
#include "windowcontroller.h" #include "windowcontroller.h"
using namespace Quotient;
NotificationsManager &NotificationsManager::instance() NotificationsManager &NotificationsManager::instance()
{ {
static NotificationsManager _instance; static NotificationsManager _instance;

View File

@@ -6,12 +6,11 @@
#include <QImage> #include <QImage>
#include <QMap> #include <QMap>
#include <QObject> #include <QObject>
#include <QPointer>
#include <QString> #include <QString>
#include <KNotification> class KNotification;
class NeoChatRoom;
#include "neochatconfig.h"
#include "neochatroom.h"
class NotificationsManager : public QObject class NotificationsManager : public QObject
{ {

View File

@@ -3,6 +3,10 @@
#include "publicroomlistmodel.h" #include "publicroomlistmodel.h"
#include <connection.h>
using namespace Quotient;
PublicRoomListModel::PublicRoomListModel(QObject *parent) PublicRoomListModel::PublicRoomListModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {

View File

@@ -6,15 +6,17 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QObject> #include <QObject>
#include <connection.h>
#include <csapi/list_public_rooms.h> #include <csapi/list_public_rooms.h>
using namespace Quotient; namespace Quotient
{
class Connection;
}
class PublicRoomListModel : public QAbstractListModel class PublicRoomListModel : public QAbstractListModel
{ {
Q_OBJECT 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 server READ server WRITE setServer NOTIFY serverChanged)
Q_PROPERTY(QString keyword READ keyword WRITE setKeyword NOTIFY keywordChanged) Q_PROPERTY(QString keyword READ keyword WRITE setKeyword NOTIFY keywordChanged)
Q_PROPERTY(bool hasMore READ hasMore NOTIFY hasMoreChanged) Q_PROPERTY(bool hasMore READ hasMore NOTIFY hasMoreChanged)
@@ -39,11 +41,11 @@ public:
[[nodiscard]] QHash<int, QByteArray> roleNames() const override; [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
[[nodiscard]] Connection *connection() const [[nodiscard]] Quotient::Connection *connection() const
{ {
return m_connection; return m_connection;
} }
void setConnection(Connection *conn); void setConnection(Quotient::Connection *conn);
[[nodiscard]] QString server() const [[nodiscard]] QString server() const
{ {
@@ -62,16 +64,16 @@ public:
Q_INVOKABLE void next(int count = 50); Q_INVOKABLE void next(int count = 50);
private: private:
Connection *m_connection = nullptr; Quotient::Connection *m_connection = nullptr;
QString m_server; QString m_server;
QString m_keyword; QString m_keyword;
bool attempted = false; bool attempted = false;
QString nextBatch; QString nextBatch;
QVector<PublicRoomsChunk> rooms; QVector<Quotient::PublicRoomsChunk> rooms;
QueryPublicRoomsJob *job = nullptr; Quotient::QueryPublicRoomsJob *job = nullptr;
Q_SIGNALS: Q_SIGNALS:
void connectionChanged(); void connectionChanged();

View File

@@ -4,29 +4,26 @@
#include "roomlistmodel.h" #include "roomlistmodel.h"
#include "neochatconfig.h" #include "neochatconfig.h"
#include "neochatroom.h"
#include "notificationsmanager.h"
#include "roommanager.h"
#include "user.h" #include "user.h"
#include "utils.h"
#include "events/roomevent.h"
#include <QBrush>
#include <QColor>
#include <QDebug> #include <QDebug>
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
#include <QDBusConnection> #include <QDBusConnection>
#include <QDBusInterface> #include <QDBusInterface>
#include <QDBusMessage> #include <QDBusMessage>
#endif #endif
#include <QStandardPaths>
#include <KLocalizedString> #include <KLocalizedString>
#include <QGuiApplication> #include <QGuiApplication>
#include <utility> #include <utility>
#include "notificationsmanager.h"
#include "roommanager.h"
#include <csapi/notifications.h> #include <csapi/notifications.h>
using namespace Quotient;
Q_DECLARE_METATYPE(Quotient::JoinState) Q_DECLARE_METATYPE(Quotient::JoinState)
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID

View File

@@ -3,15 +3,17 @@
#pragma once #pragma once
#include <connection.h>
#include <events/roomevent.h> #include <events/roomevent.h>
#include <room.h>
#include "neochatroom.h"
#include <QAbstractListModel> #include <QAbstractListModel>
using namespace Quotient; class NeoChatRoom;
namespace Quotient
{
class Connection;
class Room;
}
class NeoChatRoomType : public QObject class NeoChatRoomType : public QObject
{ {
@@ -32,7 +34,7 @@ public:
class RoomListModel : public QAbstractListModel class RoomListModel : public QAbstractListModel
{ {
Q_OBJECT 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) Q_PROPERTY(int notificationCount READ notificationCount NOTIFY notificationCountChanged)
public: public:
@@ -60,11 +62,11 @@ public:
RoomListModel(QObject *parent = nullptr); RoomListModel(QObject *parent = nullptr);
~RoomListModel() override; ~RoomListModel() override;
[[nodiscard]] Connection *connection() const [[nodiscard]] Quotient::Connection *connection() const
{ {
return m_connection; return m_connection;
} }
void setConnection(Connection *connection); void setConnection(Quotient::Connection *connection);
void doResetModel(); void doResetModel();
Q_INVOKABLE [[nodiscard]] NeoChatRoom *roomAt(int row) const; Q_INVOKABLE [[nodiscard]] NeoChatRoom *roomAt(int row) const;
@@ -95,7 +97,7 @@ private Q_SLOTS:
void refreshNotificationCount(); void refreshNotificationCount();
private: private:
Connection *m_connection = nullptr; Quotient::Connection *m_connection = nullptr;
QList<NeoChatRoom *> m_rooms; QList<NeoChatRoom *> m_rooms;
QMap<int, bool> m_categoryVisibility; QMap<int, bool> m_categoryVisibility;

View File

@@ -6,13 +6,11 @@
#include "controller.h" #include "controller.h"
#include "neochatconfig.h" #include "neochatconfig.h"
#include "neochatroom.h" #include "neochatroom.h"
#include <KConfigGroup>
#include <KLocalizedString> #include <KLocalizedString>
#include <QDesktopServices> #include <QDesktopServices>
#include <QStandardPaths> #include <QStandardPaths>
#include <csapi/joining.h>
#include <qt_connection_util.h> #include <qt_connection_util.h>
#include <utility> #include <user.h>
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
#include <KIO/OpenUrlJob> #include <KIO/OpenUrlJob>

View File

@@ -1,13 +1,14 @@
// SPDX-FileCopyrightText: 2022 Nicolas Fella <nicolas.fella@gmx.de> // SPDX-FileCopyrightText: 2022 Nicolas Fella <nicolas.fella@gmx.de>
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "runner.h"
#include <QDBusMetaType> #include <QDBusMetaType>
#include "controller.h" #include "controller.h"
#include "neochatroom.h" #include "neochatroom.h"
#include "roomlistmodel.h" #include "roomlistmodel.h"
#include "roommanager.h" #include "roommanager.h"
#include "runner.h"
#include "windowcontroller.h" #include "windowcontroller.h"
RemoteImage Runner::serializeImage(const QImage &image) RemoteImage Runner::serializeImage(const QImage &image)

View File

@@ -9,6 +9,8 @@
#endif #endif
#include "neochatroom.h" #include "neochatroom.h"
using namespace Quotient;
SpaceHierarchyCache::SpaceHierarchyCache(QObject *parent) SpaceHierarchyCache::SpaceHierarchyCache(QObject *parent)
: QObject{parent} : QObject{parent}
{ {

View File

@@ -40,4 +40,4 @@ private:
EventContent::ImageContent m_imageContent; EventContent::ImageContent m_imageContent;
}; };
REGISTER_EVENT_TYPE(StickerEvent) REGISTER_EVENT_TYPE(StickerEvent)
} // namespace Quotient }

View File

@@ -3,6 +3,11 @@
#include "userdirectorylistmodel.h" #include "userdirectorylistmodel.h"
#include <connection.h>
#include <room.h>
using namespace Quotient;
UserDirectoryListModel::UserDirectoryListModel(QObject *parent) UserDirectoryListModel::UserDirectoryListModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {

View File

@@ -6,10 +6,12 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QObject> #include <QObject>
#include <connection.h>
#include <csapi/users.h> #include <csapi/users.h>
using namespace Quotient; namespace Quotient
{
class Connection;
}
class UserDirectoryListModel : public QAbstractListModel class UserDirectoryListModel : public QAbstractListModel
{ {
@@ -33,11 +35,11 @@ public:
[[nodiscard]] QHash<int, QByteArray> roleNames() const override; [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
[[nodiscard]] Connection *connection() const [[nodiscard]] Quotient::Connection *connection() const
{ {
return m_connection; return m_connection;
} }
void setConnection(Connection *conn); void setConnection(Quotient::Connection *conn);
[[nodiscard]] QString keyword() const [[nodiscard]] QString keyword() const
{ {
@@ -53,15 +55,15 @@ public:
Q_INVOKABLE void search(int count = 50); Q_INVOKABLE void search(int count = 50);
private: private:
Connection *m_connection = nullptr; Quotient::Connection *m_connection = nullptr;
QString m_keyword; QString m_keyword;
bool m_limited = false; bool m_limited = false;
bool attempted = false; bool attempted = false;
QVector<SearchUserDirectoryJob::User> users; QVector<Quotient::SearchUserDirectoryJob::User> users;
SearchUserDirectoryJob *job = nullptr; Quotient::SearchUserDirectoryJob *job = nullptr;
Q_SIGNALS: Q_SIGNALS:
void connectionChanged(); void connectionChanged();

View File

@@ -5,15 +5,12 @@
#include <connection.h> #include <connection.h>
#include <events/roompowerlevelsevent.h> #include <events/roompowerlevelsevent.h>
#include <room.h>
#include <user.h>
#include <QDebug>
#include <QElapsedTimer>
#include <QPixmap>
#include "neochatroom.h"
#include "neochatuser.h" #include "neochatuser.h"
using namespace Quotient;
UserListModel::UserListModel(QObject *parent) UserListModel::UserListModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
, m_currentRoom(nullptr) , m_currentRoom(nullptr)
@@ -26,7 +23,6 @@ void UserListModel::setRoom(Quotient::Room *room)
return; return;
} }
using namespace Quotient;
beginResetModel(); beginResetModel();
if (m_currentRoom) { if (m_currentRoom) {
m_currentRoom->disconnect(this); m_currentRoom->disconnect(this);

View File

@@ -3,8 +3,6 @@
#pragma once #pragma once
#include <room.h>
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QObject> #include <QObject>
@@ -13,7 +11,7 @@ namespace Quotient
class Connection; class Connection;
class Room; class Room;
class User; class User;
} // namespace Quotient }
class UserType : public QObject class UserType : public QObject
{ {

View File

@@ -3,17 +3,7 @@
#pragma once #pragma once
#include <room.h>
#include <user.h>
#include <QObject>
#include <QRegularExpression> #include <QRegularExpression>
#include <QString>
#include <events/redactionevent.h>
#include <events/roomavatarevent.h>
#include <events/roommemberevent.h>
#include <events/simplestateevents.h>
namespace utils 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 userPillRegExp{"(<a href=\"https://matrix.to/#/@.*?:.*?\">.*?</a>)", QRegularExpression::DotMatchesEverythingOption};
static const QRegularExpression strikethroughRegExp{"<del>(.*?)</del>", QRegularExpression::DotMatchesEverythingOption}; static const QRegularExpression strikethroughRegExp{"<del>(.*?)</del>", QRegularExpression::DotMatchesEverythingOption};
static const QRegularExpression mxcImageRegExp{R"AAA(<img(.*?)src="mxc:\/\/(.*?)\/(.*?)"(.*?)>)AAA"}; static const QRegularExpression mxcImageRegExp{R"AAA(<img(.*?)src="mxc:\/\/(.*?)\/(.*?)"(.*?)>)AAA"};
} // namespace utils }