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

View file

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

View file

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

View file

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