mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added Ui::Show implementation for Window::SessionController.
This commit is contained in:
parent
ed5b83bc62
commit
6bcca6c94e
3 changed files with 58 additions and 1 deletions
|
@ -1802,4 +1802,44 @@ SessionController::~SessionController() {
|
||||||
resetFakeUnreadWhileOpened();
|
resetFakeUnreadWhileOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Show::Show(not_null<SessionNavigation*> navigation)
|
||||||
|
: Show(&navigation->parentController()->window()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Show::Show(not_null<Controller*> window)
|
||||||
|
: _window(base::make_weak(window.get())) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Show::~Show() = default;
|
||||||
|
|
||||||
|
void Show::showBox(
|
||||||
|
object_ptr<Ui::BoxContent> content,
|
||||||
|
Ui::LayerOptions options) const {
|
||||||
|
if (const auto window = _window.get()) {
|
||||||
|
window->show(std::move(content), options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Show::hideLayer() const {
|
||||||
|
if (const auto window = _window.get()) {
|
||||||
|
window->show(
|
||||||
|
object_ptr<Ui::BoxContent>{ nullptr },
|
||||||
|
Ui::LayerOption::CloseOther);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
not_null<QWidget*> Show::toastParent() const {
|
||||||
|
const auto window = _window.get();
|
||||||
|
Assert(window != nullptr);
|
||||||
|
return window->widget()->bodyWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Show::valid() const {
|
||||||
|
return !_window.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
Show::operator bool() const {
|
||||||
|
return valid();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "ui/layers/layer_widget.h"
|
#include "ui/layers/layer_widget.h"
|
||||||
|
#include "ui/layers/show.h"
|
||||||
#include "window/window_adaptive.h"
|
#include "window/window_adaptive.h"
|
||||||
|
|
||||||
class PhotoData;
|
class PhotoData;
|
||||||
|
@ -568,4 +569,20 @@ private:
|
||||||
|
|
||||||
void ActivateWindow(not_null<SessionController*> controller);
|
void ActivateWindow(not_null<SessionController*> controller);
|
||||||
|
|
||||||
|
class Show : public Ui::Show {
|
||||||
|
public:
|
||||||
|
explicit Show(not_null<SessionNavigation*> navigation);
|
||||||
|
explicit Show(not_null<Controller*> window);
|
||||||
|
~Show();
|
||||||
|
void showBox(
|
||||||
|
object_ptr<Ui::BoxContent> content,
|
||||||
|
Ui::LayerOptions options = Ui::LayerOption::KeepOther) const override;
|
||||||
|
void hideLayer() const override;
|
||||||
|
[[nodiscard]] not_null<QWidget*> toastParent() const override;
|
||||||
|
[[nodiscard]] bool valid() const override;
|
||||||
|
operator bool() const override;
|
||||||
|
private:
|
||||||
|
const base::weak_ptr<Controller> _window;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 214c5e8e226172e07f6e36984a65e0757a994a32
|
Subproject commit d2e482dac3e5ddbc200228d14d04d7d624c98af7
|
Loading…
Add table
Reference in a new issue