[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_group_id": "Group ID",
|
||||||
"ktg_profile_supergroup_id": "Supergroup ID",
|
"ktg_profile_supergroup_id": "Supergroup ID",
|
||||||
"ktg_profile_channel_id": "Channel ID",
|
"ktg_profile_channel_id": "Channel ID",
|
||||||
|
"ktg_settings_show_phone_number": "Show phone in drawer",
|
||||||
"ktg_settings_adaptive_bubbles": "Adaptive bubbles",
|
"ktg_settings_adaptive_bubbles": "Adaptive bubbles",
|
||||||
"ktg_settings_filters": "Folders",
|
"ktg_settings_filters": "Folders",
|
||||||
"ktg_settings_messages": "Messages",
|
"ktg_settings_messages": "Messages",
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||||
.type = SettingType::IntSetting,
|
.type = SettingType::IntSetting,
|
||||||
.defaultValue = 0,
|
.defaultValue = 0,
|
||||||
.limitHandler = NetSpeedBoostConv(IntLimit(0, 3)), }},
|
.limitHandler = NetSpeedBoostConv(IntLimit(0, 3)), }},
|
||||||
|
{ "show_phone_in_drawer", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = true, }},
|
||||||
};
|
};
|
||||||
|
|
||||||
using OldOptionKey = QString;
|
using OldOptionKey = QString;
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,7 @@ void SetupKotatoOther(
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, rktr("ktg_settings_other"));
|
AddSubsectionTitle(container, rktr("ktg_settings_other"));
|
||||||
|
|
||||||
|
SettingsMenuJsonSwitch(ktg_settings_show_phone_number, show_phone_in_drawer);
|
||||||
|
|
||||||
const auto chatIdButton = container->add(
|
const auto chatIdButton = container->add(
|
||||||
object_ptr<Button>(
|
object_ptr<Button>(
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,11 @@ mainMenuResetScaleIconLeft: 5px;
|
||||||
mainMenuCoverTextLeft: 30px;
|
mainMenuCoverTextLeft: 30px;
|
||||||
mainMenuCoverNameTop: 84px;
|
mainMenuCoverNameTop: 84px;
|
||||||
mainMenuCoverStatusTop: 102px;
|
mainMenuCoverStatusTop: 102px;
|
||||||
|
mainMenuCoverNameOnlyTop: 94px;
|
||||||
|
mainMenuCoverNameOnlyFont: font(14px semibold);
|
||||||
|
mainMenuCoverNameOnlyStyle: TextStyle(semiboldTextStyle) {
|
||||||
|
font: mainMenuCoverNameOnlyFont;
|
||||||
|
}
|
||||||
mainMenuSkip: 10px;
|
mainMenuSkip: 10px;
|
||||||
mainMenu: Menu(defaultMenu) {
|
mainMenu: Menu(defaultMenu) {
|
||||||
itemFg: windowBoldFg;
|
itemFg: windowBoldFg;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "window/window_main_menu.h"
|
#include "window/window_main_menu.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
|
|
@ -1184,15 +1185,29 @@ void MainMenu::paintEvent(QPaintEvent *e) {
|
||||||
p.fillRect(cover, st::mainMenuCoverBg);
|
p.fillRect(cover, st::mainMenuCoverBg);
|
||||||
}
|
}
|
||||||
p.setPen(st::mainMenuCoverFg);
|
p.setPen(st::mainMenuCoverFg);
|
||||||
p.setFont(st::semiboldFont);
|
if (::Kotato::JsonSettings::GetBool("show_phone_in_drawer")) {
|
||||||
_controller->session().user()->nameText().drawLeftElided(
|
p.setFont(st::semiboldFont);
|
||||||
p,
|
_controller->session().user()->nameText().drawLeftElided(
|
||||||
st::mainMenuCoverTextLeft,
|
p,
|
||||||
st::mainMenuCoverNameTop,
|
st::mainMenuCoverTextLeft,
|
||||||
widthText,
|
st::mainMenuCoverNameTop,
|
||||||
width());
|
widthText,
|
||||||
p.setFont(st::normalFont);
|
width());
|
||||||
p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), _phoneText);
|
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.
|
// Draw Saved Messages button.
|
||||||
if (!_cloudButton->isHidden()) {
|
if (!_cloudButton->isHidden()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue