mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 18:21:42 -05:00
0.10.4: Same chat msg links fixed. Crash fix attempt in ScrollArea.
If the message link is opened in the same chat the ShowWay::Forward should be ignored. There was a possible crash in ~ScrollArea() when one of the bars was already destroyed and the second called ScrollArea::leaveEvent. Now both bars are ChildWidget<>s and will be destroyed in ~QWidget().
This commit is contained in:
parent
3d3fc33253
commit
ab18fc6478
7 changed files with 73 additions and 61 deletions
|
@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 0,10,3,0
|
FILEVERSION 0,10,4,0
|
||||||
PRODUCTVERSION 0,10,3,0
|
PRODUCTVERSION 0,10,4,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -51,10 +51,10 @@ BEGIN
|
||||||
BLOCK "040904b0"
|
BLOCK "040904b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||||
VALUE "FileVersion", "0.10.3.0"
|
VALUE "FileVersion", "0.10.4.0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
||||||
VALUE "ProductName", "Telegram Desktop"
|
VALUE "ProductName", "Telegram Desktop"
|
||||||
VALUE "ProductVersion", "0.10.3.0"
|
VALUE "ProductVersion", "0.10.4.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 0,10,3,0
|
FILEVERSION 0,10,4,0
|
||||||
PRODUCTVERSION 0,10,3,0
|
PRODUCTVERSION 0,10,4,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -43,10 +43,10 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||||
VALUE "FileDescription", "Telegram Updater"
|
VALUE "FileDescription", "Telegram Updater"
|
||||||
VALUE "FileVersion", "0.10.3.0"
|
VALUE "FileVersion", "0.10.4.0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
||||||
VALUE "ProductName", "Telegram Desktop"
|
VALUE "ProductName", "Telegram Desktop"
|
||||||
VALUE "ProductVersion", "0.10.3.0"
|
VALUE "ProductVersion", "0.10.4.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#define BETA_VERSION_MACRO (0ULL)
|
#define BETA_VERSION_MACRO (0ULL)
|
||||||
|
|
||||||
constexpr int AppVersion = 10003;
|
constexpr int AppVersion = 10004;
|
||||||
constexpr str_const AppVersionStr = "0.10.3";
|
constexpr str_const AppVersionStr = "0.10.4";
|
||||||
constexpr bool AppAlphaVersion = true;
|
constexpr bool AppAlphaVersion = true;
|
||||||
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;
|
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;
|
||||||
|
|
|
@ -2038,6 +2038,11 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (auto historyPeer = _history->peer()) {
|
||||||
|
if (way == Ui::ShowWay::Forward && historyPeer->id == peerId) {
|
||||||
|
way = Ui::ShowWay::ClearStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (back || (way == Ui::ShowWay::ClearStack)) {
|
if (back || (way == Ui::ShowWay::ClearStack)) {
|
||||||
|
|
|
@ -320,17 +320,18 @@ void SplittedWidgetOther::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent),
|
ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent)
|
||||||
_disabled(false), _st(st),
|
, _st(st)
|
||||||
hor(this, false, &_st), vert(this, true, &_st), topSh(this, &_st), bottomSh(this, &_st),
|
, _horizontalBar(this, false, &_st)
|
||||||
_touchEnabled(handleTouch), _touchScroll(false), _touchPress(false), _touchRightButton(false),
|
, _verticalBar(this, true, &_st)
|
||||||
_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false),
|
, _topShadow(this, &_st)
|
||||||
_touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouch(false), _other(0) {
|
, _bottomShadow(this, &_st)
|
||||||
|
, _touchEnabled(handleTouch) {
|
||||||
setLayoutDirection(cLangDir());
|
setLayoutDirection(cLangDir());
|
||||||
|
|
||||||
connect(&vert, SIGNAL(topShadowVisibility(bool)), &topSh, SLOT(changeVisibility(bool)));
|
connect(_verticalBar, SIGNAL(topShadowVisibility(bool)), _topShadow, SLOT(changeVisibility(bool)));
|
||||||
connect(&vert, SIGNAL(bottomShadowVisibility(bool)), &bottomSh, SLOT(changeVisibility(bool)));
|
connect(_verticalBar, SIGNAL(bottomShadowVisibility(bool)), _bottomShadow, SLOT(changeVisibility(bool)));
|
||||||
vert.updateBar(true);
|
_verticalBar->updateBar(true);
|
||||||
|
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
@ -338,8 +339,8 @@ _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouc
|
||||||
setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||||
viewport()->setAutoFillBackground(false);
|
viewport()->setAutoFillBackground(false);
|
||||||
|
|
||||||
_horValue = horizontalScrollBar()->value();
|
_horizontalValue = horizontalScrollBar()->value();
|
||||||
_vertValue = verticalScrollBar()->value();
|
_verticalValue = verticalScrollBar()->value();
|
||||||
|
|
||||||
if (_touchEnabled) {
|
if (_touchEnabled) {
|
||||||
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
|
@ -360,25 +361,26 @@ void ScrollArea::onScrolled() {
|
||||||
myEnsureResized(widget());
|
myEnsureResized(widget());
|
||||||
|
|
||||||
bool em = false;
|
bool em = false;
|
||||||
int32 horValue = horizontalScrollBar()->value(), vertValue = verticalScrollBar()->value();
|
int horizontalValue = horizontalScrollBar()->value();
|
||||||
if (_horValue != horValue) {
|
int verticalValue = verticalScrollBar()->value();
|
||||||
|
if (_horizontalValue != horizontalValue) {
|
||||||
if (_disabled) {
|
if (_disabled) {
|
||||||
horizontalScrollBar()->setValue(_horValue);
|
horizontalScrollBar()->setValue(_horizontalValue);
|
||||||
} else {
|
} else {
|
||||||
_horValue = horValue;
|
_horizontalValue = horizontalValue;
|
||||||
if (_st.hiding) {
|
if (_st.hiding) {
|
||||||
hor.hideTimeout(_st.hiding);
|
_horizontalBar->hideTimeout(_st.hiding);
|
||||||
}
|
}
|
||||||
em = true;
|
em = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_vertValue != vertValue) {
|
if (_verticalValue != verticalValue) {
|
||||||
if (_disabled) {
|
if (_disabled) {
|
||||||
verticalScrollBar()->setValue(_vertValue);
|
verticalScrollBar()->setValue(_verticalValue);
|
||||||
} else {
|
} else {
|
||||||
_vertValue = vertValue;
|
_verticalValue = verticalValue;
|
||||||
if (_st.hiding) {
|
if (_st.hiding) {
|
||||||
vert.hideTimeout(_st.hiding);
|
_verticalBar->hideTimeout(_st.hiding);
|
||||||
}
|
}
|
||||||
em = true;
|
em = true;
|
||||||
}
|
}
|
||||||
|
@ -410,11 +412,11 @@ int ScrollArea::scrollTopMax() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScrollArea::scrollLeft() const {
|
int ScrollArea::scrollLeft() const {
|
||||||
return _horValue;
|
return _horizontalValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScrollArea::scrollTop() const {
|
int ScrollArea::scrollTop() const {
|
||||||
return _vertValue;
|
return _verticalValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollArea::onTouchTimer() {
|
void ScrollArea::onTouchTimer() {
|
||||||
|
@ -610,8 +612,8 @@ void ScrollArea::touchScrollUpdated(const QPoint &screenPos) {
|
||||||
void ScrollArea::disableScroll(bool dis) {
|
void ScrollArea::disableScroll(bool dis) {
|
||||||
_disabled = dis;
|
_disabled = dis;
|
||||||
if (_disabled && _st.hiding) {
|
if (_disabled && _st.hiding) {
|
||||||
hor.hideTimeout(0);
|
_horizontalBar->hideTimeout(0);
|
||||||
vert.hideTimeout(0);
|
_verticalBar->hideTimeout(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,10 +634,10 @@ bool ScrollArea::touchScroll(const QPoint &delta) {
|
||||||
|
|
||||||
void ScrollArea::resizeEvent(QResizeEvent *e) {
|
void ScrollArea::resizeEvent(QResizeEvent *e) {
|
||||||
QScrollArea::resizeEvent(e);
|
QScrollArea::resizeEvent(e);
|
||||||
hor.recountSize();
|
_horizontalBar->recountSize();
|
||||||
vert.recountSize();
|
_verticalBar->recountSize();
|
||||||
topSh.setGeometry(QRect(0, 0, width(), qAbs(_st.topsh)));
|
_topShadow->setGeometry(QRect(0, 0, width(), qAbs(_st.topsh)));
|
||||||
bottomSh.setGeometry(QRect(0, height() - qAbs(_st.bottomsh), width(), qAbs(_st.bottomsh)));
|
_bottomShadow->setGeometry(QRect(0, height() - qAbs(_st.bottomsh), width(), qAbs(_st.bottomsh)));
|
||||||
if (SplittedWidget *w = qobject_cast<SplittedWidget*>(widget())) {
|
if (SplittedWidget *w = qobject_cast<SplittedWidget*>(widget())) {
|
||||||
w->resize(width() - w->otherWidth(), w->height());
|
w->resize(width() - w->otherWidth(), w->height());
|
||||||
if (!rtl()) {
|
if (!rtl()) {
|
||||||
|
@ -663,16 +665,16 @@ void ScrollArea::keyPressEvent(QKeyEvent *e) {
|
||||||
void ScrollArea::enterEventHook(QEvent *e) {
|
void ScrollArea::enterEventHook(QEvent *e) {
|
||||||
if (_disabled) return;
|
if (_disabled) return;
|
||||||
if (_st.hiding) {
|
if (_st.hiding) {
|
||||||
hor.hideTimeout(_st.hiding);
|
_horizontalBar->hideTimeout(_st.hiding);
|
||||||
vert.hideTimeout(_st.hiding);
|
_verticalBar->hideTimeout(_st.hiding);
|
||||||
}
|
}
|
||||||
return QScrollArea::enterEvent(e);
|
return QScrollArea::enterEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollArea::leaveEventHook(QEvent *e) {
|
void ScrollArea::leaveEventHook(QEvent *e) {
|
||||||
if (_st.hiding) {
|
if (_st.hiding) {
|
||||||
hor.hideTimeout(0);
|
_horizontalBar->hideTimeout(0);
|
||||||
vert.hideTimeout(0);
|
_verticalBar->hideTimeout(0);
|
||||||
}
|
}
|
||||||
return QScrollArea::leaveEvent(e);
|
return QScrollArea::leaveEvent(e);
|
||||||
}
|
}
|
||||||
|
@ -716,10 +718,10 @@ void ScrollArea::setWidget(QWidget *w) {
|
||||||
} else if (!_other && splitted) {
|
} else if (!_other && splitted) {
|
||||||
_other = new SplittedWidgetOther(this);
|
_other = new SplittedWidgetOther(this);
|
||||||
_other->setAttribute(Qt::WA_OpaquePaintEvent);
|
_other->setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
_other->resize(vert.width(), _other->height());
|
_other->resize(_verticalBar->width(), _other->height());
|
||||||
connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onVerticalScroll()));
|
connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onVerticalScroll()));
|
||||||
hor.raise();
|
_horizontalBar->raise();
|
||||||
vert.raise();
|
_verticalBar->raise();
|
||||||
}
|
}
|
||||||
if (_ownsWidget) {
|
if (_ownsWidget) {
|
||||||
_ownsWidget = false;
|
_ownsWidget = false;
|
||||||
|
@ -734,7 +736,7 @@ void ScrollArea::setWidget(QWidget *w) {
|
||||||
w->setAttribute(Qt::WA_AcceptTouchEvents);
|
w->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
}
|
}
|
||||||
if (splitted) {
|
if (splitted) {
|
||||||
splitted->setOtherWidth(vert.width());
|
splitted->setOtherWidth(_verticalBar->width());
|
||||||
w->setGeometry(rtl() ? splitted->otherWidth() : 0, 0, width() - splitted->otherWidth(), w->height());
|
w->setGeometry(rtl() ? splitted->otherWidth() : 0, 0, width() - splitted->otherWidth(), w->height());
|
||||||
connect(splitted, SIGNAL(resizeOther()), this, SLOT(onResizeOther()));
|
connect(splitted, SIGNAL(resizeOther()), this, SLOT(onResizeOther()));
|
||||||
connect(splitted, SIGNAL(updateOther(const QRect&)), this, SLOT(onUpdateOther(const QRect&)));
|
connect(splitted, SIGNAL(updateOther(const QRect&)), this, SLOT(onUpdateOther(const QRect&)));
|
||||||
|
@ -783,8 +785,8 @@ void ScrollArea::updateColors(const style::color &bar, const style::color &bg, c
|
||||||
_st.bgColor = bg;
|
_st.bgColor = bg;
|
||||||
_st.barOverColor = barOver;
|
_st.barOverColor = barOver;
|
||||||
_st.bgOverColor = bgOver;
|
_st.bgOverColor = bgOver;
|
||||||
hor.update();
|
_horizontalBar->update();
|
||||||
vert.update();
|
_verticalBar->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScrollArea::focusNextPrevChild(bool next) {
|
bool ScrollArea::focusNextPrevChild(bool next) {
|
||||||
|
|
|
@ -235,30 +235,35 @@ private:
|
||||||
void touchUpdateSpeed();
|
void touchUpdateSpeed();
|
||||||
void touchDeaccelerate(int32 elapsed);
|
void touchDeaccelerate(int32 elapsed);
|
||||||
|
|
||||||
bool _disabled;
|
bool _disabled = false;
|
||||||
bool _ownsWidget = false; // if true, the widget is deleted in destructor.
|
bool _ownsWidget = false; // if true, the widget is deleted in destructor.
|
||||||
bool _movingByScrollBar = false;
|
bool _movingByScrollBar = false;
|
||||||
|
|
||||||
style::flatScroll _st;
|
style::flatScroll _st;
|
||||||
ScrollBar hor, vert;
|
ChildWidget<ScrollBar> _horizontalBar, _verticalBar;
|
||||||
ScrollShadow topSh, bottomSh;
|
ChildWidget<ScrollShadow> _topShadow, _bottomShadow;
|
||||||
int32 _horValue, _vertValue;
|
int _horizontalValue, _verticalValue;
|
||||||
|
|
||||||
bool _touchEnabled;
|
bool _touchEnabled;
|
||||||
QTimer _touchTimer;
|
QTimer _touchTimer;
|
||||||
bool _touchScroll, _touchPress, _touchRightButton;
|
bool _touchScroll = false;
|
||||||
|
bool _touchPress = false;
|
||||||
|
bool _touchRightButton = false;
|
||||||
QPoint _touchStart, _touchPrevPos, _touchPos;
|
QPoint _touchStart, _touchPrevPos, _touchPos;
|
||||||
|
|
||||||
TouchScrollState _touchScrollState;
|
TouchScrollState _touchScrollState = TouchScrollManual;
|
||||||
bool _touchPrevPosValid, _touchWaitingAcceleration;
|
bool _touchPrevPosValid = false;
|
||||||
|
bool _touchWaitingAcceleration = false;
|
||||||
QPoint _touchSpeed;
|
QPoint _touchSpeed;
|
||||||
uint64 _touchSpeedTime, _touchAccelerationTime, _touchTime;
|
uint64 _touchSpeedTime = 0;
|
||||||
|
uint64 _touchAccelerationTime = 0;
|
||||||
|
uint64 _touchTime = 0;
|
||||||
QTimer _touchScrollTimer;
|
QTimer _touchScrollTimer;
|
||||||
|
|
||||||
bool _widgetAcceptsTouch;
|
bool _widgetAcceptsTouch = false;
|
||||||
|
|
||||||
friend class SplittedWidgetOther;
|
friend class SplittedWidgetOther;
|
||||||
SplittedWidgetOther *_other;
|
SplittedWidgetOther *_other = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
AppVersion 10003
|
AppVersion 10004
|
||||||
AppVersionStrMajor 0.10
|
AppVersionStrMajor 0.10
|
||||||
AppVersionStrSmall 0.10.3
|
AppVersionStrSmall 0.10.4
|
||||||
AppVersionStr 0.10.3
|
AppVersionStr 0.10.4
|
||||||
AlphaChannel 1
|
AlphaChannel 1
|
||||||
BetaVersion 0
|
BetaVersion 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue