Fix almost all warnings (#157)

There are possible deprecation warnings could be on new ffmpeg. It will be investigated later.

Related to #42.
This commit is contained in:
Evgeniy Zheltonozhskiy 2018-06-12 01:59:24 +03:00 committed by Alex
parent 93d2fd3035
commit 22b0cffccd
47 changed files with 42 additions and 116 deletions

View File

@ -72,6 +72,8 @@ if (CCACHE)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
endif()
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
add_subdirectory(Telegram)
# clang-format

View File

@ -41,7 +41,6 @@ namespace {
constexpr auto kReloadChannelMembersTimeout = 1000; // 1 second wait before reload members in channel after adding
constexpr auto kSaveCloudDraftTimeout = 1000; // save draft to the cloud with 1 sec extra delay
constexpr auto kSaveDraftBeforeQuitTimeout = 1500; // give the app 1.5 secs to save drafts to cloud when quitting
constexpr auto kSmallDelayMs = 5;
constexpr auto kStickersUpdateTimeout = 3600000; // update not more than once in an hour
constexpr auto kUnreadMentionsPreloadIfLess = 5;

View File

@ -125,8 +125,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);

View File

@ -742,7 +742,6 @@ void EditColorBox::updateHSVFields() {
auto hue = std::round((1. - _hueSlider->value()) * 360);
auto saturation = std::round(_picker->valueX() * 255);
auto brightness = std::round((1. - _picker->valueY()) * 255);
auto alpha = std::round(_opacitySlider->value() * 255);
_hueField->setTextWithFocus(QString::number(hue));
_saturationField->setTextWithFocus(QString::number(percentFromByte(saturation)));
_brightnessField->setTextWithFocus(QString::number(percentFromByte(brightness)));

View File

@ -110,7 +110,7 @@ void EditPrivacyBox::prepare() {
int EditPrivacyBox::resizeGetHeight(int newWidth) {
auto top = 0;
auto layoutRow = [this, newWidth, &top](auto &widget, style::margins padding) {
auto layoutRow = [newWidth, &top](auto &widget, style::margins padding) {
if (!widget) return;
widget->resizeToNaturalWidth(newWidth - padding.left() - padding.right());
widget->moveToLeft(padding.left(), top + padding.top());
@ -152,7 +152,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;
}

View File

@ -973,7 +973,6 @@ void PeerListBox::Inner::paintRow(Painter &p, TimeMs ms, RowIndex index) {
p.drawTextLeft(namex, st::contactsPadding.top() + st::contactsStatusTop, width(), highlightedPart);
} else {
grayedPart = st::contactsStatusFont->elided(grayedPart, availableWidth - highlightedWidth);
auto grayedWidth = st::contactsStatusFont->width(grayedPart);
p.setPen(st::contactsStatusFgOnline);
p.drawTextLeft(namex, st::contactsPadding.top() + st::contactsStatusTop, width(), highlightedPart);
p.setPen(selected ? st::contactsStatusFgOver : st::contactsStatusFg);

View File

@ -667,7 +667,7 @@ void EditChatAdminsBoxController::Start(not_null<ChatData *> chat) {
}
void AddBotToGroupBoxController::Start(not_null<UserData *> bot) {
auto initBox = [bot](not_null<PeerListBox *> box) {
auto initBox = [](not_null<PeerListBox *> box) {
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
};
Ui::show(Box<PeerListBox>(std::make_unique<AddBotToGroupBoxController>(bot), std::move(initBox)));

View File

@ -716,7 +716,6 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
}
} else if (_doc) {
qint32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
qint32 h = _thumbw ? (0 + st::msgFileThumbSize + 0) : (0 + st::msgFileSize + 0);
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0;
if (_thumbw) {
nameleft = 0 + st::msgFileThumbSize + st::msgFileThumbPadding.right();

View File

@ -369,7 +369,6 @@ 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;

View File

@ -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<Ui::RippleAnimation>(
if (!set->ripple) {
set->ripple = std::make_unique<Ui::RippleAnimation>(
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));
}
}

View File

@ -548,7 +548,6 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
if (r != rect()) p.setClipRect(r);
qint32 atwidth = st::mentionFont->width('@'), hashwidth = st::mentionFont->width('#');
qint32 mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize;
qint32 mentionwidth = width() - mentionleft - 2 * st::mentionPadding.right();
qint32 htagleft = st::historyAttach.width + st::historyComposeField.textMrg.left() - st::lineWidth,
@ -928,7 +927,6 @@ void FieldAutocompleteInner::onUpdateSelected(bool force) {
qint32 sel = -1, maxSel = 0;
if (!_srows->isEmpty()) {
qint32 rows = rowscount(_srows->size(), _stickersPerRow);
qint32 row = (mouse.y() >= st::stickerPanPadding) ?
((mouse.y() - st::stickerPanPadding) / st::stickerPanSize.height()) :
-1;

View File

@ -730,7 +730,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;

View File

@ -128,7 +128,6 @@ StickersListWidget::Footer::Footer(not_null<StickersListWidget *> parent)
template <typename Callback> void StickersListWidget::Footer::enumerateVisibleIcons(Callback callback) {
int iconsX = std::round(_iconsX.current());
auto index = iconsX / st::emojiCategory.width;
auto x = _iconsLeft - (iconsX % st::emojiCategory.width);
for (auto index = std::min<int>(_icons.size(), iconsX / st::emojiCategory.width),
last = std::min(_icons.size(), index + kVisibleIconsCount);
@ -139,7 +138,7 @@ template <typename Callback> void StickersListWidget::Footer::enumerateVisibleIc
}
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();
}
@ -1547,7 +1546,7 @@ void StickersListWidget::setSelected(OverState newSelected) {
setCursor(newSelected ? style::cur_pointer : style::cur_default);
auto &sets = shownSets();
auto updateSelected = [this, &sets]() {
auto updateSelected = [this]() {
if (auto sticker = base::get_if<OverSticker>(&_selected)) {
rtlupdate(stickerRect(sticker->section, sticker->index));
} else if (auto button = base::get_if<OverButton>(&_selected)) {
@ -1692,7 +1691,7 @@ void StickersListWidget::installSet(quint64 setId) {
auto it = sets.constFind(setId);
if (it != sets.cend()) {
request(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_bool(false)))
.done([this](const MTPmessages_StickerSetInstallResult &result) {
.done([](const MTPmessages_StickerSetInstallResult &result) {
if (result.type() == mtpc_messages_stickerSetInstallResultArchive) {
Stickers::ApplyArchivedResult(result.c_messages_stickerSetInstallResultArchive());
}

View File

@ -110,7 +110,6 @@ void TabbedPanel::updateContentHeight() {
return;
}
auto was = _contentHeight;
_contentHeight = contentHeight;
resize(QRect(0, 0, innerRect().width(), _contentHeight).marginsAdded(innerPadding()).size());

View File

@ -142,8 +142,6 @@ void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, double dt, double o
_frameAlpha = anim::interpolate(1, 256, opacity);
auto frameInts = _frameInts + _innerLeft + _innerTop * _frameIntsPerLine;
auto leftToRight = (_direction == Direction::LeftToRight);
auto easeOut = anim::easeOutCirc(1., dt);

View File

@ -687,7 +687,7 @@ bool Generator::writeIncludesInSource() {
}
auto includes = QStringList();
std::function<bool(const Module &)> collector = [this, &collector, &includes](const Module &module) {
std::function<bool(const Module &)> collector = [&collector, &includes](const Module &module) {
module.enumIncludes(collector);
auto base = moduleBaseName(module);
if (!includes.contains(base)) {
@ -771,7 +771,7 @@ void palette::finalize() {\n\
compute(0, -1, { 255, 255, 255, 0}); // special color\n";
QList<structure::FullName> names;
module_.enumVariables([this, &names](const Variable &variable) -> bool {
module_.enumVariables([&names](const Variable &variable) -> bool {
names.push_back(variable.name);
return true;
});

View File

@ -104,7 +104,7 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller *> contr
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();
}
@ -2021,7 +2021,7 @@ void DialogsInner::loadPeerPhotos() {
qint32 from = (yFrom - filteredOffset()) / st::dialogsRowHeight;
if (from < 0) from = 0;
if (from < _filterResults.size()) {
qint32 to = (yTo / qint32(st::dialogsRowHeight)) + 1, w = width();
qint32 to = (yTo / qint32(st::dialogsRowHeight)) + 1;
if (to > _filterResults.size()) to = _filterResults.size();
for (; from < to; ++from) {
@ -2038,8 +2038,7 @@ void DialogsInner::loadPeerPhotos() {
qint32 to = (yTo > filteredOffset() + st::searchedBarHeight ?
((yTo - filteredOffset() - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) :
0) -
_filterResults.size() + 1,
w = width();
_filterResults.size() + 1;
if (to > _peerSearchResults.size()) to = _peerSearchResults.size();
for (; from < to; ++from) {

View File

@ -363,7 +363,7 @@ void RowPainter::paint(Painter &p, const Row *row, int fullWidth, bool active, b
history->lastItemTextCache);
}
},
[&p, fullWidth, active, selected, ms, history, unreadCount] {
[&p, active, history, unreadCount] {
if (unreadCount) {
auto counter = QString::number(unreadCount);
if (counter.size() > 4) {

View File

@ -79,9 +79,6 @@ void ChatSearchFromController::rowClicked(not_null<PeerListRow *> row) {
}
void ChatSearchFromController::rebuildRows() {
auto ms = getms();
auto wasEmpty = !delegate()->peerListFullRowsCount();
auto now = unixtime();
QMultiMap<qint32, UserData *> ordered;
if (_chat->noParticipantInfo()) {

View File

@ -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());

View File

@ -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<DeleteMessagesBox>(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<MTPMessage>());
@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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()) {

View File

@ -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);
}
@ -2157,7 +2157,7 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) {
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())) {
if (buttonsRect.y() + buttonsRect.height() > height()) {
buttonsRect.moveTop(height() - buttonsRect.height());
fillOverlay(buttonsRect);
}

View File

@ -52,7 +52,6 @@ void SessionData::clear(Instance *instance) {
{
QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()),
locker4(wereAckedMutex());
auto receivedResponsesEnd = _receivedResponses.cend();
clearCallbacks.reserve(_haveSent.size() + _wereAcked.size());
for (auto i = _haveSent.cbegin(), e = _haveSent.cend(); i != e; ++i) {
auto requestId = i.value()->requestId;

View File

@ -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};
@ -833,9 +828,6 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
selto = _dragSelFromIndex;
}
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);
qint32 rowFrom =
@ -859,7 +851,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 +889,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);
@ -1018,8 +1009,6 @@ void OverviewInner::onUpdateSelected() {
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};
updateDragSelection(0, -1, 0, -1, false);
} else if (canSelectMany) {
@ -1691,7 +1680,6 @@ void OverviewInner::mediaOverviewUpdated() {
auto &o = _history->overview(_type);
auto migratedOverview = _migrated ? &_migrated->overview(_type) : nullptr;
auto migrateCount = migratedIndexSkip();
auto wasCount = _items.size();
auto fullCount = (migrateCount + o.size());
auto tocheck = std::min(fullCount, _itemsToBeLoaded);
_items.reserve(tocheck);
@ -1923,7 +1911,6 @@ int OverviewInner::countHeight() {
if (_type == OverviewPhotos || _type == OverviewVideos) {
auto count = _items.size();
auto migratedFullCount = _migrated ? _migrated->overviewCount(_type) : 0;
auto fullCount = migratedFullCount + _history->overviewCount(_type);
auto rows = (count / _photosInRow) + ((count % _photosInRow) ? 1 : 0);
return (_rowWidth + st::overviewPhotoSkip) * rows + st::overviewPhotoSkip;
}

View File

@ -36,7 +36,6 @@ namespace Platform {
namespace {
bool noQtTrayIcon = false, tryAppIndicator = false;
bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false;
qint32 _trayIconSize = 22;
@ -209,9 +208,6 @@ void MainWindow::unreadCounterChangedHook() {
void MainWindow::updateIconCounters() {
updateWindowIcon();
auto counter = App::histories().unreadBadge();
if (noQtTrayIcon) {
} else if (trayIcon) {
QIcon icon;
@ -251,13 +247,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 +263,6 @@ void MainWindow::psFirstShow() {
} else {
show();
}
showShadows = false;
} else {
show();
}

View File

@ -55,7 +55,6 @@ protected:
int resizeGetHeight(int newWidth) override = 0;
void contentSizeUpdated() {
auto oldHeight = height();
resizeToWidth(width());
emit heightUpdated();
}

View File

@ -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);

View File

@ -359,7 +359,7 @@ void FileLoadTask::process() {
filemime = _information->filemime;
if (auto image = base::get_if<FileLoadTask::Image>(&_information->media)) {
fullimage = base::take(image->data);
if (auto opaque = (filemime != stickerMime)) {
if (filemime != stickerMime) {
fullimage = Images::prepareOpaque(std::move(fullimage));
}
isAnimation = image->animated;

View File

@ -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;
@ -1774,7 +1774,7 @@ void DocumentData::performActionOnLoad() {
auto playAnimation = isAnimation() &&
(_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage &&
item && item->getMedia();
if (auto applyTheme = isTheme()) {
if (isTheme()) {
if (!loc.isEmpty() && loc.accessEnable()) {
Messenger::Instance().showDocument(this, item);
loc.accessDisable();

View File

@ -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);

View File

@ -30,8 +30,6 @@ namespace Ui {
namespace Emoji {
namespace {
constexpr auto kSaveRecentEmojiTimeout = 3000;
auto WorkingIndex = -1;
void AppendPartToResult(TextWithEntities &result, const QChar *start, const QChar *from, const QChar *to) {

View File

@ -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;

View File

@ -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;

View File

@ -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) ||

View File

@ -341,7 +341,7 @@ EmojiBlock::EmojiBlock(const style::font &font, const QString &str, quint16 from
: ITextBlock(font, str, from, length, flags, lnkIndex)
, emoji(emoji) {
_flags |= ((TextBlockTEmoji & 0x0F) << 8);
_width = int(st::emojiSize + 2 * st::emojiPadding);
_width = st::emojiSize + 2 * st::emojiPadding;
_rpadding = 0;
for (auto i = length; i != 0;) {

View File

@ -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) {

View File

@ -219,7 +219,7 @@ enum class PrepareTextOption {
CheckLinks,
};
inline QString PrepareForSending(const QString &text, PrepareTextOption option = PrepareTextOption::IgnoreLinks) {
auto result = TextWithEntities{text};
auto result = TextWithEntities{text}; // , {}}
auto prepareFlags = (option == PrepareTextOption::CheckLinks) ?
(TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands) :
0;

View File

@ -28,13 +28,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <QWindow>
namespace {
constexpr double kFadeHeight = 1. / 3;
constexpr int kFadeAlphaMax = 160;
} // namespace
namespace Ui {
InnerDropdown::InnerDropdown(QWidget *parent, const style::InnerDropdown &st)

View File

@ -302,7 +302,6 @@ void FlatTextarea::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) {
@ -1567,7 +1566,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) {
@ -1729,9 +1727,8 @@ void FlatInput::phPrepare(Painter &p, double placeholderFocused) {
void FlatInput::keyPressEvent(QKeyEvent *e) {
QString wasText(_oldtext);
bool shift = e->modifiers().testFlag(Qt::ShiftModifier), alt = e->modifiers().testFlag(Qt::AltModifier);
bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier),
ctrlGood = true;
bool shift = e->modifiers().testFlag(Qt::ShiftModifier);
bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier);
if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
e->ignore();
} else {
@ -3688,9 +3685,8 @@ void MaskedInputField::keyPressEvent(QKeyEvent *e) {
QString wasText(_oldtext);
qint32 wasCursor(_oldcursor);
bool shift = e->modifiers().testFlag(Qt::ShiftModifier), alt = e->modifiers().testFlag(Qt::AltModifier);
bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier),
ctrlGood = true;
bool shift = e->modifiers().testFlag(Qt::ShiftModifier);
bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier);
if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
e->ignore();
} else {

View File

@ -139,7 +139,6 @@ bool MultiSelect::Item::paintCached(Painter &p, int x, int y, int outerWidth) {
PainterHighQualityEnabler hq(p);
auto opacity = _visibility.current(_hiding ? 0. : 1.);
auto scale = opacity + _st.minScale * (1. - opacity);
auto height = opacity * _cache.height() / _cache.devicePixelRatio();
auto width = opacity * _cache.width() / _cache.devicePixelRatio();

View File

@ -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;

View File

@ -113,11 +113,10 @@ void CachedUserpics::onClear() {
CachedUserpics::~CachedUserpics() {
if (_someSavedFlag) {
TimeMs result = 0;
for_const (auto &item, _images) { QFile(item.path).remove(); }
// This works about 1200ms on Windows for a folder with one image O_o
// psDeleteDir(cWorkingDir() + qsl("tdata/temp"));
// psDeleteDir(cWorkingDir() + qsl("tdata/temp"));
}
}

View File

@ -366,7 +366,6 @@ void adjustColorsUsingBackground(const QImage &img) {
Assert(img.format() == QImage::Format_ARGB32_Premultiplied);
quint64 components[3] = {0};
quint64 componentsScroll[3] = {0};
auto w = img.width();
auto h = img.height();
auto size = w * h;

View File

@ -651,7 +651,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;
@ -815,10 +814,8 @@ 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 nametop = y + st::msgFileNameTop;
auto nameright = st::msgFilePadding.left();
auto statustop = y + st::msgFileStatusTop;
auto bottom = y + st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom();
auto inner = rtlrect(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), st::msgFileSize,
st::msgFileSize, _rect.width());
@ -835,7 +832,7 @@ void Generator::paintBubble(const Bubble &bubble) {
// rescale waveform by going in waveform.size * bar_count 1D grid
auto active = bubble.outbg ? st::msgWaveformOutActive[_palette] : st::msgWaveformInActive[_palette];
auto inactive = bubble.outbg ? st::msgWaveformOutInactive[_palette] : st::msgWaveformInInactive[_palette];
qint32 wf_size = bubble.waveform.size(), availw = namewidth + st::msgWaveformSkip;
qint32 wf_size = bubble.waveform.size();
qint32 bar_count = wf_size;
qint32 max_delta = st::msgWaveformMax - st::msgWaveformMin;
auto wave_bottom = y + st::msgFilePadding.top() + st::msgWaveformMax;