mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-11 08:48:14 +00:00
Replace phone number with "Set Emoji Status".
This commit is contained in:
parent
2215500c9a
commit
c00f2f96ec
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_menu_night_mode" = "Night Mode";
|
||||
"lng_menu_add_account" = "Add Account";
|
||||
"lng_menu_activate" = "Activate";
|
||||
"lng_menu_set_status" = "Set Emoji Status";
|
||||
|
||||
"lng_disable_notifications_from_tray" = "Disable notifications";
|
||||
"lng_enable_notifications_from_tray" = "Enable notifications";
|
||||
|
@ -213,7 +213,7 @@ void EmojiStatusPanel::show(
|
||||
const auto global = button->mapToGlobal(QPoint());
|
||||
const auto local = parent->mapFromGlobal(global);
|
||||
_panel->moveTopRight(
|
||||
local.y() + button->height(),
|
||||
local.y() + button->height() - (st::normalFont->height / 2),
|
||||
local.x() + button->width() * 3);
|
||||
_panel->toggleAnimated();
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ mainMenuResetScaleTop: 2px;
|
||||
mainMenuResetScaleIconLeft: 5px;
|
||||
mainMenuCoverNameLeft: 26px;
|
||||
mainMenuCoverNameTop: 84px;
|
||||
mainMenuCoverStatusLeft: 24px;
|
||||
mainMenuCoverStatusLeft: mainMenuCoverNameLeft;
|
||||
mainMenuCoverStatusTop: 103px;
|
||||
mainMenuPhoneFont: font(12px);
|
||||
mainMenuSkip: 6px;
|
||||
|
@ -40,6 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/about_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/premium_preview_box.h"
|
||||
#include "calls/calls_box_controller.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "core/click_handler_types.h"
|
||||
@ -339,6 +340,9 @@ MainMenu::MainMenu(
|
||||
Ui::UserpicButton::Role::Custom,
|
||||
st::mainMenuUserpic)
|
||||
, _toggleAccounts(this)
|
||||
, _setEmojiStatus(this, tr::lng_menu_set_status([](const QString &text) {
|
||||
return Ui::Text::Link(text);
|
||||
}))
|
||||
, _emojiStatusPanel(std::make_unique<Info::Profile::EmojiStatusPanel>())
|
||||
, _badge(std::make_unique<Info::Profile::Badge>(
|
||||
this,
|
||||
@ -373,6 +377,7 @@ MainMenu::MainMenu(
|
||||
|
||||
setupUserpicButton();
|
||||
setupAccountsToggle();
|
||||
setupSetEmojiStatus();
|
||||
setupAccounts();
|
||||
setupArchive();
|
||||
setupMenu();
|
||||
@ -440,10 +445,7 @@ MainMenu::MainMenu(
|
||||
moveBadge();
|
||||
}, lifetime());
|
||||
_badge->setPremiumClickCallback([=] {
|
||||
_emojiStatusPanel->show(
|
||||
_controller,
|
||||
_badge->widget(),
|
||||
_badge->sizeTag());
|
||||
chooseEmojiStatus();
|
||||
});
|
||||
|
||||
_controller->session().downloaderTaskFinished(
|
||||
@ -451,14 +453,6 @@ MainMenu::MainMenu(
|
||||
update();
|
||||
}, lifetime());
|
||||
|
||||
_controller->session().changes().peerUpdates(
|
||||
_controller->session().user(),
|
||||
Data::PeerUpdate::Flag::PhoneNumber
|
||||
) | rpl::start_with_next([=] {
|
||||
updatePhone();
|
||||
}, lifetime());
|
||||
|
||||
updatePhone();
|
||||
initResetScaleButton();
|
||||
}
|
||||
|
||||
@ -624,18 +618,16 @@ void MainMenu::setupAccountsToggle() {
|
||||
_toggleAccounts->addClickHandler([=](Qt::MouseButton button) {
|
||||
if (button == Qt::LeftButton) {
|
||||
toggleAccounts();
|
||||
} else if (button == Qt::RightButton) {
|
||||
const auto menu = Ui::CreateChild<Ui::PopupMenu>(
|
||||
_toggleAccounts.data());
|
||||
|
||||
menu->addAction(tr::lng_profile_copy_phone(tr::now), [=] {
|
||||
QGuiApplication::clipboard()->setText(_phoneText);
|
||||
});
|
||||
menu->popup(QCursor::pos());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void MainMenu::setupSetEmojiStatus() {
|
||||
_setEmojiStatus->overrideLinkClickHandler([=] {
|
||||
chooseEmojiStatus();
|
||||
});
|
||||
}
|
||||
|
||||
void MainMenu::parentResized() {
|
||||
resize(st::mainMenuWidth, parentWidget()->height());
|
||||
}
|
||||
@ -755,8 +747,6 @@ void MainMenu::setupMenu() {
|
||||
_nightThemeSwitches.fire_copy(*darkMode);
|
||||
}
|
||||
}, _nightThemeToggle->lifetime());
|
||||
|
||||
updatePhone();
|
||||
}
|
||||
|
||||
void MainMenu::resizeEvent(QResizeEvent *e) {
|
||||
@ -771,6 +761,10 @@ void MainMenu::updateControlsGeometry() {
|
||||
if (_resetScaleButton) {
|
||||
_resetScaleButton->moveToRight(0, 0);
|
||||
}
|
||||
_setEmojiStatus->moveToLeft(
|
||||
st::mainMenuCoverStatusLeft,
|
||||
st::mainMenuCoverStatusTop,
|
||||
width());
|
||||
_toggleAccounts->setGeometry(
|
||||
0,
|
||||
st::mainMenuCoverNameTop,
|
||||
@ -796,9 +790,12 @@ void MainMenu::updateInnerControlsGeometry() {
|
||||
}
|
||||
}
|
||||
|
||||
void MainMenu::updatePhone() {
|
||||
_phoneText = Ui::FormatPhone(_controller->session().user()->phone());
|
||||
update();
|
||||
void MainMenu::chooseEmojiStatus() {
|
||||
if (const auto widget = _badge->widget()) {
|
||||
_emojiStatusPanel->show(_controller, widget, _badge->sizeTag());
|
||||
} else {
|
||||
ShowPremiumPreviewBox(_controller, PremiumPreview::EmojiStatus);
|
||||
}
|
||||
}
|
||||
|
||||
void MainMenu::paintEvent(QPaintEvent *e) {
|
||||
@ -832,13 +829,6 @@ void MainMenu::paintEvent(QPaintEvent *e) {
|
||||
? (st::semiboldFont->spacew + _badge->widget()->width())
|
||||
: 0)),
|
||||
width());
|
||||
p.setFont(st::mainMenuPhoneFont);
|
||||
p.setPen(st::windowSubTextFg);
|
||||
p.drawTextLeft(
|
||||
st::mainMenuCoverStatusLeft,
|
||||
st::mainMenuCoverStatusTop,
|
||||
width(),
|
||||
_phoneText);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,19 +64,21 @@ private:
|
||||
void setupUserpicButton();
|
||||
void setupAccounts();
|
||||
void setupAccountsToggle();
|
||||
void setupSetEmojiStatus();
|
||||
void setupArchive();
|
||||
void setupMenu();
|
||||
void updateControlsGeometry();
|
||||
void updateInnerControlsGeometry();
|
||||
void updatePhone();
|
||||
void initResetScaleButton();
|
||||
void toggleAccounts();
|
||||
void chooseEmojiStatus();
|
||||
|
||||
const not_null<SessionController*> _controller;
|
||||
object_ptr<Ui::UserpicButton> _userpicButton;
|
||||
Ui::Text::String _name;
|
||||
int _nameVersion = 0;
|
||||
object_ptr<ToggleAccountsButton> _toggleAccounts;
|
||||
object_ptr<Ui::FlatLabel> _setEmojiStatus;
|
||||
std::unique_ptr<Info::Profile::EmojiStatusPanel> _emojiStatusPanel;
|
||||
std::unique_ptr<Info::Profile::Badge> _badge;
|
||||
object_ptr<ResetScaleButton> _resetScaleButton = { nullptr };
|
||||
@ -94,8 +96,6 @@ private:
|
||||
base::Timer _nightThemeSwitch;
|
||||
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
||||
|
||||
QString _phoneText;
|
||||
|
||||
};
|
||||
|
||||
struct OthersUnreadState {
|
||||
|
Loading…
Reference in New Issue
Block a user