mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Remove metatypes from headers
This commit is contained in:
parent
4cd260bfcf
commit
127fb9370b
16 changed files with 42 additions and 43 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QStyleOption>
|
||||
|
||||
#include <mtx/identifiers.hpp>
|
||||
#include <mtx/responses/login.hpp>
|
||||
|
||||
#include "Config.h"
|
||||
#include "Logging.h"
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "QuickSwitcher.h"
|
||||
#include "popups/SuggestionsPopup.h"
|
||||
|
||||
Q_DECLARE_METATYPE(std::vector<RoomSearchResult>)
|
||||
|
||||
RoomSearchInput::RoomSearchInput(QWidget *parent)
|
||||
: TextField(parent)
|
||||
{}
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include "popups/SuggestionsPopup.h"
|
||||
#include "ui/TextField.h"
|
||||
|
||||
Q_DECLARE_METATYPE(std::vector<RoomSearchResult>)
|
||||
|
||||
class RoomSearchInput : public TextField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <QStyleOption>
|
||||
#include <QTimer>
|
||||
|
||||
#include <mtx/responses/register.hpp>
|
||||
|
||||
#include "Config.h"
|
||||
#include "Logging.h"
|
||||
#include "MainWindow.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;
|
||||
|
|
|
@ -109,7 +109,7 @@ FilteredTextEdit::FilteredTextEdit(QWidget *parent)
|
|||
}
|
||||
|
||||
void
|
||||
FilteredTextEdit::showResults(const QVector<SearchResult> &results)
|
||||
FilteredTextEdit::showResults(const std::vector<SearchResult> &results)
|
||||
{
|
||||
QPoint pos;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -15,8 +15,6 @@ struct DeviceInfo
|
|||
QString display_name;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::vector<DeviceInfo>)
|
||||
|
||||
class Proxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue