mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Show user as active when in call panel.
This commit is contained in:
parent
d6ab9347c1
commit
5fe8c0ed7e
7 changed files with 32 additions and 2 deletions
|
@ -241,6 +241,12 @@ GroupPanel::GroupPanel(not_null<GroupCall*> call)
|
|||
|
||||
GroupPanel::~GroupPanel() = default;
|
||||
|
||||
bool GroupPanel::isActive() const {
|
||||
return _window->isActiveWindow()
|
||||
&& _window->isVisible()
|
||||
&& !(_window->windowState() & Qt::WindowMinimized);
|
||||
}
|
||||
|
||||
void GroupPanel::showAndActivate() {
|
||||
if (_window->isHidden()) {
|
||||
_window->show();
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
GroupPanel(not_null<GroupCall*> call);
|
||||
~GroupPanel();
|
||||
|
||||
[[nodiscard]] bool isActive() const;
|
||||
void showAndActivate();
|
||||
void closeBeforeDestroy();
|
||||
|
||||
|
|
|
@ -455,6 +455,17 @@ void Instance::destroyCurrentCall() {
|
|||
}
|
||||
}
|
||||
|
||||
bool Instance::hasActivePanel(not_null<Main::Session*> session) const {
|
||||
if (inCall()) {
|
||||
return (&_currentCall->user()->session() == session)
|
||||
&& _currentCallPanel->isActive();
|
||||
} else if (inGroupCall()) {
|
||||
return (&_currentGroupCall->channel()->session() == session)
|
||||
&& _currentGroupCallPanel->isActive();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Instance::activateCurrentCall() {
|
||||
if (inCall()) {
|
||||
_currentCallPanel->showAndActivate();
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
[[nodiscard]] rpl::producer<GroupCall*> currentGroupCallValue() const;
|
||||
[[nodiscard]] bool inCall() const;
|
||||
[[nodiscard]] bool inGroupCall() const;
|
||||
[[nodiscard]] bool hasActivePanel(
|
||||
not_null<Main::Session*> session) const;
|
||||
bool activateCurrentCall();
|
||||
std::shared_ptr<tgcalls::VideoCaptureInterface> getVideoCapture() override;
|
||||
|
||||
|
|
|
@ -202,6 +202,12 @@ Panel::Panel(not_null<Call*> call)
|
|||
|
||||
Panel::~Panel() = default;
|
||||
|
||||
bool Panel::isActive() const {
|
||||
return _window->isActiveWindow()
|
||||
&& _window->isVisible()
|
||||
&& !(_window->windowState() & Qt::WindowMinimized);
|
||||
}
|
||||
|
||||
void Panel::showAndActivate() {
|
||||
_window->raise();
|
||||
_window->setWindowState(_window->windowState() | Qt::WindowActive);
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
Panel(not_null<Call*> call);
|
||||
~Panel();
|
||||
|
||||
[[nodiscard]] bool isActive() const;
|
||||
void showAndActivate();
|
||||
void replaceCall(not_null<Call*> call);
|
||||
void closeBeforeDestroy();
|
||||
|
|
|
@ -880,9 +880,12 @@ void Application::localPasscodeChanged() {
|
|||
bool Application::hasActiveWindow(not_null<Main::Session*> session) const {
|
||||
if (App::quitting() || !_window) {
|
||||
return false;
|
||||
} else if (_calls->hasActivePanel(session)) {
|
||||
return true;
|
||||
} else if (const auto controller = _window->sessionController()) {
|
||||
if (&controller->session() == session) {
|
||||
return _window->widget()->isActive();
|
||||
if (&controller->session() == session
|
||||
&& _window->widget()->isActive()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue