mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Move to std::optional.
This commit is contained in:
@@ -414,7 +414,7 @@ void GroupInfoBox::createGroup(not_null<PeerListBox*> selectUsersBox, const QStr
|
||||
App::main()->sentUpdatesReceived(result);
|
||||
|
||||
auto success = base::make_optional(&result)
|
||||
| [](auto updates) -> base::optional<const QVector<MTPChat>*> {
|
||||
| [](auto updates) -> std::optional<const QVector<MTPChat>*> {
|
||||
switch (updates->type()) {
|
||||
case mtpc_updates:
|
||||
return &updates->c_updates().vchats.v;
|
||||
@@ -422,12 +422,12 @@ void GroupInfoBox::createGroup(not_null<PeerListBox*> selectUsersBox, const QStr
|
||||
return &updates->c_updatesCombined().vchats.v;
|
||||
}
|
||||
LOG(("API Error: unexpected update cons %1 (GroupInfoBox::creationDone)").arg(updates->type()));
|
||||
return base::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
| [](auto chats) {
|
||||
return (!chats->empty() && chats->front().type() == mtpc_chat)
|
||||
? base::make_optional(chats)
|
||||
: base::none;
|
||||
: std::nullopt;
|
||||
}
|
||||
| [](auto chats) {
|
||||
return App::chat(chats->front().c_chat().vid.v);
|
||||
@@ -517,7 +517,7 @@ void GroupInfoBox::createChannel(const QString &title, const QString &descriptio
|
||||
App::main()->sentUpdatesReceived(result);
|
||||
|
||||
auto success = base::make_optional(&result)
|
||||
| [](auto updates) -> base::optional<const QVector<MTPChat>*> {
|
||||
| [](auto updates) -> std::optional<const QVector<MTPChat>*> {
|
||||
switch (updates->type()) {
|
||||
case mtpc_updates:
|
||||
return &updates->c_updates().vchats.v;
|
||||
@@ -525,12 +525,12 @@ void GroupInfoBox::createChannel(const QString &title, const QString &descriptio
|
||||
return &updates->c_updatesCombined().vchats.v;
|
||||
}
|
||||
LOG(("API Error: unexpected update cons %1 (GroupInfoBox::createChannel)").arg(updates->type()));
|
||||
return base::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
| [](auto chats) {
|
||||
return (!chats->empty() && chats->front().type() == mtpc_channel)
|
||||
? base::make_optional(chats)
|
||||
: base::none;
|
||||
: std::nullopt;
|
||||
}
|
||||
| [](auto chats) {
|
||||
return App::channel(chats->front().c_channel().vid.v);
|
||||
|
@@ -93,12 +93,12 @@ private:
|
||||
Ui::Checkbox *signatures = nullptr;
|
||||
};
|
||||
struct Saving {
|
||||
base::optional<QString> username;
|
||||
base::optional<QString> title;
|
||||
base::optional<QString> description;
|
||||
base::optional<bool> hiddenPreHistory;
|
||||
base::optional<bool> signatures;
|
||||
base::optional<bool> everyoneInvites;
|
||||
std::optional<QString> username;
|
||||
std::optional<QString> title;
|
||||
std::optional<QString> description;
|
||||
std::optional<bool> hiddenPreHistory;
|
||||
std::optional<bool> signatures;
|
||||
std::optional<bool> everyoneInvites;
|
||||
};
|
||||
|
||||
Fn<QString()> computeTitle() const;
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
void revokeInviteLink();
|
||||
void exportInviteLink(const QString &confirmation);
|
||||
|
||||
base::optional<Saving> validate() const;
|
||||
std::optional<Saving> validate() const;
|
||||
bool validateUsername(Saving &to) const;
|
||||
bool validateTitle(Saving &to) const;
|
||||
bool validateDescription(Saving &to) const;
|
||||
@@ -1087,7 +1087,7 @@ void Controller::submitDescription() {
|
||||
}
|
||||
}
|
||||
|
||||
base::optional<Controller::Saving> Controller::validate() const {
|
||||
std::optional<Controller::Saving> Controller::validate() const {
|
||||
auto result = Saving();
|
||||
if (validateUsername(result)
|
||||
&& validateTitle(result)
|
||||
|
@@ -44,7 +44,7 @@ private:
|
||||
bool reportFail(const RPCError &error);
|
||||
|
||||
not_null<PeerData*> _peer;
|
||||
base::optional<MessageIdsList> _ids;
|
||||
std::optional<MessageIdsList> _ids;
|
||||
|
||||
std::shared_ptr<Ui::RadioenumGroup<Reason>> _reasonGroup;
|
||||
object_ptr<Ui::Radioenum<Reason>> _reasonSpam = { nullptr };
|
||||
|
@@ -136,7 +136,7 @@ private:
|
||||
void drawSimpleFrame(Painter &p, QRect to, QSize size) const;
|
||||
|
||||
Ui::GroupMediaLayout _layout;
|
||||
base::optional<QRect> _animateFromGeometry;
|
||||
std::optional<QRect> _animateFromGeometry;
|
||||
const QImage _fullPreview;
|
||||
const int _shrinkSize = 0;
|
||||
QPixmap _albumImage;
|
||||
@@ -229,7 +229,7 @@ AlbumThumb::AlbumThumb(
|
||||
}
|
||||
|
||||
void AlbumThumb::resetLayoutAnimation() {
|
||||
_animateFromGeometry = base::none;
|
||||
_animateFromGeometry = std::nullopt;
|
||||
}
|
||||
|
||||
void AlbumThumb::animateLayoutToInitial() {
|
||||
|
Reference in New Issue
Block a user