From 22448ea9aecb6b2c9cdc5ab26e8ca3503d8f36a8 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sat, 8 Oct 2022 19:03:49 +0200 Subject: [PATCH] Clean up includes --- src/actionshandler.cpp | 6 +---- src/actionshandler.h | 17 ++++++------ src/blurhash.cpp | 4 +++ src/blurhash.h | 4 --- src/chatboxhelper.cpp | 1 - src/chatdocumenthandler.h | 4 +-- src/collapsestateproxymodel.h | 4 +-- src/colorschemer.h | 1 - src/commandmodel.cpp | 1 - src/commandmodel.h | 3 --- src/controller.cpp | 17 ++---------- src/controller.h | 44 +++++++++++++++----------------- src/customemojimodel+network.cpp | 1 - src/customemojimodel.cpp | 4 +++ src/customemojimodel.h | 14 +++++----- src/customemojimodel_p.h | 4 ++- src/devicesmodel.cpp | 3 +++ src/devicesmodel.h | 6 ++--- src/emojimodel.cpp | 3 +-- src/emojimodel.h | 4 +-- src/joinrulesevent.h | 3 +-- src/linkpreviewer.cpp | 5 ++++ src/linkpreviewer.h | 6 +---- src/login.cpp | 2 ++ src/login.h | 12 ++++----- src/matriximageprovider.cpp | 3 ++- src/matriximageprovider.h | 2 -- src/messageeventmodel.cpp | 3 +++ src/messageeventmodel.h | 3 +-- src/messagefiltermodel.cpp | 2 ++ src/neochatroom.cpp | 22 ++++++++-------- src/neochatroom.h | 26 +++++-------------- src/neochatuser.cpp | 2 ++ src/neochatuser.h | 6 ++--- src/notificationsmanager.cpp | 14 +++++----- src/notificationsmanager.h | 7 +++-- src/publicroomlistmodel.cpp | 4 +++ src/publicroomlistmodel.h | 18 +++++++------ src/roomlistmodel.cpp | 13 ++++------ src/roomlistmodel.h | 20 ++++++++------- src/roommanager.cpp | 4 +-- src/runner.cpp | 3 ++- src/spacehierarchycache.cpp | 2 ++ src/stickerevent.h | 2 +- src/userdirectorylistmodel.cpp | 5 ++++ src/userdirectorylistmodel.h | 16 +++++++----- src/userlistmodel.cpp | 10 +++----- src/userlistmodel.h | 4 +-- src/utils.h | 12 +-------- 49 files changed, 168 insertions(+), 208 deletions(-) diff --git a/src/actionshandler.cpp b/src/actionshandler.cpp index 082e5b2bf..464231f22 100644 --- a/src/actionshandler.cpp +++ b/src/actionshandler.cpp @@ -2,17 +2,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "actionshandler.h" -#include "controller.h" - -#include -#include #include -#include #include #include "controller.h" #include "customemojimodel.h" +#include "neochatroom.h" #include "roommanager.h" ActionsHandler::ActionsHandler(QObject *parent) diff --git a/src/actionshandler.h b/src/actionshandler.h index e422ca961..e6e45efa8 100644 --- a/src/actionshandler.h +++ b/src/actionshandler.h @@ -5,11 +5,12 @@ #include -#include "neochatroom.h" -#include - -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; }; diff --git a/src/blurhash.cpp b/src/blurhash.cpp index a12427d05..175c58fd8 100644 --- a/src/blurhash.cpp +++ b/src/blurhash.cpp @@ -3,6 +3,10 @@ #include "blurhash.h" +#include +#include +#include +#include #include namespace diff --git a/src/blurhash.h b/src/blurhash.h index d99967539..1a5e5f673 100644 --- a/src/blurhash.h +++ b/src/blurhash.h @@ -3,11 +3,7 @@ #pragma once -#include -#include #include -#include -#include uint8_t *decode(const char *blurhash, int width, int height, int punch, int nChannels); diff --git a/src/chatboxhelper.cpp b/src/chatboxhelper.cpp index 2902f2dd6..010b792c7 100644 --- a/src/chatboxhelper.cpp +++ b/src/chatboxhelper.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "chatboxhelper.h" -#include ChatBoxHelper::ChatBoxHelper(QObject *parent) : QObject(parent) diff --git a/src/chatdocumenthandler.h b/src/chatdocumenthandler.h index 9090acedd..448576242 100644 --- a/src/chatdocumenthandler.h +++ b/src/chatdocumenthandler.h @@ -3,13 +3,11 @@ #pragma once -#include #include -#include #include -#include class QTextDocument; +class QQuickTextDocument; class NeoChatRoom; class Controller; diff --git a/src/collapsestateproxymodel.h b/src/collapsestateproxymodel.h index c3af1056b..d329df5b9 100644 --- a/src/collapsestateproxymodel.h +++ b/src/collapsestateproxymodel.h @@ -3,10 +3,8 @@ #pragma once -#include -#include - #include "messageeventmodel.h" +#include class CollapseStateProxyModel : public QSortFilterProxyModel { diff --git a/src/colorschemer.h b/src/colorschemer.h index 2dd32cfe4..bec8d6dd9 100644 --- a/src/colorschemer.h +++ b/src/colorschemer.h @@ -3,7 +3,6 @@ #pragma once -#include #include class QAbstractItemModel; diff --git a/src/commandmodel.cpp b/src/commandmodel.cpp index a0db6be70..cdfe53145 100644 --- a/src/commandmodel.cpp +++ b/src/commandmodel.cpp @@ -3,7 +3,6 @@ #include -#include "actionshandler.h" #include "commandmodel.h" QVariantList CommandModel::filterModel(const QString &filter) diff --git a/src/commandmodel.h b/src/commandmodel.h index d80d2143b..9080740e0 100644 --- a/src/commandmodel.h +++ b/src/commandmodel.h @@ -4,9 +4,6 @@ #pragma once #include -#include -#include -#include struct Command { Command(const QString &p, const QString &a, const QString &h) diff --git a/src/controller.cpp b/src/controller.cpp index facf1416a..b31154e09 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -14,23 +14,16 @@ #include #endif -#include -#include #include #include #include -#include -#include -#include +#include #include #include #include #include #include -#include -#include #include -#include #include @@ -40,24 +33,18 @@ #include "neochataccountregistry.h" #endif -#include +#include #include -#include #include #include -#include #include -#include #include "neochatconfig.h" #include "neochatroom.h" #include "neochatuser.h" #include "roommanager.h" -#include "utils.h" #include "windowcontroller.h" -#include - #if defined(Q_OS_WIN) || defined(Q_OS_MAC) #include "trayicon.h" #elif !defined(Q_OS_ANDROID) diff --git a/src/controller.h b/src/controller.h index c006e40dd..1df468738 100644 --- a/src/controller.h +++ b/src/controller.h @@ -9,13 +9,8 @@ #include #include -class QKeySequences; - -#include -#include -#include +#include #include -#include 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 m_connection; + QPointer 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 &auth = none); + explicit NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Quotient::Omittable &auth = Quotient::none); }; -class NeochatDeleteDeviceJob : public BaseJob +class NeochatDeleteDeviceJob : public Quotient::BaseJob { public: - explicit NeochatDeleteDeviceJob(const QString &deviceId, const Omittable &auth = none); + explicit NeochatDeleteDeviceJob(const QString &deviceId, const Quotient::Omittable &auth = Quotient::none); }; diff --git a/src/customemojimodel+network.cpp b/src/customemojimodel+network.cpp index e8db18b36..c69b295db 100644 --- a/src/customemojimodel+network.cpp +++ b/src/customemojimodel+network.cpp @@ -3,7 +3,6 @@ #include #include -#include #include "customemojimodel_p.h" diff --git a/src/customemojimodel.cpp b/src/customemojimodel.cpp index c8a767d3a..99b751ffb 100644 --- a/src/customemojimodel.cpp +++ b/src/customemojimodel.cpp @@ -4,6 +4,10 @@ #include "customemojimodel_p.h" #include "emojimodel.h" +#include + +using namespace Quotient; + enum Roles { Name, ImageURL, diff --git a/src/customemojimodel.h b/src/customemojimodel.h index 028dcd1a9..5fb6026a2 100644 --- a/src/customemojimodel.h +++ b/src/customemojimodel.h @@ -4,18 +4,18 @@ #pragma once #include - #include -#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 diff --git a/src/customemojimodel_p.h b/src/customemojimodel_p.h index 7f775ead3..05b02513b 100644 --- a/src/customemojimodel_p.h +++ b/src/customemojimodel_p.h @@ -4,6 +4,8 @@ #pragma once #include "customemojimodel.h" +#include +#include struct CustomEmoji { QString name; // with :semicolons: @@ -12,6 +14,6 @@ struct CustomEmoji { }; struct CustomEmojiModel::Private { - Connection *conn = nullptr; + Quotient::Connection *conn = nullptr; QList emojies; }; diff --git a/src/devicesmodel.cpp b/src/devicesmodel.cpp index 51a05fd67..e00257f39 100644 --- a/src/devicesmodel.cpp +++ b/src/devicesmodel.cpp @@ -7,6 +7,9 @@ #include "controller.h" #include +#include + +using namespace Quotient; DevicesModel::DevicesModel(QObject *parent) : QAbstractListModel(parent) diff --git a/src/devicesmodel.h b/src/devicesmodel.h index 9438da7ae..a187b0fe3 100644 --- a/src/devicesmodel.h +++ b/src/devicesmodel.h @@ -7,8 +7,6 @@ #include -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(); diff --git a/src/emojimodel.cpp b/src/emojimodel.cpp index 56e7d9e78..0976b459d 100644 --- a/src/emojimodel.cpp +++ b/src/emojimodel.cpp @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: 2017 Konstantinos Sideris // SPDX-License-Identifier: GPL-3.0-or-later -#include -#include +#include #include "emojimodel.h" diff --git a/src/emojimodel.h b/src/emojimodel.h index d484b6057..e8e86d5c2 100644 --- a/src/emojimodel.h +++ b/src/emojimodel.h @@ -5,9 +5,6 @@ #include #include -#include -#include -#include 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; }; diff --git a/src/joinrulesevent.h b/src/joinrulesevent.h index cb09b3787..4ffedb19d 100644 --- a/src/joinrulesevent.h +++ b/src/joinrulesevent.h @@ -4,7 +4,6 @@ #pragma once #include -#include namespace Quotient { @@ -34,4 +33,4 @@ public: QJsonArray allow() const; }; REGISTER_EVENT_TYPE(JoinRulesEvent) -} // namespace Quotient +} diff --git a/src/linkpreviewer.cpp b/src/linkpreviewer.cpp index 4cb62d7fa..fe5bc689c 100644 --- a/src/linkpreviewer.cpp +++ b/src/linkpreviewer.cpp @@ -5,6 +5,11 @@ #include "controller.h" +#include +#include + +using namespace Quotient; + LinkPreviewer::LinkPreviewer(QObject *parent) : QObject(parent) , m_loaded(false) diff --git a/src/linkpreviewer.h b/src/linkpreviewer.h index 44992e1f9..15b573d54 100644 --- a/src/linkpreviewer.h +++ b/src/linkpreviewer.h @@ -3,12 +3,8 @@ #pragma once -#include -#include - #include - -using namespace Quotient; +#include class LinkPreviewer : public QObject { diff --git a/src/login.cpp b/src/login.cpp index b0e26162c..7d764aef8 100644 --- a/src/login.cpp +++ b/src/login.cpp @@ -12,6 +12,8 @@ #include +using namespace Quotient; + Login::Login(QObject *parent) : QObject(parent) { diff --git a/src/login.h b/src/login.h index 2fbab1a08..da8d942e3 100644 --- a/src/login.h +++ b/src/login.h @@ -4,12 +4,12 @@ #pragma once #include +#include -#include -#include - -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; diff --git a/src/matriximageprovider.cpp b/src/matriximageprovider.cpp index 467b2307b..f363e91f8 100644 --- a/src/matriximageprovider.cpp +++ b/src/matriximageprovider.cpp @@ -13,8 +13,9 @@ #include #include "controller.h" +#include -using Quotient::BaseJob; +using namespace Quotient; ThumbnailResponse::ThumbnailResponse(QString id, QSize size) : mediaId(std::move(id)) diff --git a/src/matriximageprovider.h b/src/matriximageprovider.h index d5f28aa7e..e41554c3f 100644 --- a/src/matriximageprovider.h +++ b/src/matriximageprovider.h @@ -6,10 +6,8 @@ #include -#include #include -#include #include namespace Quotient diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index f9e0ca870..84369939a 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -23,8 +23,11 @@ #include #include +#include "neochatuser.h" #include "utils.h" +using namespace Quotient; + QHash MessageEventModel::roleNames() const { QHash roles = QAbstractItemModel::roleNames(); diff --git a/src/messageeventmodel.h b/src/messageeventmodel.h index 928ddcd53..3fd1f5b3d 100644 --- a/src/messageeventmodel.h +++ b/src/messageeventmodel.h @@ -6,7 +6,6 @@ #include #include "neochatroom.h" -#include class MessageEventModel : public QAbstractListModel { @@ -94,7 +93,7 @@ private: int refreshEventRoles(const QString &eventId, const QVector &roles = {}); void moveReadMarker(const QString &toEventId); - std::vector> m_extraEvents; + std::vector> m_extraEvents; Q_SIGNALS: void roomChanged(); diff --git a/src/messagefiltermodel.cpp b/src/messagefiltermodel.cpp index d13f24d35..cf51a031f 100644 --- a/src/messagefiltermodel.cpp +++ b/src/messagefiltermodel.cpp @@ -6,6 +6,8 @@ #include "messageeventmodel.h" #include "neochatconfig.h" +using namespace Quotient; + MessageFilterModel::MessageFilterModel(QObject *parent) : QSortFilterProxyModel(parent) { diff --git a/src/neochatroom.cpp b/src/neochatroom.cpp index 1d4f8b256..de01dbd2a 100644 --- a/src/neochatroom.cpp +++ b/src/neochatroom.cpp @@ -18,36 +18,34 @@ #include #include -#include -#include -#include #include #include +#include #include -#include #include -#include -#include +#include #include +#include +#include #include -#include -#include +#include #include -#include +#include #include #include -#include -#include -#include #include "controller.h" +#include "joinrulesevent.h" #include "neochatconfig.h" +#include "neochatuser.h" #include "notificationsmanager.h" #include "stickerevent.h" #include "utils.h" #include +using namespace Quotient; + NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinState) : Room(connection, std::move(roomId), joinState) { diff --git a/src/neochatroom.h b/src/neochatroom.h index 2fb0b4b4b..d3dd243da 100644 --- a/src/neochatroom.h +++ b/src/neochatroom.h @@ -3,26 +3,12 @@ #pragma once -#include "joinrulesevent.h" -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include - +#include #include -#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 doDeleteMessagesByUser(const QString &user); diff --git a/src/neochatuser.cpp b/src/neochatuser.cpp index d90a5ccd8..d3fca6826 100644 --- a/src/neochatuser.cpp +++ b/src/neochatuser.cpp @@ -9,6 +9,8 @@ #include +using namespace Quotient; + NeoChatUser::NeoChatUser(QString userId, Connection *connection) : User(std::move(userId), connection) { diff --git a/src/neochatuser.h b/src/neochatuser.h index bc3a2e697..5a523e73b 100644 --- a/src/neochatuser.h +++ b/src/neochatuser.h @@ -7,16 +7,14 @@ #include -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(); diff --git a/src/notificationsmanager.cpp b/src/notificationsmanager.cpp index 23ae3b38e..de7f383e6 100644 --- a/src/notificationsmanager.cpp +++ b/src/notificationsmanager.cpp @@ -5,25 +5,25 @@ #include -#include #include -#include "knotifications_version.h" #include #include -#ifdef HAVE_WINDOWSYSTEM -#include -#endif #include -#include "csapi/pushrules.h" -#include "jobs/basejob.h" +#include +#include +#include +#include #include "controller.h" #include "neochatconfig.h" +#include "neochatroom.h" #include "roommanager.h" #include "windowcontroller.h" +using namespace Quotient; + NotificationsManager &NotificationsManager::instance() { static NotificationsManager _instance; diff --git a/src/notificationsmanager.h b/src/notificationsmanager.h index 8db75c074..e1f3500de 100644 --- a/src/notificationsmanager.h +++ b/src/notificationsmanager.h @@ -6,12 +6,11 @@ #include #include #include +#include #include -#include - -#include "neochatconfig.h" -#include "neochatroom.h" +class KNotification; +class NeoChatRoom; class NotificationsManager : public QObject { diff --git a/src/publicroomlistmodel.cpp b/src/publicroomlistmodel.cpp index 7dfc719d7..4d4ca98bc 100644 --- a/src/publicroomlistmodel.cpp +++ b/src/publicroomlistmodel.cpp @@ -3,6 +3,10 @@ #include "publicroomlistmodel.h" +#include + +using namespace Quotient; + PublicRoomListModel::PublicRoomListModel(QObject *parent) : QAbstractListModel(parent) { diff --git a/src/publicroomlistmodel.h b/src/publicroomlistmodel.h index 58dff0458..91eb69ab8 100644 --- a/src/publicroomlistmodel.h +++ b/src/publicroomlistmodel.h @@ -6,15 +6,17 @@ #include #include -#include #include -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 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 rooms; + QVector rooms; - QueryPublicRoomsJob *job = nullptr; + Quotient::QueryPublicRoomsJob *job = nullptr; Q_SIGNALS: void connectionChanged(); diff --git a/src/roomlistmodel.cpp b/src/roomlistmodel.cpp index d9676c57a..606f56aa8 100644 --- a/src/roomlistmodel.cpp +++ b/src/roomlistmodel.cpp @@ -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 -#include #include #ifndef Q_OS_ANDROID #include #include #include #endif -#include #include #include #include -#include "notificationsmanager.h" -#include "roommanager.h" #include +using namespace Quotient; + Q_DECLARE_METATYPE(Quotient::JoinState) #ifndef Q_OS_ANDROID diff --git a/src/roomlistmodel.h b/src/roomlistmodel.h index f039821d1..169eb22f9 100644 --- a/src/roomlistmodel.h +++ b/src/roomlistmodel.h @@ -3,15 +3,17 @@ #pragma once -#include #include -#include - -#include "neochatroom.h" #include -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 m_rooms; QMap m_categoryVisibility; diff --git a/src/roommanager.cpp b/src/roommanager.cpp index ba49aac24..0b7482eef 100644 --- a/src/roommanager.cpp +++ b/src/roommanager.cpp @@ -6,13 +6,11 @@ #include "controller.h" #include "neochatconfig.h" #include "neochatroom.h" -#include #include #include #include -#include #include -#include +#include #ifndef Q_OS_ANDROID #include diff --git a/src/runner.cpp b/src/runner.cpp index 82ee3d540..17892e8f8 100644 --- a/src/runner.cpp +++ b/src/runner.cpp @@ -1,13 +1,14 @@ // SPDX-FileCopyrightText: 2022 Nicolas Fella // SPDX-License-Identifier: GPL-2.0-or-later +#include "runner.h" + #include #include "controller.h" #include "neochatroom.h" #include "roomlistmodel.h" #include "roommanager.h" -#include "runner.h" #include "windowcontroller.h" RemoteImage Runner::serializeImage(const QImage &image) diff --git a/src/spacehierarchycache.cpp b/src/spacehierarchycache.cpp index c25d2e96e..bd313628d 100644 --- a/src/spacehierarchycache.cpp +++ b/src/spacehierarchycache.cpp @@ -9,6 +9,8 @@ #endif #include "neochatroom.h" +using namespace Quotient; + SpaceHierarchyCache::SpaceHierarchyCache(QObject *parent) : QObject{parent} { diff --git a/src/stickerevent.h b/src/stickerevent.h index ed0c44fe0..e44e098b0 100644 --- a/src/stickerevent.h +++ b/src/stickerevent.h @@ -40,4 +40,4 @@ private: EventContent::ImageContent m_imageContent; }; REGISTER_EVENT_TYPE(StickerEvent) -} // namespace Quotient +} diff --git a/src/userdirectorylistmodel.cpp b/src/userdirectorylistmodel.cpp index 0b02fd3a9..209c5e126 100644 --- a/src/userdirectorylistmodel.cpp +++ b/src/userdirectorylistmodel.cpp @@ -3,6 +3,11 @@ #include "userdirectorylistmodel.h" +#include +#include + +using namespace Quotient; + UserDirectoryListModel::UserDirectoryListModel(QObject *parent) : QAbstractListModel(parent) { diff --git a/src/userdirectorylistmodel.h b/src/userdirectorylistmodel.h index 5b5685cd6..5652b299d 100644 --- a/src/userdirectorylistmodel.h +++ b/src/userdirectorylistmodel.h @@ -6,10 +6,12 @@ #include #include -#include #include -using namespace Quotient; +namespace Quotient +{ +class Connection; +} class UserDirectoryListModel : public QAbstractListModel { @@ -33,11 +35,11 @@ public: [[nodiscard]] QHash 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 users; + QVector users; - SearchUserDirectoryJob *job = nullptr; + Quotient::SearchUserDirectoryJob *job = nullptr; Q_SIGNALS: void connectionChanged(); diff --git a/src/userlistmodel.cpp b/src/userlistmodel.cpp index 2421f0cb0..f6fef7f69 100644 --- a/src/userlistmodel.cpp +++ b/src/userlistmodel.cpp @@ -5,15 +5,12 @@ #include #include -#include -#include - -#include -#include -#include +#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); diff --git a/src/userlistmodel.h b/src/userlistmodel.h index b619517cd..770b00567 100644 --- a/src/userlistmodel.h +++ b/src/userlistmodel.h @@ -3,8 +3,6 @@ #pragma once -#include - #include #include @@ -13,7 +11,7 @@ namespace Quotient class Connection; class Room; class User; -} // namespace Quotient +} class UserType : public QObject { diff --git a/src/utils.h b/src/utils.h index eeb803db2..c27a7e7d9 100644 --- a/src/utils.h +++ b/src/utils.h @@ -3,17 +3,7 @@ #pragma once -#include -#include - -#include #include -#include - -#include -#include -#include -#include namespace utils { @@ -23,4 +13,4 @@ static const QRegularExpression codePillRegExp{"
]*>(.*?).*?)", QRegularExpression::DotMatchesEverythingOption};
 static const QRegularExpression strikethroughRegExp{"(.*?)", QRegularExpression::DotMatchesEverythingOption};
 static const QRegularExpression mxcImageRegExp{R"AAA()AAA"};
-} // namespace utils
+}