mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-26 19:14:02 +02:00
Change group call icon in top bar.
This commit is contained in:
parent
8b0430a255
commit
ba185d1f6f
6 changed files with 33 additions and 10 deletions
BIN
Telegram/Resources/icons/top_bar_group_call.png
Normal file
BIN
Telegram/Resources/icons/top_bar_group_call.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 588 B |
BIN
Telegram/Resources/icons/top_bar_group_call@2x.png
Normal file
BIN
Telegram/Resources/icons/top_bar_group_call@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
Telegram/Resources/icons/top_bar_group_call@3x.png
Normal file
BIN
Telegram/Resources/icons/top_bar_group_call@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -64,6 +64,7 @@ TopBarWidget::TopBarWidget(
|
||||||
, _delete(this, tr::lng_selected_delete(), st::defaultActiveButton)
|
, _delete(this, tr::lng_selected_delete(), st::defaultActiveButton)
|
||||||
, _back(this, st::historyTopBarBack)
|
, _back(this, st::historyTopBarBack)
|
||||||
, _call(this, st::topBarCall)
|
, _call(this, st::topBarCall)
|
||||||
|
, _groupCall(this, st::topBarGroupCall)
|
||||||
, _search(this, st::topBarSearch)
|
, _search(this, st::topBarSearch)
|
||||||
, _infoToggle(this, st::topBarInfo)
|
, _infoToggle(this, st::topBarInfo)
|
||||||
, _menuToggle(this, st::topBarMenuToggle)
|
, _menuToggle(this, st::topBarMenuToggle)
|
||||||
|
@ -83,8 +84,9 @@ TopBarWidget::TopBarWidget(
|
||||||
_delete->setClickedCallback([=] { _deleteSelection.fire({}); });
|
_delete->setClickedCallback([=] { _deleteSelection.fire({}); });
|
||||||
_delete->setWidthChangedCallback([=] { updateControlsGeometry(); });
|
_delete->setWidthChangedCallback([=] { updateControlsGeometry(); });
|
||||||
_clear->setClickedCallback([=] { _clearSelection.fire({}); });
|
_clear->setClickedCallback([=] { _clearSelection.fire({}); });
|
||||||
_call->setClickedCallback([=] { onCall(); });
|
_call->setClickedCallback([=] { call(); });
|
||||||
_search->setClickedCallback([=] { onSearch(); });
|
_groupCall->setClickedCallback([=] { groupCall(); });
|
||||||
|
_search->setClickedCallback([=] { search(); });
|
||||||
_menuToggle->setClickedCallback([=] { showMenu(); });
|
_menuToggle->setClickedCallback([=] { showMenu(); });
|
||||||
_infoToggle->setClickedCallback([=] { toggleInfoSection(); });
|
_infoToggle->setClickedCallback([=] { toggleInfoSection(); });
|
||||||
_back->addClickHandler([=] { backClicked(); });
|
_back->addClickHandler([=] { backClicked(); });
|
||||||
|
@ -202,21 +204,27 @@ void TopBarWidget::refreshLang() {
|
||||||
InvokeQueued(this, [this] { updateControlsGeometry(); });
|
InvokeQueued(this, [this] { updateControlsGeometry(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::onSearch() {
|
void TopBarWidget::search() {
|
||||||
if (_activeChat.key) {
|
if (_activeChat.key) {
|
||||||
_controller->content()->searchInChat(_activeChat.key);
|
_controller->content()->searchInChat(_activeChat.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::onCall() {
|
void TopBarWidget::call() {
|
||||||
if (const auto peer = _activeChat.key.peer()) {
|
if (const auto peer = _activeChat.key.peer()) {
|
||||||
if (const auto user = peer->asUser()) {
|
if (const auto user = peer->asUser()) {
|
||||||
Core::App().calls().startOutgoingCall(user, false);
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
} else if (const auto megagroup = peer->asMegagroup()) {
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TopBarWidget::groupCall() {
|
||||||
|
if (const auto peer = _activeChat.key.peer()) {
|
||||||
|
if (const auto megagroup = peer->asMegagroup()) {
|
||||||
if (megagroup->amAnonymous()) {
|
if (megagroup->amAnonymous()) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
.text = tr::lng_group_call_no_anonymous(tr::now),
|
.text = tr::lng_group_call_no_anonymous(tr::now),
|
||||||
});
|
});
|
||||||
} else if (const auto call = megagroup->call()) {
|
} else if (const auto call = megagroup->call()) {
|
||||||
Core::App().calls().joinGroupCall(megagroup, call->input());
|
Core::App().calls().joinGroupCall(megagroup, call->input());
|
||||||
} else {
|
} else {
|
||||||
|
@ -653,6 +661,7 @@ void TopBarWidget::updateControlsGeometry() {
|
||||||
_search->moveToRight(_rightTaken, otherButtonsTop);
|
_search->moveToRight(_rightTaken, otherButtonsTop);
|
||||||
_rightTaken += _search->width() + st::topBarCallSkip;
|
_rightTaken += _search->width() + st::topBarCallSkip;
|
||||||
_call->moveToRight(_rightTaken, otherButtonsTop);
|
_call->moveToRight(_rightTaken, otherButtonsTop);
|
||||||
|
_groupCall->moveToRight(_rightTaken, otherButtonsTop);
|
||||||
_rightTaken += _call->width();
|
_rightTaken += _call->width();
|
||||||
|
|
||||||
updateMembersShowArea();
|
updateMembersShowArea();
|
||||||
|
@ -713,13 +722,20 @@ void TopBarWidget::updateControlsVisibility() {
|
||||||
if (const auto user = peer->asUser()) {
|
if (const auto user = peer->asUser()) {
|
||||||
return session().serverConfig().phoneCallsEnabled.current()
|
return session().serverConfig().phoneCallsEnabled.current()
|
||||||
&& user->hasCalls();
|
&& user->hasCalls();
|
||||||
} else if (const auto megagroup = peer->asMegagroup()) {
|
|
||||||
return megagroup->canManageCall();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}();
|
}();
|
||||||
_call->setVisible(historyMode && callsEnabled);
|
_call->setVisible(historyMode && callsEnabled);
|
||||||
|
const auto groupCallsEnabled = [&] {
|
||||||
|
if (const auto peer = _activeChat.key.peer()) {
|
||||||
|
if (const auto megagroup = peer->asMegagroup()) {
|
||||||
|
return megagroup->canManageCall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}();
|
||||||
|
_groupCall->setVisible(historyMode && groupCallsEnabled);
|
||||||
|
|
||||||
if (_membersShowArea) {
|
if (_membersShowArea) {
|
||||||
_membersShowArea->show();
|
_membersShowArea->show();
|
||||||
|
|
|
@ -95,8 +95,9 @@ private:
|
||||||
void selectedShowCallback();
|
void selectedShowCallback();
|
||||||
void updateInfoToggleActive();
|
void updateInfoToggleActive();
|
||||||
|
|
||||||
void onCall();
|
void call();
|
||||||
void onSearch();
|
void groupCall();
|
||||||
|
void search();
|
||||||
void showMenu();
|
void showMenu();
|
||||||
void toggleInfoSection();
|
void toggleInfoSection();
|
||||||
|
|
||||||
|
@ -144,6 +145,7 @@ private:
|
||||||
object_ptr<Ui::AbstractButton> _info = { nullptr };
|
object_ptr<Ui::AbstractButton> _info = { nullptr };
|
||||||
|
|
||||||
object_ptr<Ui::IconButton> _call;
|
object_ptr<Ui::IconButton> _call;
|
||||||
|
object_ptr<Ui::IconButton> _groupCall;
|
||||||
object_ptr<Ui::IconButton> _search;
|
object_ptr<Ui::IconButton> _search;
|
||||||
object_ptr<Ui::IconButton> _infoToggle;
|
object_ptr<Ui::IconButton> _infoToggle;
|
||||||
object_ptr<Ui::IconButton> _menuToggle;
|
object_ptr<Ui::IconButton> _menuToggle;
|
||||||
|
|
|
@ -763,6 +763,11 @@ topBarCall: IconButton(topBarSearch) {
|
||||||
icon: icon {{ "top_bar_call", menuIconFg }};
|
icon: icon {{ "top_bar_call", menuIconFg }};
|
||||||
iconOver: icon {{ "top_bar_call", menuIconFgOver }};
|
iconOver: icon {{ "top_bar_call", menuIconFgOver }};
|
||||||
}
|
}
|
||||||
|
topBarGroupCall: IconButton(topBarSearch) {
|
||||||
|
icon: icon {{ "top_bar_group_call", menuIconFg }};
|
||||||
|
iconOver: icon {{ "top_bar_group_call", menuIconFgOver }};
|
||||||
|
iconPosition: point(8px, 15px);
|
||||||
|
}
|
||||||
topBarInfo: IconButton(topBarSearch) {
|
topBarInfo: IconButton(topBarSearch) {
|
||||||
icon: icon {{ "top_bar_profile", menuIconFg }};
|
icon: icon {{ "top_bar_profile", menuIconFg }};
|
||||||
iconOver: icon {{ "top_bar_profile", menuIconFgOver }};
|
iconOver: icon {{ "top_bar_profile", menuIconFgOver }};
|
||||||
|
|
Loading…
Add table
Reference in a new issue