Remove unused variable

The following are commits related to removed variables.

apiwrap.cpp
e050e27: kSaveDraftBeforeQuitTimeout

app.cpp
113f665: serviceImageCacheSize

boxes/auto_download_box.cpp
a0c6104: checked(Source source, Type type)

boxes/background_preview_box.cpp
b6edf45: resultBytesPerPixel
fe21b5a: ms

boxes/calendar_box.cpp
ae97704: yearIndex, monthIndex
99bb093: ms

boxes/connection_box.cpp
f794d8d: ping

boxes/dictionaries_manager.cpp
8353867: session

boxes/peer_list_box.cpp
2ce2a14: grayedWidth

boxes/peers/add_participants_box.cpp
07e010d: chat, channel

boxes/self_destruction_box.cpp
fe9f02e: count

chat_helpers/emoji_suggestions_widget.cpp
a12bc60: is(QLatin1String string)

chat_helpers/field_autocomplete.cpp
8c7a35c: atwidth, hashwidth

chat_helpers/gifs_list_widget.cpp
ff65734: inlineItems
3d846fc: newSelected
d1687ab: kSaveDraftBeforeQuitTimeout

chat_helpers/stickers_dice_pack.cpp
c83e297: kZeroDiceDocumentId

chat_helpers/stickers_emoji_pack.cpp
d298953: length

chat_helpers/stickers_list_widget.cpp
eb75859: index, x

core/crash_reports.cpp
5940ae6: LaunchedDateTimeStr, LaunchedBinaryName

data/data_changes.cpp
3c4e959:clearRealtime

data/data_cloud_file.cpp
4b354b0: fromCloud, cacheTag

data/data_document_media.cpp
7db5359: kMaxVideoFrameArea

data/data_messages.cpp
794e315: wasCount

data/data_photo_media.cpp
e27d2bc: index

data/data_wall_paper.cpp
b6edf45: resultBytesPerPixel

data/data_types.cpp
aa8f62d: kWebDocumentCacheTag, kStorageCacheMask

history/admin_log/history_admin_log_inner.cpp
794e315: canDelete, canForward

history/history_location_manager.cpp
60f45ab: kCoordPrecision
9f90d3a: kMaxHttpRedirects

history/history_message.cpp
cedf8a6: kPinnedMessageTextLimit

history/history_widget.cpp
b305924: serviceColor
efa5fc4: hasForward
5e7aa4f: kTabbedSelectorToggleTooltipTimeoutMs, kTabbedSelectorToggleTooltipCount

history/view/history_view_context_menu.cpp
fe1a90b: isVideoLink, isVoiceLink, isAudioLink

settings.cpp
e2f54eb: defaultRecent

settings/settings_folders.cpp
e8bf5bb: kRefreshSuggestedTimeout

ui/filter_icon_panel.cpp
c4a0bc1: kDelayedHideTimeoutMs

window/themes/window_theme_preview.cpp
ef927c8: mutedCounter

-----

Modified variables

boxes/stickers_box.cpp
554eb3a: _rows[pressedIndex] -> set

data/data_notify_settings.cpp
734c410: muteForSeconds -> muteUntil

history/view/history_view_list_widget.cpp
07528be: _items[index] -> view
e5f3bed: fromState, tillState

history/history.cpp
cd3c1c6: kStatusShowClientsideRecordVideo -> kStatusShowClientsideRecordVoice

storage/download_manager_mtproto.cpp
ae8fb14: _queues[dcId] -> queue

storage/localstorage.cpp
357caf8: MTP::Environment::Production -> production
This commit is contained in:
Sean Wei 2020-07-02 18:42:30 +08:00 committed by John Preston
parent c61cabb075
commit 556aa28df6
39 changed files with 12 additions and 121 deletions

View File

@ -83,9 +83,6 @@ constexpr auto kReloadChannelMembersTimeout = 1000;
// Save draft to the cloud with 1 sec extra delay.
constexpr auto kSaveCloudDraftTimeout = 1000;
// Give the app 1.5 secs to save drafts to cloud when quitting.
constexpr auto kSaveDraftBeforeQuitTimeout = 1500;
// Max users in one super group invite request.
constexpr auto kMaxUsersPerInvite = 100;

View File

@ -74,8 +74,6 @@ using CornersMap = QMap<uint32, CornersPixmaps>;
CornersMap cornersMap;
QImage cornersMaskLarge[4], cornersMaskSmall[4];
int32 serviceImageCacheSize = 0;
} // namespace
namespace App {

View File

@ -97,9 +97,6 @@ void AutoDownloadBox::setupContent() {
setTitle(tr::lng_profile_settings_section());
const auto settings = &_session->settings().autoDownload();
const auto checked = [=](Source source, Type type) {
return (settings->bytesLimit(source, type) > 0);
};
auto wrap = object_ptr<Ui::VerticalLayout>(this);
const auto content = wrap.data();

View File

@ -348,7 +348,6 @@ QImage ColorizePattern(QImage image, QColor color) {
const auto height = image.height();
const auto pattern = anim::shifted(color);
const auto resultBytesPerPixel = (image.depth() >> 3);
constexpr auto resultIntsPerPixel = 1;
const auto resultIntsPerLine = (image.bytesPerLine() >> 2);
const auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel;
@ -744,7 +743,6 @@ void BackgroundPreviewBox::checkLoadedDocument() {
guard = _generating.make_guard()
]() mutable {
auto scaled = PrepareScaledFromFull(image, patternBackground);
const auto ms = crl::now();
auto blurred = patternBackground
? QImage()
: PrepareScaledNonPattern(

View File

@ -122,8 +122,6 @@ void CalendarBox::Context::applyMonth(const QDate &month, bool forced) {
_daysCount = month.daysInMonth();
_daysShift = daysShiftForMonth(month);
_rowsCount = rowsCountForMonth(month);
auto yearIndex = month.year();
auto monthIndex = month.month();
_highlightedIndex = month.daysTo(_highlighted);
_minDayIndex = _min.isNull() ? INT_MIN : month.daysTo(_min);
_maxDayIndex = _max.isNull() ? INT_MAX : month.daysTo(_max);
@ -302,7 +300,6 @@ int CalendarBox::Inner::rowsTop() const {
void CalendarBox::Inner::paintRows(Painter &p, QRect clip) {
p.setFont(st::calendarDaysFont);
auto ms = crl::now();
auto y = rowsTop();
auto index = -_context->daysShift();
auto highlightedIndex = _context->highlightedIndex();

View File

@ -1415,7 +1415,6 @@ auto ProxiesBoxController::views() const -> rpl::producer<ItemView> {
}
void ProxiesBoxController::updateView(const Item &item) {
const auto ping = 0;
const auto selected = (Global::SelectedProxy() == item.data);
const auto deleted = item.deleted;
const auto type = [&] {

View File

@ -388,7 +388,6 @@ void ManageDictionariesBox::setInnerFocus() {
void ManageDictionariesBox::prepare() {
const auto multiSelect = CreateMultiSelect(this);
const auto session = &_controller->session();
const auto inner = setInnerWidget(
object_ptr<Inner>(
this,

View File

@ -1299,7 +1299,6 @@ crl::time PeerListContent::paintRow(
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
} else {
grayedPart = st::contactsStatusFont->elided(grayedPart, availableWidth - highlightedWidth);
auto grayedWidth = st::contactsStatusFont->width(grayedPart);
p.setPen(_st.item.statusFgActive);
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
p.setPen(selected ? _st.item.statusFgOver : _st.item.statusFg);

View File

@ -654,8 +654,6 @@ void AddSpecialBoxController::showRestricted(
_editParticipantBox->closeBox();
}
const auto chat = _peer->asChat();
const auto channel = _peer->asChannel();
const auto showRestrictedSure = crl::guard(this, [=] {
showRestricted(user, true);
});

View File

@ -62,7 +62,6 @@ void SelfDestructionBox::showContent() {
_description->moveToLeft(st::boxPadding.left(), y);
y += _description->height() + st::boxMediumSkip;
const auto count = int(_ttlValues.size());
for (const auto value : _ttlValues) {
const auto button = Ui::CreateChild<Ui::Radiobutton>(
this,

View File

@ -1435,12 +1435,12 @@ void StickersBox::Inner::setPressed(SelectedRow pressed) {
update(0, _itemsTop + pressedIndex * _rowHeight, width(), _rowHeight);
auto &set = _rows[pressedIndex];
auto rippleMask = Ui::RippleAnimation::rectMask(QSize(width(), _rowHeight));
if (!_rows[pressedIndex]->ripple) {
_rows[pressedIndex]->ripple = std::make_unique<Ui::RippleAnimation>(st::contactsRipple, std::move(rippleMask), [this, pressedIndex] {
if (!set->ripple) {
set->ripple = std::make_unique<Ui::RippleAnimation>(st::contactsRipple, std::move(rippleMask), [this, pressedIndex] {
update(0, _itemsTop + pressedIndex * _rowHeight, width(), _rowHeight);
});
}
_rows[pressedIndex]->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + pressedIndex * _rowHeight));
set->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + pressedIndex * _rowHeight));
}
}

View File

@ -698,9 +698,6 @@ QString SuggestionsController::getEmojiQuery() {
cursor.movePosition(QTextCursor::End);
return cursor.position();
}();
const auto is = [&](QLatin1String string) {
return (text.compare(string, Qt::CaseInsensitive) == 0);
};
if (!_options.suggestExactFirstWord
|| !length
|| text[0].isSpace()

View File

@ -620,8 +620,6 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
if (r != rect()) p.setClipRect(r);
auto atwidth = st::mentionFont->width('@');
auto hashwidth = st::mentionFont->width('#');
auto mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize;
auto mentionwidth = width()
- mentionleft

View File

@ -36,7 +36,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace ChatHelpers {
namespace {
constexpr auto kSaveChosenTabTimeout = 1000;
constexpr auto kSearchRequestDelay = 400;
constexpr auto kInlineItemsMaxPerRow = 5;
constexpr auto kSearchBotUsername = "gif"_cs;
@ -803,7 +802,6 @@ bool GifsListWidget::inlineItemVisible(const InlineBots::Layout::ItemBase *layou
auto col = position % MatrixRowShift;
Assert((row < _rows.size()) && (col < _rows[row].items.size()));
auto &inlineItems = _rows[row].items;
auto top = 0;
for (auto i = 0; i != row; ++i) {
top += _rows[i].height;
@ -952,9 +950,7 @@ void GifsListWidget::updateSelected() {
return;
}
auto newSelected = -1;
auto p = mapFromGlobal(_lastMousePos);
int sx = (rtl() ? width() - p.x() : p.x()) - (st::inlineResultsLeft - st::buttonRadius);
int sy = p.y() - st::stickerPanPadding;
int row = -1, col = -1, sel = -1;

View File

@ -19,11 +19,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QFileInfo>
namespace Stickers {
namespace {
constexpr auto kZeroDiceDocumentId = 0xa3b83c9f84fa9e83ULL;
} // namespace
DicePack::DicePack(not_null<Main::Session*> session, const QString &emoji)
: _session(session)

View File

@ -130,7 +130,6 @@ EmojiPack::EmojiPack(not_null<Main::Session*> session)
EmojiPack::~EmojiPack() = default;
bool EmojiPack::add(not_null<HistoryItem*> item) {
auto length = 0;
if (const auto emoji = item->isolatedEmoji()) {
_items[emoji].emplace(item);
return true;
@ -141,7 +140,6 @@ bool EmojiPack::add(not_null<HistoryItem*> item) {
void EmojiPack::remove(not_null<const HistoryItem*> item) {
Expects(item->isIsolatedEmoji());
auto length = 0;
const auto emoji = item->isolatedEmoji();
const auto i = _items.find(emoji);
Assert(i != end(_items));

View File

@ -256,8 +256,6 @@ StickersListWidget::Footer::Footer(not_null<StickersListWidget*> parent)
void StickersListWidget::Footer::clearHeavyData() {
const auto count = int(_icons.size());
const auto iconsX = qRound(_iconsX.current());
const auto index = iconsX / st::stickerIconWidth;
const auto x = _iconsLeft - (iconsX % st::stickerIconWidth);
const auto first = floorclamp(iconsX, st::stickerIconWidth, 0, count);
const auto last = ceilclamp(
iconsX + width(),

View File

@ -65,8 +65,6 @@ AnnotationRefs ProcessAnnotationRefs;
QString ReportPath;
FILE *ReportFile = nullptr;
int ReportFileNo = 0;
char LaunchedDateTimeStr[32] = { 0 };
char LaunchedBinaryName[256] = { 0 };
void SafeWriteChar(char ch) {
fwrite(&ch, 1, 1, ReportFile);

View File

@ -33,7 +33,6 @@ template <typename DataType, typename UpdateType>
void Changes::Manager<DataType, UpdateType>::sendRealtimeNotifications(
not_null<DataType*> data,
Flags flags) {
auto clearRealtime = false;
for (auto i = 0; i != kCount; ++i) {
const auto flag = static_cast<Flag>(1U << i);
if (flags & flag) {

View File

@ -100,8 +100,6 @@ bool CloudImage::failed() const {
}
void CloudImage::load(not_null<Main::Session*> session, FileOrigin origin) {
const auto fromCloud = LoadFromCloudOrLocal;
const auto cacheTag = kImageCacheTag;
const auto autoLoading = false;
const auto finalCheck = [=] {
if (const auto active = activeView()) {

View File

@ -33,7 +33,6 @@ namespace {
constexpr auto kReadAreaLimit = 12'032 * 9'024;
constexpr auto kWallPaperThumbnailLimit = 960;
constexpr auto kMaxVideoFrameArea = 7'680 * 4'320;
constexpr auto kGoodThumbQuality = 87;
enum class FileType {

View File

@ -98,7 +98,6 @@ void MessagesList::addRange(
bool incrementCount) {
Expects(!count || !incrementCount);
auto wasCount = _count;
auto update = MessagesSliceUpdate();
auto result = addRangeItemsAndCountNew(
update,

View File

@ -178,7 +178,7 @@ bool NotifySettings::change(
MTP_flags(flags),
MTPBool(),
silentPosts ? MTP_bool(*silentPosts) : MTPBool(),
muteForSeconds ? MTP_int(base::unixtime::now() + *muteForSeconds) : MTPint(),
MTP_int(muteUntil),
MTPstring()));
}

View File

@ -99,7 +99,6 @@ float64 PhotoMedia::progress() const {
void PhotoMedia::automaticLoad(
Data::FileOrigin origin,
const HistoryItem *item) {
const auto index = PhotoSizeIndex(PhotoSize::Large);
if (!item || loaded() || _owner->cancelled()) {
return;
}

View File

@ -21,8 +21,6 @@ constexpr auto kDocumentCacheTag = 0x0000000000000100ULL;
constexpr auto kDocumentCacheMask = 0x00000000000000FFULL;
constexpr auto kDocumentThumbCacheTag = 0x0000000000000200ULL;
constexpr auto kDocumentThumbCacheMask = 0x00000000000000FFULL;
constexpr auto kStorageCacheTag = 0x0000010000000000ULL;
constexpr auto kStorageCacheMask = 0x000000FFFFFFFFFFULL;
constexpr auto kWebDocumentCacheTag = 0x0000020000000000ULL;
constexpr auto kWebDocumentCacheMask = 0x000000FFFFFFFFFFULL;
constexpr auto kUrlCacheTag = 0x0000030000000000ULL;

View File

@ -544,7 +544,6 @@ QImage PreparePatternImage(
const auto patternBg = anim::shifted(bg);
const auto patternFg = anim::shifted(fg);
const auto resultBytesPerPixel = (image.depth() >> 3);
constexpr auto resultIntsPerPixel = 1;
const auto resultIntsPerLine = (image.bytesPerLine() >> 2);
const auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel;

View File

@ -1105,8 +1105,6 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
} else { // maybe cursor on some text history item?
const auto item = view ? view->data().get() : nullptr;
const auto itemId = item ? item->fullId() : FullMsgId();
bool canDelete = item && item->canDelete() && (item->id > 0 || !item->serviceMsg());
bool canForward = item && item->allowsForward();
auto msg = dynamic_cast<HistoryMessage*>(item);
if (isUponSelected > 0) {

View File

@ -375,7 +375,7 @@ bool History::updateSendActionNeedsAnimating(
}, [&](const MTPDsendMessageRecordVideoAction &) {
emplaceAction(Type::RecordVideo, kStatusShowClientsideRecordVideo);
}, [&](const MTPDsendMessageRecordAudioAction &) {
emplaceAction(Type::RecordVoice, kStatusShowClientsideRecordVideo);
emplaceAction(Type::RecordVoice, kStatusShowClientsideRecordVoice);
}, [&](const MTPDsendMessageRecordRoundAction &) {
emplaceAction(Type::RecordRound, kStatusShowClientsideRecordRound);
}, [&](const MTPDsendMessageGeoLocationAction &) {

View File

@ -14,13 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_file_origin.h"
#include "platform/platform_specific.h"
namespace {
constexpr auto kCoordPrecision = 8;
constexpr auto kMaxHttpRedirects = 5;
} // namespace
QString LocationClickHandler::copyToClipboardText() const {
return _text;
}

View File

@ -52,8 +52,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
constexpr auto kPinnedMessageTextLimit = 16;
[[nodiscard]] MTPDmessage::Flags NewForwardedFlags(
not_null<PeerData*> peer,
UserId from,

View File

@ -118,8 +118,6 @@ namespace {
constexpr auto kMessagesPerPageFirst = 30;
constexpr auto kMessagesPerPage = 50;
constexpr auto kPreloadHeightsCount = 3; // when 3 screens to scroll left make a preload request
constexpr auto kTabbedSelectorToggleTooltipTimeoutMs = 3000;
constexpr auto kTabbedSelectorToggleTooltipCount = 3;
constexpr auto kScrollToVoiceAfterScrolledMs = 1000;
constexpr auto kSkipRepaintWhileScrollMs = 100;
constexpr auto kShowMembersDropdownTimeoutMs = 300;
@ -6695,9 +6693,6 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
if (!drawWebPagePreview) {
const auto firstItem = _toForward.front();
const auto firstMedia = firstItem->media();
const auto serviceColor = (_toForward.size() > 1)
|| (firstMedia != nullptr)
|| firstItem->serviceMsg();
const auto preview = (_toForward.size() < 2 && firstMedia && firstMedia->hasReplyPreview())
? firstMedia->replyPreview()
: nullptr;
@ -6825,7 +6820,6 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
Expects(_pinnedBar != nullptr);
auto top = _topBar->bottomNoMargins();
bool serviceColor = false, hasForward = readyToForward();
p.fillRect(myrtlrect(0, top, width(), st::historyReplyHeight), st::historyPinnedBg);
top += st::msgReplyPadding.top();

View File

@ -634,9 +634,6 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
const auto document = linkDocument
? linkDocument->document().get()
: nullptr;
const auto isVideoLink = document ? document->isVideoFile() : false;
const auto isVoiceLink = document ? document->isVoiceMessage() : false;
const auto isAudioLink = document ? document->isAudioFile() : false;
const auto hasSelection = !request.selectedItems.empty()
|| !request.selectedText.empty();

View File

@ -358,7 +358,7 @@ std::optional<int> ListWidget::scrollTopForPosition(
}
const auto index = findNearestItem(position);
const auto view = _items[index];
return scrollTopForView(_items[index]);
return scrollTopForView(view);
}
std::optional<int> ListWidget::scrollTopForView(
@ -1748,11 +1748,9 @@ void ListWidget::updateDragSelection() {
}
const auto fromView = selectingUp ? overView : pressView;
const auto tillView = selectingUp ? pressView : overView;
updateDragSelection(
selectingUp ? overView : pressView,
selectingUp ? _overState : _pressState,
selectingUp ? pressView : overView,
selectingUp ? _pressState : _overState);
const auto fromState = selectingUp ? _overState : _pressState;
const auto tillState = selectingUp ? _pressState : _overState;
updateDragSelection(fromView, fromState, tillView, tillState);
}
void ListWidget::updateDragSelection(

View File

@ -104,42 +104,6 @@ RecentEmojiPack &GetRecentEmoji() {
}
}
}
const auto defaultRecent = {
0xD83DDE02LLU,
0xD83DDE18LLU,
0x2764LLU,
0xD83DDE0DLLU,
0xD83DDE0ALLU,
0xD83DDE01LLU,
0xD83DDC4DLLU,
0x263ALLU,
0xD83DDE14LLU,
0xD83DDE04LLU,
0xD83DDE2DLLU,
0xD83DDC8BLLU,
0xD83DDE12LLU,
0xD83DDE33LLU,
0xD83DDE1CLLU,
0xD83DDE48LLU,
0xD83DDE09LLU,
0xD83DDE03LLU,
0xD83DDE22LLU,
0xD83DDE1DLLU,
0xD83DDE31LLU,
0xD83DDE21LLU,
0xD83DDE0FLLU,
0xD83DDE1ELLU,
0xD83DDE05LLU,
0xD83DDE1ALLU,
0xD83DDE4ALLU,
0xD83DDE0CLLU,
0xD83DDE00LLU,
0xD83DDE0BLLU,
0xD83DDE06LLU,
0xD83DDC4CLLU,
0xD83DDE10LLU,
0xD83DDE15LLU,
};
for (const auto emoji : Ui::Emoji::GetDefaultRecent()) {
if (result.size() >= kRecentEmojiLimit) break;

View File

@ -37,7 +37,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Settings {
namespace {
constexpr auto kRefreshSuggestedTimeout = 7200 * crl::time(1000);
constexpr auto kFiltersLimit = 10;
using Flag = Data::ChatFilter::Flag;

View File

@ -349,7 +349,7 @@ void DownloadManagerMtproto::removeSession(MTP::DcId dcId) {
// Make sure we don't send anything to that session while redirecting.
session.requested += kMaxWaitedInSession * kMaxSessionsCount;
_queues[dcId].removeSession(index);
queue.removeSession(index);
Assert(session.requested == kMaxWaitedInSession * kMaxSessionsCount);
dc.sessions.pop_back();

View File

@ -106,13 +106,13 @@ bool CheckStreamStatus(QDataStream &stream) {
[[nodiscard]] const MTP::Config &LookupFallbackConfig() {
static const auto lookupConfig = [](not_null<Main::Account*> account) {
const auto mtp = &account->mtp();
return (mtp->environment() == MTP::Environment::Production)
const auto production = MTP::Environment::Production;
return (mtp->environment() == production)
? &mtp->config()
: nullptr;
};
const auto &app = Core::App();
const auto &domain = app.domain();
const auto production = MTP::Environment::Production;
if (!domain.started()) {
return app.fallbackProductionConfig();
}

View File

@ -22,7 +22,6 @@ namespace Ui {
namespace {
constexpr auto kHideTimeoutMs = crl::time(300);
constexpr auto kDelayedHideTimeoutMs = 3 * crl::time(1000);
constexpr auto kIconsPerRow = 6;
constexpr auto kIcons = std::array{

View File

@ -627,7 +627,6 @@ void Generator::paintRow(const Row &row) {
auto availableWidth = namewidth;
if (row.unreadCounter) {
auto counter = QString::number(row.unreadCounter);
auto mutedCounter = row.muted;
auto unreadRight = x + fullWidth - st::dialogsPadding.x();
auto unreadTop = texttop + st::dialogsTextFont->ascent - st::dialogsUnreadFont->ascent - (st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2;