Fix more warnings

This commit is contained in:
Evgenii Zheltonozhskii 2018-10-21 19:55:59 +03:00 committed by Alex
parent 16318f93fc
commit 4b78d52194
38 changed files with 43 additions and 128 deletions

View File

@ -43,7 +43,6 @@ AboutBox::AboutBox(QWidget *parent)
, _text3(this, st::aboutLabel) {}
void AboutBox::prepare() {
constexpr auto test = std::is_convertible<const char *, QString>::value;
setTitle([] { return str_const_toString(AppName); });
addButton(langFactory(lng_close), [this] { closeBox(); });

View File

@ -465,7 +465,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, lng_rights_chat_banned_custom_date(lt_date, langDayOfMonthFull(date(until).date())));
}

View File

@ -860,7 +860,6 @@ void GifsListWidget::updateSelected() {
return;
}
auto newSelected = -1;
auto p = mapFromGlobal(_lastMousePos);
int sx = (rtl() ? width() - p.x() : p.x()) - (st::inlineResultsLeft - st::buttonRadius);

View File

@ -489,7 +489,6 @@ object_ptr<TabbedSelector::InnerFooter> StickersListWidget::createFooter() {
}
void StickersListWidget::setVisibleTopBottom(int visibleTop, int visibleBottom) {
auto top = getVisibleTop();
Inner::setVisibleTopBottom(visibleTop, visibleBottom);
if (_section == Section::Featured) {
readVisibleSets();
@ -1501,7 +1500,6 @@ void StickersListWidget::updateSelected() {
newSelected = OverGroupAdd{};
}
} else {
auto special = ((set.flags & MTPDstickerSet::Flag::f_official) != 0);
int rowIndex = std::floor(yOffset / st::stickerPanSize.height());
int columnIndex = std::floor(sx / st::stickerPanSize.width());
auto index = rowIndex * kStickersPanelPerRow + columnIndex;

View File

@ -240,7 +240,6 @@ void DialogsWidget::showAnimated(Window::SlideDirection direction, const Window:
_chooseFromUser->hideFast();
_lockUnlock->hide();
int delta = st::slideShift;
if (_showDirection == Window::SlideDirection::FromLeft) {
std::swap(_cacheUnder, _cacheOver);
}

View File

@ -1532,7 +1532,6 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
// If no items were added it means we've loaded everything old.
oldLoaded = true;
} else if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors
bool channel = isChannel();
qint32 mask = 0;
QList<not_null<UserData *>> *lastAuthors = nullptr;
std::set<not_null<PeerData *>> *markupSenders = nullptr;
@ -1540,12 +1539,10 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
lastAuthors = &peer->asChat()->lastAuthors;
markupSenders = &peer->asChat()->markupSenders;
} else if (peer->isMegagroup()) {
// We don't add users to mgInfo->lastParticipants here.
// We're scrolling back and we see messages from users that
// could be gone from the megagroup already. It is fine for
// chat->lastAuthors, because they're used only for field
// autocomplete, but this is bad for megagroups, because its
// lastParticipants are displayed in Profile as members list.
// We don't add users to mgInfo->lastParticipants here. We're scrolling back and we see messages from users
// that could be gone from the megagroup already. It is fine for chat->lastAuthors, because they're used
// only for field autocomplete, but this is bad for megagroups, because its lastParticipants are displayed
// in Profile as members list.
markupSenders = &peer->asChannel()->mgInfo->markupSenders;
}
for (auto i = block->items.size(); i > 0; --i) {
@ -1632,7 +1629,7 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
}
void History::addNewerSlice(const QVector<MTPMessage> &slice) {
bool wasEmpty = isEmpty(), wasLoadedAtBottom = loadedAtBottom();
bool wasLoadedAtBottom = loadedAtBottom();
if (slice.isEmpty()) {
newLoaded = true;
@ -1981,7 +1978,6 @@ HistoryBlock *History::finishBuildingFrontBlock() {
auto block = _buildingFrontBlock->block;
if (block) {
if (blocks.size() > 1) {
auto last = block->items.back(); // ... item, item, item, last ], [ first, item, item ...
auto first = blocks[1]->items.front();
// we've added a new front block, so previous item for

View File

@ -724,7 +724,6 @@ void InnerWidget::clearAfterFilterChange() {
}
void InnerWidget::paintEmpty(Painter &p) {
style::font font(st::msgServiceFont);
auto rectWidth = st::historyAdminLogEmptyWidth;
auto innerWidth = rectWidth - st::historyAdminLogEmptyPadding.left() - st::historyAdminLogEmptyPadding.right();
auto rectHeight = st::historyAdminLogEmptyPadding.top() + _emptyText.countHeight(innerWidth) +
@ -877,8 +876,6 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
suggestRestrictUser(user);
}
} else { // maybe cursor on some text history item?
bool canDelete = item && item->canDelete() && (item->id > 0 || !item->serviceMsg());
bool canForward = item && item->canForward();
auto msg = dynamic_cast<HistoryMessage *>(item);
if (isUponSelected > 0) {
@ -966,7 +963,7 @@ void InnerWidget::savePhotoToFile(PhotoData *photo) {
auto filter = qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter();
FileDialog::GetWritePath(lang(lng_save_photo), filter, filedialogDefaultName(qsl("photo"), qsl(".jpg")),
base::lambda_guarded(this, [this, photo](const QString &result) {
base::lambda_guarded(this, [photo](const QString &result) {
if (!result.isEmpty()) {
photo->full->pix().toImage().save(result, "JPG");
}
@ -1090,7 +1087,7 @@ void InnerWidget::suggestRestrictUser(not_null<UserData *> user) {
editRestrictions(true, MTP_channelBannedRights(MTP_flags(0), MTP_int(0)));
} else {
request(MTPchannels_GetParticipant(_channel->inputChannel, user->inputUser))
.done([this, editRestrictions](const MTPchannels_ChannelParticipant &result) {
.done([editRestrictions](const MTPchannels_ChannelParticipant &result) {
Expects(result.type() == mtpc_channels_channelParticipant);
auto &participant = result.c_channels_channelParticipant();
App::feedUsers(participant.vusers);
@ -1103,7 +1100,7 @@ void InnerWidget::suggestRestrictUser(not_null<UserData *> user) {
editRestrictions(hasAdminRights, MTP_channelBannedRights(MTP_flags(0), MTP_int(0)));
}
})
.fail([this, editRestrictions](const RPCError &error) {
.fail([editRestrictions](const RPCError &error) {
editRestrictions(false, MTP_channelBannedRights(MTP_flags(0), MTP_int(0)));
})
.send();

View File

@ -261,7 +261,7 @@ Widget::Widget(QWidget *parent, not_null<Window::Controller *> controller, not_n
connect(_scroll, &Ui::ScrollArea::scrolled, this, [this] { onScroll(); });
_whatIsThis->setClickedCallback([this] { Ui::show(Box<InformBox>(lang(lng_admin_log_about_text))); });
_whatIsThis->setClickedCallback([] { Ui::show(Box<InformBox>(lang(lng_admin_log_about_text))); });
}
void Widget::showFilter() {

View File

@ -668,7 +668,6 @@ void HistoryInner::touchDeaccelerate(qint32 elapsed) {
}
void HistoryInner::touchEvent(QTouchEvent *e) {
const Qt::TouchPointStates &states(e->touchPointStates());
if (e->type() == QEvent::TouchCancel) { // cancel
if (!_touchInProgress) return;
_touchInProgress = false;

View File

@ -133,7 +133,6 @@ void ReplyKeyboard::updateMessageId() {
void ReplyKeyboard::resize(int width, int height) {
_width = width;
auto markup = _item->Get<HistoryMessageReplyMarkup>();
double y = 0,
buttonHeight = _rows.isEmpty() ? _st->buttonHeight() : (double(height + _st->buttonSkip()) / _rows.size());
for (auto &row : _rows) {
@ -522,7 +521,6 @@ void HistoryMessageUnreadBar::paint(Painter &p, int y, int w) const {
p.setFont(st::historyUnreadBarFont);
p.setPen(st::historyUnreadBarFg);
int left = st::msgServiceMargin.left();
int maxwidth = w;
if (Adaptive::ChatWide()) {
maxwidth = std::min(maxwidth, qint32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));

View File

@ -1542,10 +1542,8 @@ HistoryTextState HistoryDocument::getState(QPoint point, HistoryStateRequest req
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
bool out = _parent->out(), isPost = _parent->isPost();
bool loaded = _data->loaded();
bool showPause = updateStatusText();
qint32 nameleft = 0, nametop = 0, nameright = 0, linktop = 0, bottom = 0;
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
@ -2842,7 +2840,6 @@ void HistorySticker::draw(Painter &p, const QRect &r, TextSelection selection, T
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
_data->checkSticker();
bool loaded = _data->loaded();
bool selected = (selection == FullSelection);
bool out = _parent->out(), isPost = _parent->isPost(), childmedia = (_parent->getMedia() != this);
@ -3200,7 +3197,6 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, T
HistoryTextState HistoryContact::getState(QPoint point, HistoryStateRequest request) const {
HistoryTextState result;
bool out = _parent->out(), isPost = _parent->isPost();
qint32 nameleft = 0, linktop = 0;
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
@ -3506,7 +3502,6 @@ void HistoryWebPage::initDimensions() {
}
// init dimensions
auto l = st::msgPadding.left() + st::webPageLeft, r = st::msgPadding.right();
auto skipBlockWidth = _parent->skipBlockWidth();
_maxw = skipBlockWidth;
_minh = 0;
@ -3680,8 +3675,6 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, T
(outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor);
auto &semibold = selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) :
(outbg ? st::msgOutServiceFg : st::msgInServiceFg);
auto &regular = selected ? (outbg ? st::msgOutDateFgSelected : st::msgInDateFgSelected) :
(outbg ? st::msgOutDateFg : st::msgInDateFg);
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
auto padding = inBubblePadding();
@ -4044,7 +4037,6 @@ void HistoryGame::initDimensions() {
}
// init dimensions
qint32 l = st::msgPadding.left() + st::webPageLeft, r = st::msgPadding.right();
qint32 skipBlockWidth = _parent->skipBlockWidth();
_maxw = skipBlockWidth;
_minh = 0;
@ -4143,7 +4135,7 @@ int HistoryGame::resizeGetHeight(int width) {
void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
qint32 width = _width, height = _height;
qint32 width = _width;
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
bool selected = (selection == FullSelection);
@ -4152,8 +4144,6 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, Time
(outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor);
auto &semibold = selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) :
(outbg ? st::msgOutServiceFg : st::msgInServiceFg);
auto &regular = selected ? (outbg ? st::msgOutDateFgSelected : st::msgInDateFgSelected) :
(outbg ? st::msgOutDateFg : st::msgInDateFg);
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
auto padding = inBubblePadding();
@ -4226,7 +4216,7 @@ HistoryTextState HistoryGame::getState(QPoint point, HistoryStateRequest request
HistoryTextState result;
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
qint32 width = _width, height = _height;
qint32 width = _width;
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
auto padding = inBubblePadding();
@ -4501,7 +4491,6 @@ void HistoryInvoice::initDimensions() {
}
// init dimensions
qint32 l = st::msgPadding.left(), r = st::msgPadding.right();
qint32 skipBlockWidth = _parent->skipBlockWidth();
_maxw = skipBlockWidth;
_minh = 0;
@ -4589,17 +4578,13 @@ int HistoryInvoice::resizeGetHeight(int width) {
void HistoryInvoice::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
qint32 width = _width, height = _height;
qint32 width = _width;
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
bool selected = (selection == FullSelection);
auto &barfg = selected ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) :
(outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor);
auto &semibold = selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) :
(outbg ? st::msgOutServiceFg : st::msgInServiceFg);
auto &regular = selected ? (outbg ? st::msgOutDateFgSelected : st::msgInDateFgSelected) :
(outbg ? st::msgOutDateFg : st::msgInDateFg);
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
auto padding = inBubblePadding();
@ -4647,7 +4632,6 @@ void HistoryInvoice::draw(Painter &p, const QRect &r, TextSelection selection, T
p.translate(attachLeft, attachTop);
_attach->draw(p, r.translated(-attachLeft, -attachTop), attachSelection, ms);
auto pixwidth = _attach->currentWidth();
auto pixheight = _attach->height();
auto available = _status.maxWidth();
auto statusW = available + 2 * st::msgDateImgPadding.x();

View File

@ -711,7 +711,7 @@ HistoryMessage::HistoryMessage(not_null<History *> history, MsgId id, MTPDmessag
createComponents(config);
auto cloneMedia = [this, history, mediaType] {
auto cloneMedia = [history, mediaType] {
if (mediaType == MediaTypeWebPage) {
if (auto channel = history->peer->asChannel()) {
if (channel->restrictedRights().is_embed_links()) {
@ -1840,7 +1840,7 @@ void HistoryMessage::paintFromName(Painter &p, QRect &trect, bool selected) cons
void HistoryMessage::paintForwardedInfo(Painter &p, QRect &trect, bool selected) const {
if (displayForwardedFrom()) {
style::font serviceFont(st::msgServiceFont), serviceName(st::msgServiceNameFont);
style::font serviceFont(st::msgServiceFont);
auto outbg = hasOutLayout();
p.setPen(selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) :
@ -2180,7 +2180,6 @@ void HistoryMessage::updatePressed(QPoint point) {
if (drawBubble()) {
auto mediaDisplayed = _media && _media->isDisplayed();
auto top = marginTop();
auto trect = g.marginsAdded(-st::msgPadding);
if (mediaDisplayed && _media->isBubbleTop()) {
trect.setY(trect.y() - st::msgPadding.top());
@ -2205,7 +2204,6 @@ void HistoryMessage::updatePressed(QPoint point) {
trect.setHeight(trect.height() + st::msgPadding.bottom());
}
auto needDateCheck = true;
if (mediaDisplayed) {
auto mediaAboveText = _media->isAboveMessage();
auto mediaHeight = _media->height();

View File

@ -4785,9 +4785,6 @@ void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, bool silent,
void HistoryWidget::onPhotoProgress(const FullMsgId &newId) {
if (auto item = App::histItemById(newId)) {
auto photo = (item->getMedia() && item->getMedia()->type() == MediaTypePhoto) ?
static_cast<HistoryPhoto *>(item->getMedia())->photo() :
nullptr;
if (!item->isPost()) {
updateSendAction(item->history(), SendAction::Type::UploadPhoto, 0);
}
@ -5570,7 +5567,6 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot
bool lastKeyboardUsed = lastForceReplyReplied();
bool out = !_peer->isSelf(), unread = !_peer->isSelf();
auto flags = NewMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
auto sendFlags = MTPmessages_SendInlineBotResult::Flag::f_clear_draft | 0;
if (replyToId()) {
@ -5753,7 +5749,6 @@ bool HistoryWidget::sendExistingDocument(DocumentData *doc, const QString &capti
bool lastKeyboardUsed = lastForceReplyReplied();
bool out = !_peer->isSelf(), unread = !_peer->isSelf();
auto flags = NewMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
auto sendFlags = MTPmessages_SendMedia::Flags(0);
if (replyToId()) {
@ -5817,7 +5812,6 @@ void HistoryWidget::sendExistingPhoto(PhotoData *photo, const QString &caption)
bool lastKeyboardUsed = lastForceReplyReplied();
bool out = !_peer->isSelf(), unread = !_peer->isSelf();
auto flags = NewMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
auto sendFlags = MTPmessages_SendMedia::Flags(0);
if (replyToId()) {
@ -6878,8 +6872,6 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
Expects(_pinnedBar != nullptr);
auto top = _topBar->bottomNoMargins();
Text *from = 0, *text = 0;
bool serviceColor = false, hasForward = readyToForward();
ImagePtr preview;
p.fillRect(myrtlrect(0, top, _chatWidth, st::historyReplyHeight), st::historyPinnedBg);

View File

@ -396,8 +396,6 @@ void Sticker::preload() const {
}
void Sticker::paint(Painter &p, const QRect &clip, const PaintContext *context) const {
bool loaded = getShownDocument()->loaded();
auto over = _a_over.current(context->ms, _active ? 1. : 0.);
if (over > 0) {
p.setOpacity(over);
@ -591,7 +589,6 @@ void Video::initDimensions() {
bool withThumb = !content_thumb()->isNull();
_maxw = st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft;
qint32 textWidth = _maxw - (withThumb ? (st::inlineThumbSize + st::inlineThumbSkip) : 0);
TextParseOptions titleOpts = {0, _maxw, 2 * st::semiboldFont->height, Qt::LayoutDirectionAuto};
auto title = TextUtilities::SingleLine(_result->getLayoutTitle());
if (title.isEmpty()) {
@ -609,7 +606,6 @@ void Video::initDimensions() {
description = _duration;
}
_description.setText(st::defaultTextStyle, description, descriptionOpts);
qint32 descriptionHeight = std::min(_description.countHeight(_maxw), descriptionLines * st::normalFont->height);
_minh = st::inlineThumbSize;
_minh += st::inlineRowMargin * 2 + st::inlineRowBorder;
@ -716,7 +712,6 @@ File::File(not_null<Context *> context, Result *result)
void File::initDimensions() {
_maxw = st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft;
int textWidth = _maxw - (st::msgFileSize + st::inlineThumbSkip);
TextParseOptions titleOpts = {0, _maxw, st::semiboldFont->height, Qt::LayoutDirectionAuto};
_title.setText(st::semiboldTextStyle, TextUtilities::SingleLine(_result->getLayoutTitle()), titleOpts);
@ -732,7 +727,7 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con
qint32 left = st::msgFileSize + st::inlineThumbSkip;
DocumentData *document = getShownDocument();
bool loaded = document->loaded(), displayLoading = document->displayLoading();
bool displayLoading = document->displayLoading();
if (displayLoading) {
ensureAnimation();
if (!_animation->radial.animating()) {
@ -934,14 +929,11 @@ Contact::Contact(not_null<Context *> context, Result *result)
void Contact::initDimensions() {
_maxw = st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft;
qint32 textWidth = _maxw - (st::inlineThumbSize + st::inlineThumbSkip);
TextParseOptions titleOpts = {0, _maxw, st::semiboldFont->height, Qt::LayoutDirectionAuto};
_title.setText(st::semiboldTextStyle, TextUtilities::SingleLine(_result->getLayoutTitle()), titleOpts);
qint32 titleHeight = std::min(_title.countHeight(_maxw), st::semiboldFont->height);
TextParseOptions descriptionOpts = {TextParseMultiline, _maxw, st::normalFont->height, Qt::LayoutDirectionAuto};
_description.setText(st::defaultTextStyle, _result->getLayoutDescription(), descriptionOpts);
qint32 descriptionHeight = std::min(_description.countHeight(_maxw), st::normalFont->height);
_minh = st::msgFileSize;
_minh += st::inlineRowMargin * 2 + st::inlineRowBorder;
@ -1036,7 +1028,6 @@ Article::Article(not_null<Context *> context, Result *result, bool withThumb)
void Article::initDimensions() {
_maxw = st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft;
qint32 textWidth = _maxw - (_withThumb ? (st::inlineThumbSize + st::inlineThumbSkip) : 0);
TextParseOptions titleOpts = {0, _maxw, 2 * st::semiboldFont->height, Qt::LayoutDirectionAuto};
_title.setText(st::semiboldTextStyle, TextUtilities::SingleLine(_result->getLayoutTitle()), titleOpts);
qint32 titleHeight = std::min(_title.countHeight(_maxw), 2 * st::semiboldFont->height);
@ -1213,7 +1204,6 @@ void Game::countFrameSize() {
void Game::initDimensions() {
_maxw = st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft;
qint32 textWidth = _maxw - (st::inlineThumbSize + st::inlineThumbSkip);
TextParseOptions titleOpts = {0, _maxw, 2 * st::semiboldFont->height, Qt::LayoutDirectionAuto};
_title.setText(st::semiboldTextStyle, TextUtilities::SingleLine(_result->getLayoutTitle()), titleOpts);
qint32 titleHeight = std::min(_title.countHeight(_maxw), 2 * st::semiboldFont->height);
@ -1250,7 +1240,7 @@ void Game::paint(Painter &p, const QRect &clip, const PaintContext *context) con
if (animatedThumb) {
document->automaticLoad(nullptr);
bool loaded = document->loaded(), loading = document->loading(), displayLoading = document->displayLoading();
bool loaded = document->loaded(), displayLoading = document->displayLoading();
if (loaded && !_gif && !_gif.isBad()) {
auto that = const_cast<Game *>(this);
that->_gif = Media::Clip::MakeReader(document, FullMsgId(), [that](Media::Clip::Notification notification) {

View File

@ -448,7 +448,7 @@ int Inner::refreshInlineRows(PeerData *queryPeer, UserData *bot, const CacheEntr
_inlineBot = bot;
_inlineQueryPeer = queryPeer;
refreshSwitchPmButton(entry);
auto clearResults = [this, entry]() {
auto clearResults = [entry]() {
if (!entry) {
return true;
}
@ -589,7 +589,6 @@ bool Inner::inlineItemVisible(const ItemBase *layout) {
int row = position / MatrixRowShift, col = position % MatrixRowShift;
Assert((row < _rows.size()) && (col < _rows[row].items.size()));
auto &inlineItems = _rows[row].items;
int top = st::stickerPanPadding;
for (qint32 i = 0; i < row; ++i) {
top += _rows.at(i).height;
@ -603,7 +602,6 @@ void Inner::updateSelected() {
return;
}
auto newSelected = -1;
auto p = mapFromGlobal(_lastMousePos);
int sx = (rtl() ? width() - p.x() : p.x()) - (st::inlineResultsLeft - st::buttonRadius);

View File

@ -105,7 +105,7 @@ void Widget::createLanguageLink() {
_changeLanguage->show();
_changeLanguage->hideFast();
_changeLanguage->entity()->setClickedCallback(
[this, languageId] { Lang::CurrentCloudManager().switchToLanguage(languageId); });
[languageId] { Lang::CurrentCloudManager().switchToLanguage(languageId); });
_changeLanguage->toggleAnimated(!_resetAccount);
updateControlsGeometry();
};
@ -118,7 +118,7 @@ void Widget::createLanguageLink() {
} else if (!suggestedId.isEmpty() && suggestedId != currentId) {
request(
MTPlangpack_GetStrings(MTP_string(suggestedId), MTP_vector<MTPstring>(1, MTP_string("lng_switch_to_this"))))
.done([this, suggestedId, createLink](const MTPVector<MTPLangPackString> &result) {
.done([suggestedId, createLink](const MTPVector<MTPLangPackString> &result) {
auto strings = Lang::Instance::ParseStrings(result);
auto it = strings.find(lng_switch_to_this);
if (it != strings.end()) {

View File

@ -181,7 +181,6 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela
file.seek(0);
QByteArray data;
int skip = 0;
auto readUtf16Stream = [relativePath, absolutePath](auto &&stream) {
stream.setCodec("UTF-16");
auto string = stream.readAll();

View File

@ -1393,7 +1393,6 @@ public:
return false;
}
int res = 0;
char err[AV_ERROR_MAX_STRING_SIZE] = {0};
int videoStreamId = av_find_best_stream(fmtContext, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);

View File

@ -100,13 +100,13 @@ CoverWidget::CoverWidget(QWidget *parent)
_playback->setValue(value, false);
handleSeekFinished(value);
});
_playPause->setClickedCallback([this] { instance()->playPauseCancelClicked(AudioMsgId::Type::Song); });
_playPause->setClickedCallback([] { instance()->playPauseCancelClicked(AudioMsgId::Type::Song); });
updateRepeatTrackIcon();
_repeatTrack->setClickedCallback([this] { instance()->toggleRepeat(AudioMsgId::Type::Song); });
_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();
@ -359,10 +359,10 @@ void CoverWidget::createPrevNextButtons() {
if (!_previousTrack) {
_previousTrack.create(this, st::mediaPlayerPanelPreviousButton);
_previousTrack->show();
_previousTrack->setClickedCallback([this]() { instance()->previous(); });
_previousTrack->setClickedCallback([]() { instance()->previous(); });
_nextTrack.create(this, st::mediaPlayerPanelNextButton);
_nextTrack->show();
_nextTrack->setClickedCallback([this]() { instance()->next(); });
_nextTrack->setClickedCallback([]() { instance()->next(); });
updatePlayPrevNextPositions();
}
}

View File

@ -118,7 +118,6 @@ int Panel::bestPositionFor(int left) const {
void Panel::scrollPlaylistToCurrentTrack() {
if (auto list = static_cast<ListWidget *>(_scroll->widget())) {
auto rect = list->getCurrentTrackGeometry();
auto top = _scroll->scrollTop(), bottom = top + _scroll->height();
_scroll->scrollToY(rect.y());
}
}

View File

@ -124,7 +124,7 @@ Widget::Widget(QWidget *parent)
_playPause->setClickedCallback([this] { instance()->playPauseCancelClicked(_type); });
updateVolumeToggleIcon();
_volumeToggle->setClickedCallback([this] {
_volumeToggle->setClickedCallback([] {
Global::SetSongVolume((Global::SongVolume() > 0) ? 0. : Global::RememberedSongVolume());
mixer()->setSongVolume(Global::SongVolume());
Global::RefSongVolumeChanged().notify();
@ -132,7 +132,7 @@ Widget::Widget(QWidget *parent)
subscribe(Global::RefSongVolumeChanged(), [this] { updateVolumeToggleIcon(); });
updateRepeatTrackIcon();
_repeatTrack->setClickedCallback([this] { instance()->toggleRepeat(AudioMsgId::Type::Song); });
_repeatTrack->setClickedCallback([] { instance()->toggleRepeat(AudioMsgId::Type::Song); });
subscribe(instance()->repeatChangedNotifier(), [this](AudioMsgId::Type type) {
if (type == _type) {
@ -242,7 +242,6 @@ void Widget::handleSeekProgress(double progress) {
void Widget::handleSeekFinished(double progress) {
if (!_lastDurationMs) return;
auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), Q_INT64_C(0), _lastDurationMs);
_seekPositionMs = -1;
auto state = mixer()->currentState(_type);
@ -538,10 +537,10 @@ void Widget::createPrevNextButtons() {
if (!_previousTrack) {
_previousTrack.create(this, st::mediaPlayerPreviousButton);
_previousTrack->show();
_previousTrack->setClickedCallback([this]() { instance()->previous(); });
_previousTrack->setClickedCallback([]() { instance()->previous(); });
_nextTrack.create(this, st::mediaPlayerNextButton);
_nextTrack->show();
_nextTrack->setClickedCallback([this]() { instance()->next(); });
_nextTrack->setClickedCallback([]() { instance()->next(); });
updatePlayPrevNextPositions();
}
}

View File

@ -129,7 +129,7 @@ void Controller::updatePlayPauseResumeState(const Player::TrackState &state) {
}
void Controller::updateTimeTexts(const Player::TrackState &state) {
qint64 position = 0, length = state.length;
qint64 position = 0;
if (Player::IsStoppedAtEnd(state.state)) {
position = state.length;

View File

@ -974,7 +974,7 @@ bool Instance::Private::onErrorDefault(mtpRequestId requestId, const RPCError &e
auto &err(error.type());
auto code = error.code();
if (!isFloodError(error) && err != qstr("AUTH_KEY_UNREGISTERED")) {
int breakpoint = 0;
// int breakpoint = 0;
}
auto badGuestDc = (code == 400) && (err == qsl("FILE_ID_INVALID"));
QRegularExpressionMatch m;

View File

@ -555,7 +555,7 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
}
bool radial = isRadialAnimation(context->ms);
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, datetop = -1;
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0;
nameleft = _st.songPadding.left() + _st.songThumbSize + _st.songPadding.right();
nameright = _st.songPadding.left();
@ -639,7 +639,7 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
void Voice::getState(ClickHandlerPtr &link, HistoryCursorState &cursor, QPoint point) const {
bool loaded = _data->loaded();
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, datetop = 0;
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0;
nameleft = _st.songPadding.left() + _st.songThumbSize + _st.songPadding.right();
nameright = _st.songPadding.left();
@ -932,8 +932,6 @@ void Document::getState(ClickHandlerPtr &link, HistoryCursorState &cursor, QPoin
bool loaded = _data->loaded() || Local::willStickerImageLoad(_data->mediaKey());
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, datetop = 0;
bool wthumb = withThumb();
if (_data->song()) {
nameleft = _st.songPadding.left() + _st.songThumbSize + _st.songPadding.right();
nameright = _st.songPadding.left();

View File

@ -368,7 +368,6 @@ void OverviewInner::touchDeaccelerate(qint32 elapsed) {
}
void OverviewInner::touchEvent(QTouchEvent *e) {
const Qt::TouchPointStates &states(e->touchPointStates());
if (e->type() == QEvent::TouchCancel) { // cancel
if (!_touchInProgress) return;
_touchInProgress = false;

View File

@ -48,7 +48,7 @@ GroupMembersWidget::GroupMembersWidget(QWidget *parent, PeerData *peer, TitleVis
Notify::PeerUpdatedHandler(observeEvents,
[this](const Notify::PeerUpdate &update) { notifyPeerUpdated(update); }));
setRemovedCallback([this, peer](PeerData *selectedPeer) { removePeer(selectedPeer); });
setRemovedCallback([this](PeerData *selectedPeer) { removePeer(selectedPeer); });
setSelectedCallback([](PeerData *selectedPeer) { Ui::showPeerProfile(selectedPeer); });
setUpdateItemCallback([this](Item *item) { updateItemStatusText(item); });
setPreloadMoreCallback([this] { preloadMore(); });
@ -203,22 +203,9 @@ Ui::PopupMenu *GroupMembersWidget::fillPeerMenu(PeerData *selectedPeer) {
auto user = selectedPeer->asUser();
auto result = new Ui::PopupMenu(nullptr);
result->addAction(lang(lng_context_view_profile), [selectedPeer] { Ui::showPeerProfile(selectedPeer); });
auto chat = peer()->asChat();
auto channel = peer()->asMegagroup();
for_const (auto item, items()) {
if (item->peer == selectedPeer) {
auto canRemoveAdmin = [item, chat, channel] {
if ((item->adminState == Item::AdminState::Admin) && !item->peer->isSelf()) {
if (chat) {
// Adding of admins from context menu of chat participants
// is not supported, so the removing is also disabled.
return false; // chat->amCreator();
} else if (channel) {
return channel->amCreator();
}
}
return false;
};
if (channel) {
if (channel->canEditAdmin(user)) {
auto label = lang((item->adminState != Item::AdminState::None) ? lng_context_edit_permissions :

View File

@ -67,7 +67,6 @@ void PeerListWidget::paintContents(Painter &p) {
auto ms = getms();
auto left = getListLeft();
auto top = getListTop();
auto memberRowWidth = rowWidth();
auto from = floorclamp(_visibleTop - top, st::profileMemberHeight, 0, _items.size());
auto to = ceilclamp(_visibleBottom - top, st::profileMemberHeight, 0, _items.size());

View File

@ -113,7 +113,6 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
p.fillRect(e->rect(), st::profileBg);
if (_mode == Mode::TwoColumn) {
int leftHeight = countBlocksHeight(RectPart::Left);
int rightHeight = countBlocksHeight(RectPart::Right);
int shadowHeight = rightHeight; // std::min(leftHeight, rightHeight);

View File

@ -2762,7 +2762,6 @@ FileLocation readFileLocation(MediaKey location, bool check) {
location = aliasIt.value();
}
FileLocations::iterator i = _fileLocations.find(location);
for (FileLocations::iterator i = _fileLocations.find(location);
(i != _fileLocations.end()) && (i.key() == location);) {
if (check) {
@ -2857,7 +2856,6 @@ public:
QByteArray imageData;
quint64 locFirst, locSecond;
quint32 legacyTypeField = 0;
readFromStream(image.stream, locFirst, locSecond, imageData);
// we're saving files now before we have actual location

View File

@ -90,7 +90,6 @@ void RoundCheckbox::paint(Painter &p, TimeMs ms, int x, int y, int outerWidth, d
auto cacheSize = kWideScale * _st.size * cIntRetinaFactor();
auto cacheFrom = QRect(0, 0, cacheSize, cacheSize);
auto displayInactive = !_inactiveCacheBg.isNull();
auto inactiveTo = cacheDestRect(x, y, masterScale);
PainterHighQualityEnabler hq(p);

View File

@ -230,7 +230,7 @@ void prepareRound(QImage &image, QImage *cornerMasks, ImageRoundCorners corners)
auto intsTopRight = ints + imageWidth - cornerWidth;
auto intsBottomLeft = ints + (imageHeight - cornerHeight) * imageWidth;
auto intsBottomRight = ints + (imageHeight - cornerHeight + 1) * imageWidth - cornerWidth;
auto maskCorner = [imageIntsPerPixel, imageIntsPerLine](quint32 *imageInts, const QImage &mask) {
auto maskCorner = [imageIntsPerLine](quint32 *imageInts, const QImage &mask) {
auto maskWidth = mask.width();
auto maskHeight = mask.height();
auto maskBytesPerPixel = (mask.depth() >> 3);

View File

@ -161,8 +161,6 @@ public:
int item = -1;
int newItem = eng->findItem(0);
style::align alignment = eng->option.alignment();
const QCharAttributes *attributes = eng->attributes();
if (!attributes) return;
int end = 0;

View File

@ -302,7 +302,7 @@ void FlatTextarea::touchEvent(QTouchEvent *e) {
case QEvent::TouchEnd:
if (!_touchPress) return;
if (!_touchMove && window()) {
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);
@ -1565,7 +1565,7 @@ void FlatInput::touchEvent(QTouchEvent *e) {
case QEvent::TouchEnd:
if (!_touchPress) return;
if (!_touchMove && window()) {
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);
@ -1901,8 +1901,7 @@ void InputArea::touchEvent(QTouchEvent *e) {
case QEvent::TouchEnd:
if (!_touchPress) return;
if (!_touchMove && window()) {
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);
@ -2647,8 +2646,7 @@ void InputField::touchEvent(QTouchEvent *e) {
case QEvent::TouchEnd:
if (!_touchPress) return;
if (!_touchMove && window()) {
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);
@ -3437,8 +3435,7 @@ void MaskedInputField::touchEvent(QTouchEvent *e) {
case QEvent::TouchEnd:
if (!_touchPress) return;
if (!_touchMove && window()) {
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);

View File

@ -441,7 +441,6 @@ bool FlatLabel::event(QEvent *e) {
}
void FlatLabel::touchEvent(QTouchEvent *e) {
const Qt::TouchPointStates &states(e->touchPointStates());
if (e->type() == QEvent::TouchCancel) { // cancel
if (!_touchInProgress) return;
_touchInProgress = false;

View File

@ -743,7 +743,7 @@ void MultiSelect::Inner::removeItem(quint64 itemId) {
item->hideAnimated();
_idsMap.erase(item->id());
auto inserted = _removingItems.insert(std::move(item));
_removingItems.insert(std::move(item));
_items.erase(_items.begin() + i);
if (_active == i) {

View File

@ -59,7 +59,7 @@ Tooltip::Tooltip()
setAttribute(Qt::WA_TranslucentBackground, true);
_showTimer.setCallback([this] { performShow(); });
_hideByLeaveTimer.setCallback([this] { Hide(); });
_hideByLeaveTimer.setCallback([] { Hide(); });
connect(App::wnd()->windowHandle(), SIGNAL(activeChanged()), this, SLOT(onWndActiveChanged()));
}

View File

@ -522,7 +522,7 @@ void EditorBlock::saveEditing(QColor value) {
auto &row = _data[_editing];
auto name = row.name();
if (_type == Type::New) {
auto removing = std::exchange(_editing, -1);
_editing = -1;
setSelected(-1);
setPressed(-1);

View File

@ -814,7 +814,6 @@ void Generator::paintBubble(const Bubble &bubble) {
bubble.text.draw(*_p, trect.x(), trect.y(), trect.width());
} else if (!bubble.waveform.isEmpty()) {
auto nameleft = x + st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right();
auto nameright = st::msgFilePadding.left();
auto statustop = y + st::msgFileStatusTop;
auto inner = rtlrect(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), st::msgFileSize,