mirror of https://github.com/procxx/kepka.git
Use nullptr instead of std::unique_ptr<Type>().
This commit is contained in:
parent
0bea2620b5
commit
012d59ab42
|
@ -601,7 +601,7 @@ ContactsBox::Inner::Inner(QWidget *parent, ChatData *chat, MembersFilter members
|
||||||
, _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPadding.right())
|
, _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPadding.right())
|
||||||
, _aboutAllAdmins(st::defaultTextStyle, lang(lng_chat_about_all_admins), _defaultOptions, _aboutWidth)
|
, _aboutAllAdmins(st::defaultTextStyle, lang(lng_chat_about_all_admins), _defaultOptions, _aboutWidth)
|
||||||
, _aboutAdmins(st::defaultTextStyle, lang(lng_chat_about_admins), _defaultOptions, _aboutWidth)
|
, _aboutAdmins(st::defaultTextStyle, lang(lng_chat_about_admins), _defaultOptions, _aboutWidth)
|
||||||
, _customList((membersFilter == MembersFilter::Recent) ? std::unique_ptr<Dialogs::IndexedList>() : std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Add))
|
, _customList((membersFilter == MembersFilter::Recent) ? nullptr : std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Add))
|
||||||
, _contacts((membersFilter == MembersFilter::Recent) ? App::main()->contactsList() : _customList.get())
|
, _contacts((membersFilter == MembersFilter::Recent) ? App::main()->contactsList() : _customList.get())
|
||||||
, _addContactLnk(this, lang(lng_add_contact_button)) {
|
, _addContactLnk(this, lang(lng_add_contact_button)) {
|
||||||
initList();
|
initList();
|
||||||
|
|
|
@ -78,12 +78,13 @@ void PrivacyExceptionsBoxController::rowClicked(gsl::not_null<PeerListRow*> row)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PrivacyExceptionsBoxController::Row> PrivacyExceptionsBoxController::createRow(gsl::not_null<History*> history) {
|
std::unique_ptr<PrivacyExceptionsBoxController::Row> PrivacyExceptionsBoxController::createRow(gsl::not_null<History*> history) {
|
||||||
if (auto user = history->peer->asUser()) {
|
if (history->peer->isSelf()) {
|
||||||
if (!user->isSelf()) {
|
return nullptr;
|
||||||
return std::make_unique<Row>(history);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return std::unique_ptr<Row>();
|
if (auto user = history->peer->asUser()) {
|
||||||
|
return std::make_unique<Row>(history);
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -258,7 +258,7 @@ public:
|
||||||
return _searchController ? _searchController->isLoading() : false;
|
return _searchController ? _searchController->isLoading() : false;
|
||||||
}
|
}
|
||||||
virtual std::unique_ptr<PeerListRow> createSearchRow(gsl::not_null<PeerData*> peer) {
|
virtual std::unique_ptr<PeerListRow> createSearchRow(gsl::not_null<PeerData*> peer) {
|
||||||
return std::unique_ptr<PeerListRow>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRowSelected(gsl::not_null<PeerData*> peer) {
|
bool isRowSelected(gsl::not_null<PeerData*> peer) {
|
||||||
|
|
|
@ -4275,7 +4275,7 @@ void HistoryWidget::uploadFiles(const QStringList &files, SendMediaType type) {
|
||||||
if (!canWriteMessage()) return;
|
if (!canWriteMessage()) return;
|
||||||
|
|
||||||
auto caption = QString();
|
auto caption = QString();
|
||||||
uploadFilesAfterConfirmation(files, QByteArray(), QImage(), std::unique_ptr<FileLoadTask::MediaInformation>(), type, caption);
|
uploadFilesAfterConfirmation(files, QByteArray(), QImage(), nullptr, type, caption);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::uploadFilesAfterConfirmation(const QStringList &files, const QByteArray &content, const QImage &image, std::unique_ptr<FileLoadTask::MediaInformation> information, SendMediaType type, QString caption) {
|
void HistoryWidget::uploadFilesAfterConfirmation(const QStringList &files, const QByteArray &content, const QImage &image, std::unique_ptr<FileLoadTask::MediaInformation> information, SendMediaType type, QString caption) {
|
||||||
|
|
|
@ -121,7 +121,7 @@ std::unique_ptr<ItemBase> ItemBase::createLayout(gsl::not_null<Context*> context
|
||||||
case Type::Game: return std::make_unique<internal::Game>(context, result); break;
|
case Type::Game: return std::make_unique<internal::Game>(context, result); break;
|
||||||
case Type::Contact: return std::make_unique<internal::Contact>(context, result); break;
|
case Type::Contact: return std::make_unique<internal::Contact>(context, result); break;
|
||||||
}
|
}
|
||||||
return std::unique_ptr<ItemBase>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ItemBase> ItemBase::createLayoutGif(gsl::not_null<Context*> context, DocumentData *document) {
|
std::unique_ptr<ItemBase> ItemBase::createLayoutGif(gsl::not_null<Context*> context, DocumentData *document) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ std::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
|
||||||
};
|
};
|
||||||
Type type = getInlineResultType(mtpData);
|
Type type = getInlineResultType(mtpData);
|
||||||
if (type == Type::Unknown) {
|
if (type == Type::Unknown) {
|
||||||
return std::unique_ptr<Result>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = std::make_unique<Result>(Creator{ queryId, type });
|
auto result = std::make_unique<Result>(Creator{ queryId, type });
|
||||||
|
@ -100,18 +100,18 @@ std::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
|
||||||
bool badAttachment = (result->_photo && !result->_photo->access) || (result->_document && !result->_document->isValid());
|
bool badAttachment = (result->_photo && !result->_photo->access) || (result->_document && !result->_document->isValid());
|
||||||
|
|
||||||
if (!message) {
|
if (!message) {
|
||||||
return std::unique_ptr<Result>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure required media fields for layouts.
|
// Ensure required media fields for layouts.
|
||||||
if (result->_type == Type::Photo) {
|
if (result->_type == Type::Photo) {
|
||||||
if (!result->_photo && result->_content_url.isEmpty()) {
|
if (!result->_photo && result->_content_url.isEmpty()) {
|
||||||
return std::unique_ptr<Result>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
result->createPhoto();
|
result->createPhoto();
|
||||||
} else if (result->_type == Type::File || result->_type == Type::Gif || result->_type == Type::Sticker) {
|
} else if (result->_type == Type::File || result->_type == Type::Gif || result->_type == Type::Sticker) {
|
||||||
if (!result->_document && result->_content_url.isEmpty()) {
|
if (!result->_document && result->_content_url.isEmpty()) {
|
||||||
return std::unique_ptr<Result>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
result->createDocument();
|
result->createDocument();
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ std::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
|
||||||
}
|
}
|
||||||
|
|
||||||
if (badAttachment || !result->sendData || !result->sendData->isValid()) {
|
if (badAttachment || !result->sendData || !result->sendData->isValid()) {
|
||||||
return std::unique_ptr<Result>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result->_thumb->isNull() && !result->_thumb_url.isEmpty()) {
|
if (result->_thumb->isNull() && !result->_thumb_url.isEmpty()) {
|
||||||
|
|
|
@ -616,7 +616,7 @@ bool Mixer::fadedStop(AudioMsgId::Type type, bool *fadedStart) {
|
||||||
|
|
||||||
void Mixer::play(const AudioMsgId &audio, int64 position) {
|
void Mixer::play(const AudioMsgId &audio, int64 position) {
|
||||||
setSongVolume(Global::SongVolume());
|
setSongVolume(Global::SongVolume());
|
||||||
play(audio, std::unique_ptr<VideoSoundData>(), position);
|
play(audio, nullptr, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mixer::play(const AudioMsgId &audio, std::unique_ptr<VideoSoundData> videoData, int64 position) {
|
void Mixer::play(const AudioMsgId &audio, std::unique_ptr<VideoSoundData> videoData, int64 position) {
|
||||||
|
|
|
@ -121,7 +121,7 @@ std::unique_ptr<PeerListRow> ParticipantsBoxController::createSearchRow(gsl::not
|
||||||
if (auto user = peer->asUser()) {
|
if (auto user = peer->asUser()) {
|
||||||
return createRow(user);
|
return createRow(user);
|
||||||
}
|
}
|
||||||
return std::unique_ptr<PeerListRow>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
|
@ -691,12 +691,13 @@ AddParticipantBoxController::AddParticipantBoxController(gsl::not_null<ChannelDa
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> AddParticipantBoxController::createSearchRow(gsl::not_null<PeerData*> peer) {
|
std::unique_ptr<PeerListRow> AddParticipantBoxController::createSearchRow(gsl::not_null<PeerData*> peer) {
|
||||||
if (!peer->isSelf()) {
|
if (peer->isSelf()) {
|
||||||
if (auto user = peer->asUser()) {
|
return nullptr;
|
||||||
return createRow(user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return std::unique_ptr<PeerListRow>();
|
if (auto user = peer->asUser()) {
|
||||||
|
return createRow(user);
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddParticipantBoxController::prepare() {
|
void AddParticipantBoxController::prepare() {
|
||||||
|
|
|
@ -83,12 +83,15 @@ void BlockUserBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<BlockUserBoxController::Row> BlockUserBoxController::createRow(gsl::not_null<History*> history) {
|
std::unique_ptr<BlockUserBoxController::Row> BlockUserBoxController::createRow(gsl::not_null<History*> history) {
|
||||||
|
if (history->peer->isSelf()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
if (auto user = history->peer->asUser()) {
|
if (auto user = history->peer->asUser()) {
|
||||||
auto row = std::make_unique<Row>(history);
|
auto row = std::make_unique<Row>(history);
|
||||||
updateIsBlocked(row.get(), user);
|
updateIsBlocked(row.get(), user);
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
return std::unique_ptr<Row>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -392,7 +392,7 @@ void CountrySelectBox::Inner::mousePressEvent(QMouseEvent *e) {
|
||||||
if (_ripples.size() <= _pressed) {
|
if (_ripples.size() <= _pressed) {
|
||||||
_ripples.reserve(_pressed + 1);
|
_ripples.reserve(_pressed + 1);
|
||||||
while (_ripples.size() <= _pressed) {
|
while (_ripples.size() <= _pressed) {
|
||||||
_ripples.push_back(std::unique_ptr<Ui::RippleAnimation>());
|
_ripples.push_back(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_ripples[_pressed]) {
|
if (!_ripples[_pressed]) {
|
||||||
|
|
|
@ -893,7 +893,7 @@ std::unique_ptr<Preview> GeneratePreview(const QString &filepath, const CurrentD
|
||||||
auto result = std::make_unique<Preview>();
|
auto result = std::make_unique<Preview>();
|
||||||
result->path = filepath;
|
result->path = filepath;
|
||||||
if (!LoadFromFile(filepath, &result->instance, &result->content)) {
|
if (!LoadFromFile(filepath, &result->instance, &result->content)) {
|
||||||
return std::unique_ptr<Preview>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
result->preview = Generator(result->instance, data).generate();
|
result->preview = Generator(result->instance, data).generate();
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue