diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index d7c4c035c..949a96a33 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -369,9 +369,7 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) { if (_pack.isEmpty()) return; auto ms = getms(); - qint32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0); - 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 f3f04498f..fef29f50f 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -952,12 +952,12 @@ void StickersBox::Inner::setPressed(int pressed) { update(0, _itemsTop + _pressed * _rowHeight, width(), _rowHeight); auto &set = _rows[_pressed]; auto rippleMask = Ui::RippleAnimation::rectMask(QSize(width(), _rowHeight)); - if (!_rows[_pressed]->ripple) { - _rows[_pressed]->ripple = std::make_unique( - st::contactsRipple, std::move(rippleMask), - [this, index = _pressed] { update(0, _itemsTop + index * _rowHeight, 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); + }); } - _rows[_pressed]->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + _pressed * _rowHeight)); + set->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + _pressed * _rowHeight)); } } diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp index fd9a0647f..97a403eeb 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp @@ -79,9 +79,6 @@ void ChatSearchFromController::rowClicked(not_null row) { } void ChatSearchFromController::rebuildRows() { - auto ms = getms(); - auto wasEmpty = !delegate()->peerListFullRowsCount(); - auto now = unixtime(); QMultiMap ordered; if (_chat->noParticipantInfo()) { diff --git a/Telegram/SourceFiles/history/history_admin_log_section.cpp b/Telegram/SourceFiles/history/history_admin_log_section.cpp index cc3cef54a..f252e246e 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/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index bcf83df4d..2cc9620a9 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -920,7 +920,6 @@ void MainWidget::showSendPathsLayer() { void MainWidget::deleteLayer(int selectedCount) { if (selectedCount) { - auto forDelete = true; auto selected = _overview ? _overview->getSelectedItems() : _history->getSelectedItems(); if (!selected.isEmpty()) { Ui::show(Box(selected)); @@ -1307,7 +1306,7 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu if (h) Local::addSavedPeer(peer, h->lastMsgDate); } else if (peer->isChannel()) { if (peer->asChannel()->inviter > 0 && peer->asChannel()->amIn()) { - if (auto from = App::userLoaded(peer->asChannel()->inviter)) { + if (App::userLoaded(peer->asChannel()->inviter)) { auto h = App::history(peer->id); h->clear(true); h->addNewerSlice(QVector()); @@ -1358,9 +1357,6 @@ void MainWidget::onCacheBackground() { result.setDevicePixelRatio(cRetinaFactor()); { QPainter p(&result); - auto left = 0; - auto top = 0; - auto right = _willCacheFor.width(); auto bottom = _willCacheFor.height(); auto w = bg.width() / cRetinaFactor(); auto h = bg.height() / cRetinaFactor(); diff --git a/Telegram/SourceFiles/media/media_clip_reader.cpp b/Telegram/SourceFiles/media/media_clip_reader.cpp index 3d1a16d6d..7bc814787 100644 --- a/Telegram/SourceFiles/media/media_clip_reader.cpp +++ b/Telegram/SourceFiles/media/media_clip_reader.cpp @@ -769,7 +769,6 @@ Manager::ResultHandleState Manager::handleResult(ReaderPrivate *reader, ProcessR auto it = constUnsafeFindReaderPointer(reader); if (it != _readerPointers.cend()) { qint32 index = 0; - Reader *r = it.key(); Reader::Frame *frame = it.key()->frameToWrite(&index); if (frame) { frame->clear(); diff --git a/Telegram/SourceFiles/media/player/media_player_cover.cpp b/Telegram/SourceFiles/media/player/media_player_cover.cpp index 03ffd608c..095600e7b 100644 --- a/Telegram/SourceFiles/media/player/media_player_cover.cpp +++ b/Telegram/SourceFiles/media/player/media_player_cover.cpp @@ -279,13 +279,10 @@ void CoverWidget::handleSongUpdate(const TrackState &state) { void CoverWidget::updateTimeText(const TrackState &state) { QString time; - qint64 position = 0, length = 0, display = 0; + qint64 display = 0; auto frequency = state.frequency; if (!IsStoppedOrStopping(state.state)) { - display = position = state.position; - length = state.length; - } else { - length = state.length ? state.length : (state.id.audio()->song()->duration * frequency); + display = state.position; } _lastDurationMs = (state.length * 1000LL) / frequency; diff --git a/Telegram/SourceFiles/media/player/media_player_widget.cpp b/Telegram/SourceFiles/media/player/media_player_widget.cpp index a65ee433e..7abcdc69d 100644 --- a/Telegram/SourceFiles/media/player/media_player_widget.cpp +++ b/Telegram/SourceFiles/media/player/media_player_widget.cpp @@ -431,11 +431,10 @@ void Widget::handleSongUpdate(const TrackState &state) { void Widget::updateTimeText(const TrackState &state) { QString time; - qint64 position = 0, length = 0, display = 0; + qint64 display = 0; auto frequency = state.frequency; if (!IsStoppedOrStopping(state.state)) { - display = position = state.position; - length = state.length; + display = state.position; } else if (state.length) { display = state.length; } else if (state.id.audio()->song()) { diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 7fd7447c7..1b1aa3df6 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -2141,7 +2141,7 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) { if (titleRect.x() < 0) { titleRect = QRect(0, _themePreviewRect.y(), width(), st::themePreviewMargin.top()); } - if (auto fillTitleRect = (titleRect.y() < 0)) { + if (titleRect.y() < 0) { titleRect.moveTop(0); fillOverlay(titleRect); } @@ -2154,10 +2154,8 @@ 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()); - if (auto fillButtonsRect = (buttonsRect.y() + buttonsRect.height() > height())) { + 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 61cd75b80..927d9ab0f 100644 --- a/Telegram/SourceFiles/mtproto/session.cpp +++ b/Telegram/SourceFiles/mtproto/session.cpp @@ -50,9 +50,7 @@ void SessionData::setKey(const AuthKeyPtr &key) { void SessionData::clear(Instance *instance) { RPCCallbackClears clearCallbacks; { - QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()), - locker4(wereAckedMutex()); - auto receivedResponsesEnd = _receivedResponses.cend(); + 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 56d8ba25a..7aa0aa2c3 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -784,11 +784,6 @@ bool OverviewInner::preloadLocal() { } TextSelection OverviewInner::itemSelectedValue(qint32 index) const { - qint32 selfrom = -1, selto = -1; - if (_dragSelFromIndex >= 0 && _dragSelToIndex >= 0) { - selfrom = _dragSelToIndex; - selto = _dragSelFromIndex; - } if (_items.at(index)->toMediaItem()) { // draw item if (index >= _dragSelToIndex && index <= _dragSelFromIndex && _dragSelToIndex >= 0) { return (_dragSelecting && _items.at(index)->msgId() > 0) ? FullSelection : TextSelection{0, 0}; @@ -834,7 +829,6 @@ void OverviewInner::paintEvent(QPaintEvent *e) { } SelectedItems::const_iterator selEnd = _selected.cend(); - bool hasSel = !_selected.isEmpty(); if (_type == OverviewPhotos || _type == OverviewVideos) { qint32 count = _items.size(), rowsCount = count / _photosInRow + ((count % _photosInRow) ? 1 : 0); @@ -859,7 +853,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) { } } else { p.translate(_rowsLeft, _marginTop); - qint32 y = 0, w = _rowWidth; + qint32 y = 0; for (qint32 j = 0, l = _items.size(); j < l; ++j) { qint32 i = _reversed ? (l - j - 1) : j, nexti = _reversed ? (i - 1) : (i + 1); qint32 nextItemTop = @@ -897,7 +891,6 @@ void OverviewInner::onUpdateSelected() { ClickHandlerHost *lnkhost = nullptr; HistoryItem *item = 0; qint32 index = -1; - qint32 newsel = 0; HistoryCursorState cursorState = HistoryDefaultCursorState; if (_type == OverviewPhotos || _type == OverviewVideos) { double w = (double(_width - st::overviewPhotoSkip) / _photosInRow); @@ -1016,11 +1009,8 @@ void OverviewInner::onUpdateSelected() { } if (_dragAction == Selecting) { bool canSelectMany = (_peer != 0); - if (_mousedItem == _dragItem && lnk && !_selected.isEmpty() && - _selected.cbegin().value() != FullSelection) { - bool afterSymbol = false, uponSymbol = false; - quint16 second = 0; - _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/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index dec6afdb5..d233c7703 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -251,13 +251,10 @@ void MainWindow::psCreateTrayIcon() { void MainWindow::psFirstShow() { psCreateTrayIcon(); - psUpdateMargins(); - bool showShadows = true; - show(); - //_private.enableShadow(winId()); + if (cWindowPos().maximized) { DEBUG_LOG(("Window Pos: First show, setting maximized.")); setWindowState(Qt::WindowMaximized); @@ -270,7 +267,6 @@ void MainWindow::psFirstShow() { } else { show(); } - showShadows = false; } else { show(); } diff --git a/Telegram/SourceFiles/settings/settings_cover.cpp b/Telegram/SourceFiles/settings/settings_cover.cpp index 1945bb8b2..4db2d57c9 100644 --- a/Telegram/SourceFiles/settings/settings_cover.cpp +++ b/Telegram/SourceFiles/settings/settings_cover.cpp @@ -134,7 +134,6 @@ int CoverWidget::resizeGetHeight(int newWidth) { void CoverWidget::refreshButtonsGeometry(int newWidth) { int buttonLeft = _userpicButton->x() + _userpicButton->width() + st::settingsButtonLeft; - int buttonsRight = newWidth - st::settingsButtonSkip; _setPhoto->moveToLeft(buttonLeft, _userpicButton->y() + st::settingsButtonTop, newWidth); buttonLeft += _setPhoto->width() + st::settingsButtonSkip; _editName->moveToLeft(buttonLeft, _setPhoto->y(), newWidth); diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index 9e9110c86..2d98ca02a 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -359,7 +359,7 @@ void FileLoadTask::process() { filemime = _information->filemime; if (auto image = base::get_if(&_information->media)) { fullimage = base::take(image->data); - if (auto opaque = (filemime != stickerMime)) { + if (filemime != stickerMime) { fullimage = Images::prepareOpaque(std::move(fullimage)); } isAnimation = image->animated; diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 97cd50321..388e13c55 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -138,7 +138,7 @@ void EmptyUserpic::Impl::fillString(const QString &name) { auto ch = name.constData(), end = ch + name.size(); while (ch != end) { auto emojiLength = 0; - if (auto emoji = Ui::Emoji::Find(ch, end, &emojiLength)) { + if (Ui::Emoji::Find(ch, end, &emojiLength)) { ch += emojiLength; } else if (ch->isHighSurrogate()) { ++ch; @@ -1771,10 +1771,8 @@ 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(); - if (auto applyTheme = isTheme()) { + auto playAnimation = isAnimation() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage && item && item->getMedia(); + if (isTheme()) { if (!loc.isEmpty() && loc.accessEnable()) { Messenger::Instance().showDocument(this, item); loc.accessDisable(); diff --git a/Telegram/SourceFiles/ui/countryinput.cpp b/Telegram/SourceFiles/ui/countryinput.cpp index 22fe505c3..91f5ab914 100644 --- a/Telegram/SourceFiles/ui/countryinput.cpp +++ b/Telegram/SourceFiles/ui/countryinput.cpp @@ -97,8 +97,6 @@ CountryInput::CountryInput(QWidget *parent, const style::InputField &st) initCountries(); resize(_st.width, _st.heightMin); - auto availableWidth = width() - _st.textMargins.left() - _st.textMargins.right() - _st.placeholderMargins.left() - - _st.placeholderMargins.right() - 1; auto placeholderFont = _st.placeholderFont->f; placeholderFont.setStyleStrategy(QFont::PreferMatch); auto metrics = QFontMetrics(placeholderFont); diff --git a/Telegram/SourceFiles/ui/images.cpp b/Telegram/SourceFiles/ui/images.cpp index b9ba458be..eff8fd857 100644 --- a/Telegram/SourceFiles/ui/images.cpp +++ b/Telegram/SourceFiles/ui/images.cpp @@ -73,7 +73,7 @@ QImage prepareBlur(QImage img) { uchar *pix = img.bits(); if (pix) { - int w = img.width(), h = img.height(), wold = w, hold = h; + int w = img.width(), h = img.height(); const int radius = 3; const int r1 = radius + 1; const int div = radius * 2 + 1; diff --git a/Telegram/SourceFiles/ui/style/style_core.cpp b/Telegram/SourceFiles/ui/style/style_core.cpp index 85b340f0b..9a696d161 100644 --- a/Telegram/SourceFiles/ui/style/style_core.cpp +++ b/Telegram/SourceFiles/ui/style/style_core.cpp @@ -84,7 +84,6 @@ void colorizeImage(const QImage &src, QColor c, QImage *outResult, QRect srcRect auto pattern = anim::shifted(c); - auto resultBytesPerPixel = (src.depth() >> 3); constexpr auto resultIntsPerPixel = 1; auto resultIntsPerLine = (outResult->bytesPerLine() >> 2); auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel; diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp index 731379bbf..7f458cf58 100644 --- a/Telegram/SourceFiles/ui/text/text.cpp +++ b/Telegram/SourceFiles/ui/text/text.cpp @@ -513,7 +513,6 @@ public: qint32 i = 0, l = preparsed.size(); source.entities.clear(); source.entities.reserve(l); - const QChar s = source.text.size(); for (; i < l; ++i) { auto type = preparsed.at(i).type(); if (((type == EntityInTextMention || type == EntityInTextMentionName) && !parseMentions) || diff --git a/Telegram/SourceFiles/ui/text/text_entity.cpp b/Telegram/SourceFiles/ui/text/text_entity.cpp index 7667613ca..210fe1a3d 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.cpp +++ b/Telegram/SourceFiles/ui/text/text_entity.cpp @@ -1253,7 +1253,7 @@ QString EscapeForRichParsing(const QString &text) { QString SingleLine(const QString &text) { auto result = text; - auto s = text.unicode(), ch = s, e = text.unicode() + text.size(); + auto s = text.unicode(), e = text.unicode() + text.size(); // Trim. while (s < e && chIsTrimmed(*s)) { @@ -1315,7 +1315,6 @@ QStringList PrepareSearchWords(const QString &query, const QRegularExpression *S auto result = QStringList(); if (!clean.isEmpty()) { auto list = clean.split(SplitterOverride ? *SplitterOverride : RegExpWordSplit(), QString::SkipEmptyParts); - auto size = list.size(); result.reserve(list.size()); for_const (auto &word, list) { auto trimmed = word.trimmed(); @@ -1401,7 +1400,7 @@ bool CutPart(TextWithEntities &sending, TextWithEntities &left, qint32 limit) { } int elen = 0; - if (auto e = Ui::Emoji::Find(ch, end, &elen)) { + if (Ui::Emoji::Find(ch, end, &elen)) { for (int i = 0; i < elen; ++i, ++ch, ++s) { if (ch->isHighSurrogate() && i + 1 < elen && (ch + 1)->isLowSurrogate()) { ++ch; @@ -2066,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 e9340a1fc..c821f99fa 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.h +++ b/Telegram/SourceFiles/ui/text/text_entity.h @@ -219,10 +219,8 @@ 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; } diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.cpp b/Telegram/SourceFiles/ui/widgets/input_fields.cpp index 48431c756..222d8d725 100644 --- a/Telegram/SourceFiles/ui/widgets/input_fields.cpp +++ b/Telegram/SourceFiles/ui/widgets/input_fields.cpp @@ -1567,7 +1567,6 @@ void FlatInput::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)); if (_touchRightButton) { diff --git a/Telegram/SourceFiles/ui/widgets/tooltip.cpp b/Telegram/SourceFiles/ui/widgets/tooltip.cpp index 260c26df6..7944d5330 100644 --- a/Telegram/SourceFiles/ui/widgets/tooltip.cpp +++ b/Telegram/SourceFiles/ui/widgets/tooltip.cpp @@ -381,7 +381,6 @@ void ImportantTooltip::updateGeometry() { } void ImportantTooltip::resizeEvent(QResizeEvent *e) { - auto inner = countInner(); auto contentTop = _st.padding.top(); if (_useTransparency && (_side & RectPart::Bottom)) { contentTop += _st.arrow;