diff options
-rw-r--r-- | src/Cache.cpp | 11 | ||||
-rw-r--r-- | src/Cache.h | 2 | ||||
-rw-r--r-- | src/Cache_p.h | 6 | ||||
-rw-r--r-- | src/LoginPage.cpp | 1 | ||||
-rw-r--r-- | src/MatrixClient.cpp | 20 | ||||
-rw-r--r-- | src/MatrixClient.h | 18 | ||||
-rw-r--r-- | src/QuickSwitcher.cpp | 2 | ||||
-rw-r--r-- | src/QuickSwitcher.h | 2 | ||||
-rw-r--r-- | src/RegisterPage.cpp | 2 | ||||
-rw-r--r-- | src/RoomList.h | 3 | ||||
-rw-r--r-- | src/TextInputWidget.cpp | 2 | ||||
-rw-r--r-- | src/TextInputWidget.h | 4 | ||||
-rw-r--r-- | src/dialogs/UserProfile.cpp | 2 | ||||
-rw-r--r-- | src/dialogs/UserProfile.h | 2 | ||||
-rw-r--r-- | src/popups/SuggestionsPopup.cpp | 4 | ||||
-rw-r--r-- | src/popups/SuggestionsPopup.h | 4 |
16 files changed, 42 insertions, 43 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp index f6f8052d..dfd7475c 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -80,7 +80,7 @@ using CachedReceipts = std::multimap<uint64_t, std::string, std::greater<uint64_ using Receipts = std::map<std::string, std::map<std::string, uint64_t>>; Q_DECLARE_METATYPE(SearchResult) -Q_DECLARE_METATYPE(QVector<SearchResult>) +Q_DECLARE_METATYPE(std::vector<SearchResult>) Q_DECLARE_METATYPE(RoomMember) Q_DECLARE_METATYPE(mtx::responses::Timeline) Q_DECLARE_METATYPE(RoomSearchResult) @@ -1834,7 +1834,7 @@ Cache::searchRooms(const std::string &query, std::uint8_t max_items) return results; } -QVector<SearchResult> +std::vector<SearchResult> Cache::searchUsers(const std::string &room_id, const std::string &query, std::uint8_t max_items) { std::multimap<int, std::pair<std::string, std::string>> items; @@ -1857,7 +1857,7 @@ Cache::searchUsers(const std::string &room_id, const std::string &query, std::ui else if (items.size() > 0) std::advance(end, items.size()); - QVector<SearchResult> results; + std::vector<SearchResult> results; for (auto it = items.begin(); it != end; it++) { const auto user = it->second; results.push_back(SearchResult{QString::fromStdString(user.first), @@ -2390,12 +2390,11 @@ void init(const QString &user_id) { qRegisterMetaType<SearchResult>(); - qRegisterMetaType<QVector<SearchResult>>(); + qRegisterMetaType<std::vector<SearchResult>>(); qRegisterMetaType<RoomMember>(); qRegisterMetaType<RoomSearchResult>(); qRegisterMetaType<RoomInfo>(); qRegisterMetaType<QMap<QString, RoomInfo>>(); - qRegisterMetaType<QMap<QString, mtx::responses::Notifications>>(); qRegisterMetaType<std::map<QString, RoomInfo>>(); qRegisterMetaType<std::map<QString, mtx::responses::Timeline>>(); @@ -2734,7 +2733,7 @@ calculateRoomReadStatus() instance_->calculateRoomReadStatus(); } -QVector<SearchResult> +std::vector<SearchResult> searchUsers(const std::string &room_id, const std::string &query, std::uint8_t max_items) { return instance_->searchUsers(room_id, query, max_items); diff --git a/src/Cache.h b/src/Cache.h index a8991eb5..69b3ef2d 100644 --- a/src/Cache.h +++ b/src/Cache.h @@ -218,7 +218,7 @@ calculateRoomReadStatus(const std::string &room_id); void calculateRoomReadStatus(); -QVector<SearchResult> +std::vector<SearchResult> searchUsers(const std::string &room_id, const std::string &query, std::uint8_t max_items = 5); std::vector<RoomSearchResult> searchRooms(const std::string &query, std::uint8_t max_items = 5); diff --git a/src/Cache_p.h b/src/Cache_p.h index 32f2a67d..b76a512f 100644 --- a/src/Cache_p.h +++ b/src/Cache_p.h @@ -172,9 +172,9 @@ public: bool calculateRoomReadStatus(const std::string &room_id); void calculateRoomReadStatus(); - QVector<SearchResult> searchUsers(const std::string &room_id, - const std::string &query, - std::uint8_t max_items = 5); + std::vector<SearchResult> searchUsers(const std::string &room_id, + const std::string &query, + std::uint8_t max_items = 5); std::vector<RoomSearchResult> searchRooms(const std::string &query, std::uint8_t max_items = 5); diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp index c244db28..c06137c9 100644 --- a/src/LoginPage.cpp +++ b/src/LoginPage.cpp @@ -19,6 +19,7 @@ #include <QStyleOption> #include <mtx/identifiers.hpp> +#include <mtx/responses/login.hpp> #include "Config.h" #include "Logging.h" diff --git a/src/MatrixClient.cpp b/src/MatrixClient.cpp index 12d7ac91..b69ba480 100644 --- a/src/MatrixClient.cpp +++ b/src/MatrixClient.cpp @@ -2,6 +2,26 @@ #include <memory> +#include <QMetaType> +#include <QObject> +#include <QString> + +#include "nlohmann/json.hpp" +#include <mtx/responses.hpp> + +Q_DECLARE_METATYPE(mtx::responses::Login) +Q_DECLARE_METATYPE(mtx::responses::Messages) +Q_DECLARE_METATYPE(mtx::responses::Notifications) +Q_DECLARE_METATYPE(mtx::responses::Rooms) +Q_DECLARE_METATYPE(mtx::responses::Sync) +Q_DECLARE_METATYPE(mtx::responses::JoinedGroups) +Q_DECLARE_METATYPE(mtx::responses::GroupProfile) + +Q_DECLARE_METATYPE(nlohmann::json) +Q_DECLARE_METATYPE(std::string) +Q_DECLARE_METATYPE(std::vector<std::string>) +Q_DECLARE_METATYPE(std::vector<QString>) + namespace { auto client_ = std::make_shared<mtx::http::Client>(); } diff --git a/src/MatrixClient.h b/src/MatrixClient.h index c77b1183..4db51095 100644 --- a/src/MatrixClient.h +++ b/src/MatrixClient.h @@ -1,25 +1,7 @@ #pragma once -#include <QMetaType> -#include <QObject> -#include <QString> - -#include "nlohmann/json.hpp" -#include <mtx/responses.hpp> #include <mtxclient/http/client.hpp> -Q_DECLARE_METATYPE(mtx::responses::Login) -Q_DECLARE_METATYPE(mtx::responses::Messages) -Q_DECLARE_METATYPE(mtx::responses::Notifications) -Q_DECLARE_METATYPE(mtx::responses::Rooms) -Q_DECLARE_METATYPE(mtx::responses::Sync) -Q_DECLARE_METATYPE(mtx::responses::JoinedGroups) -Q_DECLARE_METATYPE(mtx::responses::GroupProfile) -Q_DECLARE_METATYPE(std::string) -Q_DECLARE_METATYPE(nlohmann::json) -Q_DECLARE_METATYPE(std::vector<std::string>) -Q_DECLARE_METATYPE(std::vector<QString>) - namespace http { mtx::http::Client * client(); diff --git a/src/QuickSwitcher.cpp b/src/QuickSwitcher.cpp index 53dd21e0..05a9f431 100644 --- a/src/QuickSwitcher.cpp +++ b/src/QuickSwitcher.cpp @@ -26,6 +26,8 @@ #include "QuickSwitcher.h" #include "popups/SuggestionsPopup.h" +Q_DECLARE_METATYPE(std::vector<RoomSearchResult>) + RoomSearchInput::RoomSearchInput(QWidget *parent) : TextField(parent) {} diff --git a/src/QuickSwitcher.h b/src/QuickSwitcher.h index 05f7be07..5bc31650 100644 --- a/src/QuickSwitcher.h +++ b/src/QuickSwitcher.h @@ -25,8 +25,6 @@ #include "popups/SuggestionsPopup.h" #include "ui/TextField.h" -Q_DECLARE_METATYPE(std::vector<RoomSearchResult>) - class RoomSearchInput : public TextField { Q_OBJECT diff --git a/src/RegisterPage.cpp b/src/RegisterPage.cpp index 942fd1b8..76721036 100644 --- a/src/RegisterPage.cpp +++ b/src/RegisterPage.cpp @@ -19,6 +19,8 @@ #include <QStyleOption> #include <QTimer> +#include <mtx/responses/register.hpp> + #include "Config.h" #include "Logging.h" #include "MainWindow.h" diff --git a/src/RoomList.h b/src/RoomList.h index d921990b..51a24043 100644 --- a/src/RoomList.h +++ b/src/RoomList.h @@ -17,15 +17,12 @@ #pragma once -#include <QMetaType> #include <QPushButton> #include <QScrollArea> #include <QSharedPointer> #include <QVBoxLayout> #include <QWidget> -#include <mtx.hpp> - class LeaveRoomDialog; class OverlayModal; class RoomInfoListItem; diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp index 7be50ab5..2ad74e3a 100644 --- a/src/TextInputWidget.cpp +++ b/src/TextInputWidget.cpp @@ -109,7 +109,7 @@ FilteredTextEdit::FilteredTextEdit(QWidget *parent) } void -FilteredTextEdit::showResults(const QVector<SearchResult> &results) +FilteredTextEdit::showResults(const std::vector<SearchResult> &results) { QPoint pos; diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h index a430aa5c..2f267a23 100644 --- a/src/TextInputWidget.h +++ b/src/TextInputWidget.h @@ -76,13 +76,13 @@ signals: //! Trigger the suggestion popup. void showSuggestions(const QString &query); - void resultsRetrieved(const QVector<SearchResult> &results); + void resultsRetrieved(const std::vector<SearchResult> &results); void selectNextSuggestion(); void selectPreviousSuggestion(); void selectHoveredSuggestion(); public slots: - void showResults(const QVector<SearchResult> &results); + void showResults(const std::vector<SearchResult> &results); protected: void keyPressEvent(QKeyEvent *event) override; diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp index 273ffd54..f1dd77df 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp @@ -15,6 +15,8 @@ using namespace dialogs; +Q_DECLARE_METATYPE(std::vector<DeviceInfo>) + constexpr int BUTTON_SIZE = 36; constexpr int BUTTON_RADIUS = BUTTON_SIZE / 2; constexpr int WIDGET_MARGIN = 20; diff --git a/src/dialogs/UserProfile.h b/src/dialogs/UserProfile.h index 0f684cda..81276d2a 100644 --- a/src/dialogs/UserProfile.h +++ b/src/dialogs/UserProfile.h @@ -15,8 +15,6 @@ struct DeviceInfo QString display_name; }; -Q_DECLARE_METATYPE(std::vector<DeviceInfo>) - class Proxy : public QObject { Q_OBJECT diff --git a/src/popups/SuggestionsPopup.cpp b/src/popups/SuggestionsPopup.cpp index ba1f77b9..8f355b38 100644 --- a/src/popups/SuggestionsPopup.cpp +++ b/src/popups/SuggestionsPopup.cpp @@ -60,9 +60,9 @@ SuggestionsPopup::addRooms(const std::vector<RoomSearchResult> &rooms) } void -SuggestionsPopup::addUsers(const QVector<SearchResult> &users) +SuggestionsPopup::addUsers(const std::vector<SearchResult> &users) { - if (users.isEmpty()) { + if (users.empty()) { hide(); return; } diff --git a/src/popups/SuggestionsPopup.h b/src/popups/SuggestionsPopup.h index de52760a..dcd054f8 100644 --- a/src/popups/SuggestionsPopup.h +++ b/src/popups/SuggestionsPopup.h @@ -9,8 +9,6 @@ #include "ChatPage.h" #include "PopupItem.h" -Q_DECLARE_METATYPE(QVector<SearchResult>) - class SuggestionsPopup : public QWidget { Q_OBJECT @@ -33,7 +31,7 @@ public: } public slots: - void addUsers(const QVector<SearchResult> &users); + void addUsers(const std::vector<SearchResult> &users); void addRooms(const std::vector<RoomSearchResult> &rooms); //! Move to the next available suggestion item. |