mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Replace phone number with "Set Emoji Status".
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user