mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 00:08:02 +00:00
Merge branch 'dev' of https://github.com/telegramdesktop/tdesktop into dev
This commit is contained in:
commit
ebc4f3cb35
@ -2445,21 +2445,6 @@ int BotKeyboard::Style::minButtonWidth(HistoryMessageReplyMarkup::Button::Type t
|
||||
return result;
|
||||
}
|
||||
|
||||
void BotKeyboard::resizeEvent(QResizeEvent *e) {
|
||||
if (!_impl) return;
|
||||
|
||||
updateStyle();
|
||||
|
||||
_height = _impl->naturalHeight() + st::botKbScroll.deltat + st::botKbScroll.deltab;
|
||||
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
||||
if (height() != _height) {
|
||||
resize(width(), _height);
|
||||
return;
|
||||
}
|
||||
|
||||
_impl->resize(width() - _st->margin - st::botKbScroll.width, _height - (st::botKbScroll.deltat + st::botKbScroll.deltab));
|
||||
}
|
||||
|
||||
void BotKeyboard::mousePressEvent(QMouseEvent *e) {
|
||||
_lastMousePos = e->globalPos();
|
||||
updateSelected();
|
||||
@ -2529,14 +2514,8 @@ bool BotKeyboard::updateMarkup(HistoryItem *to, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
updateStyle();
|
||||
_height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0);
|
||||
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
||||
if (height() != _height) {
|
||||
resize(width(), _height);
|
||||
} else {
|
||||
resizeEvent(nullptr);
|
||||
}
|
||||
resizeToWidth(width(), _maxOuterHeight);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2548,13 +2527,23 @@ bool BotKeyboard::forceReply() const {
|
||||
return _forceReply;
|
||||
}
|
||||
|
||||
void BotKeyboard::resizeToWidth(int width, int maxOuterHeight) {
|
||||
updateStyle(width);
|
||||
_height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0);
|
||||
void BotKeyboard::resizeToWidth(int newWidth, int maxOuterHeight) {
|
||||
_maxOuterHeight = maxOuterHeight;
|
||||
|
||||
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
||||
resize(width, _height);
|
||||
updateStyle(newWidth);
|
||||
_height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0);
|
||||
if (_maximizeSize) {
|
||||
accumulate_max(_height, _maxOuterHeight);
|
||||
}
|
||||
if (_impl) {
|
||||
int implWidth = newWidth - _st->margin - st::botKbScroll.width;
|
||||
int implHeight = _height - (st::botKbScroll.deltat + st::botKbScroll.deltab);
|
||||
_impl->resize(implWidth, implHeight);
|
||||
}
|
||||
QSize newSize(newWidth, _height);
|
||||
if (newSize != size()) {
|
||||
resize(newSize);
|
||||
}
|
||||
}
|
||||
|
||||
bool BotKeyboard::maximizeSize() const {
|
||||
@ -2565,10 +2554,10 @@ bool BotKeyboard::singleUse() const {
|
||||
return _singleUse;
|
||||
}
|
||||
|
||||
void BotKeyboard::updateStyle(int32 w) {
|
||||
void BotKeyboard::updateStyle(int newWidth) {
|
||||
if (!_impl) return;
|
||||
|
||||
int implWidth = ((w < 0) ? width() : w) - st::botKbButton.margin - st::botKbScroll.width;
|
||||
int implWidth = newWidth - st::botKbButton.margin - st::botKbScroll.width;
|
||||
_st = _impl->isEnoughSpace(implWidth, st::botKbButton) ? &st::botKbButton : &st::botKbTinyButton;
|
||||
|
||||
_impl->setStyle(std_::make_unique<Style>(this, *_st));
|
||||
@ -2594,13 +2583,6 @@ QString BotKeyboard::tooltipText() const {
|
||||
return QString();
|
||||
}
|
||||
|
||||
//void BotKeyboard::onParentScrolled() {
|
||||
// // Holding scrollarea can fire scrolled() event from a resize() call before
|
||||
// // the resizeEvent() is called, which prepares _impl for updateSelected() call.
|
||||
// // Calling updateSelected() without delay causes _impl->getState() before _impl->resize().
|
||||
// QMetaObject::invokeMethod(this, "updateSelected", Qt::QueuedConnection);
|
||||
//}
|
||||
|
||||
void BotKeyboard::updateSelected() {
|
||||
PopupTooltip::Show(1000, this);
|
||||
|
||||
@ -3086,8 +3068,6 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
|
||||
_kbScroll.setWidget(&_keyboard);
|
||||
_kbScroll.hide();
|
||||
|
||||
// connect(&_kbScroll, SIGNAL(scrolled()), &_keyboard, SLOT(onParentScrolled()));
|
||||
|
||||
updateScrollColors();
|
||||
|
||||
_historyToEnd->installEventFilter(this);
|
||||
|
@ -357,7 +357,6 @@ public:
|
||||
BotKeyboard();
|
||||
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||
@ -371,7 +370,7 @@ public:
|
||||
bool forceReply() const;
|
||||
|
||||
void step_selected(uint64 ms, bool timer);
|
||||
void resizeToWidth(int width, int maxOuterHeight);
|
||||
void resizeToWidth(int newWidth, int maxOuterHeight);
|
||||
|
||||
bool maximizeSize() const;
|
||||
bool singleUse() const;
|
||||
@ -388,18 +387,10 @@ public:
|
||||
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
||||
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) override;
|
||||
|
||||
//public slots:
|
||||
//
|
||||
// void onParentScrolled();
|
||||
|
||||
//private slots:
|
||||
private:
|
||||
|
||||
void updateSelected();
|
||||
|
||||
private:
|
||||
|
||||
void updateStyle(int32 w = -1);
|
||||
void updateStyle(int newWidth);
|
||||
void clearSelection();
|
||||
|
||||
FullMsgId _wasForMsgId;
|
||||
|
@ -43,7 +43,6 @@ HINSTANCE LibShell32;
|
||||
HINSTANCE LibWtsApi32;
|
||||
HINSTANCE LibPropSys;
|
||||
HINSTANCE LibComBase;
|
||||
HINSTANCE LibWinRtString;
|
||||
|
||||
void start() {
|
||||
LibUxTheme = LoadLibrary(L"UXTHEME.DLL");
|
||||
@ -66,10 +65,8 @@ void start() {
|
||||
|
||||
LibComBase = LoadLibrary(L"COMBASE.DLL");
|
||||
load(LibComBase, "RoGetActivationFactory", RoGetActivationFactory);
|
||||
|
||||
LibWinRtString = LoadLibrary(L"api-ms-win-core-winrt-string-l1-1-0.dll");
|
||||
load(LibWinRtString, "WindowsCreateStringReference", WindowsCreateStringReference);
|
||||
load(LibWinRtString, "WindowsDeleteString", WindowsDeleteString);
|
||||
load(LibComBase, "WindowsCreateStringReference", WindowsCreateStringReference);
|
||||
load(LibComBase, "WindowsDeleteString", WindowsDeleteString);
|
||||
}
|
||||
|
||||
} // namespace Dlls
|
||||
|
@ -78,8 +78,6 @@ extern f_PropVariantToString PropVariantToString;
|
||||
typedef HRESULT (FAR STDAPICALLTYPE *f_RoGetActivationFactory)(_In_ HSTRING activatableClassId, _In_ REFIID iid, _COM_Outptr_ void ** factory);
|
||||
extern f_RoGetActivationFactory RoGetActivationFactory;
|
||||
|
||||
// api-ms-win-core-winrt-string-l1-1-0.dll
|
||||
|
||||
typedef HRESULT (FAR STDAPICALLTYPE *f_WindowsCreateStringReference)(_In_reads_opt_(length + 1) PCWSTR sourceString, UINT32 length, _Out_ HSTRING_HEADER * hstringHeader, _Outptr_result_maybenull_ _Result_nullonfailure_ HSTRING * string);
|
||||
extern f_WindowsCreateStringReference WindowsCreateStringReference;
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace {
|
||||
_PsInitializer() {
|
||||
Dlls::start();
|
||||
|
||||
useOpenWith = (Dlls::SHAssocEnumHandlers != nullptr) && (SHCreateItemFromParsingName != nullptr);
|
||||
useOpenWith = (Dlls::SHAssocEnumHandlers != nullptr) && (Dlls::SHCreateItemFromParsingName != nullptr);
|
||||
useOpenAs = (Dlls::SHOpenWithDialog != nullptr) || (Dlls::OpenAs_RunDLL != nullptr);
|
||||
useShellapi = (Dlls::SHQueryUserNotificationState != nullptr);
|
||||
}
|
||||
|
@ -943,12 +943,18 @@ public:
|
||||
_y = top;
|
||||
_yFrom = yFrom + top;
|
||||
_yTo = (yTo < 0) ? -1 : (yTo + top);
|
||||
if (_elideLast) {
|
||||
_yToElide = _yTo;
|
||||
}
|
||||
_selection = selection;
|
||||
_fullWidthSelection = fullWidthSelection;
|
||||
_wLeft = _w = w;
|
||||
if (_elideLast) {
|
||||
_yToElide = _yTo;
|
||||
if (_elideRemoveFromEnd > 0 && !_t->_blocks.isEmpty()) {
|
||||
int firstBlockHeight = countBlockHeight(_t->_blocks.front(), _t->_font);
|
||||
if (_y + firstBlockHeight >= _yToElide) {
|
||||
_wLeft -= _elideRemoveFromEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
_str = _t->_text.unicode();
|
||||
|
||||
if (_p) {
|
||||
|
Loading…
Reference in New Issue
Block a user