From 87d608140819efa6e6d8df81623993c270df54d8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 7 Apr 2018 12:47:08 +0400 Subject: [PATCH] Version 1.2.16: Fix build in Xcode 9.3. --- Telegram/SourceFiles/apiwrap.cpp | 12 ++++----- Telegram/SourceFiles/auth_session.cpp | 4 +-- Telegram/SourceFiles/boxes/confirm_box.cpp | 2 +- .../boxes/edit_participant_box.cpp | 2 +- .../SourceFiles/boxes/edit_privacy_box.cpp | 4 +-- .../boxes/peer_list_controllers.cpp | 2 +- .../chat_helpers/stickers_list_widget.cpp | 2 +- .../SourceFiles/codegen/style/generator.cpp | 26 +++++++++---------- Telegram/SourceFiles/data/data_peer_values.h | 2 +- .../dialogs/dialogs_inner_widget.cpp | 4 +-- .../admin_log/history_admin_log_inner.cpp | 2 +- .../admin_log/history_admin_log_section.cpp | 2 +- .../history/history_inner_widget.cpp | 2 +- .../SourceFiles/history/history_widget.cpp | 2 +- .../inline_bots/inline_results_widget.cpp | 2 +- Telegram/SourceFiles/intro/introwidget.cpp | 7 +++-- Telegram/SourceFiles/mainwidget.cpp | 6 ++--- .../media/player/media_player_cover.cpp | 26 +++++++++---------- .../media/player/media_player_widget.cpp | 8 +++--- Telegram/SourceFiles/mediaview.cpp | 4 +-- .../profile/profile_block_group_members.cpp | 8 +++--- Telegram/SourceFiles/rpl/producer_tests.cpp | 2 +- .../settings/settings_advanced_widget.cpp | 4 +-- .../settings/settings_privacy_widget.cpp | 2 +- Telegram/SourceFiles/ui/images.cpp | 2 +- Telegram/SourceFiles/ui/special_buttons.cpp | 2 +- Telegram/SourceFiles/ui/widgets/tooltip.cpp | 4 +-- Telegram/SourceFiles/window/layer_widget.cpp | 2 +- .../themes/window_theme_editor_block.cpp | 6 ++--- .../SourceFiles/window/window_controller.cpp | 4 +-- Telegram/gyp/refresh.sh | 2 +- 31 files changed, 81 insertions(+), 78 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index e833d616e..30ff7c43a 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -908,7 +908,7 @@ void ApiWrap::requestPeers(const QList &peers) { channels.push_back((*i)->asChannel()->inputChannel); } } - auto handleChats = [this](const MTPmessages_Chats &result) { + auto handleChats = [=](const MTPmessages_Chats &result) { if (auto chats = Api::getChatsFromMessagesChats(result)) { App::feedChats(*chats); } @@ -920,7 +920,7 @@ void ApiWrap::requestPeers(const QList &peers) { request(MTPchannels_GetChannels(MTP_vector(channels))).done(handleChats).send(); } if (!users.isEmpty()) { - request(MTPusers_GetUsers(MTP_vector(users))).done([this](const MTPVector &result) { + request(MTPusers_GetUsers(MTP_vector(users))).done([=](const MTPVector &result) { App::feedUsers(result); }).send(); } @@ -1702,7 +1702,7 @@ void ApiWrap::handlePrivacyChange(mtpTypeId keyTypeId, const MTPVectorisSelf() || user->loadedStatus != PeerData::FullLoaded) { return; } @@ -2033,7 +2033,7 @@ void ApiWrap::requestParticipantsCountDelayed( not_null channel) { _participantsCountRequestTimer.call( kReloadChannelMembersTimeout, - [this, channel] { channel->updateFullForced(); }); + [=] { channel->updateFullForced(); }); } void ApiWrap::requestChannelRangeDifference(not_null history) { @@ -2296,7 +2296,7 @@ void ApiWrap::requestStickers(TimeId now) { }; _stickersUpdateRequest = request(MTPmessages_GetAllStickers( MTP_int(Local::countStickersHash(true)) - )).done(onDone).fail([this, onDone](const RPCError &error) { + )).done(onDone).fail([=](const RPCError &error) { LOG(("App Fail: Failed to get stickers!")); onDone(MTP_messages_allStickersNotModified()); }).send(); @@ -3738,7 +3738,7 @@ void ApiWrap::uploadAlbumMedia( const MessageGroupId &groupId, const MTPInputMedia &media) { const auto localId = item->fullId(); - const auto failed = [this] { + const auto failed = [=] { }; request(MTPmessages_UploadMedia( diff --git a/Telegram/SourceFiles/auth_session.cpp b/Telegram/SourceFiles/auth_session.cpp index 69059bd5d..0e51c5719 100644 --- a/Telegram/SourceFiles/auth_session.cpp +++ b/Telegram/SourceFiles/auth_session.cpp @@ -278,10 +278,10 @@ AuthSession::AuthSession(UserId userId) , _changelogs(Core::Changelogs::Create(this)) { Expects(_userId != 0); - _saveDataTimer.setCallback([this] { + _saveDataTimer.setCallback([=] { Local::writeUserSettings(); }); - subscribe(Messenger::Instance().passcodedChanged(), [this] { + subscribe(Messenger::Instance().passcodedChanged(), [=] { _shouldLockAt = 0; notifications().updateAll(); }); diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index c9abc36cc..e2578d0da 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -641,7 +641,7 @@ ConfirmInviteBox::ConfirmInviteBox(QWidget*, const QString &title, bool isChanne } void ConfirmInviteBox::prepare() { - addButton(langFactory(lng_group_invite_join), [this] { + addButton(langFactory(lng_group_invite_join), [] { if (auto main = App::main()) { main->onInviteImport(); } diff --git a/Telegram/SourceFiles/boxes/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/edit_participant_box.cpp index dbb88fe05..4c4745c45 100644 --- a/Telegram/SourceFiles/boxes/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_participant_box.cpp @@ -469,7 +469,7 @@ void EditRestrictedBox::createUntilVariants() { _untilVariants.back()->setDisabled(true); } }; - auto addCustomVariant = [this, addVariant](TimeId until, TimeId from, TimeId to) { + auto addCustomVariant = [addVariant](TimeId until, TimeId from, TimeId to) { if (!ChannelData::IsRestrictedForever(until) && until > from && until <= to) { addVariant( until, diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index 536257bfc..26319c9b5 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -95,7 +95,7 @@ void EditPrivacyBox::prepare() { int EditPrivacyBox::resizeGetHeight(int newWidth) { auto top = 0; - auto layoutRow = [this, newWidth, &top](auto &widget, style::margins padding) { + auto layoutRow = [&](auto &widget, style::margins padding) { if (!widget) return; widget->resizeToNaturalWidth(newWidth - padding.left() - padding.right()); widget->moveToLeft(padding.left(), top + padding.top()); @@ -137,7 +137,7 @@ int EditPrivacyBox::countDefaultHeight(int newWidth) { } return st::editPrivacyOptionMargin.top() + st::defaultCheck.diameter + st::editPrivacyOptionMargin.bottom(); }; - auto labelHeight = [this, newWidth](const QString &text, const style::FlatLabel &st, style::margins padding) { + auto labelHeight = [newWidth](const QString &text, const style::FlatLabel &st, style::margins padding) { if (text.isEmpty()) { return 0; } diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index a05c8ee74..43f494d28 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -731,7 +731,7 @@ void EditChatAdminsBoxController::Start(not_null chat) { } void AddBotToGroupBoxController::Start(not_null bot) { - auto initBox = [bot](not_null box) { + auto initBox = [=](not_null box) { box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); }); }; Ui::show(Box(std::make_unique(bot), std::move(initBox))); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 0d17beb62..fa3966251 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -256,7 +256,7 @@ void StickersListWidget::Footer::enumerateVisibleIcons(Callback callback) { } void StickersListWidget::Footer::preloadImages() { - enumerateVisibleIcons([this](const StickerIcon &icon, int x) { + enumerateVisibleIcons([](const StickerIcon &icon, int x) { if (auto sticker = icon.sticker) { sticker->thumb->load(); } diff --git a/Telegram/SourceFiles/codegen/style/generator.cpp b/Telegram/SourceFiles/codegen/style/generator.cpp index 98d9737d8..026e007b1 100644 --- a/Telegram/SourceFiles/codegen/style/generator.cpp +++ b/Telegram/SourceFiles/codegen/style/generator.cpp @@ -457,7 +457,7 @@ public:\n\ inline const color &get_transparent() const { return _colors[0]; }; // special color\n"; int indexInPalette = 1; - if (!module_.enumVariables([this, &indexInPalette](const Variable &variable) -> bool { + if (!module_.enumVariables([&](const Variable &variable) -> bool { auto name = variable.name.back(); if (variable.value.type().tag != structure::TypeTag::Color) { return false; @@ -584,7 +584,7 @@ QList data();\n\ } bool Generator::writeStructsForwardDeclarations() { - bool hasNoExternalStructs = module_.enumVariables([this](const Variable &value) -> bool { + bool hasNoExternalStructs = module_.enumVariables([&](const Variable &value) -> bool { if (value.value.type().tag == structure::TypeTag::Struct) { if (!module_.findStructInModule(value.value.type().name, module_)) { return false; @@ -598,7 +598,7 @@ bool Generator::writeStructsForwardDeclarations() { header_->newline(); std::set alreadyDeclaredTypes; - bool result = module_.enumVariables([this, &alreadyDeclaredTypes](const Variable &value) -> bool { + bool result = module_.enumVariables([&](const Variable &value) -> bool { if (value.value.type().tag == structure::TypeTag::Struct) { if (!module_.findStructInModule(value.value.type().name, module_)) { if (alreadyDeclaredTypes.find(value.value.type().name.back()) == alreadyDeclaredTypes.end()) { @@ -618,7 +618,7 @@ bool Generator::writeStructsDefinitions() { return true; } - bool result = module_.enumStructs([this](const Struct &value) -> bool { + bool result = module_.enumStructs([&](const Struct &value) -> bool { header_->stream() << "\ struct " << value.name.back() << " {\n"; for (auto &field : value.fields) { @@ -646,7 +646,7 @@ bool Generator::writeRefsDeclarations() { if (isPalette_) { header_->stream() << "extern const style::color &transparent; // special color\n"; } - bool result = module_.enumVariables([this](const Variable &value) -> bool { + bool result = module_.enumVariables([&](const Variable &value) -> bool { auto name = value.name.back(); auto type = typeToString(value.value.type()); if (type.isEmpty()) { @@ -668,7 +668,7 @@ bool Generator::writeIncludesInSource() { } auto includes = QStringList(); - std::function collector = [this, &collector, &includes](const Module &module) { + std::function collector = [&](const Module &module) { module.enumIncludes(collector); auto base = moduleBaseName(module); if (!includes.contains(base)) { @@ -690,7 +690,7 @@ bool Generator::writeVariableDefinitions() { } source_->newline(); - bool result = module_.enumVariables([this](const Variable &variable) -> bool { + bool result = module_.enumVariables([&](const Variable &variable) -> bool { auto name = variable.name.back(); auto type = typeToString(variable.value.type()); if (type.isEmpty()) { @@ -710,7 +710,7 @@ bool Generator::writeRefsDefinition() { if (isPalette_) { source_->stream() << "const style::color &transparent(_palette.get_transparent()); // special color\n"; } - bool result = module_.enumVariables([this](const Variable &variable) -> bool { + bool result = module_.enumVariables([&](const Variable &variable) -> bool { auto name = variable.name.back(); auto type = typeToString(variable.value.type()); if (type.isEmpty()) { @@ -752,7 +752,7 @@ void palette::finalize() {\n\ compute(0, -1, { 255, 255, 255, 0}); // special color\n"; QList names; - module_.enumVariables([this, &names](const Variable &variable) -> bool { + module_.enumVariables([&](const Variable &variable) -> bool { names.push_back(variable.name); return true; }); @@ -761,7 +761,7 @@ void palette::finalize() {\n\ int indexInPalette = 1; QByteArray checksumString; checksumString.append("&transparent:{ 255, 255, 255, 0 }"); - auto result = module_.enumVariables([this, &indexInPalette, &checksumString, &dataRows, &names](const Variable &variable) -> bool { + auto result = module_.enumVariables([&](const Variable &variable) -> bool { auto name = variable.name.back(); auto index = indexInPalette++; paletteIndices_.emplace(name, index); @@ -826,7 +826,7 @@ int getPaletteIndex(QLatin1String name) {\n\ auto tabsUsed = 1; // Returns true if at least one check was finished. - auto finishChecksTillKey = [this, &chars, &checkTypes, &checkLengthHistory, &tabsUsed, tabs](const QString &key) { + auto finishChecksTillKey = [&](const QString &key) { auto result = false; while (!chars.isEmpty() && key.midRef(0, chars.size()) != chars) { result = true; @@ -1069,7 +1069,7 @@ void init_" << baseName_ << "() {\n\ if (module_.hasIncludes()) { bool writtenAtLeastOne = false; - bool result = module_.enumIncludes([this,&writtenAtLeastOne](const Module &module) -> bool { + bool result = module_.enumIncludes([&](const Module &module) -> bool { if (module.hasVariables()) { source_->stream() << "\tinit_" + moduleBaseName(module) + "();\n"; writtenAtLeastOne = true; @@ -1096,7 +1096,7 @@ void init_" << baseName_ << "() {\n\ if (isPalette_) { source_->stream() << "\t_palette.finalize();\n"; - } else if (!module_.enumVariables([this](const Variable &variable) -> bool { + } else if (!module_.enumVariables([&](const Variable &variable) -> bool { auto name = variable.name.back(); auto value = valueAssignmentCode(variable.value); if (value.isEmpty()) { diff --git a/Telegram/SourceFiles/data/data_peer_values.h b/Telegram/SourceFiles/data/data_peer_values.h index 3346662ae..5196a1d54 100644 --- a/Telegram/SourceFiles/data/data_peer_values.h +++ b/Telegram/SourceFiles/data/data_peer_values.h @@ -34,7 +34,7 @@ inline auto SingleFlagValue( return FlagsValueWithMask( std::move(value), flag - ) | rpl::map([flag](typename ChangeType::Type value) { + ) | rpl::map([](typename ChangeType::Type value) { return !!value; }); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 2a8c3c154..1f4239598 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -95,7 +95,7 @@ DialogsInner::DialogsInner(QWidget *parent, not_null contro [this](auto item) { itemRemoved(item); }, lifetime()); Auth().data().itemRepaintRequest( - ) | rpl::start_with_next([this](auto item) { + ) | rpl::start_with_next([=](auto item) { const auto history = item->history(); if (history->textCachedFor == item) { history->updateChatListEntry(); @@ -114,7 +114,7 @@ DialogsInner::DialogsInner(QWidget *parent, not_null contro UpdateRowSection::Default | UpdateRowSection::Filtered); }); - subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &data) { + subscribe(Window::Theme::Background(), [=](const Window::Theme::BackgroundUpdate &data) { if (data.paletteChanged()) { Dialogs::Layout::clearUnreadBadgesCache(); } diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index 59edff71e..7e8f5cc9f 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -1193,7 +1193,7 @@ void InnerWidget::suggestRestrictUser(not_null user) { MTP_int(0)); editRestrictions(hasAdminRights, bannedRights); } - }).fail([this, editRestrictions](const RPCError &error) { + }).fail([=](const RPCError &error) { auto bannedRights = MTP_channelBannedRights( MTP_flags(0), MTP_int(0)); diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp index b8022e32b..8625b4010 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp @@ -261,7 +261,7 @@ Widget::Widget(QWidget *parent, not_null controller, not_nu connect(_scroll, &Ui::ScrollArea::scrolled, this, [this] { onScroll(); }); - _whatIsThis->setClickedCallback([this] { Ui::show(Box(lang(lng_admin_log_about_text))); }); + _whatIsThis->setClickedCallback([=] { Ui::show(Box(lang(lng_admin_log_about_text))); }); } void Widget::showFilter() { diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 32e8db3b8..6ab1278fa 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1732,7 +1732,7 @@ void HistoryInner::savePhotoToFile(not_null photo) { filedialogDefaultName( qsl("photo"), qsl(".jpg")), - base::lambda_guarded(this, [this, photo](const QString &result) { + base::lambda_guarded(this, [=](const QString &result) { if (!result.isEmpty()) { photo->full->pix().toImage().save(result, "JPG"); } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 088c87d8d..ad218f9f3 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -582,7 +582,7 @@ HistoryWidget::HistoryWidget( } }, lifetime()); Auth().data().animationPlayInlineRequest( - ) | rpl::start_with_next([this](auto item) { + ) | rpl::start_with_next([=](auto item) { if (const auto view = item->mainView()) { if (const auto media = view->media()) { media->playAnimation(); diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index e2b7ddea6..d021cd37f 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -443,7 +443,7 @@ int Inner::refreshInlineRows(PeerData *queryPeer, UserData *bot, const CacheEntr _inlineBot = bot; _inlineQueryPeer = queryPeer; refreshSwitchPmButton(entry); - auto clearResults = [this, entry]() { + auto clearResults = [&] { if (!entry) { return true; } diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp index 7a73317be..e1c4da652 100644 --- a/Telegram/SourceFiles/intro/introwidget.cpp +++ b/Telegram/SourceFiles/intro/introwidget.cpp @@ -104,7 +104,7 @@ void Widget::createLanguageLink() { this, object_ptr(this, text)); _changeLanguage->hide(anim::type::instant); - _changeLanguage->entity()->setClickedCallback([this, languageId] { + _changeLanguage->entity()->setClickedCallback([=] { Lang::CurrentCloudManager().switchToLanguage(languageId); }); _changeLanguage->toggle(!_resetAccount, anim::type::normal); @@ -117,7 +117,10 @@ void Widget::createLanguageLink() { if (!currentId.isEmpty() && currentId != defaultId) { createLink(Lang::GetOriginalValue(lng_switch_to_this), defaultId); } else if (!suggestedId.isEmpty() && suggestedId != currentId) { - request(MTPlangpack_GetStrings(MTP_string(suggestedId), MTP_vector(1, MTP_string("lng_switch_to_this")))).done([this, suggestedId, createLink](const MTPVector &result) { + request(MTPlangpack_GetStrings( + MTP_string(suggestedId), + MTP_vector(1, MTP_string("lng_switch_to_this")) + )).done([=](const MTPVector &result) { auto strings = Lang::Instance::ParseStrings(result); auto it = strings.find(lng_switch_to_this); if (it != strings.end()) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index ebf54fecc..a726d73cb 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -911,7 +911,7 @@ void MainWidget::cancelUploadLayer(not_null item) { void MainWidget::deletePhotoLayer(PhotoData *photo) { if (!photo) return; - Ui::show(Box(lang(lng_delete_photo_sure), lang(lng_box_delete), base::lambda_guarded(this, [this, photo] { + Ui::show(Box(lang(lng_delete_photo_sure), lang(lng_box_delete), base::lambda_guarded(this, [=] { Ui::hideLayer(); auto me = App::self(); @@ -1665,12 +1665,12 @@ void MainWidget::documentLoadFailed(FileLoader *loader, bool started) { auto document = Auth().data().document(documentId); if (started) { auto failedFileName = loader->fileName(); - Ui::show(Box(lang(lng_download_finish_failed), base::lambda_guarded(this, [this, document, failedFileName] { + Ui::show(Box(lang(lng_download_finish_failed), base::lambda_guarded(this, [=] { Ui::hideLayer(); if (document) document->save(failedFileName); }))); } else { - Ui::show(Box(lang(lng_download_path_failed), lang(lng_download_path_settings), base::lambda_guarded(this, [this] { + Ui::show(Box(lang(lng_download_path_failed), lang(lng_download_path_settings), base::lambda_guarded(this, [=] { Global::SetDownloadPath(QString()); Global::SetDownloadPathBookmark(QByteArray()); Ui::show(Box()); diff --git a/Telegram/SourceFiles/media/player/media_player_cover.cpp b/Telegram/SourceFiles/media/player/media_player_cover.cpp index 7c40f5380..209e45445 100644 --- a/Telegram/SourceFiles/media/player/media_player_cover.cpp +++ b/Telegram/SourceFiles/media/player/media_player_cover.cpp @@ -76,47 +76,47 @@ CoverWidget::CoverWidget(QWidget *parent) : RpWidget(parent) _timeLabel->setAttribute(Qt::WA_TransparentForMouseEvents); setMouseTracking(true); - _playback->setInLoadingStateChangedCallback([this](bool loading) { + _playback->setInLoadingStateChangedCallback([=](bool loading) { _playbackSlider->setDisabled(loading); }); - _playback->setValueChangedCallback([this](float64 value) { + _playback->setValueChangedCallback([=](float64 value) { _playbackSlider->setValue(value); }); - _playbackSlider->setChangeProgressCallback([this](float64 value) { + _playbackSlider->setChangeProgressCallback([=](float64 value) { _playback->setValue(value, false); handleSeekProgress(value); }); - _playbackSlider->setChangeFinishedCallback([this](float64 value) { + _playbackSlider->setChangeFinishedCallback([=](float64 value) { _playback->setValue(value, false); handleSeekFinished(value); }); - _playPause->setClickedCallback([this] { + _playPause->setClickedCallback([=] { instance()->playPauseCancelClicked(AudioMsgId::Type::Song); }); updateRepeatTrackIcon(); - _repeatTrack->setClickedCallback([this] { + _repeatTrack->setClickedCallback([=] { instance()->toggleRepeat(AudioMsgId::Type::Song); }); updateVolumeToggleIcon(); - _volumeToggle->setClickedCallback([this]() { + _volumeToggle->setClickedCallback([=]() { Global::SetSongVolume((Global::SongVolume() > 0) ? 0. : Global::RememberedSongVolume()); mixer()->setSongVolume(Global::SongVolume()); Global::RefSongVolumeChanged().notify(); }); - subscribe(Global::RefSongVolumeChanged(), [this] { updateVolumeToggleIcon(); }); - subscribe(instance()->repeatChangedNotifier(), [this](AudioMsgId::Type type) { + subscribe(Global::RefSongVolumeChanged(), [=] { updateVolumeToggleIcon(); }); + subscribe(instance()->repeatChangedNotifier(), [=](AudioMsgId::Type type) { if (type == AudioMsgId::Type::Song) { updateRepeatTrackIcon(); } }); - subscribe(instance()->updatedNotifier(), [this](const TrackState &state) { + subscribe(instance()->updatedNotifier(), [=](const TrackState &state) { if (state.id.type() == AudioMsgId::Type::Song) { handleSongUpdate(state); } }); - subscribe(instance()->trackChangedNotifier(), [this](AudioMsgId::Type type) { + subscribe(instance()->trackChangedNotifier(), [=](AudioMsgId::Type type) { if (type == AudioMsgId::Type::Song) { handleSongChange(); } @@ -353,12 +353,12 @@ void CoverWidget::createPrevNextButtons() { if (!_previousTrack) { _previousTrack.create(this, st::mediaPlayerPanelPreviousButton); _previousTrack->show(); - _previousTrack->setClickedCallback([this]() { + _previousTrack->setClickedCallback([=]() { instance()->previous(); }); _nextTrack.create(this, st::mediaPlayerPanelNextButton); _nextTrack->show(); - _nextTrack->setClickedCallback([this]() { + _nextTrack->setClickedCallback([=]() { instance()->next(); }); updatePlayPrevNextPositions(); diff --git a/Telegram/SourceFiles/media/player/media_player_widget.cpp b/Telegram/SourceFiles/media/player/media_player_widget.cpp index 4977c2246..ee5f356b7 100644 --- a/Telegram/SourceFiles/media/player/media_player_widget.cpp +++ b/Telegram/SourceFiles/media/player/media_player_widget.cpp @@ -116,7 +116,7 @@ Widget::Widget(QWidget *parent) : RpWidget(parent) }); updateVolumeToggleIcon(); - _volumeToggle->setClickedCallback([this] { + _volumeToggle->setClickedCallback([=] { Global::SetSongVolume((Global::SongVolume() > 0) ? 0. : Global::RememberedSongVolume()); mixer()->setSongVolume(Global::SongVolume()); Global::RefSongVolumeChanged().notify(); @@ -124,7 +124,7 @@ Widget::Widget(QWidget *parent) : RpWidget(parent) subscribe(Global::RefSongVolumeChanged(), [this] { updateVolumeToggleIcon(); }); updateRepeatTrackIcon(); - _repeatTrack->setClickedCallback([this] { + _repeatTrack->setClickedCallback([=] { instance()->toggleRepeat(AudioMsgId::Type::Song); }); @@ -538,12 +538,12 @@ void Widget::createPrevNextButtons() { if (!_previousTrack) { _previousTrack.create(this, st::mediaPlayerPreviousButton); _previousTrack->show(); - _previousTrack->setClickedCallback([this]() { + _previousTrack->setClickedCallback([=]() { instance()->previous(); }); _nextTrack.create(this, st::mediaPlayerNextButton); _nextTrack->show(); - _nextTrack->setClickedCallback([this]() { + _nextTrack->setClickedCallback([=]() { instance()->next(); }); updatePlayPrevNextPositions(); diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index e73d1089a..5ef3d4301 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -152,7 +152,7 @@ void MediaView::refreshLang() { } void MediaView::moveToScreen() { - auto widgetScreen = [this](auto &&widget) -> QScreen* { + auto widgetScreen = [&](auto &&widget) -> QScreen* { if (auto handle = widget ? widget->windowHandle() : nullptr) { return handle->screen(); } @@ -2280,7 +2280,7 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) { } } - auto fillOverlay = [this, &p, clip](QRect fill) { + auto fillOverlay = [&](QRect fill) { auto clipped = fill.intersected(clip); if (!clipped.isEmpty()) { p.setOpacity(st::themePreviewOverlayOpacity); diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.cpp b/Telegram/SourceFiles/profile/profile_block_group_members.cpp index 568411444..7be60b05b 100644 --- a/Telegram/SourceFiles/profile/profile_block_group_members.cpp +++ b/Telegram/SourceFiles/profile/profile_block_group_members.cpp @@ -43,16 +43,16 @@ GroupMembersWidget::GroupMembersWidget( notifyPeerUpdated(update); })); - setRemovedCallback([this, peer](PeerData *selectedPeer) { + setRemovedCallback([=](PeerData *selectedPeer) { removePeer(selectedPeer); }); - setSelectedCallback([this](PeerData *selectedPeer) { + setSelectedCallback([=](PeerData *selectedPeer) { Ui::showPeerProfile(selectedPeer); }); - setUpdateItemCallback([this](Item *item) { + setUpdateItemCallback([=](Item *item) { updateItemStatusText(item); }); - setPreloadMoreCallback([this] { + setPreloadMoreCallback([=] { preloadMore(); }); diff --git a/Telegram/SourceFiles/rpl/producer_tests.cpp b/Telegram/SourceFiles/rpl/producer_tests.cpp index b1f090cda..42fc60383 100644 --- a/Telegram/SourceFiles/rpl/producer_tests.cpp +++ b/Telegram/SourceFiles/rpl/producer_tests.cpp @@ -171,7 +171,7 @@ TEST_CASE("basic event_streams tests", "[rpl::event_stream]") { stream.fire(3); { auto saved = lifetime(); - stream.events().start([=, &stream](int value) { + stream.events().start([=](int value) { *sum += value; }, [=](no_error) { }, [=] { diff --git a/Telegram/SourceFiles/settings/settings_advanced_widget.cpp b/Telegram/SourceFiles/settings/settings_advanced_widget.cpp index d77f4878f..057590269 100644 --- a/Telegram/SourceFiles/settings/settings_advanced_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_advanced_widget.cpp @@ -41,13 +41,13 @@ void AdvancedWidget::createControls() { style::margins marginSmall(0, 0, 0, st::settingsSmallSkip); style::margins marginLarge(0, 0, 0, st::settingsLargeSkip); - style::margins marginLocalStorage = ([&marginSmall, &marginLarge]() { + style::margins marginLocalStorage = [&] { #ifndef TDESKTOP_DISABLE_NETWORK_PROXY return marginSmall; #else // !TDESKTOP_DISABLE_NETWORK_PROXY return marginLarge; #endif // TDESKTOP_DISABLE_NETWORK_PROXY - })(); + }(); if (self()) { createChildRow(_manageLocalStorage, marginLocalStorage, lang(lng_settings_manage_local_storage), SLOT(onManageLocalStorage())); } diff --git a/Telegram/SourceFiles/settings/settings_privacy_widget.cpp b/Telegram/SourceFiles/settings/settings_privacy_widget.cpp index 914395a72..bdbc51734 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_widget.cpp @@ -199,7 +199,7 @@ void PrivacyWidget::autoLockUpdated() { void PrivacyWidget::onBlockedUsers() { Ui::show(Box(std::make_unique(), [](not_null box) { box->addButton(langFactory(lng_close), [box] { box->closeBox(); }); - box->addLeftButton(langFactory(lng_blocked_list_add), [box] { BlockedBoxController::BlockNewUser(); }); + box->addLeftButton(langFactory(lng_blocked_list_add), [=] { BlockedBoxController::BlockNewUser(); }); })); } diff --git a/Telegram/SourceFiles/ui/images.cpp b/Telegram/SourceFiles/ui/images.cpp index 4c7796ea7..ead43062a 100644 --- a/Telegram/SourceFiles/ui/images.cpp +++ b/Telegram/SourceFiles/ui/images.cpp @@ -214,7 +214,7 @@ void prepareRound( auto intsTopRight = ints + target.x() + target.width() - cornerWidth + target.y() * imageWidth; auto intsBottomLeft = ints + target.x() + (target.y() + target.height() - cornerHeight) * imageWidth; auto intsBottomRight = ints + target.x() + target.width() - cornerWidth + (target.y() + target.height() - cornerHeight) * imageWidth; - auto maskCorner = [imageWidth, imageHeight, imageIntsPerPixel, imageIntsPerLine](uint32 *imageInts, const QImage &mask) { + auto maskCorner = [&](uint32 *imageInts, const QImage &mask) { auto maskWidth = mask.width(); auto maskHeight = mask.height(); auto maskBytesPerPixel = (mask.depth() >> 3); diff --git a/Telegram/SourceFiles/ui/special_buttons.cpp b/Telegram/SourceFiles/ui/special_buttons.cpp index 98c045e45..85ac56358 100644 --- a/Telegram/SourceFiles/ui/special_buttons.cpp +++ b/Telegram/SourceFiles/ui/special_buttons.cpp @@ -302,7 +302,7 @@ void SendButton::paintEvent(QPaintEvent *e) { auto rippleColor = anim::color(st::historyAttachEmoji.ripple.color, st::historyRecordVoiceRippleBgActive, recordActive); paintRipple(p, (width() - st::historyAttachEmoji.rippleAreaSize) / 2, st::historyAttachEmoji.rippleAreaPosition.y(), ms, &rippleColor); - auto fastIcon = [recordActive, over, this] { + auto fastIcon = [&] { if (recordActive == 1.) { return &st::historyRecordVoiceActive; } else if (over) { diff --git a/Telegram/SourceFiles/ui/widgets/tooltip.cpp b/Telegram/SourceFiles/ui/widgets/tooltip.cpp index 26cac6b43..6f5a6bfac 100644 --- a/Telegram/SourceFiles/ui/widgets/tooltip.cpp +++ b/Telegram/SourceFiles/ui/widgets/tooltip.cpp @@ -40,8 +40,8 @@ Tooltip::Tooltip() : TWidget(nullptr) { setAttribute(Qt::WA_NoSystemBackground, true); setAttribute(Qt::WA_TranslucentBackground, true); - _showTimer.setCallback([this] { performShow(); }); - _hideByLeaveTimer.setCallback([this] { Hide(); }); + _showTimer.setCallback([=] { performShow(); }); + _hideByLeaveTimer.setCallback([=] { Hide(); }); connect(App::wnd()->windowHandle(), SIGNAL(activeChanged()), this, SLOT(onWndActiveChanged())); } diff --git a/Telegram/SourceFiles/window/layer_widget.cpp b/Telegram/SourceFiles/window/layer_widget.cpp index 03a1ac0ed..8d755f5c1 100644 --- a/Telegram/SourceFiles/window/layer_widget.cpp +++ b/Telegram/SourceFiles/window/layer_widget.cpp @@ -961,7 +961,7 @@ QPixmap MediaPreviewWidget::currentImage() const { if (_document->loaded()) { if (!_gif && !_gif.isBad()) { auto that = const_cast(this); - that->_gif = Media::Clip::MakeReader(_document, FullMsgId(), [this, that](Media::Clip::Notification notification) { + that->_gif = Media::Clip::MakeReader(_document, FullMsgId(), [=](Media::Clip::Notification notification) { that->clipCallback(notification); }); if (_gif) _gif->setAutoplay(); diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp index 0fcced4bf..d2a901b8e 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp @@ -127,14 +127,14 @@ void EditorBlock::Row::setValue(QColor value) { } void EditorBlock::Row::fillValueString() { - auto addHex = [this](int code) { + auto addHex = [=](int code) { if (code >= 0 && code < 10) { _valueString.append('0' + code); } else if (code >= 10 && code < 16) { _valueString.append('a' + (code - 10)); } }; - auto addCode = [this, addHex](int code) { + auto addCode = [=](int code) { addHex(code / 16); addHex(code % 16); }; @@ -459,7 +459,7 @@ void EditorBlock::enumerateRowsFrom(int top, Callback callback) const { int EditorBlock::resizeGetHeight(int newWidth) { auto result = 0; auto descriptionWidth = newWidth - st::themeEditorMargin.left() - st::themeEditorMargin.right(); - enumerateRows([this, &result, descriptionWidth](Row &row) { + enumerateRows([&](Row &row) { row.setTop(result); auto height = row.height(); diff --git a/Telegram/SourceFiles/window/window_controller.cpp b/Telegram/SourceFiles/window/window_controller.cpp index f307b628b..43951c2f2 100644 --- a/Telegram/SourceFiles/window/window_controller.cpp +++ b/Telegram/SourceFiles/window/window_controller.cpp @@ -141,7 +141,7 @@ Controller::ColumnLayout Controller::computeColumnLayout() const { auto bodyWidth = window()->bodyWidget()->width(); auto dialogsWidth = 0, chatWidth = 0, thirdWidth = 0; - auto useOneColumnLayout = [this, bodyWidth] { + auto useOneColumnLayout = [&] { auto minimalNormal = st::columnMinimalWidthLeft + st::columnMinimalWidthMain; if (bodyWidth < minimalNormal) { @@ -150,7 +150,7 @@ Controller::ColumnLayout Controller::computeColumnLayout() const { return false; }; - auto useNormalLayout = [this, bodyWidth] { + auto useNormalLayout = [&] { // Used if useSmallColumnLayout() == false. if (bodyWidth < minimalThreeColumnWidth()) { return true; diff --git a/Telegram/gyp/refresh.sh b/Telegram/gyp/refresh.sh index f808de5ba..348eda42c 100755 --- a/Telegram/gyp/refresh.sh +++ b/Telegram/gyp/refresh.sh @@ -28,7 +28,7 @@ else #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode # use patched gyp with Xcode project generator - ../../../Libraries/gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out -Gxcode_upgrade_check_project_version=920 -Dofficial_build_target=$BuildTarget Telegram.gyp --format=xcode + ../../../Libraries/gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out -Gxcode_upgrade_check_project_version=930 -Dofficial_build_target=$BuildTarget Telegram.gyp --format=xcode fi cd ../..