Further warning fixes

This commit is contained in:
Evgenii Zheltonozhskii 2018-06-08 19:50:27 +03:00
parent f9c7e0bddb
commit 2563fa0dff
12 changed files with 7 additions and 35 deletions

View File

@ -41,7 +41,6 @@ namespace {
constexpr auto kReloadChannelMembersTimeout = 1000; // 1 second wait before reload members in channel after adding 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 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 kSmallDelayMs = 5;
constexpr auto kStickersUpdateTimeout = 3600000; // update not more than once in an hour constexpr auto kStickersUpdateTimeout = 3600000; // update not more than once in an hour
constexpr auto kUnreadMentionsPreloadIfLess = 5; constexpr auto kUnreadMentionsPreloadIfLess = 5;

View File

@ -828,8 +828,6 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
selto = _dragSelFromIndex; selto = _dragSelFromIndex;
} }
SelectedItems::const_iterator selEnd = _selected.cend();
if (_type == OverviewPhotos || _type == OverviewVideos) { if (_type == OverviewPhotos || _type == OverviewVideos) {
qint32 count = _items.size(), rowsCount = count / _photosInRow + ((count % _photosInRow) ? 1 : 0); qint32 count = _items.size(), rowsCount = count / _photosInRow + ((count % _photosInRow) ? 1 : 0);
qint32 rowFrom = qint32 rowFrom =
@ -1682,7 +1680,6 @@ void OverviewInner::mediaOverviewUpdated() {
auto &o = _history->overview(_type); auto &o = _history->overview(_type);
auto migratedOverview = _migrated ? &_migrated->overview(_type) : nullptr; auto migratedOverview = _migrated ? &_migrated->overview(_type) : nullptr;
auto migrateCount = migratedIndexSkip(); auto migrateCount = migratedIndexSkip();
auto wasCount = _items.size();
auto fullCount = (migrateCount + o.size()); auto fullCount = (migrateCount + o.size());
auto tocheck = std::min(fullCount, _itemsToBeLoaded); auto tocheck = std::min(fullCount, _itemsToBeLoaded);
_items.reserve(tocheck); _items.reserve(tocheck);
@ -1914,7 +1911,6 @@ int OverviewInner::countHeight() {
if (_type == OverviewPhotos || _type == OverviewVideos) { if (_type == OverviewPhotos || _type == OverviewVideos) {
auto count = _items.size(); auto count = _items.size();
auto migratedFullCount = _migrated ? _migrated->overviewCount(_type) : 0; auto migratedFullCount = _migrated ? _migrated->overviewCount(_type) : 0;
auto fullCount = migratedFullCount + _history->overviewCount(_type);
auto rows = (count / _photosInRow) + ((count % _photosInRow) ? 1 : 0); auto rows = (count / _photosInRow) + ((count % _photosInRow) ? 1 : 0);
return (_rowWidth + st::overviewPhotoSkip) * rows + st::overviewPhotoSkip; return (_rowWidth + st::overviewPhotoSkip) * rows + st::overviewPhotoSkip;
} }

View File

@ -36,7 +36,6 @@ namespace Platform {
namespace { namespace {
bool noQtTrayIcon = false, tryAppIndicator = false; bool noQtTrayIcon = false, tryAppIndicator = false;
bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false;
qint32 _trayIconSize = 22; qint32 _trayIconSize = 22;
@ -209,9 +208,6 @@ void MainWindow::unreadCounterChangedHook() {
void MainWindow::updateIconCounters() { void MainWindow::updateIconCounters() {
updateWindowIcon(); updateWindowIcon();
auto counter = App::histories().unreadBadge();
if (noQtTrayIcon) { if (noQtTrayIcon) {
} else if (trayIcon) { } else if (trayIcon) {
QIcon icon; QIcon icon;

View File

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

View File

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

View File

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

View File

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

View File

@ -302,7 +302,6 @@ void FlatTextarea::touchEvent(QTouchEvent *e) {
case QEvent::TouchEnd: case QEvent::TouchEnd:
if (!_touchPress) return; if (!_touchPress) return;
if (!_touchMove && window()) { if (!_touchMove && window()) {
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart)); QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
if (_touchRightButton) { if (_touchRightButton) {
@ -1728,9 +1727,8 @@ void FlatInput::phPrepare(Painter &p, double placeholderFocused) {
void FlatInput::keyPressEvent(QKeyEvent *e) { void FlatInput::keyPressEvent(QKeyEvent *e) {
QString wasText(_oldtext); QString wasText(_oldtext);
bool shift = e->modifiers().testFlag(Qt::ShiftModifier), alt = e->modifiers().testFlag(Qt::AltModifier); bool shift = e->modifiers().testFlag(Qt::ShiftModifier);
bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier), bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier);
ctrlGood = true;
if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) { if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
e->ignore(); e->ignore();
} else { } else {
@ -3687,9 +3685,8 @@ void MaskedInputField::keyPressEvent(QKeyEvent *e) {
QString wasText(_oldtext); QString wasText(_oldtext);
qint32 wasCursor(_oldcursor); qint32 wasCursor(_oldcursor);
bool shift = e->modifiers().testFlag(Qt::ShiftModifier), alt = e->modifiers().testFlag(Qt::AltModifier); bool shift = e->modifiers().testFlag(Qt::ShiftModifier);
bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier), bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier);
ctrlGood = true;
if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) { if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
e->ignore(); e->ignore();
} else { } else {

View File

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

View File

@ -113,11 +113,10 @@ void CachedUserpics::onClear() {
CachedUserpics::~CachedUserpics() { CachedUserpics::~CachedUserpics() {
if (_someSavedFlag) { if (_someSavedFlag) {
TimeMs result = 0;
for_const (auto &item, _images) { QFile(item.path).remove(); } for_const (auto &item, _images) { QFile(item.path).remove(); }
// This works about 1200ms on Windows for a folder with one image O_o // 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); Assert(img.format() == QImage::Format_ARGB32_Premultiplied);
quint64 components[3] = {0}; quint64 components[3] = {0};
quint64 componentsScroll[3] = {0};
auto w = img.width(); auto w = img.width();
auto h = img.height(); auto h = img.height();
auto size = w * h; auto size = w * h;

View File

@ -651,7 +651,6 @@ void Generator::paintRow(const Row &row) {
auto availableWidth = namewidth; auto availableWidth = namewidth;
if (row.unreadCounter) { if (row.unreadCounter) {
auto counter = QString::number(row.unreadCounter); auto counter = QString::number(row.unreadCounter);
auto mutedCounter = row.muted;
auto unreadRight = x + fullWidth - st::dialogsPadding.x(); auto unreadRight = x + fullWidth - st::dialogsPadding.x();
auto unreadTop = texttop + st::dialogsTextFont->ascent - st::dialogsUnreadFont->ascent - auto unreadTop = texttop + st::dialogsTextFont->ascent - st::dialogsUnreadFont->ascent -
(st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2; (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()); bubble.text.draw(*_p, trect.x(), trect.y(), trect.width());
} else if (!bubble.waveform.isEmpty()) { } else if (!bubble.waveform.isEmpty()) {
auto nameleft = x + st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right(); auto nameleft = x + st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right();
auto nametop = y + st::msgFileNameTop;
auto nameright = st::msgFilePadding.left(); auto nameright = st::msgFilePadding.left();
auto statustop = y + st::msgFileStatusTop; 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, auto inner = rtlrect(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), st::msgFileSize,
st::msgFileSize, _rect.width()); 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 // rescale waveform by going in waveform.size * bar_count 1D grid
auto active = bubble.outbg ? st::msgWaveformOutActive[_palette] : st::msgWaveformInActive[_palette]; auto active = bubble.outbg ? st::msgWaveformOutActive[_palette] : st::msgWaveformInActive[_palette];
auto inactive = bubble.outbg ? st::msgWaveformOutInactive[_palette] : st::msgWaveformInInactive[_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 bar_count = wf_size;
qint32 max_delta = st::msgWaveformMax - st::msgWaveformMin; qint32 max_delta = st::msgWaveformMax - st::msgWaveformMin;
auto wave_bottom = y + st::msgFilePadding.top() + st::msgWaveformMax; auto wave_bottom = y + st::msgFilePadding.top() + st::msgWaveformMax;