Remove uses of Quotient:Omittable
Note this technically won't build for now because of the lack of RoomMember support but I'll push that at the quotient-next branch next. This is needed as well to get a branch that builds on dev.
This commit is contained in:
committed by
Tobias Fella
parent
31f0e39617
commit
15b7c04834
@@ -10,10 +10,10 @@ ImagePackEventContent::ImagePackEventContent(const QJsonObject &json)
|
|||||||
{
|
{
|
||||||
if (json.contains(QStringLiteral("pack"))) {
|
if (json.contains(QStringLiteral("pack"))) {
|
||||||
pack = ImagePackEventContent::Pack{
|
pack = ImagePackEventContent::Pack{
|
||||||
fromJson<Omittable<QString>>(json["pack"_ls].toObject()["display_name"_ls]),
|
fromJson<std::optional<QString>>(json["pack"_ls].toObject()["display_name"_ls]),
|
||||||
fromJson<Omittable<QUrl>>(json["pack"_ls].toObject()["avatar_url"_ls]),
|
fromJson<std::optional<QUrl>>(json["pack"_ls].toObject()["avatar_url"_ls]),
|
||||||
fromJson<Omittable<QStringList>>(json["pack"_ls].toObject()["usage"_ls]),
|
fromJson<std::optional<QStringList>>(json["pack"_ls].toObject()["usage"_ls]),
|
||||||
fromJson<Omittable<QString>>(json["pack"_ls].toObject()["attribution"_ls]),
|
fromJson<std::optional<QString>>(json["pack"_ls].toObject()["attribution"_ls]),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
pack = none;
|
pack = none;
|
||||||
@@ -21,7 +21,7 @@ ImagePackEventContent::ImagePackEventContent(const QJsonObject &json)
|
|||||||
|
|
||||||
const auto &keys = json["images"_ls].toObject().keys();
|
const auto &keys = json["images"_ls].toObject().keys();
|
||||||
for (const auto &k : keys) {
|
for (const auto &k : keys) {
|
||||||
Omittable<EventContent::ImageInfo> info;
|
std::optional<EventContent::ImageInfo> info;
|
||||||
if (json["images"_ls][k].toObject().contains(QStringLiteral("info"))) {
|
if (json["images"_ls][k].toObject().contains(QStringLiteral("info"))) {
|
||||||
info = EventContent::ImageInfo(QUrl(json["images"_ls][k]["url"_ls].toString()), json["images"_ls][k]["info"_ls].toObject(), k);
|
info = EventContent::ImageInfo(QUrl(json["images"_ls][k]["url"_ls].toString()), json["images"_ls][k]["info"_ls].toObject(), k);
|
||||||
} else {
|
} else {
|
||||||
@@ -30,9 +30,9 @@ ImagePackEventContent::ImagePackEventContent(const QJsonObject &json)
|
|||||||
images += ImagePackImage{
|
images += ImagePackImage{
|
||||||
k,
|
k,
|
||||||
fromJson<QUrl>(json["images"_ls][k]["url"_ls].toString()),
|
fromJson<QUrl>(json["images"_ls][k]["url"_ls].toString()),
|
||||||
fromJson<Omittable<QString>>(json["images"_ls][k]["body"_ls]),
|
fromJson<std::optional<QString>>(json["images"_ls][k]["body"_ls]),
|
||||||
info,
|
info,
|
||||||
fromJson<Omittable<QStringList>>(json["images"_ls][k]["usage"_ls]),
|
fromJson<std::optional<QStringList>>(json["images"_ls][k]["usage"_ls]),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,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. */
|
std::optional<QString> displayName; /**< The display name of the pack. */
|
||||||
Quotient::Omittable<QUrl> avatarUrl; /**< The source mxc URL for the pack avatar. */
|
std::optional<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". */
|
std::optional<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). */
|
std::optional<QString> attribution; /**< The attribution for the pack author(s). */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,14 +38,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. */
|
std::optional<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. */
|
std::optional<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;
|
std::optional<QStringList> usage;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @sa Pack
|
* @sa Pack
|
||||||
*/
|
*/
|
||||||
Quotient::Omittable<Pack> pack;
|
std::optional<Pack> pack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return a vector of images in the pack.
|
* @brief Return a vector of images in the pack.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Omittable<QJsonObject> &auth)
|
NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const std::optional<QJsonObject> &auth)
|
||||||
: BaseJob(HttpVerb::Post, QStringLiteral("ChangePasswordJob"), "/_matrix/client/r0/account/password")
|
: BaseJob(HttpVerb::Post, QStringLiteral("ChangePasswordJob"), "/_matrix/client/r0/account/password")
|
||||||
{
|
{
|
||||||
QJsonObject _data;
|
QJsonObject _data;
|
||||||
|
|||||||
@@ -4,10 +4,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/omittable.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 std::optional<QJsonObject> &auth = std::nullopt);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
NeoChatDeactivateAccountJob::NeoChatDeactivateAccountJob(const Omittable<QJsonObject> &auth)
|
NeoChatDeactivateAccountJob::NeoChatDeactivateAccountJob(const std::optional<QJsonObject> &auth)
|
||||||
: BaseJob(HttpVerb::Post, QStringLiteral("DisableDeviceJob"), "_matrix/client/v3/account/deactivate")
|
: BaseJob(HttpVerb::Post, QStringLiteral("DisableDeviceJob"), "_matrix/client/v3/account/deactivate")
|
||||||
{
|
{
|
||||||
QJsonObject data;
|
QJsonObject data;
|
||||||
|
|||||||
@@ -4,10 +4,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/omittable.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 std::optional<QJsonObject> &auth = std::nullopt);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
NeochatDeleteDeviceJob::NeochatDeleteDeviceJob(const QString &deviceId, const Omittable<QJsonObject> &auth)
|
NeochatDeleteDeviceJob::NeochatDeleteDeviceJob(const QString &deviceId, const std::optional<QJsonObject> &auth)
|
||||||
: BaseJob(HttpVerb::Delete, QStringLiteral("DeleteDeviceJob"), QStringLiteral("/_matrix/client/r0/devices/%1").arg(deviceId).toLatin1())
|
: BaseJob(HttpVerb::Delete, QStringLiteral("DeleteDeviceJob"), QStringLiteral("/_matrix/client/r0/devices/%1").arg(deviceId).toLatin1())
|
||||||
{
|
{
|
||||||
QJsonObject _data;
|
QJsonObject _data;
|
||||||
|
|||||||
@@ -4,10 +4,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/omittable.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 std::optional<QJsonObject> &auth = std::nullopt);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -87,7 +87,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(), std::nullopt, std::nullopt, 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 +136,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, std::nullopt, std::nullopt, 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));
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ QString Registration::recaptchaSiteKey() const
|
|||||||
void Registration::registerAccount()
|
void Registration::registerAccount()
|
||||||
{
|
{
|
||||||
setStatus(Working);
|
setStatus(Working);
|
||||||
Omittable<QJsonObject> authData = none;
|
std::optional<QJsonObject> authData = none;
|
||||||
if (nextStep() == "m.login.recaptcha"_ls) {
|
if (nextStep() == "m.login.recaptcha"_ls) {
|
||||||
authData = QJsonObject{
|
authData = QJsonObject{
|
||||||
{"type"_ls, "m.login.recaptcha"_ls},
|
{"type"_ls, "m.login.recaptcha"_ls},
|
||||||
@@ -244,12 +244,12 @@ void Registration::setPassword(const QString &password)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NeoChatRegisterJob::NeoChatRegisterJob(const QString &kind,
|
NeoChatRegisterJob::NeoChatRegisterJob(const QString &kind,
|
||||||
const Omittable<QJsonObject> &auth,
|
const std::optional<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,
|
||||||
Omittable<bool> inhibitLogin)
|
std::optional<bool> inhibitLogin)
|
||||||
: BaseJob(HttpVerb::Post, "RegisterJob"_ls, QByteArrayLiteral("/_matrix/client/r0/register"), false)
|
: BaseJob(HttpVerb::Post, "RegisterJob"_ls, QByteArrayLiteral("/_matrix/client/r0/register"), false)
|
||||||
{
|
{
|
||||||
QJsonObject _data;
|
QJsonObject _data;
|
||||||
|
|||||||
@@ -27,12 +27,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 std::optional<QJsonObject> &auth = std::nullopt,
|
||||||
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);
|
std::optional<bool> inhibitLogin = std::nullopt);
|
||||||
|
|
||||||
QString userId() const
|
QString userId() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user