mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-28 19:40:54 +00:00
Displaying time in chat list for all timestamps in the last 20 hours.
Fixed possible crash in MediaView video player seek after clip error. Fixed possible crash in native event filter on Windows. Removed unused lng_stickers_add key.
This commit is contained in:
parent
82a0ac28ad
commit
832163c1b7
@ -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;
|
||||
}
|
||||
|
@ -312,9 +312,6 @@ private:
|
||||
|
||||
ConfirmBox *_clearBox = nullptr;
|
||||
|
||||
QString _addText;
|
||||
int _addWidth;
|
||||
|
||||
int _buttonHeight = 0;
|
||||
bool _hasFeaturedButton = false;
|
||||
bool _hasArchivedButton = false;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user