diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index 7e3864f78..c1607f4a8 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -666,8 +666,8 @@ void EditChatAdminsBoxController::Start(not_null chat) { Ui::show(Box(std::move(controller), std::move(initBox))); } -void AddBotToGroupBoxController::Start(not_null bot) { - auto initBox = [](not_null box) { +void AddBotToGroupBoxController::Start(not_null bot) { + 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/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 949a96a33..3d9177718 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -369,7 +369,8 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) { if (_pack.isEmpty()) return; auto ms = getms(); - qint32 from = std::floor(e->rect().top() / st::stickersSize.height()), to = std::floor(e->rect().bottom() / st::stickersSize.height()) + 1; + qint32 from = std::floor(e->rect().top() / st::stickersSize.height()), + to = std::floor(e->rect().bottom() / st::stickersSize.height()) + 1; for (qint32 i = from; i < to; ++i) { for (qint32 j = 0; j < kStickersPanelPerRow; ++j) { diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index fef29f50f..5b0dd3312 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -953,9 +953,9 @@ void StickersBox::Inner::setPressed(int pressed) { auto &set = _rows[_pressed]; auto rippleMask = Ui::RippleAnimation::rectMask(QSize(width(), _rowHeight)); if (!set->ripple) { - set->ripple = std::make_unique(st::contactsRipple, std::move(rippleMask), [this, index = _pressed] { - update(0, _itemsTop + index * _rowHeight, width(), _rowHeight); - }); + set->ripple = std::make_unique( + st::contactsRipple, std::move(rippleMask), + [this, index = _pressed] { update(0, _itemsTop + index * _rowHeight, width(), _rowHeight); }); } set->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + _pressed * _rowHeight)); } diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index 24685cddf..9e4e0cb5c 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -927,8 +927,12 @@ void FieldAutocompleteInner::onUpdateSelected(bool force) { qint32 sel = -1, maxSel = 0; if (!_srows->isEmpty()) { - qint32 row = (mouse.y() >= st::stickerPanPadding) ? ((mouse.y() - st::stickerPanPadding) / st::stickerPanSize.height()) : -1; - qint32 col = (mouse.x() >= st::stickerPanPadding) ? ((mouse.x() - st::stickerPanPadding) / st::stickerPanSize.width()) : -1; + qint32 row = (mouse.y() >= st::stickerPanPadding) ? + ((mouse.y() - st::stickerPanPadding) / st::stickerPanSize.height()) : + -1; + qint32 col = (mouse.x() >= st::stickerPanPadding) ? + ((mouse.x() - st::stickerPanPadding) / st::stickerPanSize.width()) : + -1; if (row >= 0 && col >= 0) { sel = row * _stickersPerRow + col; } diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 9594b4290..abcebf19d 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -1690,14 +1690,17 @@ void StickersListWidget::installSet(quint64 setId) { auto &sets = Global::StickerSets(); auto it = sets.constFind(setId); if (it != sets.cend()) { - request(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_bool(false))).done([](const MTPmessages_StickerSetInstallResult &result) { - if (result.type() == mtpc_messages_stickerSetInstallResultArchive) { - Stickers::ApplyArchivedResult(result.c_messages_stickerSetInstallResultArchive()); - } - }).fail([this, setId](const RPCError &error) { - notInstalledLocally(setId); - Stickers::UndoInstallLocally(setId); - }).send(); + request(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_bool(false))) + .done([](const MTPmessages_StickerSetInstallResult &result) { + if (result.type() == mtpc_messages_stickerSetInstallResultArchive) { + Stickers::ApplyArchivedResult(result.c_messages_stickerSetInstallResultArchive()); + } + }) + .fail([this, setId](const RPCError &error) { + notInstalledLocally(setId); + Stickers::UndoInstallLocally(setId); + }) + .send(); installedLocally(setId); Stickers::InstallLocally(setId); diff --git a/Telegram/SourceFiles/codegen/style/generator.cpp b/Telegram/SourceFiles/codegen/style/generator.cpp index c36eee498..0753a9b45 100644 --- a/Telegram/SourceFiles/codegen/style/generator.cpp +++ b/Telegram/SourceFiles/codegen/style/generator.cpp @@ -687,7 +687,7 @@ bool Generator::writeIncludesInSource() { } auto includes = QStringList(); - std::function collector = [&collector, &includes](const Module &module) { + std::function collector = [&collector, &includes](const Module &module) { module.enumIncludes(collector); auto base = moduleBaseName(module); if (!includes.contains(base)) { diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 7b2a7cc43..8237d4dde 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -2035,7 +2035,10 @@ void DialogsInner::loadPeerPhotos() { _filterResults.size(); if (from < 0) from = 0; if (from < _peerSearchResults.size()) { - qint32 to = (yTo > filteredOffset() + st::searchedBarHeight ? ((yTo - filteredOffset() - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) : 0) - _filterResults.size() + 1; + qint32 to = (yTo > filteredOffset() + st::searchedBarHeight ? + ((yTo - filteredOffset() - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) : + 0) - + _filterResults.size() + 1; if (to > _peerSearchResults.size()) to = _peerSearchResults.size(); for (; from < to; ++from) { diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index 93676225e..8fc79bd20 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -347,35 +347,32 @@ void RowPainter::paint(Painter &p, const Row *row, int fullWidth, bool active, b (st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2; auto unreadWidth = 0; - UnreadBadgeStyle st; - st.active = active; - st.muted = false; - st.padding = 0; - st.textTop = 0; - paintUnreadCount(p, counter, unreadRight, unreadTop, st, &unreadWidth); - availableWidth -= unreadWidth + st.padding + (hadOneBadge ? st::dialogsUnreadPadding : 0); - } - auto &color = active ? st::dialogsTextFgServiceActive : (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService); - if (!history->paintSendAction(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) { - item->drawInDialog( - p, - QRect(nameleft, texttop, availableWidth, st::dialogsTextFont->height), - active, - selected, - HistoryItem::DrawInDialog::Normal, - history->textCachedFor, - history->lastItemTextCache); - } - }, [&p, active, history, unreadCount] { - if (unreadCount) { - auto counter = QString::number(unreadCount); - if (counter.size() > 4) { - counter = qsl("..") + counter.mid(counter.size() - 3); - } - auto mutedCounter = history->mute(); - auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize; - auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight; - auto unreadWidth = 0; + UnreadBadgeStyle st; + st.active = active; + st.muted = false; + st.padding = 0; + st.textTop = 0; + paintUnreadCount(p, counter, unreadRight, unreadTop, st, &unreadWidth); + availableWidth -= unreadWidth + st.padding + (hadOneBadge ? st::dialogsUnreadPadding : 0); + } + auto &color = active ? st::dialogsTextFgServiceActive : + (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService); + if (!history->paintSendAction(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) { + item->drawInDialog(p, QRect(nameleft, texttop, availableWidth, st::dialogsTextFont->height), active, + selected, HistoryItem::DrawInDialog::Normal, history->textCachedFor, + history->lastItemTextCache); + } + }, + [&p, active, history, unreadCount] { + if (unreadCount) { + auto counter = QString::number(unreadCount); + if (counter.size() > 4) { + counter = qsl("..") + counter.mid(counter.size() - 3); + } + auto mutedCounter = history->mute(); + auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize; + auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight; + auto unreadWidth = 0; UnreadBadgeStyle st; st.active = active; diff --git a/Telegram/SourceFiles/history/history_admin_log_section.cpp b/Telegram/SourceFiles/history/history_admin_log_section.cpp index f252e246e..b8fe16534 100644 --- a/Telegram/SourceFiles/history/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_section.cpp @@ -379,7 +379,7 @@ void Widget::paintEvent(QPaintEvent *e) { Painter p(this); auto clip = e->rect(); - //auto ms = getms(); + // auto ms = getms(); //_historyDownShown.step(ms); auto fill = QRect(0, 0, width(), App::main()->height()); diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 1b1aa3df6..d3bbb7c6a 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -2154,7 +2154,9 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) { p.drawTextLeft(titleRect.x(), titleRect.y(), width(), lang(lng_theme_preview_title)); } - auto buttonsRect = QRect(_themePreviewRect.x(), _themePreviewRect.y() + _themePreviewRect.height() - st::themePreviewMargin.bottom(), _themePreviewRect.width(), st::themePreviewMargin.bottom()); + auto buttonsRect = QRect(_themePreviewRect.x(), + _themePreviewRect.y() + _themePreviewRect.height() - st::themePreviewMargin.bottom(), + _themePreviewRect.width(), st::themePreviewMargin.bottom()); if (buttonsRect.y() + buttonsRect.height() > height()) { buttonsRect.moveTop(height() - buttonsRect.height()); fillOverlay(buttonsRect); diff --git a/Telegram/SourceFiles/mtproto/session.cpp b/Telegram/SourceFiles/mtproto/session.cpp index 927d9ab0f..d27496711 100644 --- a/Telegram/SourceFiles/mtproto/session.cpp +++ b/Telegram/SourceFiles/mtproto/session.cpp @@ -50,7 +50,8 @@ void SessionData::setKey(const AuthKeyPtr &key) { void SessionData::clear(Instance *instance) { RPCCallbackClears clearCallbacks; { - QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()), locker4(wereAckedMutex()); + QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()), + locker4(wereAckedMutex()); clearCallbacks.reserve(_haveSent.size() + _wereAcked.size()); for (auto i = _haveSent.cbegin(), e = _haveSent.cend(); i != e; ++i) { auto requestId = i.value()->requestId; diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index 7aa0aa2c3..39cc25a40 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -1009,8 +1009,9 @@ void OverviewInner::onUpdateSelected() { } if (_dragAction == Selecting) { bool canSelectMany = (_peer != 0); - if (_mousedItem == _dragItem && lnk && !_selected.isEmpty() && _selected.cbegin().value() != FullSelection) { - _selected[_dragItem] = { 0, 0 }; + if (_mousedItem == _dragItem && lnk && !_selected.isEmpty() && + _selected.cbegin().value() != FullSelection) { + _selected[_dragItem] = {0, 0}; updateDragSelection(0, -1, 0, -1, false); } else if (canSelectMany) { bool selectingDown = diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 388e13c55..ff876ecc6 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -1771,7 +1771,9 @@ void DocumentData::performActionOnLoad() { auto showImage = !isVideo() && (size < App::kImageSizeLimit); auto playVoice = voice() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen); auto playMusic = tryPlaySong() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen); - auto playAnimation = isAnimation() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage && item && item->getMedia(); + auto playAnimation = isAnimation() && + (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage && + item && item->getMedia(); if (isTheme()) { if (!loc.isEmpty() && loc.accessEnable()) { Messenger::Instance().showDocument(this, item); diff --git a/Telegram/SourceFiles/ui/text/text_entity.cpp b/Telegram/SourceFiles/ui/text/text_entity.cpp index 210fe1a3d..fe42b9898 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.cpp +++ b/Telegram/SourceFiles/ui/text/text_entity.cpp @@ -2065,7 +2065,7 @@ QString ApplyEntities(const TextWithEntities &text) { QString result; qint32 size = text.text.size(); - const QChar *b = text.text.constData(), *already = b;//, *e = b + size; + const QChar *b = text.text.constData(), *already = b; //, *e = b + size; auto entity = text.entities.cbegin(), end = text.entities.cend(); auto skipTillRelevantAndGetTag = [&entity, &end, size, &tags] { while (entity != end) { diff --git a/Telegram/SourceFiles/ui/text/text_entity.h b/Telegram/SourceFiles/ui/text/text_entity.h index c821f99fa..8e6ffb2d0 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.h +++ b/Telegram/SourceFiles/ui/text/text_entity.h @@ -219,8 +219,10 @@ enum class PrepareTextOption { CheckLinks, }; inline QString PrepareForSending(const QString &text, PrepareTextOption option = PrepareTextOption::IgnoreLinks) { - auto result = TextWithEntities { text }; // , {}} - auto prepareFlags = (option == PrepareTextOption::CheckLinks) ? (TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands) : 0; + auto result = TextWithEntities{text}; // , {}} + auto prepareFlags = (option == PrepareTextOption::CheckLinks) ? + (TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands) : + 0; PrepareForSending(result, prepareFlags); return result.text; }