mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to close call panel without hanging up call.
This commit is contained in:
parent
c0c330a150
commit
b790847fde
2 changed files with 12 additions and 8 deletions
|
@ -44,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
|
#include "base/event_filter.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/power_save_blocker.h"
|
#include "base/power_save_blocker.h"
|
||||||
#include "media/streaming/media_streaming_utility.h"
|
#include "media/streaming/media_streaming_utility.h"
|
||||||
|
@ -147,17 +148,18 @@ void Panel::initWindow() {
|
||||||
window()->setTitle(_user->name());
|
window()->setTitle(_user->name());
|
||||||
window()->setTitleStyle(st::callTitle);
|
window()->setTitleStyle(st::callTitle);
|
||||||
|
|
||||||
window()->events(
|
base::install_event_filter(window().get(), [=](not_null<QEvent*> e) {
|
||||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
if (e->type() == QEvent::Close && handleClose()) {
|
||||||
if (e->type() == QEvent::Close) {
|
e->ignore();
|
||||||
handleClose();
|
return base::EventFilterResult::Cancel;
|
||||||
} else if (e->type() == QEvent::KeyPress) {
|
} else if (e->type() == QEvent::KeyPress) {
|
||||||
if ((static_cast<QKeyEvent*>(e.get())->key() == Qt::Key_Escape)
|
if ((static_cast<QKeyEvent*>(e.get())->key() == Qt::Key_Escape)
|
||||||
&& window()->isFullScreen()) {
|
&& window()->isFullScreen()) {
|
||||||
window()->showNormal();
|
window()->showNormal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, window()->lifetime());
|
return base::EventFilterResult::Continue;
|
||||||
|
});
|
||||||
|
|
||||||
window()->setBodyTitleArea([=](QPoint widgetPoint) {
|
window()->setBodyTitleArea([=](QPoint widgetPoint) {
|
||||||
using Flag = Ui::WindowTitleHitTestFlag;
|
using Flag = Ui::WindowTitleHitTestFlag;
|
||||||
|
@ -828,10 +830,12 @@ void Panel::paint(QRect clip) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::handleClose() {
|
bool Panel::handleClose() const {
|
||||||
if (_call) {
|
if (_call) {
|
||||||
_call->hangup();
|
window()->hide();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<Ui::RpWindow*> Panel::window() const {
|
not_null<Ui::RpWindow*> Panel::window() const {
|
||||||
|
|
|
@ -106,7 +106,7 @@ private:
|
||||||
void initLayout();
|
void initLayout();
|
||||||
void initGeometry();
|
void initGeometry();
|
||||||
|
|
||||||
void handleClose();
|
[[nodiscard]] bool handleClose() const;
|
||||||
|
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateHangupGeometry();
|
void updateHangupGeometry();
|
||||||
|
|
Loading…
Add table
Reference in a new issue