Show right call top bar after migration.

This commit is contained in:
John Preston 2025-04-07 14:42:53 +04:00
parent 909bd3dd2d
commit 915dec7ba5
4 changed files with 21 additions and 19 deletions

View file

@ -228,14 +228,14 @@ private:
TopBar::TopBar(
QWidget *parent,
const base::weak_ptr<Call> &call,
Call *call,
std::shared_ptr<Ui::Show> show)
: TopBar(parent, show, call, nullptr) {
}
TopBar::TopBar(
QWidget *parent,
const base::weak_ptr<GroupCall> &call,
GroupCall *call,
std::shared_ptr<Ui::Show> show)
: TopBar(parent, show, nullptr, call) {
}
@ -243,8 +243,8 @@ TopBar::TopBar(
TopBar::TopBar(
QWidget *parent,
std::shared_ptr<Ui::Show> show,
const base::weak_ptr<Call> &call,
const base::weak_ptr<GroupCall> &groupCall)
Call *call,
GroupCall *groupCall)
: RpWidget(parent)
, _call(call)
, _groupCall(groupCall)

View file

@ -42,11 +42,11 @@ class TopBar : public Ui::RpWidget {
public:
TopBar(
QWidget *parent,
const base::weak_ptr<Call> &call,
Call *call,
std::shared_ptr<Ui::Show> show);
TopBar(
QWidget *parent,
const base::weak_ptr<GroupCall> &call,
GroupCall *call,
std::shared_ptr<Ui::Show> show);
~TopBar();
@ -64,8 +64,8 @@ private:
TopBar(
QWidget *parent,
std::shared_ptr<Ui::Show> show,
const base::weak_ptr<Call> &call,
const base::weak_ptr<GroupCall> &groupCall);
Call *call,
GroupCall *groupCall);
void initControls();
void setupInitialBrush();

View file

@ -926,15 +926,15 @@ void MainWidget::setCurrentCall(Calls::Call *call) {
}
_currentCallLifetime.destroy();
_currentCall = call;
if (_currentCall) {
if (call) {
_callTopBar.destroy();
_currentCall->stateValue(
call->stateValue(
) | rpl::start_with_next([=](Calls::Call::State state) {
using State = Calls::Call::State;
if (state != State::Established) {
destroyCallTopBar();
} else if (!_callTopBar) {
createCallTopBar();
createCallTopBar(call, nullptr);
}
}, _currentCallLifetime);
} else {
@ -948,7 +948,7 @@ void MainWidget::setCurrentGroupCall(Calls::GroupCall *call) {
}
_currentCallLifetime.destroy();
_currentGroupCall = call;
if (_currentGroupCall) {
if (call) {
_callTopBar.destroy();
_currentGroupCall->stateValue(
) | rpl::start_with_next([=](Calls::GroupCall::State state) {
@ -960,7 +960,7 @@ void MainWidget::setCurrentGroupCall(Calls::GroupCall *call) {
&& state != State::Connecting) {
destroyCallTopBar();
} else if (!_callTopBar) {
createCallTopBar();
createCallTopBar(nullptr, call);
}
}, _currentCallLifetime);
} else {
@ -968,15 +968,17 @@ void MainWidget::setCurrentGroupCall(Calls::GroupCall *call) {
}
}
void MainWidget::createCallTopBar() {
Expects(_currentCall != nullptr || _currentGroupCall != nullptr);
void MainWidget::createCallTopBar(
Calls::Call *call,
Calls::GroupCall *group) {
Expects(call || group);
const auto show = controller()->uiShow();
_callTopBar.create(
this,
(_currentCall
? object_ptr<Calls::TopBar>(this, _currentCall, show)
: object_ptr<Calls::TopBar>(this, _currentGroupCall, show)));
(call
? object_ptr<Calls::TopBar>(this, call, show)
: object_ptr<Calls::TopBar>(this, group, show)));
_callTopBar->entity()->initBlobsUnder(this, _callTopBar->geometryValue());
_callTopBar->heightValue(
) | rpl::start_with_next([this](int value) {

View file

@ -244,7 +244,7 @@ private:
void setCurrentCall(Calls::Call *call);
void setCurrentGroupCall(Calls::GroupCall *call);
void createCallTopBar();
void createCallTopBar(Calls::Call *call, Calls::GroupCall *group);
void destroyCallTopBar();
void callTopBarHeightUpdated(int callTopBarHeight);