mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Provided Ui::Show to Calls::TopBar.
This commit is contained in:
parent
236b7bbf28
commit
29910cd1f7
3 changed files with 35 additions and 15 deletions
|
@ -227,23 +227,27 @@ private:
|
|||
|
||||
TopBar::TopBar(
|
||||
QWidget *parent,
|
||||
const base::weak_ptr<Call> &call)
|
||||
: TopBar(parent, call, nullptr) {
|
||||
const base::weak_ptr<Call> &call,
|
||||
std::shared_ptr<Ui::Show> show)
|
||||
: TopBar(parent, show, call, nullptr) {
|
||||
}
|
||||
|
||||
TopBar::TopBar(
|
||||
QWidget *parent,
|
||||
const base::weak_ptr<GroupCall> &call)
|
||||
: TopBar(parent, nullptr, call) {
|
||||
const base::weak_ptr<GroupCall> &call,
|
||||
std::shared_ptr<Ui::Show> show)
|
||||
: TopBar(parent, show, nullptr, call) {
|
||||
}
|
||||
|
||||
TopBar::TopBar(
|
||||
QWidget *parent,
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
const base::weak_ptr<Call> &call,
|
||||
const base::weak_ptr<GroupCall> &groupCall)
|
||||
: RpWidget(parent)
|
||||
, _call(call)
|
||||
, _groupCall(groupCall)
|
||||
, _show(show)
|
||||
, _userpics(call
|
||||
? nullptr
|
||||
: std::make_unique<Ui::GroupCallUserpics>(
|
||||
|
@ -279,7 +283,9 @@ void TopBar::initControls() {
|
|||
call->setMuted(!call->muted());
|
||||
} else if (const auto group = _groupCall.get()) {
|
||||
if (group->mutedByAdmin()) {
|
||||
Ui::Toast::Show(tr::lng_group_call_force_muted_sub(tr::now));
|
||||
Ui::Toast::Show(
|
||||
_show->toastParent(),
|
||||
tr::lng_group_call_force_muted_sub(tr::now));
|
||||
} else {
|
||||
group->setMuted((group->muted() == MuteState::Muted)
|
||||
? MuteState::Active
|
||||
|
@ -394,7 +400,9 @@ void TopBar::initControls() {
|
|||
if (const auto call = _call.get()) {
|
||||
if (Logs::DebugEnabled()
|
||||
&& (_info->clickModifiers() & Qt::ControlModifier)) {
|
||||
Ui::show(Box<DebugInfoBox>(_call));
|
||||
_show->showBox(
|
||||
Box<DebugInfoBox>(_call),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else {
|
||||
Core::App().calls().showInfoPanel(call);
|
||||
}
|
||||
|
@ -409,11 +417,13 @@ void TopBar::initControls() {
|
|||
if (!group->peer()->canManageGroupCall()) {
|
||||
group->hangup();
|
||||
} else {
|
||||
Ui::show(Box(
|
||||
Group::LeaveBox,
|
||||
group,
|
||||
false,
|
||||
Group::BoxContext::MainWindow));
|
||||
_show->showBox(
|
||||
Box(
|
||||
Group::LeaveBox,
|
||||
group,
|
||||
false,
|
||||
Group::BoxContext::MainWindow),
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@ class LabelSimple;
|
|||
class FlatLabel;
|
||||
struct GroupCallUser;
|
||||
class GroupCallUserpics;
|
||||
class Show;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Main {
|
||||
|
@ -39,8 +40,14 @@ enum class BarState;
|
|||
|
||||
class TopBar : public Ui::RpWidget {
|
||||
public:
|
||||
TopBar(QWidget *parent, const base::weak_ptr<Call> &call);
|
||||
TopBar(QWidget *parent, const base::weak_ptr<GroupCall> &call);
|
||||
TopBar(
|
||||
QWidget *parent,
|
||||
const base::weak_ptr<Call> &call,
|
||||
std::shared_ptr<Ui::Show> show);
|
||||
TopBar(
|
||||
QWidget *parent,
|
||||
const base::weak_ptr<GroupCall> &call,
|
||||
std::shared_ptr<Ui::Show> show);
|
||||
~TopBar();
|
||||
|
||||
void initBlobsUnder(
|
||||
|
@ -56,6 +63,7 @@ private:
|
|||
|
||||
TopBar(
|
||||
QWidget *parent,
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
const base::weak_ptr<Call> &call,
|
||||
const base::weak_ptr<GroupCall> &groupCall);
|
||||
|
||||
|
@ -72,6 +80,7 @@ private:
|
|||
|
||||
const base::weak_ptr<Call> _call;
|
||||
const base::weak_ptr<GroupCall> _groupCall;
|
||||
const std::shared_ptr<Ui::Show> _show;
|
||||
|
||||
bool _muted = false;
|
||||
std::vector<Ui::GroupCallUser> _users;
|
||||
|
|
|
@ -962,11 +962,12 @@ void MainWidget::setCurrentGroupCall(Calls::GroupCall *call) {
|
|||
void MainWidget::createCallTopBar() {
|
||||
Expects(_currentCall != nullptr || _currentGroupCall != nullptr);
|
||||
|
||||
const auto show = std::make_shared<Window::Show>(controller());
|
||||
_callTopBar.create(
|
||||
this,
|
||||
(_currentCall
|
||||
? object_ptr<Calls::TopBar>(this, _currentCall)
|
||||
: object_ptr<Calls::TopBar>(this, _currentGroupCall)));
|
||||
? object_ptr<Calls::TopBar>(this, _currentCall, show)
|
||||
: object_ptr<Calls::TopBar>(this, _currentGroupCall, show)));
|
||||
_callTopBar->entity()->initBlobsUnder(this, _callTopBar->geometryValue());
|
||||
_callTopBar->heightValue(
|
||||
) | rpl::start_with_next([this](int value) {
|
||||
|
|
Loading…
Add table
Reference in a new issue