2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-29 13:47:47 +00:00

Option to hide phone number in drawer

This commit is contained in:
RadRussianRus 2019-10-07 02:58:56 +03:00
parent 16b195b1f5
commit aea5ca9013
5 changed files with 32 additions and 9 deletions

View File

@ -11,5 +11,7 @@
// "sticker_height": 128,
// "big_emoji_outline": false,
// "always_show_scheduled": true,
// "show_chat_id": true
// "show_chat_id": true,
// "net_speed_boost": null,
// "show_phone_in_drawer": true
}

View File

@ -218,6 +218,11 @@ bool Manager::readCustomFile() {
cSetNetUploadRequestInterval(500);
}
}
const auto settingsShowDrawerPhoneIt = settings.constFind(qsl("show_phone_in_drawer"));
if (settingsShowDrawerPhoneIt != settings.constEnd() && (*settingsShowDrawerPhoneIt).isBool()) {
cSetShowPhoneInDrawer((*settingsShowDrawerPhoneIt).toBool());
}
return true;
}
@ -250,6 +255,7 @@ void Manager::writeDefaultFile() {
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
settings.insert(qsl("show_chat_id"), cShowChatId());
settings.insert(qsl("net_speed_boost"), QJsonValue(QJsonValue::Null));
settings.insert(qsl("show_phone_in_drawer"), cShowPhoneInDrawer());
auto document = QJsonDocument();
document.setObject(settings);

View File

@ -220,3 +220,5 @@ int gNetDownloadSessionsCount = 2;
int gNetUploadSessionsCount = 2;
int gNetMaxFileQueries = 16;
int gNetUploadRequestInterval = 500;
bool gShowPhoneInDrawer = true;

View File

@ -194,3 +194,5 @@ DeclareSetting(int, NetDownloadSessionsCount);
DeclareSetting(int, NetUploadSessionsCount);
DeclareSetting(int, NetMaxFileQueries);
DeclareSetting(int, NetUploadRequestInterval);
DeclareSetting(bool, ShowPhoneInDrawer);

View File

@ -419,14 +419,25 @@ void MainMenu::paintEvent(QPaintEvent *e) {
}
p.setPen(st::mainMenuCoverFg);
p.setFont(st::semiboldFont);
_controller->session().user()->nameText().drawLeftElided(
p,
st::mainMenuCoverTextLeft,
st::mainMenuCoverNameTop,
widthText,
width());
p.setFont(st::normalFont);
p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), _phoneText);
if (cShowPhoneInDrawer()) {
_controller->session().user()->nameText().drawLeftElided(
p,
st::mainMenuCoverTextLeft,
st::mainMenuCoverNameTop,
widthText,
width());
p.setFont(st::normalFont);
p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), _phoneText);
} else {
const auto diff = st::mainMenuCoverStatusTop - st::mainMenuCoverNameTop;
_controller->session().user()->nameText().drawLeftElided(
p,
st::mainMenuCoverTextLeft,
st::mainMenuCoverNameTop + (diff / 2),
widthText,
width());
}
if (_cloudButton) {
Ui::EmptyUserpic::PaintSavedMessages(
p,