2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Remove twidget header.

This commit is contained in:
John Preston
2019-09-13 15:22:54 +03:00
parent e2f54eb3e9
commit c5845f17ae
188 changed files with 1070 additions and 907 deletions

View File

@@ -736,7 +736,7 @@ void Application::registerLeaveSubscription(QWidget *widget) {
#ifdef Q_OS_MAC
if (const auto topLevel = widget->window()) {
if (topLevel == _window->widget()) {
auto weak = make_weak(widget);
auto weak = Ui::MakeWeak(widget);
auto subscription = _window->widget()->leaveEvents(
) | rpl::start_with_next([weak] {
if (const auto window = weak.data()) {
@@ -862,3 +862,11 @@ Application &App() {
}
} // namespace Core
namespace Ui {
void PostponeCall(FnMut<void()> &&callable) {
Core::App().postponeCall(std::move(callable));
}
} // namespace Ui

View File

@@ -47,7 +47,7 @@ auto QtSignalProducer(Object *object, Signal signal) {
NoArgument,
rpl::empty_value,
std::remove_const_t<std::decay_t<Value>>>;
const auto guarded = make_weak(object);
const auto guarded = QPointer<Object>(object);
return rpl::make_producer<Produced>([=](auto consumer) {
if (!guarded) {
return rpl::lifetime();
@@ -59,7 +59,7 @@ auto QtSignalProducer(Object *object, Signal signal) {
signal,
listener,
std::forward<decltype(handler)>(handler));
const auto weak = make_weak(listener);
const auto weak = QPointer<QObject>(listener);
return rpl::lifetime([=] {
if (weak) {
delete weak;

View File

@@ -513,7 +513,7 @@ bool Sandbox::notify(QObject *receiver, QEvent *e) {
const auto wrap = createEventNestingLevel();
if (e->type() == QEvent::UpdateRequest) {
const auto weak = make_weak(receiver);
const auto weak = QPointer<QObject>(receiver);
_widgetUpdateRequests.fire({});
if (!weak) {
return true;

View File

@@ -25,17 +25,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace base {
template <typename D, typename T>
inline constexpr D up_cast(T object) {
using DV = std::decay_t<decltype(*D())>;
using TV = std::decay_t<decltype(*T())>;
if constexpr (std::is_base_of_v<DV, TV>) {
return object;
} else {
return nullptr;
}
}
template <typename T>
using set_of_unique_ptr = std::set<std::unique_ptr<T>, base::pointer_comparator<T>>;