mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Fix webview initialization on GCC.
This commit is contained in:
parent
8721b7a689
commit
d15ff46eb4
@ -491,28 +491,30 @@ bool Panel::showWebview(
|
||||
}
|
||||
|
||||
bool Panel::createWebview() {
|
||||
auto container = base::make_unique_q<RpWidget>(_widget.get());
|
||||
auto outer = base::make_unique_q<RpWidget>(_widget.get());
|
||||
const auto container = outer.get();
|
||||
_widget->showInner(std::move(outer));
|
||||
|
||||
_webviewBottom = std::make_unique<RpWidget>(_widget.get());
|
||||
const auto bottom = _webviewBottom.get();
|
||||
bottom->show();
|
||||
|
||||
bottom->heightValue(
|
||||
) | rpl::start_with_next([=, raw = container.get()](int height) {
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
const auto inner = _widget->innerGeometry();
|
||||
bottom->move(inner.x(), inner.y() + inner.height() - height);
|
||||
raw->resize(inner.width(), inner.height() - height);
|
||||
container->resize(inner.width(), inner.height() - height);
|
||||
bottom->resizeToWidth(inner.width());
|
||||
}, bottom->lifetime());
|
||||
container->show();
|
||||
|
||||
_webview = std::make_unique<WebviewWithLifetime>(
|
||||
container.get(),
|
||||
container,
|
||||
Webview::WindowConfig{
|
||||
.userDataPath = _delegate->panelWebviewDataPath(),
|
||||
});
|
||||
const auto raw = &_webview->window;
|
||||
QObject::connect(container.get(), &QObject::destroyed, [=] {
|
||||
QObject::connect(container, &QObject::destroyed, [=] {
|
||||
if (_webview && &_webview->window == raw) {
|
||||
_webview = nullptr;
|
||||
if (_webviewProgress) {
|
||||
@ -563,8 +565,6 @@ postEvent: function(eventType, eventData) {
|
||||
}
|
||||
};)");
|
||||
|
||||
_widget->showInner(std::move(container));
|
||||
|
||||
setupProgressGeometry();
|
||||
|
||||
return true;
|
||||
|
@ -496,32 +496,34 @@ bool Panel::showWebview(
|
||||
}
|
||||
|
||||
bool Panel::createWebview() {
|
||||
auto container = base::make_unique_q<RpWidget>(_widget.get());
|
||||
_webviewParent = container.get();
|
||||
auto outer = base::make_unique_q<RpWidget>(_widget.get());
|
||||
const auto container = outer.get();
|
||||
_widget->showInner(std::move(outer));
|
||||
_webviewParent = container;
|
||||
|
||||
_webviewBottom = std::make_unique<RpWidget>(_widget.get());
|
||||
const auto bottom = _webviewBottom.get();
|
||||
bottom->show();
|
||||
|
||||
bottom->heightValue(
|
||||
) | rpl::start_with_next([=, raw = container.get()](int height) {
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
const auto inner = _widget->innerGeometry();
|
||||
if (_mainButton && !_mainButton->isHidden()) {
|
||||
height = _mainButton->height();
|
||||
}
|
||||
bottom->move(inner.x(), inner.y() + inner.height() - height);
|
||||
raw->resize(inner.width(), inner.height() - height);
|
||||
container->resize(inner.width(), inner.height() - height);
|
||||
bottom->resizeToWidth(inner.width());
|
||||
}, bottom->lifetime());
|
||||
container->show();
|
||||
|
||||
_webview = std::make_unique<WebviewWithLifetime>(
|
||||
container.get(),
|
||||
container,
|
||||
Webview::WindowConfig{
|
||||
.userDataPath = _userDataPath,
|
||||
});
|
||||
const auto raw = &_webview->window;
|
||||
QObject::connect(container.get(), &QObject::destroyed, [=] {
|
||||
QObject::connect(container, &QObject::destroyed, [=] {
|
||||
if (_webview && &_webview->window == raw) {
|
||||
_webview = nullptr;
|
||||
if (_webviewProgress) {
|
||||
@ -584,8 +586,6 @@ postEvent: function(eventType, eventData) {
|
||||
}
|
||||
};)");
|
||||
|
||||
_widget->showInner(std::move(container));
|
||||
|
||||
setupProgressGeometry();
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user