[Option][GUI] Show phone in drawer
This commit is contained in:
parent
18444e204e
commit
cb1a2c6d04
5 changed files with 34 additions and 9 deletions
|
|
@ -60,6 +60,7 @@
|
|||
"ktg_profile_group_id": "Group ID",
|
||||
"ktg_profile_supergroup_id": "Supergroup ID",
|
||||
"ktg_profile_channel_id": "Channel ID",
|
||||
"ktg_settings_show_phone_number": "Show phone in drawer",
|
||||
"ktg_settings_adaptive_bubbles": "Adaptive bubbles",
|
||||
"ktg_settings_filters": "Folders",
|
||||
"ktg_settings_messages": "Messages",
|
||||
|
|
|
|||
|
|
@ -290,6 +290,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
|||
.type = SettingType::IntSetting,
|
||||
.defaultValue = 0,
|
||||
.limitHandler = NetSpeedBoostConv(IntLimit(0, 3)), }},
|
||||
{ "show_phone_in_drawer", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.defaultValue = true, }},
|
||||
};
|
||||
|
||||
using OldOptionKey = QString;
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ void SetupKotatoOther(
|
|||
AddSkip(container);
|
||||
AddSubsectionTitle(container, rktr("ktg_settings_other"));
|
||||
|
||||
SettingsMenuJsonSwitch(ktg_settings_show_phone_number, show_phone_in_drawer);
|
||||
|
||||
const auto chatIdButton = container->add(
|
||||
object_ptr<Button>(
|
||||
|
|
|
|||
|
|
@ -114,6 +114,11 @@ mainMenuResetScaleIconLeft: 5px;
|
|||
mainMenuCoverTextLeft: 30px;
|
||||
mainMenuCoverNameTop: 84px;
|
||||
mainMenuCoverStatusTop: 102px;
|
||||
mainMenuCoverNameOnlyTop: 94px;
|
||||
mainMenuCoverNameOnlyFont: font(14px semibold);
|
||||
mainMenuCoverNameOnlyStyle: TextStyle(semiboldTextStyle) {
|
||||
font: mainMenuCoverNameOnlyFont;
|
||||
}
|
||||
mainMenuSkip: 10px;
|
||||
mainMenu: Menu(defaultMenu) {
|
||||
itemFg: windowBoldFg;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "window/window_main_menu.h"
|
||||
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "window/themes/window_theme.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "window/window_session_controller.h"
|
||||
|
|
@ -1184,16 +1185,30 @@ void MainMenu::paintEvent(QPaintEvent *e) {
|
|||
p.fillRect(cover, st::mainMenuCoverBg);
|
||||
}
|
||||
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 (::Kotato::JsonSettings::GetBool("show_phone_in_drawer")) {
|
||||
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);
|
||||
} else {
|
||||
p.setFont(st::mainMenuCoverNameOnlyFont);
|
||||
auto name = _controller->session().user()->nameText().toString();
|
||||
auto nameStr = Ui::Text::String();
|
||||
nameStr.setText(st::mainMenuCoverNameOnlyStyle, name, Ui::NameTextOptions());
|
||||
nameStr.drawLeftElided(
|
||||
p,
|
||||
st::mainMenuCoverTextLeft,
|
||||
st::mainMenuCoverNameOnlyTop,
|
||||
widthText,
|
||||
width());
|
||||
|
||||
}
|
||||
|
||||
// Draw Saved Messages button.
|
||||
if (!_cloudButton->isHidden()) {
|
||||
Ui::EmptyUserpic::PaintSavedMessages(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue