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/eventcontent.h>
|
||||||
#include <Quotient/events/stateevent.h>
|
#include <Quotient/events/stateevent.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
|
||||||
namespace Quotient
|
namespace Quotient
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -26,10 +28,10 @@ public:
|
|||||||
* @brief Defines the properties of an image pack.
|
* @brief Defines the properties of an image pack.
|
||||||
*/
|
*/
|
||||||
struct Pack {
|
struct Pack {
|
||||||
Quotient::Omittable<QString> displayName; /**< The display name of the pack. */
|
Omittable<QString> displayName; /**< The display name of the pack. */
|
||||||
Quotient::Omittable<QUrl> avatarUrl; /**< The source mxc URL for the pack avatar. */
|
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". */
|
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> attribution; /**< The attribution for the pack author(s). */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,14 +40,14 @@ public:
|
|||||||
struct ImagePackImage {
|
struct ImagePackImage {
|
||||||
QString shortcode; /**< The shortcode for the image. */
|
QString shortcode; /**< The shortcode for the image. */
|
||||||
QUrl url; /**< The mxc URL for this image. */
|
QUrl url; /**< The mxc URL for this image. */
|
||||||
Quotient::Omittable<QString> body; /**< An optional text body for this image. */
|
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<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.
|
* @brief An array of the usages for this image.
|
||||||
*
|
*
|
||||||
* The possible values match those of the usage key of a pack object.
|
* 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
|
* @sa Pack
|
||||||
*/
|
*/
|
||||||
Quotient::Omittable<Pack> pack;
|
Omittable<Pack> pack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return a vector of images in the pack.
|
* @brief Return a vector of images in the pack.
|
||||||
|
|||||||
@@ -6,8 +6,10 @@
|
|||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/omittable.h>
|
#include <Quotient/omittable.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
|
||||||
class NeochatAdd3PIdJob : public Quotient::BaseJob
|
class NeochatAdd3PIdJob : public Quotient::BaseJob
|
||||||
{
|
{
|
||||||
public:
|
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/jobs/basejob.h>
|
||||||
#include <Quotient/omittable.h>
|
#include <Quotient/omittable.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
|
||||||
class NeochatChangePasswordJob : public Quotient::BaseJob
|
class NeochatChangePasswordJob : public Quotient::BaseJob
|
||||||
{
|
{
|
||||||
public:
|
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/jobs/basejob.h>
|
||||||
#include <Quotient/omittable.h>
|
#include <Quotient/omittable.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
|
||||||
class NeoChatDeactivateAccountJob : public Quotient::BaseJob
|
class NeoChatDeactivateAccountJob : public Quotient::BaseJob
|
||||||
{
|
{
|
||||||
public:
|
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/jobs/basejob.h>
|
||||||
#include <Quotient/omittable.h>
|
#include <Quotient/omittable.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
|
||||||
class NeochatDeleteDeviceJob : public Quotient::BaseJob
|
class NeochatDeleteDeviceJob : public Quotient::BaseJob
|
||||||
{
|
{
|
||||||
public:
|
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;
|
RoomEventFilter filter;
|
||||||
filter.unreadThreadNotifications = none;
|
filter.unreadThreadNotifications = {};
|
||||||
filter.lazyLoadMembers = true;
|
filter.lazyLoadMembers = true;
|
||||||
filter.includeRedundantMembers = false;
|
filter.includeRedundantMembers = false;
|
||||||
filter.notRooms = QStringList();
|
filter.notRooms = QStringList();
|
||||||
@@ -58,7 +58,7 @@ void SearchModel::search()
|
|||||||
.orderBy = "recent"_ls,
|
.orderBy = "recent"_ls,
|
||||||
.eventContext = SearchJob::IncludeEventContext{3, 3, true},
|
.eventContext = SearchJob::IncludeEventContext{3, 3, true},
|
||||||
.includeState = false,
|
.includeState = false,
|
||||||
.groupings = none,
|
.groupings = {},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/room.h>
|
#include <Quotient/room.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
#include "neochatconnection.h"
|
#include "neochatconnection.h"
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
|
||||||
@@ -87,7 +88,7 @@ void SpaceChildrenModel::refreshModel()
|
|||||||
m_rootItem =
|
m_rootItem =
|
||||||
new SpaceTreeItem(dynamic_cast<NeoChatConnection *>(m_space->connection()), nullptr, m_space->id(), m_space->displayName(), m_space->canonicalAlias());
|
new SpaceTreeItem(dynamic_cast<NeoChatConnection *>(m_space->connection()), nullptr, m_space->id(), m_space->displayName(), m_space->canonicalAlias());
|
||||||
endResetModel();
|
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);
|
m_currentJobs.append(job);
|
||||||
connect(job, &Quotient::BaseJob::success, this, [this, job]() {
|
connect(job, &Quotient::BaseJob::success, this, [this, job]() {
|
||||||
insertChildren(job->rooms());
|
insertChildren(job->rooms());
|
||||||
@@ -136,7 +137,7 @@ void SpaceChildrenModel::insertChildren(std::vector<Quotient::GetSpaceHierarchyJ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (children[i].childrenState.size() > 0) {
|
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);
|
m_currentJobs.append(job);
|
||||||
connect(job, &Quotient::BaseJob::success, this, [this, parent, insertRow, job]() {
|
connect(job, &Quotient::BaseJob::success, this, [this, parent, insertRow, job]() {
|
||||||
insertChildren(job->rooms(), index(insertRow, 0, parent));
|
insertChildren(job->rooms(), index(insertRow, 0, parent));
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/util.h>
|
#include <Quotient/util.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
|
||||||
namespace Quotient
|
namespace Quotient
|
||||||
{
|
{
|
||||||
class CheckUsernameAvailabilityJob;
|
class CheckUsernameAvailabilityJob;
|
||||||
@@ -27,12 +29,12 @@ class NeoChatRegisterJob : public Quotient::BaseJob
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit NeoChatRegisterJob(const QString &kind = QStringLiteral("user"),
|
explicit NeoChatRegisterJob(const QString &kind = QStringLiteral("user"),
|
||||||
const Quotient::Omittable<QJsonObject> &auth = Quotient::none,
|
const Omittable<QJsonObject> &auth = {},
|
||||||
const QString &username = {},
|
const QString &username = {},
|
||||||
const QString &password = {},
|
const QString &password = {},
|
||||||
const QString &deviceId = {},
|
const QString &deviceId = {},
|
||||||
const QString &initialDeviceDisplayName = {},
|
const QString &initialDeviceDisplayName = {},
|
||||||
Quotient::Omittable<bool> inhibitLogin = Quotient::none);
|
Omittable<bool> inhibitLogin = {});
|
||||||
|
|
||||||
QString userId() const
|
QString userId() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user