There's no QVector anymore, QList is the QVector in Qt6

This commit is contained in:
Laurent Montel
2023-10-19 13:41:46 +02:00
parent 6571dbe554
commit c7614caf41
31 changed files with 67 additions and 67 deletions

View File

@@ -59,7 +59,7 @@ void ActionsHandler::handleMessageEvent(ChatBarCache *chatBarCache)
handleMessage(m_room->mainCache()->text(), handledText, chatBarCache); handleMessage(m_room->mainCache()->text(), handledText, chatBarCache);
} }
QString ActionsHandler::handleMentions(QString handledText, QVector<Mention> *mentions) QString ActionsHandler::handleMentions(QString handledText, QList<Mention> *mentions)
{ {
if (!m_room) { if (!m_room) {
return QString(); return QString();

View File

@@ -61,6 +61,6 @@ private:
NeoChatRoom *m_room = nullptr; NeoChatRoom *m_room = nullptr;
void checkEffects(const QString &text); void checkEffects(const QString &text);
QString handleMentions(QString handledText, QVector<Mention> *mentions); QString handleMentions(QString handledText, QList<Mention> *mentions);
void handleMessage(const QString &text, QString handledText, ChatBarCache *chatBarCache); void handleMessage(const QString &text, QString handledText, ChatBarCache *chatBarCache);
}; };

View File

@@ -137,7 +137,7 @@ void ChatBarCache::setAttachmentPath(const QString &attachmentPath)
Q_EMIT attachmentPathChanged(); Q_EMIT attachmentPathChanged();
} }
QVector<Mention> *ChatBarCache::mentions() QList<Mention> *ChatBarCache::mentions()
{ {
return &m_mentions; return &m_mentions;
} }

View File

@@ -158,7 +158,7 @@ public:
/** /**
* @brief Retrieve the mentions for the current chat bar text. * @brief Retrieve the mentions for the current chat bar text.
*/ */
QVector<Mention> *mentions(); QList<Mention> *mentions();
/** /**
* @brief Get the saved chat bar text. * @brief Get the saved chat bar text.
@@ -180,6 +180,6 @@ private:
QString m_relationId = QString(); QString m_relationId = QString();
RelationType m_relationType = RelationType::None; RelationType m_relationType = RelationType::None;
QString m_attachmentPath = QString(); QString m_attachmentPath = QString();
QVector<Mention> m_mentions; QList<Mention> m_mentions;
QString m_savedText; QString m_savedText;
}; };

View File

@@ -3,7 +3,7 @@
#pragma once #pragma once
#include <QVector> #include <QList>
#include <Quotient/events/eventcontent.h> #include <Quotient/events/eventcontent.h>
#include <Quotient/events/stateevent.h> #include <Quotient/events/stateevent.h>
@@ -60,7 +60,7 @@ public:
* *
* @sa ImagePackImage * @sa ImagePackImage
*/ */
QVector<ImagePackEventContent::ImagePackImage> images; QList<ImagePackEventContent::ImagePackImage> images;
explicit ImagePackEventContent(const QJsonObject &o); explicit ImagePackEventContent(const QJsonObject &o);

View File

@@ -7,10 +7,10 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QCoroTask> #include <QCoroTask>
#include <QList>
#include <QObject> #include <QObject>
#include <QPointer> #include <QPointer>
#include <QQmlEngine> #include <QQmlEngine>
#include <QVector>
#include <Quotient/connection.h> #include <Quotient/connection.h>

View File

@@ -55,7 +55,7 @@ auto roomNickLambda = [](const QString &text, NeoChatRoom *room, ChatBarCache *)
return QString(); return QString();
}; };
QVector<ActionsModel::Action> actions{ QList<ActionsModel::Action> actions{
Action{ Action{
QStringLiteral("shrug"), QStringLiteral("shrug"),
[](const QString &message, NeoChatRoom *, ChatBarCache *) { [](const QString &message, NeoChatRoom *, ChatBarCache *) {
@@ -574,7 +574,7 @@ QHash<int, QByteArray> ActionsModel::roleNames() const
}; };
} }
QVector<Action> &ActionsModel::allActions() const QList<Action> &ActionsModel::allActions() const
{ {
return actions; return actions;
} }

View File

@@ -88,7 +88,7 @@ public:
/** /**
* @brief Return a vector with all supported actions. * @brief Return a vector with all supported actions.
*/ */
QVector<Action> &allActions() const; QList<Action> &allActions() const;
private: private:
ActionsModel() = default; ActionsModel() = default;

View File

@@ -98,6 +98,6 @@ Q_SIGNALS:
private: private:
void fetchDevices(); void fetchDevices();
QVector<Quotient::Device> m_devices; QList<Quotient::Device> m_devices;
QPointer<Quotient::Connection> m_connection; QPointer<Quotient::Connection> m_connection;
}; };

View File

@@ -151,7 +151,7 @@ void ImagePacksModel::setShowEmoticons(bool showEmoticons)
m_showEmoticons = showEmoticons; m_showEmoticons = showEmoticons;
Q_EMIT showEmoticonsChanged(); Q_EMIT showEmoticonsChanged();
} }
QVector<Quotient::ImagePackEventContent::ImagePackImage> ImagePacksModel::images(int index) QList<Quotient::ImagePackEventContent::ImagePackImage> ImagePacksModel::images(int index)
{ {
if (index < 0 || index >= m_events.size()) { if (index < 0 || index >= m_events.size()) {
return {}; return {};

View File

@@ -5,9 +5,9 @@
#include "events/imagepackevent.h" #include "events/imagepackevent.h"
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QList>
#include <QPointer> #include <QPointer>
#include <QQmlEngine> #include <QQmlEngine>
#include <QVector>
class NeoChatRoom; class NeoChatRoom;
@@ -86,7 +86,7 @@ public:
/** /**
* @brief Return a vector of the images in the pack at the given index. * @brief Return a vector of the images in the pack at the given index.
*/ */
[[nodiscard]] QVector<Quotient::ImagePackEventContent::ImagePackImage> images(int index); [[nodiscard]] QList<Quotient::ImagePackEventContent::ImagePackImage> images(int index);
Q_SIGNALS: Q_SIGNALS:
void roomChanged(); void roomChanged();
@@ -96,7 +96,7 @@ Q_SIGNALS:
private: private:
QPointer<NeoChatRoom> m_room; QPointer<NeoChatRoom> m_room;
QVector<Quotient::ImagePackEventContent> m_events; QList<Quotient::ImagePackEventContent> m_events;
bool m_showStickers = true; bool m_showStickers = true;
bool m_showEmoticons = true; bool m_showEmoticons = true;
void reloadImages(); void reloadImages();

View File

@@ -35,7 +35,7 @@ void KeywordNotificationRuleModel::updateNotificationRules(const QString &type)
const QJsonObject ruleDataJson = Controller::instance().activeConnection()->accountDataJson("m.push_rules"); const QJsonObject ruleDataJson = Controller::instance().activeConnection()->accountDataJson("m.push_rules");
const Quotient::PushRuleset ruleData = Quotient::fromJson<Quotient::PushRuleset>(ruleDataJson["global"].toObject()); const Quotient::PushRuleset ruleData = Quotient::fromJson<Quotient::PushRuleset>(ruleDataJson["global"].toObject());
const QVector<Quotient::PushRule> contentRules = ruleData.content; const QList<Quotient::PushRule> contentRules = ruleData.content;
beginResetModel(); beginResetModel();
m_notificationRules.clear(); m_notificationRules.clear();
@@ -78,11 +78,11 @@ void KeywordNotificationRuleModel::addKeyword(const QString &keyword)
NotificationsManager::instance().initializeKeywordNotificationAction(); NotificationsManager::instance().initializeKeywordNotificationAction();
} }
const QVector<QVariant> actions = NotificationsManager::instance().getKeywordNotificationActions(); const QList<QVariant> actions = NotificationsManager::instance().getKeywordNotificationActions();
auto job = Controller::instance() auto job = Controller::instance()
.activeConnection() .activeConnection()
->callApi<Quotient::SetPushRuleJob>("global", "content", keyword, actions, "", "", QVector<Quotient::PushCondition>(), keyword); ->callApi<Quotient::SetPushRuleJob>("global", "content", keyword, actions, "", "", QList<Quotient::PushCondition>(), keyword);
connect(job, &Quotient::BaseJob::success, this, [this, keyword]() { connect(job, &Quotient::BaseJob::success, this, [this, keyword]() {
beginInsertRows(QModelIndex(), m_notificationRules.count(), m_notificationRules.count()); beginInsertRows(QModelIndex(), m_notificationRules.count(), m_notificationRules.count());
m_notificationRules.append(keyword); m_notificationRules.append(keyword);

View File

@@ -266,7 +266,7 @@ int MessageEventModel::timelineBaseIndex() const
return m_currentRoom ? int(m_currentRoom->pendingEvents().size()) : 0; return m_currentRoom ? int(m_currentRoom->pendingEvents().size()) : 0;
} }
void MessageEventModel::refreshEventRoles(int row, const QVector<int> &roles) void MessageEventModel::refreshEventRoles(int row, const QList<int> &roles)
{ {
const auto idx = index(row); const auto idx = index(row);
Q_EMIT dataChanged(idx, idx, roles); Q_EMIT dataChanged(idx, idx, roles);
@@ -310,7 +310,7 @@ void MessageEventModel::moveReadMarker(const QString &toEventId)
endMoveRows(); endMoveRows();
} }
int MessageEventModel::refreshEventRoles(const QString &id, const QVector<int> &roles) int MessageEventModel::refreshEventRoles(const QString &id, const QList<int> &roles)
{ {
// On 64-bit platforms, difference_type for std containers is long long // On 64-bit platforms, difference_type for std containers is long long
// but Qt uses int throughout its interfaces; hence casting to int below. // but Qt uses int throughout its interfaces; hence casting to int below.

View File

@@ -137,8 +137,8 @@ private:
void fetchMore(const QModelIndex &parent) override; void fetchMore(const QModelIndex &parent) override;
void refreshLastUserEvents(int baseTimelineRow); void refreshLastUserEvents(int baseTimelineRow);
void refreshEventRoles(int row, const QVector<int> &roles = {}); void refreshEventRoles(int row, const QList<int> &roles = {});
int refreshEventRoles(const QString &eventId, const QVector<int> &roles = {}); int refreshEventRoles(const QString &eventId, const QList<int> &roles = {});
void moveReadMarker(const QString &toEventId); void moveReadMarker(const QString &toEventId);
void createEventObjects(const Quotient::RoomMessageEvent *event); void createEventObjects(const Quotient::RoomMessageEvent *event);

View File

@@ -132,7 +132,7 @@ private:
bool m_loading = false; bool m_loading = false;
QString nextBatch; QString nextBatch;
QVector<Quotient::PublicRoomsChunk> rooms; QList<Quotient::PublicRoomsChunk> rooms;
Quotient::QueryPublicRoomsJob *job = nullptr; Quotient::QueryPublicRoomsJob *job = nullptr;

View File

@@ -106,7 +106,7 @@ void PushRuleModel::updateNotificationRules(const QString &type)
endResetModel(); endResetModel();
} }
void PushRuleModel::setRules(QVector<Quotient::PushRule> rules, PushNotificationKind::Kind kind) void PushRuleModel::setRules(QList<Quotient::PushRule> rules, PushNotificationKind::Kind kind)
{ {
for (const auto &rule : rules) { for (const auto &rule : rules) {
QString roomId; QString roomId;
@@ -307,8 +307,8 @@ void PushRuleModel::setPushRuleAction(const QString &id, PushNotificationAction:
void PushRuleModel::addKeyword(const QString &keyword, const QString &roomId) void PushRuleModel::addKeyword(const QString &keyword, const QString &roomId)
{ {
PushNotificationKind::Kind kind = PushNotificationKind::Content; PushNotificationKind::Kind kind = PushNotificationKind::Content;
const QVector<QVariant> actions = actionToVariant(m_defaultKeywordAction); const QList<QVariant> actions = actionToVariant(m_defaultKeywordAction);
QVector<Quotient::PushCondition> pushConditions; QList<Quotient::PushCondition> pushConditions;
if (!roomId.isEmpty()) { if (!roomId.isEmpty()) {
kind = PushNotificationKind::Override; kind = PushNotificationKind::Override;
@@ -369,7 +369,7 @@ void PushRuleModel::setNotificationRuleEnabled(const QString &kind, const QStrin
void PushRuleModel::setNotificationRuleActions(const QString &kind, const QString &ruleId, PushNotificationAction::Action action) void PushRuleModel::setNotificationRuleActions(const QString &kind, const QString &ruleId, PushNotificationAction::Action action)
{ {
QVector<QVariant> actions; QList<QVariant> actions;
if (ruleId == QStringLiteral(".m.rule.call")) { if (ruleId == QStringLiteral(".m.rule.call")) {
actions = actionToVariant(action, QStringLiteral("ring")); actions = actionToVariant(action, QStringLiteral("ring"));
} else { } else {
@@ -379,7 +379,7 @@ void PushRuleModel::setNotificationRuleActions(const QString &kind, const QStrin
Controller::instance().activeConnection()->callApi<Quotient::SetPushRuleActionsJob>(QStringLiteral("global"), kind, ruleId, actions); Controller::instance().activeConnection()->callApi<Quotient::SetPushRuleActionsJob>(QStringLiteral("global"), kind, ruleId, actions);
} }
PushNotificationAction::Action PushRuleModel::variantToAction(const QVector<QVariant> &actions, bool enabled) PushNotificationAction::Action PushRuleModel::variantToAction(const QList<QVariant> &actions, bool enabled)
{ {
bool notify = false; bool notify = false;
bool isNoisy = false; bool isNoisy = false;
@@ -422,16 +422,16 @@ PushNotificationAction::Action PushRuleModel::variantToAction(const QVector<QVar
} }
} }
QVector<QVariant> PushRuleModel::actionToVariant(PushNotificationAction::Action action, const QString &sound) QList<QVariant> PushRuleModel::actionToVariant(PushNotificationAction::Action action, const QString &sound)
{ {
// The caller should never try to set the state to unknown. // The caller should never try to set the state to unknown.
// It exists only as a default state to diable the settings options until the actual state is retrieved from the server. // It exists only as a default state to diable the settings options until the actual state is retrieved from the server.
if (action == PushNotificationAction::Unknown) { if (action == PushNotificationAction::Unknown) {
Q_ASSERT(false); Q_ASSERT(false);
return QVector<QVariant>(); return QList<QVariant>();
} }
QVector<QVariant> actions; QList<QVariant> actions;
if (action != PushNotificationAction::Off) { if (action != PushNotificationAction::Off) {
actions.append(QStringLiteral("notify")); actions.append(QStringLiteral("notify"));

View File

@@ -238,14 +238,14 @@ private:
PushNotificationAction::Action m_defaultKeywordAction; PushNotificationAction::Action m_defaultKeywordAction;
QList<Rule> m_rules; QList<Rule> m_rules;
void setRules(QVector<Quotient::PushRule> rules, PushNotificationKind::Kind kind); void setRules(QList<Quotient::PushRule> rules, PushNotificationKind::Kind kind);
int getRuleIndex(const QString &ruleId) const; int getRuleIndex(const QString &ruleId) const;
PushNotificationSection::Section getSection(Quotient::PushRule rule); PushNotificationSection::Section getSection(Quotient::PushRule rule);
void setNotificationRuleEnabled(const QString &kind, const QString &ruleId, bool enabled); void setNotificationRuleEnabled(const QString &kind, const QString &ruleId, bool enabled);
void setNotificationRuleActions(const QString &kind, const QString &ruleId, PushNotificationAction::Action action); void setNotificationRuleActions(const QString &kind, const QString &ruleId, PushNotificationAction::Action action);
PushNotificationAction::Action variantToAction(const QVector<QVariant> &actions, bool enabled); PushNotificationAction::Action variantToAction(const QList<QVariant> &actions, bool enabled);
QVector<QVariant> actionToVariant(PushNotificationAction::Action action, const QString &sound = QStringLiteral("default")); QList<QVariant> actionToVariant(PushNotificationAction::Action action, const QString &sound = QStringLiteral("default"));
}; };
Q_DECLARE_METATYPE(PushRuleModel *) Q_DECLARE_METATYPE(PushRuleModel *)

View File

@@ -372,7 +372,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
void RoomListModel::refresh(NeoChatRoom *room, const QVector<int> &roles) void RoomListModel::refresh(NeoChatRoom *room, const QList<int> &roles)
{ {
const auto it = std::find(m_rooms.begin(), m_rooms.end(), room); const auto it = std::find(m_rooms.begin(), m_rooms.end(), room);
if (it == m_rooms.end()) { if (it == m_rooms.end()) {

View File

@@ -158,7 +158,7 @@ private Q_SLOTS:
void doAddRoom(Quotient::Room *room); void doAddRoom(Quotient::Room *room);
void updateRoom(Quotient::Room *room, Quotient::Room *prev); void updateRoom(Quotient::Room *room, Quotient::Room *prev);
void deleteRoom(Quotient::Room *room); void deleteRoom(Quotient::Room *room);
void refresh(NeoChatRoom *room, const QVector<int> &roles = {}); void refresh(NeoChatRoom *room, const QList<int> &roles = {});
void refreshNotificationCount(); void refreshNotificationCount();
void refreshHighlightCount(); void refreshHighlightCount();

View File

@@ -12,7 +12,7 @@ SortFilterSpaceListModel::SortFilterSpaceListModel(QObject *parent)
sort(0); sort(0);
invalidateFilter(); invalidateFilter();
connect(this, &QAbstractProxyModel::sourceModelChanged, this, [this]() { connect(this, &QAbstractProxyModel::sourceModelChanged, this, [this]() {
connect(sourceModel(), &QAbstractListModel::dataChanged, this, [this](const QModelIndex &, const QModelIndex &, QVector<int> roles) { connect(sourceModel(), &QAbstractListModel::dataChanged, this, [this](const QModelIndex &, const QModelIndex &, QList<int> roles) {
if (roles.contains(RoomListModel::IsChildSpaceRole)) { if (roles.contains(RoomListModel::IsChildSpaceRole)) {
invalidate(); invalidate();
} }

View File

@@ -6,9 +6,9 @@
#include "events/imagepackevent.h" #include "events/imagepackevent.h"
#include "neochatroom.h" #include "neochatroom.h"
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QList>
#include <QObject> #include <QObject>
#include <QQmlEngine> #include <QQmlEngine>
#include <QVector>
class ImagePacksModel; class ImagePacksModel;
@@ -100,7 +100,7 @@ Q_SIGNALS:
private: private:
ImagePacksModel *m_model = nullptr; ImagePacksModel *m_model = nullptr;
int m_index = 0; int m_index = 0;
QVector<Quotient::ImagePackEventContent::ImagePackImage> m_images; QList<Quotient::ImagePackEventContent::ImagePackImage> m_images;
NeoChatRoom *m_room; NeoChatRoom *m_room;
void reloadImages(); void reloadImages();
}; };

View File

@@ -103,7 +103,7 @@ private:
bool attempted = false; bool attempted = false;
QVector<Quotient::SearchUserDirectoryJob::User> users; QList<Quotient::SearchUserDirectoryJob::User> users;
Quotient::SearchUserDirectoryJob *job = nullptr; Quotient::SearchUserDirectoryJob *job = nullptr;
}; };

View File

@@ -145,7 +145,7 @@ void UserListModel::userRemoved(Quotient::User *user)
} }
} }
void UserListModel::refreshUser(Quotient::User *user, const QVector<int> &roles) void UserListModel::refreshUser(Quotient::User *user, const QList<int> &roles)
{ {
auto pos = findUserPos(user); auto pos = findUserPos(user);
if (pos != m_users.size()) { if (pos != m_users.size()) {

View File

@@ -89,7 +89,7 @@ Q_SIGNALS:
private Q_SLOTS: private Q_SLOTS:
void userAdded(Quotient::User *user); void userAdded(Quotient::User *user);
void userRemoved(Quotient::User *user); void userRemoved(Quotient::User *user);
void refreshUser(Quotient::User *user, const QVector<int> &roles = {}); void refreshUser(Quotient::User *user, const QList<int> &roles = {});
void refreshAllUsers(); void refreshAllUsers();
private: private:

View File

@@ -158,7 +158,7 @@ void NeoChatConnection::deactivateAccount(const QString &password)
void NeoChatConnection::createRoom(const QString &name, const QString &topic, const QString &parent, bool setChildParent) void NeoChatConnection::createRoom(const QString &name, const QString &topic, const QString &parent, bool setChildParent)
{ {
QVector<CreateRoomJob::StateEvent> initialStateEvents; QList<CreateRoomJob::StateEvent> initialStateEvents;
if (!parent.isEmpty()) { if (!parent.isEmpty()) {
initialStateEvents.append(CreateRoomJob::StateEvent{ initialStateEvents.append(CreateRoomJob::StateEvent{
"m.space.parent"_ls, "m.space.parent"_ls,
@@ -190,7 +190,7 @@ void NeoChatConnection::createRoom(const QString &name, const QString &topic, co
void NeoChatConnection::createSpace(const QString &name, const QString &topic, const QString &parent, bool setChildParent) void NeoChatConnection::createSpace(const QString &name, const QString &topic, const QString &parent, bool setChildParent)
{ {
QVector<CreateRoomJob::StateEvent> initialStateEvents; QList<CreateRoomJob::StateEvent> initialStateEvents;
if (!parent.isEmpty()) { if (!parent.isEmpty()) {
initialStateEvents.append(CreateRoomJob::StateEvent{ initialStateEvents.append(CreateRoomJob::StateEvent{
"m.space.parent"_ls, "m.space.parent"_ls,

View File

@@ -1110,10 +1110,10 @@ bool NeoChatRoom::hasParent() const
return currentState().eventsOfType("m.space.parent"_ls).size() > 0; return currentState().eventsOfType("m.space.parent"_ls).size() > 0;
} }
QVector<QString> NeoChatRoom::parentIds() const QList<QString> NeoChatRoom::parentIds() const
{ {
auto parentEvents = currentState().eventsOfType("m.space.parent"_ls); auto parentEvents = currentState().eventsOfType("m.space.parent"_ls);
QVector<QString> parentIds; QList<QString> parentIds;
for (const auto &parentEvent : parentEvents) { for (const auto &parentEvent : parentEvents) {
if (parentEvent->contentJson().contains("via"_ls) && !parentEvent->contentPart<QJsonArray>("via"_ls).isEmpty()) { if (parentEvent->contentJson().contains("via"_ls) && !parentEvent->contentPart<QJsonArray>("via"_ls).isEmpty()) {
parentIds += parentEvent->stateKey(); parentIds += parentEvent->stateKey();
@@ -1346,7 +1346,7 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
* "don't_notify" * "don't_notify"
* ] * ]
*/ */
const QVector<QVariant> actions = {"dont_notify"_ls}; const QList<QVariant> actions = {"dont_notify"_ls};
/** /**
* Setup the push condition to get all events for the current room * Setup the push condition to get all events for the current room
* see https://spec.matrix.org/v1.3/client-server-api/#conditions-1 * see https://spec.matrix.org/v1.3/client-server-api/#conditions-1
@@ -1363,7 +1363,7 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
pushCondition.kind = "event_match"_ls; pushCondition.kind = "event_match"_ls;
pushCondition.key = "room_id"_ls; pushCondition.key = "room_id"_ls;
pushCondition.pattern = id(); pushCondition.pattern = id();
const QVector<PushCondition> conditions = {pushCondition}; const QList<PushCondition> conditions = {pushCondition};
// Add new override rule and make sure it's enabled // Add new override rule and make sure it's enabled
auto job = Controller::instance() auto job = Controller::instance()
@@ -1390,9 +1390,9 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
* "don't_notify" * "don't_notify"
* ] * ]
*/ */
const QVector<QVariant> actions = {"dont_notify"_ls}; const QList<QVariant> actions = {"dont_notify"_ls};
// No conditions for a room rule // No conditions for a room rule
const QVector<PushCondition> conditions; const QList<PushCondition> conditions;
auto setJob = Controller::instance() auto setJob = Controller::instance()
.activeConnection() .activeConnection()
@@ -1422,9 +1422,9 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
QJsonObject tweaks; QJsonObject tweaks;
tweaks.insert("set_tweak"_ls, "sound"_ls); tweaks.insert("set_tweak"_ls, "sound"_ls);
tweaks.insert("value"_ls, "default"_ls); tweaks.insert("value"_ls, "default"_ls);
const QVector<QVariant> actions = {"notify"_ls, tweaks}; const QList<QVariant> actions = {"notify"_ls, tweaks};
// No conditions for a room rule // No conditions for a room rule
const QVector<PushCondition> conditions; const QList<PushCondition> conditions;
// Add new room rule and make sure enabled // Add new room rule and make sure enabled
auto setJob = Controller::instance() auto setJob = Controller::instance()

View File

@@ -122,7 +122,7 @@ class NeoChatRoom : public Quotient::Room
* *
* Empty if no parent space is set. * Empty if no parent space is set.
*/ */
Q_PROPERTY(QVector<QString> parentIds READ parentIds NOTIFY parentIdsChanged) Q_PROPERTY(QList<QString> parentIds READ parentIds NOTIFY parentIdsChanged)
/** /**
* @brief The current canonical parent for the room. * @brief The current canonical parent for the room.
@@ -525,7 +525,7 @@ public:
*/ */
Q_INVOKABLE bool hasParent() const; Q_INVOKABLE bool hasParent() const;
QVector<QString> parentIds() const; QList<QString> parentIds() const;
QString canonicalParent() const; QString canonicalParent() const;
void setCanonicalParent(const QString &parentId); void setCanonicalParent(const QString &parentId);

View File

@@ -226,7 +226,7 @@ void Registration::testUsername()
}); });
} }
QVector<QVariantMap> Registration::terms() const QList<QVariantMap> Registration::terms() const
{ {
return m_terms; return m_terms;
} }

View File

@@ -4,12 +4,12 @@
#pragma once #pragma once
#include <QJsonObject> #include <QJsonObject>
#include <QList>
#include <QObject> #include <QObject>
#include <QPointer> #include <QPointer>
#include <QQmlEngine> #include <QQmlEngine>
#include <QString> #include <QString>
#include <QVariantMap> #include <QVariantMap>
#include <QVector>
#include <Quotient/csapi/registration.h> #include <Quotient/csapi/registration.h>
@@ -69,7 +69,7 @@ class Registration : public QObject
Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged) Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged)
Q_PROPERTY(QString nextStep READ nextStep WRITE setNextStep NOTIFY nextStepChanged) Q_PROPERTY(QString nextStep READ nextStep WRITE setNextStep NOTIFY nextStepChanged)
Q_PROPERTY(QVector<QVariantMap> terms READ terms NOTIFY termsChanged) Q_PROPERTY(QList<QVariantMap> terms READ terms NOTIFY termsChanged)
Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(QString statusString READ statusString NOTIFY statusChanged) Q_PROPERTY(QString statusString READ statusString NOTIFY statusChanged)
@@ -121,7 +121,7 @@ public:
QString nextStep() const; QString nextStep() const;
void setNextStep(const QString &nextStep); void setNextStep(const QString &nextStep);
QVector<QVariantMap> terms() const; QList<QVariantMap> terms() const;
Status status() const; Status status() const;
QString statusString() const; QString statusString() const;
@@ -148,7 +148,7 @@ private:
QString m_homeserver; QString m_homeserver;
QString m_username; QString m_username;
QString m_password; QString m_password;
QVector<QVariantMap> m_terms; QList<QVariantMap> m_terms;
QString m_email; QString m_email;
Status m_status = NoServer; Status m_status = NoServer;
QString m_nextStep; QString m_nextStep;
@@ -158,7 +158,7 @@ private:
QPointer<Quotient::CheckUsernameAvailabilityJob> m_usernameJob; QPointer<Quotient::CheckUsernameAvailabilityJob> m_usernameJob;
QPointer<NeoChatRegisterJob> m_testServerJob; QPointer<NeoChatRegisterJob> m_testServerJob;
QVector<QVector<QString>> m_flows; QList<QList<QString>> m_flows;
QPointer<Quotient::Connection> m_connection; QPointer<Quotient::Connection> m_connection;
void testHomeserver(); void testHomeserver();

View File

@@ -54,7 +54,7 @@ void SpaceHierarchyCache::populateSpaceHierarchy(const QString &spaceId)
connect(job, &BaseJob::success, this, [this, job, spaceId]() { connect(job, &BaseJob::success, this, [this, job, spaceId]() {
const auto rooms = job->rooms(); const auto rooms = job->rooms();
QVector<QString> roomList; QList<QString> roomList;
for (unsigned long i = 0; i < rooms.size(); ++i) { for (unsigned long i = 0; i < rooms.size(); ++i) {
for (const auto &state : rooms[i].childrenState) { for (const auto &state : rooms[i].childrenState) {
roomList.push_back(state->stateKey()); roomList.push_back(state->stateKey());
@@ -83,7 +83,7 @@ void SpaceHierarchyCache::removeSpaceFromHierarchy(Quotient::Room *room)
} }
} }
QVector<QString> &SpaceHierarchyCache::getRoomListForSpace(const QString &spaceId, bool updateCache) QList<QString> &SpaceHierarchyCache::getRoomListForSpace(const QString &spaceId, bool updateCache)
{ {
if (updateCache) { if (updateCache) {
populateSpaceHierarchy(spaceId); populateSpaceHierarchy(spaceId);

View File

@@ -5,10 +5,10 @@
#pragma once #pragma once
#include <QHash> #include <QHash>
#include <QList>
#include <QObject> #include <QObject>
#include <QQmlEngine> #include <QQmlEngine>
#include <QString> #include <QString>
#include <QVector>
namespace Quotient namespace Quotient
{ {
@@ -43,7 +43,7 @@ public:
/** /**
* @brief Return the list of child rooms for the given space ID. * @brief Return the list of child rooms for the given space ID.
*/ */
[[nodiscard]] QVector<QString> &getRoomListForSpace(const QString &spaceId, bool updateCache); [[nodiscard]] QList<QString> &getRoomListForSpace(const QString &spaceId, bool updateCache);
/** /**
* @brief Returns whether the space is a child space of any other space. * @brief Returns whether the space is a child space of any other space.
@@ -60,8 +60,8 @@ private Q_SLOTS:
private: private:
explicit SpaceHierarchyCache(QObject *parent = nullptr); explicit SpaceHierarchyCache(QObject *parent = nullptr);
QVector<QString> m_activeSpaceRooms; QList<QString> m_activeSpaceRooms;
QHash<QString, QVector<QString>> m_spaceHierarchy; QHash<QString, QList<QString>> m_spaceHierarchy;
void cacheSpaceHierarchy(); void cacheSpaceHierarchy();
void populateSpaceHierarchy(const QString &spaceId); void populateSpaceHierarchy(const QString &spaceId);
}; };