Fix build for Windows, add BoxShowFinishes.

This commit is contained in:
John Preston 2023-09-12 20:14:37 +04:00
parent c538357107
commit 2fe9ec27b1
3 changed files with 18 additions and 3 deletions

View file

@ -70,4 +70,17 @@ not_null<Ui::VerticalLayout*> GenericBox::verticalLayout() {
return _content; return _content;
} }
rpl::producer<> BoxShowFinishes(not_null<GenericBox*> box) {
const auto singleShot = box->lifetime().make_state<rpl::lifetime>();
const auto showFinishes = singleShot->make_state<rpl::event_stream<>>();
box->setShowFinishedCallback([=] {
showFinishes->fire({});
singleShot->destroy();
box->setShowFinishedCallback(nullptr);
});
return showFinishes->events();
}
} // namespace Ui } // namespace Ui

View file

@ -192,4 +192,6 @@ inline GenericBox::GenericBox(
, _content(_owned.data()) { , _content(_owned.data()) {
} }
[[nodiscard]] rpl::producer<> BoxShowFinishes(not_null<GenericBox*> box);
} // namespace Ui } // namespace Ui

View file

@ -48,9 +48,9 @@ TWidget::TWidget(QWidget *parent)
[[maybe_unused]] static const auto Once = [] { [[maybe_unused]] static const auto Once = [] {
auto format = QSurfaceFormat::defaultFormat(); auto format = QSurfaceFormat::defaultFormat();
format.setSwapInterval(0); format.setSwapInterval(0);
if (Platform::IsMac()) { #ifdef Q_OS_MAC
format.setColorSpace(QColorSpace::SRgb); format.setColorSpace(QColorSpace::SRgb);
} #endif // Q_OS_MAC
QSurfaceFormat::setDefaultFormat(format); QSurfaceFormat::setDefaultFormat(format);
return true; return true;
}(); }();