diff --git a/Telegram/SourceFiles/boxes/stickersetbox.cpp b/Telegram/SourceFiles/boxes/stickersetbox.cpp index 1a002920df..adb47c99a1 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.cpp +++ b/Telegram/SourceFiles/boxes/stickersetbox.cpp @@ -473,8 +473,6 @@ StickersInner::StickersInner(StickersBox::Section section) : TWidget() , _removeWidth(st::normalFont->width(lang(lng_stickers_remove))) , _returnWidth(st::normalFont->width(lang(lng_stickers_return))) , _restoreWidth(st::normalFont->width(lang(lng_stickers_restore))) -, _addText(lang(lng_stickers_add).toUpper()) -, _addWidth(st::defaultActiveButton.font->width(_addText)) , _aboveShadow(st::boxShadow) { setup(); } @@ -489,8 +487,6 @@ StickersInner::StickersInner(const Stickers::Order &archivedIds) : TWidget() , _removeWidth(st::normalFont->width(lang(lng_stickers_remove))) , _returnWidth(st::normalFont->width(lang(lng_stickers_return))) , _restoreWidth(st::normalFont->width(lang(lng_stickers_restore))) -, _addText(lang(lng_stickers_add).toUpper()) -, _addWidth(st::defaultActiveButton.font->width(_addText)) , _aboveShadow(st::boxShadow) { setup(); } @@ -1128,7 +1124,7 @@ int StickersInner::countMaxNameWidth() const { if (_section == Section::Installed) { namew -= qMax(qMax(qMax(_returnWidth, _removeWidth), _restoreWidth), _clearWidth); } else { - namew -= _addWidth - st::defaultActiveButton.width; + namew -= st::stickersAddIcon.width() - st::defaultActiveButton.width; } return namew; } diff --git a/Telegram/SourceFiles/boxes/stickersetbox.h b/Telegram/SourceFiles/boxes/stickersetbox.h index 42d9e23cf1..cde1293f1b 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.h +++ b/Telegram/SourceFiles/boxes/stickersetbox.h @@ -312,9 +312,6 @@ private: ConfirmBox *_clearBox = nullptr; - QString _addText; - int _addWidth; - int _buttonHeight = 0; bool _hasFeaturedButton = false; bool _hasArchivedButton = false; diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index 29e8ea46dd..cb19698b95 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -33,11 +33,16 @@ namespace Layout { namespace { +// Show all dates that are in the last 20 hours in time format. +constexpr int kRecentlyInSeconds = 20 * 3600; + void paintRowDate(Painter &p, const QDateTime &date, QRect &rectForName, bool active) { QDateTime now(QDateTime::currentDateTime()), lastTime(date); QDate nowDate(now.date()), lastDate(lastTime.date()); QString dt; - if (lastDate == nowDate) { + bool wasSameDay = (lastDate == nowDate); + bool wasRecently = qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds; + if (wasSameDay || wasRecently) { dt = lastTime.toString(cTimeFormat()); } else if (lastDate.year() == nowDate.year() && lastDate.weekNumber() == nowDate.weekNumber()) { dt = langDayOfWeek(lastDate); diff --git a/Telegram/SourceFiles/media/media_clip_reader.cpp b/Telegram/SourceFiles/media/media_clip_reader.cpp index 043d149e36..5d87563173 100644 --- a/Telegram/SourceFiles/media/media_clip_reader.cpp +++ b/Telegram/SourceFiles/media/media_clip_reader.cpp @@ -110,7 +110,7 @@ Reader::Reader(const FileLocation &location, const QByteArray &data, Callback && } Reader::Frame *Reader::frameToShow(int32 *index) const { // 0 means not ready - int32 step = _step.loadAcquire(), i; + int step = _step.loadAcquire(), i; if (step == WaitingForDimensionsStep) { if (index) *index = 0; return nullptr; @@ -205,8 +205,8 @@ void Reader::start(int32 framew, int32 frameh, int32 outerw, int32 outerh, Image } QPixmap Reader::current(int32 framew, int32 frameh, int32 outerw, int32 outerh, uint64 ms) { - Frame *frame = frameToShow(); - t_assert(frame != 0); + auto frame = frameToShow(); + t_assert(frame != nullptr); if (ms) { frame->displayed.storeRelease(1); diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 3afe8ae3f9..62307f3bd1 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -731,7 +731,10 @@ void MediaView::clipCallback(Media::Clip::Notification notification) { case NotificationReinit: { if (auto item = App::histItemById(_msgmigrated ? 0 : _channel, _msgid)) { if (_gif->state() == State::Error) { - _current = QPixmap(); + stopGif(); + updateControls(); + update(); + break; } else if (_gif->state() == State::Finished) { _videoPositionMs = _videoDurationMs; _videoStopped = true; @@ -1118,7 +1121,10 @@ void MediaView::displayPhoto(PhotoData *photo, HistoryItem *item) { void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty messages shown as docs: doc can be NULL if (!doc || (!doc->isAnimation() && !doc->isVideo()) || doc != _doc || (item && (item->id != _msgid || (item->history() != (_msgmigrated ? _migrated : _history))))) { _fullScreenVideo = false; + _current = QPixmap(); stopGif(); + } else if (gifShown()) { + _current = QPixmap(); } _doc = doc; _photo = nullptr; @@ -1128,8 +1134,6 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty _autoplayVideoDocument = nullptr; } - _current = QPixmap(); - _caption = Text(); if (_doc) { if (_doc->sticker()) { diff --git a/Telegram/SourceFiles/platform/win/windows_event_filter.cpp b/Telegram/SourceFiles/platform/win/windows_event_filter.cpp index f782a9eb92..0d9331782b 100644 --- a/Telegram/SourceFiles/platform/win/windows_event_filter.cpp +++ b/Telegram/SourceFiles/platform/win/windows_event_filter.cpp @@ -103,7 +103,10 @@ bool EventFilter::mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa } } return false; - case WM_NCPAINT: if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return false; *result = 0; return true; + case WM_NCPAINT: { + if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return false; + if (result) *result = 0; + } return true; case WM_NCCALCSIZE: { WINDOWPLACEMENT wp; @@ -120,12 +123,13 @@ bool EventFilter::mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa } } } - *result = 0; + if (result) *result = 0; return true; } case WM_NCACTIVATE: { - *result = DefWindowProc(hWnd, msg, wParam, -1); + auto res = DefWindowProc(hWnd, msg, wParam, -1); + if (result) *result = res; } return true; case WM_WINDOWPOSCHANGING: @@ -172,6 +176,8 @@ bool EventFilter::mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa } return false; case WM_NCHITTEST: { + if (!result) return false; + POINTS p = MAKEPOINTS(lParam); RECT r; GetWindowRect(hWnd, &r);