Port away from Quotient::Omittable
This commit is contained in:
10
src/definitions.h
Normal file
10
src/definitions.h
Normal file
@@ -0,0 +1,10 @@
|
||||
// SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
#if Quotient_VERSION_MINOR > 8
|
||||
#define Omittable std::optional
|
||||
#define none Quotient::none
|
||||
#else
|
||||
#define Omittable Quotient::Omittable
|
||||
#define none std::nullopt
|
||||
#endif
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <Quotient/events/eventcontent.h>
|
||||
#include <Quotient/events/stateevent.h>
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
/**
|
||||
@@ -26,10 +28,10 @@ public:
|
||||
* @brief Defines the properties of an image pack.
|
||||
*/
|
||||
struct Pack {
|
||||
Quotient::Omittable<QString> displayName; /**< The display name of the pack. */
|
||||
Quotient::Omittable<QUrl> avatarUrl; /**< The source mxc URL for the pack avatar. */
|
||||
Quotient::Omittable<QStringList> usage; /**< An array of the usages for this pack. Possible usages are "emoticon" and "sticker". */
|
||||
Quotient::Omittable<QString> attribution; /**< The attribution for the pack author(s). */
|
||||
Omittable<QString> displayName; /**< The display name of the pack. */
|
||||
Omittable<QUrl> avatarUrl; /**< The source mxc URL for the pack avatar. */
|
||||
Omittable<QStringList> usage; /**< An array of the usages for this pack. Possible usages are "emoticon" and "sticker". */
|
||||
Omittable<QString> attribution; /**< The attribution for the pack author(s). */
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -38,14 +40,14 @@ public:
|
||||
struct ImagePackImage {
|
||||
QString shortcode; /**< The shortcode for the image. */
|
||||
QUrl url; /**< The mxc URL for this image. */
|
||||
Quotient::Omittable<QString> body; /**< An optional text body for this image. */
|
||||
Quotient::Omittable<Quotient::EventContent::ImageInfo> info; /**< The ImageInfo object used for the info block of m.sticker events. */
|
||||
Omittable<QString> body; /**< An optional text body for this image. */
|
||||
Omittable<Quotient::EventContent::ImageInfo> info; /**< The ImageInfo object used for the info block of m.sticker events. */
|
||||
/**
|
||||
* @brief An array of the usages for this image.
|
||||
*
|
||||
* The possible values match those of the usage key of a pack object.
|
||||
*/
|
||||
Quotient::Omittable<QStringList> usage;
|
||||
Omittable<QStringList> usage;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -53,7 +55,7 @@ public:
|
||||
*
|
||||
* @sa Pack
|
||||
*/
|
||||
Quotient::Omittable<Pack> pack;
|
||||
Omittable<Pack> pack;
|
||||
|
||||
/**
|
||||
* @brief Return a vector of images in the pack.
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/omittable.h>
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
class NeochatAdd3PIdJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
explicit NeochatAdd3PIdJob(const QString &clientSecret, const QString &sid, const Quotient::Omittable<QJsonObject> &auth = Quotient::none);
|
||||
explicit NeochatAdd3PIdJob(const QString &clientSecret, const QString &sid, const Omittable<QJsonObject> &auth = {});
|
||||
};
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/omittable.h>
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
class NeochatChangePasswordJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
explicit NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Quotient::Omittable<QJsonObject> &auth = Quotient::none);
|
||||
explicit NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Omittable<QJsonObject> &auth = {});
|
||||
};
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/omittable.h>
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
class NeoChatDeactivateAccountJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
explicit NeoChatDeactivateAccountJob(const Quotient::Omittable<QJsonObject> &auth = Quotient::none);
|
||||
explicit NeoChatDeactivateAccountJob(const Omittable<QJsonObject> &auth = {});
|
||||
};
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/omittable.h>
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
class NeochatDeleteDeviceJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
explicit NeochatDeleteDeviceJob(const QString &deviceId, const Quotient::Omittable<QJsonObject> &auth = Quotient::none);
|
||||
explicit NeochatDeleteDeviceJob(const QString &deviceId, const Omittable<QJsonObject> &auth = {});
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ void SearchModel::search()
|
||||
}
|
||||
|
||||
RoomEventFilter filter;
|
||||
filter.unreadThreadNotifications = none;
|
||||
filter.unreadThreadNotifications = {};
|
||||
filter.lazyLoadMembers = true;
|
||||
filter.includeRedundantMembers = false;
|
||||
filter.notRooms = QStringList();
|
||||
@@ -58,7 +58,7 @@ void SearchModel::search()
|
||||
.orderBy = "recent"_ls,
|
||||
.eventContext = SearchJob::IncludeEventContext{3, 3, true},
|
||||
.includeState = false,
|
||||
.groupings = none,
|
||||
.groupings = {},
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/room.h>
|
||||
|
||||
#include "definitions.h"
|
||||
#include "neochatconnection.h"
|
||||
#include "neochatroom.h"
|
||||
|
||||
@@ -87,7 +88,7 @@ void SpaceChildrenModel::refreshModel()
|
||||
m_rootItem =
|
||||
new SpaceTreeItem(dynamic_cast<NeoChatConnection *>(m_space->connection()), nullptr, m_space->id(), m_space->displayName(), m_space->canonicalAlias());
|
||||
endResetModel();
|
||||
auto job = m_space->connection()->callApi<Quotient::GetSpaceHierarchyJob>(m_space->id(), Quotient::none, Quotient::none, 1);
|
||||
auto job = m_space->connection()->callApi<Quotient::GetSpaceHierarchyJob>(m_space->id(), none, none, 1);
|
||||
m_currentJobs.append(job);
|
||||
connect(job, &Quotient::BaseJob::success, this, [this, job]() {
|
||||
insertChildren(job->rooms());
|
||||
@@ -136,7 +137,7 @@ void SpaceChildrenModel::insertChildren(std::vector<Quotient::GetSpaceHierarchyJ
|
||||
}
|
||||
}
|
||||
if (children[i].childrenState.size() > 0) {
|
||||
auto job = m_space->connection()->callApi<Quotient::GetSpaceHierarchyJob>(children[i].roomId, Quotient::none, Quotient::none, 1);
|
||||
auto job = m_space->connection()->callApi<Quotient::GetSpaceHierarchyJob>(children[i].roomId, none, none, 1);
|
||||
m_currentJobs.append(job);
|
||||
connect(job, &Quotient::BaseJob::success, this, [this, parent, insertRow, job]() {
|
||||
insertChildren(job->rooms(), index(insertRow, 0, parent));
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/util.h>
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
class CheckUsernameAvailabilityJob;
|
||||
@@ -27,12 +29,12 @@ class NeoChatRegisterJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
explicit NeoChatRegisterJob(const QString &kind = QStringLiteral("user"),
|
||||
const Quotient::Omittable<QJsonObject> &auth = Quotient::none,
|
||||
const Omittable<QJsonObject> &auth = {},
|
||||
const QString &username = {},
|
||||
const QString &password = {},
|
||||
const QString &deviceId = {},
|
||||
const QString &initialDeviceDisplayName = {},
|
||||
Quotient::Omittable<bool> inhibitLogin = Quotient::none);
|
||||
Omittable<bool> inhibitLogin = {});
|
||||
|
||||
QString userId() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user