mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Keep window geometry on confcall migration.
This commit is contained in:
parent
fbbcbc8753
commit
c507382d19
6 changed files with 66 additions and 23 deletions
|
@ -236,9 +236,12 @@ void Instance::startOrJoinGroupCall(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::startOrJoinConferenceCall(StartConferenceInfo args) {
|
void Instance::startOrJoinConferenceCall(StartConferenceInfo args) {
|
||||||
destroyCurrentCall(
|
const auto migrationInfo = (args.migrating && _currentCallPanel)
|
||||||
args.migrating ? args.call.get() : nullptr,
|
? _currentCallPanel->migrationInfo()
|
||||||
args.migrating ? args.linkSlug : QString());
|
: ConferencePanelMigration();
|
||||||
|
if (!args.migrating) {
|
||||||
|
destroyCurrentCall();
|
||||||
|
}
|
||||||
|
|
||||||
const auto session = &args.call->peer()->session();
|
const auto session = &args.call->peer()->session();
|
||||||
auto call = std::make_unique<GroupCall>(_delegate.get(), args);
|
auto call = std::make_unique<GroupCall>(_delegate.get(), args);
|
||||||
|
@ -249,7 +252,9 @@ void Instance::startOrJoinConferenceCall(StartConferenceInfo args) {
|
||||||
destroyGroupCall(raw);
|
destroyGroupCall(raw);
|
||||||
}, raw->lifetime());
|
}, raw->lifetime());
|
||||||
|
|
||||||
_currentGroupCallPanel = std::make_unique<Group::Panel>(raw);
|
_currentGroupCallPanel = std::make_unique<Group::Panel>(
|
||||||
|
raw,
|
||||||
|
migrationInfo);
|
||||||
_currentGroupCall = std::move(call);
|
_currentGroupCall = std::move(call);
|
||||||
_currentGroupCallChanges.fire_copy(raw);
|
_currentGroupCallChanges.fire_copy(raw);
|
||||||
if (!args.invite.empty()) {
|
if (!args.invite.empty()) {
|
||||||
|
@ -257,6 +262,10 @@ void Instance::startOrJoinConferenceCall(StartConferenceInfo args) {
|
||||||
} else if (args.sharingLink && !args.linkSlug.isEmpty()) {
|
} else if (args.sharingLink && !args.linkSlug.isEmpty()) {
|
||||||
_currentGroupCallPanel->migrationShowShareLink();
|
_currentGroupCallPanel->migrationShowShareLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.migrating) {
|
||||||
|
destroyCurrentCall(args.call.get(), args.linkSlug);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::confirmLeaveCurrent(
|
void Instance::confirmLeaveCurrent(
|
||||||
|
@ -740,9 +749,11 @@ void Instance::destroyCurrentCall(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (const auto current = currentGroupCall()) {
|
if (const auto current = currentGroupCall()) {
|
||||||
current->hangup();
|
if (!migrateCall || current->lookupReal() != migrateCall) {
|
||||||
if (const auto still = currentGroupCall()) {
|
current->hangup();
|
||||||
destroyGroupCall(still);
|
if (const auto still = currentGroupCall()) {
|
||||||
|
destroyGroupCall(still);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,6 +233,14 @@ bool Panel::isActive() const {
|
||||||
return window()->isActiveWindow() && isVisible();
|
return window()->isActiveWindow() && isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConferencePanelMigration Panel::migrationInfo() const {
|
||||||
|
const auto handle = window()->windowHandle();
|
||||||
|
return handle ? ConferencePanelMigration{
|
||||||
|
.screen = handle->screen(),
|
||||||
|
.geometry = window()->geometry(),
|
||||||
|
} : ConferencePanelMigration();
|
||||||
|
}
|
||||||
|
|
||||||
base::weak_ptr<Ui::Toast::Instance> Panel::showToast(
|
base::weak_ptr<Ui::Toast::Instance> Panel::showToast(
|
||||||
const QString &text,
|
const QString &text,
|
||||||
crl::time duration) {
|
crl::time duration) {
|
||||||
|
|
|
@ -68,6 +68,7 @@ class Userpic;
|
||||||
class SignalBars;
|
class SignalBars;
|
||||||
class VideoBubble;
|
class VideoBubble;
|
||||||
struct DeviceSelection;
|
struct DeviceSelection;
|
||||||
|
struct ConferencePanelMigration;
|
||||||
|
|
||||||
class Panel final
|
class Panel final
|
||||||
: public base::has_weak_ptr
|
: public base::has_weak_ptr
|
||||||
|
@ -81,6 +82,8 @@ public:
|
||||||
[[nodiscard]] bool isVisible() const;
|
[[nodiscard]] bool isVisible() const;
|
||||||
[[nodiscard]] bool isActive() const;
|
[[nodiscard]] bool isActive() const;
|
||||||
|
|
||||||
|
[[nodiscard]] ConferencePanelMigration migrationInfo() const;
|
||||||
|
|
||||||
base::weak_ptr<Ui::Toast::Instance> showToast(
|
base::weak_ptr<Ui::Toast::Instance> showToast(
|
||||||
const QString &text,
|
const QString &text,
|
||||||
crl::time duration = 0);
|
crl::time duration = 0);
|
||||||
|
|
|
@ -71,6 +71,11 @@ struct StartConferenceInfo {
|
||||||
QString videoCaptureScreenId;
|
QString videoCaptureScreenId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ConferencePanelMigration {
|
||||||
|
QScreen *screen = nullptr;
|
||||||
|
QRect geometry;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Calls
|
} // namespace Calls
|
||||||
|
|
||||||
namespace Calls::Group {
|
namespace Calls::Group {
|
||||||
|
|
|
@ -191,6 +191,10 @@ struct Panel::ControlsBackgroundNarrow {
|
||||||
};
|
};
|
||||||
|
|
||||||
Panel::Panel(not_null<GroupCall*> call)
|
Panel::Panel(not_null<GroupCall*> call)
|
||||||
|
: Panel(call, ConferencePanelMigration()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Panel::Panel(not_null<GroupCall*> call, ConferencePanelMigration info)
|
||||||
: _call(call)
|
: _call(call)
|
||||||
, _peer(call->peer())
|
, _peer(call->peer())
|
||||||
, _layerBg(std::make_unique<Ui::LayerManager>(widget()))
|
, _layerBg(std::make_unique<Ui::LayerManager>(widget()))
|
||||||
|
@ -253,7 +257,7 @@ Panel::Panel(not_null<GroupCall*> call)
|
||||||
initWindow();
|
initWindow();
|
||||||
initWidget();
|
initWidget();
|
||||||
initControls();
|
initControls();
|
||||||
initLayout();
|
initLayout(info);
|
||||||
showAndActivate();
|
showAndActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1673,8 +1677,8 @@ void Panel::kickParticipantSure(not_null<PeerData*> participantPeer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::initLayout() {
|
void Panel::initLayout(ConferencePanelMigration info) {
|
||||||
initGeometry();
|
initGeometry(info);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
_controls->wrap.raise();
|
_controls->wrap.raise();
|
||||||
|
@ -1704,22 +1708,32 @@ rpl::lifetime &Panel::lifetime() {
|
||||||
return window()->lifetime();
|
return window()->lifetime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::initGeometry() {
|
void Panel::initGeometry(ConferencePanelMigration info) {
|
||||||
const auto center = Core::App().getPointForCallPanelCenter();
|
|
||||||
const auto width = _call->rtmp()
|
|
||||||
? st::groupCallWidthRtmp
|
|
||||||
: st::groupCallWidth;
|
|
||||||
const auto height = _call->rtmp()
|
|
||||||
? st::groupCallHeightRtmp
|
|
||||||
: st::groupCallHeight;
|
|
||||||
const auto minWidth = _call->rtmp()
|
const auto minWidth = _call->rtmp()
|
||||||
? st::groupCallWidthRtmpMin
|
? st::groupCallWidthRtmpMin
|
||||||
: st::groupCallWidth;
|
: st::groupCallWidth;
|
||||||
const auto minHeight = _call->rtmp()
|
const auto minHeight = _call->rtmp()
|
||||||
? st::groupCallHeightRtmpMin
|
? st::groupCallHeightRtmpMin
|
||||||
: st::groupCallHeight;
|
: st::groupCallHeight;
|
||||||
const auto rect = QRect(0, 0, width, height);
|
if (info.screen && !info.geometry.isEmpty()) {
|
||||||
window()->setGeometry(rect.translated(center - rect.center()));
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
window()->setScreen(info.screen);
|
||||||
|
#else // Qt >= 6.0.0
|
||||||
|
window()->createWinId();
|
||||||
|
window()->windowHandle()->setScreen(info.screen);
|
||||||
|
#endif // Qt < 6.0.0
|
||||||
|
window()->setGeometry(info.geometry);
|
||||||
|
} else {
|
||||||
|
const auto center = Core::App().getPointForCallPanelCenter();
|
||||||
|
const auto width = _call->rtmp()
|
||||||
|
? st::groupCallWidthRtmp
|
||||||
|
: st::groupCallWidth;
|
||||||
|
const auto height = _call->rtmp()
|
||||||
|
? st::groupCallHeightRtmp
|
||||||
|
: st::groupCallHeight;
|
||||||
|
const auto rect = QRect(0, 0, width, height);
|
||||||
|
window()->setGeometry(rect.translated(center - rect.center()));
|
||||||
|
}
|
||||||
window()->setMinimumSize({ minWidth, minHeight });
|
window()->setMinimumSize({ minWidth, minHeight });
|
||||||
window()->show();
|
window()->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ struct CallBodyLayout;
|
||||||
|
|
||||||
namespace Calls {
|
namespace Calls {
|
||||||
struct InviteRequest;
|
struct InviteRequest;
|
||||||
|
struct ConferencePanelMigration;
|
||||||
} // namespace Calls
|
} // namespace Calls
|
||||||
|
|
||||||
namespace Calls::Group {
|
namespace Calls::Group {
|
||||||
|
@ -90,7 +91,8 @@ class Panel final
|
||||||
: public base::has_weak_ptr
|
: public base::has_weak_ptr
|
||||||
, private Ui::DesktopCapture::ChooseSourceDelegate {
|
, private Ui::DesktopCapture::ChooseSourceDelegate {
|
||||||
public:
|
public:
|
||||||
Panel(not_null<GroupCall*> call);
|
explicit Panel(not_null<GroupCall*> call);
|
||||||
|
Panel(not_null<GroupCall*> call, ConferencePanelMigration info);
|
||||||
~Panel();
|
~Panel();
|
||||||
|
|
||||||
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
|
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
|
||||||
|
@ -156,8 +158,8 @@ private:
|
||||||
void initWidget();
|
void initWidget();
|
||||||
void initControls();
|
void initControls();
|
||||||
void initShareAction();
|
void initShareAction();
|
||||||
void initLayout();
|
void initLayout(ConferencePanelMigration info);
|
||||||
void initGeometry();
|
void initGeometry(ConferencePanelMigration info);
|
||||||
void setupScheduledLabels(rpl::producer<TimeId> date);
|
void setupScheduledLabels(rpl::producer<TimeId> date);
|
||||||
void setupMembers();
|
void setupMembers();
|
||||||
void setupVideo(not_null<Viewport*> viewport);
|
void setupVideo(not_null<Viewport*> viewport);
|
||||||
|
|
Loading…
Add table
Reference in a new issue