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