mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -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
|
||||
FILEVERSION 0,10,3,0
|
||||
PRODUCTVERSION 0,10,3,0
|
||||
FILEVERSION 0,10,4,0
|
||||
PRODUCTVERSION 0,10,4,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -51,10 +51,10 @@ BEGIN
|
|||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||
VALUE "FileVersion", "0.10.3.0"
|
||||
VALUE "FileVersion", "0.10.4.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "0.10.3.0"
|
||||
VALUE "ProductVersion", "0.10.4.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,10,3,0
|
||||
PRODUCTVERSION 0,10,3,0
|
||||
FILEVERSION 0,10,4,0
|
||||
PRODUCTVERSION 0,10,4,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -43,10 +43,10 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||
VALUE "FileDescription", "Telegram Updater"
|
||||
VALUE "FileVersion", "0.10.3.0"
|
||||
VALUE "FileVersion", "0.10.4.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "0.10.3.0"
|
||||
VALUE "ProductVersion", "0.10.4.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#define BETA_VERSION_MACRO (0ULL)
|
||||
|
||||
constexpr int AppVersion = 10003;
|
||||
constexpr str_const AppVersionStr = "0.10.3";
|
||||
constexpr int AppVersion = 10004;
|
||||
constexpr str_const AppVersionStr = "0.10.4";
|
||||
constexpr bool AppAlphaVersion = true;
|
||||
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;
|
||||
|
|
|
@ -2038,6 +2038,11 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (auto historyPeer = _history->peer()) {
|
||||
if (way == Ui::ShowWay::Forward && historyPeer->id == peerId) {
|
||||
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),
|
||||
_disabled(false), _st(st),
|
||||
hor(this, false, &_st), vert(this, true, &_st), topSh(this, &_st), bottomSh(this, &_st),
|
||||
_touchEnabled(handleTouch), _touchScroll(false), _touchPress(false), _touchRightButton(false),
|
||||
_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false),
|
||||
_touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouch(false), _other(0) {
|
||||
ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent)
|
||||
, _st(st)
|
||||
, _horizontalBar(this, false, &_st)
|
||||
, _verticalBar(this, true, &_st)
|
||||
, _topShadow(this, &_st)
|
||||
, _bottomShadow(this, &_st)
|
||||
, _touchEnabled(handleTouch) {
|
||||
setLayoutDirection(cLangDir());
|
||||
|
||||
connect(&vert, SIGNAL(topShadowVisibility(bool)), &topSh, SLOT(changeVisibility(bool)));
|
||||
connect(&vert, SIGNAL(bottomShadowVisibility(bool)), &bottomSh, SLOT(changeVisibility(bool)));
|
||||
vert.updateBar(true);
|
||||
connect(_verticalBar, SIGNAL(topShadowVisibility(bool)), _topShadow, SLOT(changeVisibility(bool)));
|
||||
connect(_verticalBar, SIGNAL(bottomShadowVisibility(bool)), _bottomShadow, SLOT(changeVisibility(bool)));
|
||||
_verticalBar->updateBar(true);
|
||||
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
@ -338,8 +339,8 @@ _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouc
|
|||
setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
viewport()->setAutoFillBackground(false);
|
||||
|
||||
_horValue = horizontalScrollBar()->value();
|
||||
_vertValue = verticalScrollBar()->value();
|
||||
_horizontalValue = horizontalScrollBar()->value();
|
||||
_verticalValue = verticalScrollBar()->value();
|
||||
|
||||
if (_touchEnabled) {
|
||||
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
|
@ -360,25 +361,26 @@ void ScrollArea::onScrolled() {
|
|||
myEnsureResized(widget());
|
||||
|
||||
bool em = false;
|
||||
int32 horValue = horizontalScrollBar()->value(), vertValue = verticalScrollBar()->value();
|
||||
if (_horValue != horValue) {
|
||||
int horizontalValue = horizontalScrollBar()->value();
|
||||
int verticalValue = verticalScrollBar()->value();
|
||||
if (_horizontalValue != horizontalValue) {
|
||||
if (_disabled) {
|
||||
horizontalScrollBar()->setValue(_horValue);
|
||||
horizontalScrollBar()->setValue(_horizontalValue);
|
||||
} else {
|
||||
_horValue = horValue;
|
||||
_horizontalValue = horizontalValue;
|
||||
if (_st.hiding) {
|
||||
hor.hideTimeout(_st.hiding);
|
||||
_horizontalBar->hideTimeout(_st.hiding);
|
||||
}
|
||||
em = true;
|
||||
}
|
||||
}
|
||||
if (_vertValue != vertValue) {
|
||||
if (_verticalValue != verticalValue) {
|
||||
if (_disabled) {
|
||||
verticalScrollBar()->setValue(_vertValue);
|
||||
verticalScrollBar()->setValue(_verticalValue);
|
||||
} else {
|
||||
_vertValue = vertValue;
|
||||
_verticalValue = verticalValue;
|
||||
if (_st.hiding) {
|
||||
vert.hideTimeout(_st.hiding);
|
||||
_verticalBar->hideTimeout(_st.hiding);
|
||||
}
|
||||
em = true;
|
||||
}
|
||||
|
@ -410,11 +412,11 @@ int ScrollArea::scrollTopMax() const {
|
|||
}
|
||||
|
||||
int ScrollArea::scrollLeft() const {
|
||||
return _horValue;
|
||||
return _horizontalValue;
|
||||
}
|
||||
|
||||
int ScrollArea::scrollTop() const {
|
||||
return _vertValue;
|
||||
return _verticalValue;
|
||||
}
|
||||
|
||||
void ScrollArea::onTouchTimer() {
|
||||
|
@ -610,8 +612,8 @@ void ScrollArea::touchScrollUpdated(const QPoint &screenPos) {
|
|||
void ScrollArea::disableScroll(bool dis) {
|
||||
_disabled = dis;
|
||||
if (_disabled && _st.hiding) {
|
||||
hor.hideTimeout(0);
|
||||
vert.hideTimeout(0);
|
||||
_horizontalBar->hideTimeout(0);
|
||||
_verticalBar->hideTimeout(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -632,10 +634,10 @@ bool ScrollArea::touchScroll(const QPoint &delta) {
|
|||
|
||||
void ScrollArea::resizeEvent(QResizeEvent *e) {
|
||||
QScrollArea::resizeEvent(e);
|
||||
hor.recountSize();
|
||||
vert.recountSize();
|
||||
topSh.setGeometry(QRect(0, 0, width(), qAbs(_st.topsh)));
|
||||
bottomSh.setGeometry(QRect(0, height() - qAbs(_st.bottomsh), width(), qAbs(_st.bottomsh)));
|
||||
_horizontalBar->recountSize();
|
||||
_verticalBar->recountSize();
|
||||
_topShadow->setGeometry(QRect(0, 0, width(), qAbs(_st.topsh)));
|
||||
_bottomShadow->setGeometry(QRect(0, height() - qAbs(_st.bottomsh), width(), qAbs(_st.bottomsh)));
|
||||
if (SplittedWidget *w = qobject_cast<SplittedWidget*>(widget())) {
|
||||
w->resize(width() - w->otherWidth(), w->height());
|
||||
if (!rtl()) {
|
||||
|
@ -663,16 +665,16 @@ void ScrollArea::keyPressEvent(QKeyEvent *e) {
|
|||
void ScrollArea::enterEventHook(QEvent *e) {
|
||||
if (_disabled) return;
|
||||
if (_st.hiding) {
|
||||
hor.hideTimeout(_st.hiding);
|
||||
vert.hideTimeout(_st.hiding);
|
||||
_horizontalBar->hideTimeout(_st.hiding);
|
||||
_verticalBar->hideTimeout(_st.hiding);
|
||||
}
|
||||
return QScrollArea::enterEvent(e);
|
||||
}
|
||||
|
||||
void ScrollArea::leaveEventHook(QEvent *e) {
|
||||
if (_st.hiding) {
|
||||
hor.hideTimeout(0);
|
||||
vert.hideTimeout(0);
|
||||
_horizontalBar->hideTimeout(0);
|
||||
_verticalBar->hideTimeout(0);
|
||||
}
|
||||
return QScrollArea::leaveEvent(e);
|
||||
}
|
||||
|
@ -716,10 +718,10 @@ void ScrollArea::setWidget(QWidget *w) {
|
|||
} else if (!_other && splitted) {
|
||||
_other = new SplittedWidgetOther(this);
|
||||
_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()));
|
||||
hor.raise();
|
||||
vert.raise();
|
||||
_horizontalBar->raise();
|
||||
_verticalBar->raise();
|
||||
}
|
||||
if (_ownsWidget) {
|
||||
_ownsWidget = false;
|
||||
|
@ -734,7 +736,7 @@ void ScrollArea::setWidget(QWidget *w) {
|
|||
w->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
}
|
||||
if (splitted) {
|
||||
splitted->setOtherWidth(vert.width());
|
||||
splitted->setOtherWidth(_verticalBar->width());
|
||||
w->setGeometry(rtl() ? splitted->otherWidth() : 0, 0, width() - splitted->otherWidth(), w->height());
|
||||
connect(splitted, SIGNAL(resizeOther()), this, SLOT(onResizeOther()));
|
||||
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.barOverColor = barOver;
|
||||
_st.bgOverColor = bgOver;
|
||||
hor.update();
|
||||
vert.update();
|
||||
_horizontalBar->update();
|
||||
_verticalBar->update();
|
||||
}
|
||||
|
||||
bool ScrollArea::focusNextPrevChild(bool next) {
|
||||
|
|
|
@ -235,30 +235,35 @@ private:
|
|||
void touchUpdateSpeed();
|
||||
void touchDeaccelerate(int32 elapsed);
|
||||
|
||||
bool _disabled;
|
||||
bool _disabled = false;
|
||||
bool _ownsWidget = false; // if true, the widget is deleted in destructor.
|
||||
bool _movingByScrollBar = false;
|
||||
|
||||
style::flatScroll _st;
|
||||
ScrollBar hor, vert;
|
||||
ScrollShadow topSh, bottomSh;
|
||||
int32 _horValue, _vertValue;
|
||||
ChildWidget<ScrollBar> _horizontalBar, _verticalBar;
|
||||
ChildWidget<ScrollShadow> _topShadow, _bottomShadow;
|
||||
int _horizontalValue, _verticalValue;
|
||||
|
||||
bool _touchEnabled;
|
||||
QTimer _touchTimer;
|
||||
bool _touchScroll, _touchPress, _touchRightButton;
|
||||
bool _touchScroll = false;
|
||||
bool _touchPress = false;
|
||||
bool _touchRightButton = false;
|
||||
QPoint _touchStart, _touchPrevPos, _touchPos;
|
||||
|
||||
TouchScrollState _touchScrollState;
|
||||
bool _touchPrevPosValid, _touchWaitingAcceleration;
|
||||
TouchScrollState _touchScrollState = TouchScrollManual;
|
||||
bool _touchPrevPosValid = false;
|
||||
bool _touchWaitingAcceleration = false;
|
||||
QPoint _touchSpeed;
|
||||
uint64 _touchSpeedTime, _touchAccelerationTime, _touchTime;
|
||||
uint64 _touchSpeedTime = 0;
|
||||
uint64 _touchAccelerationTime = 0;
|
||||
uint64 _touchTime = 0;
|
||||
QTimer _touchScrollTimer;
|
||||
|
||||
bool _widgetAcceptsTouch;
|
||||
bool _widgetAcceptsTouch = false;
|
||||
|
||||
friend class SplittedWidgetOther;
|
||||
SplittedWidgetOther *_other;
|
||||
SplittedWidgetOther *_other = nullptr;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
AppVersion 10003
|
||||
AppVersion 10004
|
||||
AppVersionStrMajor 0.10
|
||||
AppVersionStrSmall 0.10.3
|
||||
AppVersionStr 0.10.3
|
||||
AppVersionStrSmall 0.10.4
|
||||
AppVersionStr 0.10.4
|
||||
AlphaChannel 1
|
||||
BetaVersion 0
|
||||
|
|
Loading…
Add table
Reference in a new issue