[Option][GUI] Show phone in drawer
This commit is contained in:
parent
61efca5f91
commit
81d8f889e9
5 changed files with 39 additions and 14 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>(
|
||||
|
|
|
|||
|
|
@ -116,6 +116,11 @@ mainMenuCoverNameTop: 84px;
|
|||
mainMenuCoverStatusLeft: 24px;
|
||||
mainMenuCoverStatusTop: 103px;
|
||||
mainMenuPhoneFont: font(12px);
|
||||
mainMenuCoverNameOnlyTop: 94px;
|
||||
mainMenuCoverNameOnlyFont: font(14px semibold);
|
||||
mainMenuCoverNameOnlyStyle: TextStyle(semiboldTextStyle) {
|
||||
font: mainMenuCoverNameOnlyFont;
|
||||
}
|
||||
mainMenuSkip: 6px;
|
||||
mainMenuFooterHeightMin: 80px;
|
||||
mainMenu: Menu(defaultMenu) {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -21,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/vertical_layout_reorder.h"
|
||||
#include "ui/text/format_values.h" // Ui::FormatPhone
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/special_buttons.h"
|
||||
|
|
@ -749,7 +751,6 @@ void MainMenu::paintEvent(QPaintEvent *e) {
|
|||
- st::mainMenuCoverNameLeft
|
||||
- _toggleAccounts->rightSkip();
|
||||
|
||||
p.setFont(st::semiboldFont);
|
||||
p.setPen(st::windowBoldFg);
|
||||
const auto user = _controller->session().user();
|
||||
if (_nameVersion < user->nameVersion()) {
|
||||
|
|
@ -759,19 +760,33 @@ void MainMenu::paintEvent(QPaintEvent *e) {
|
|||
user->name(),
|
||||
Ui::NameTextOptions());
|
||||
}
|
||||
_name.drawLeftElided(
|
||||
p,
|
||||
st::mainMenuCoverNameLeft,
|
||||
st::mainMenuCoverNameTop,
|
||||
widthText,
|
||||
width());
|
||||
p.setFont(st::mainMenuPhoneFont);
|
||||
p.setPen(st::windowSubTextFg);
|
||||
p.drawTextLeft(
|
||||
st::mainMenuCoverStatusLeft,
|
||||
st::mainMenuCoverStatusTop,
|
||||
width(),
|
||||
_phoneText);
|
||||
if (::Kotato::JsonSettings::GetBool("show_phone_in_drawer")) {
|
||||
p.setFont(st::semiboldFont);
|
||||
_name.drawLeftElided(
|
||||
p,
|
||||
st::mainMenuCoverNameLeft,
|
||||
st::mainMenuCoverNameTop,
|
||||
widthText,
|
||||
width());
|
||||
p.setFont(st::mainMenuPhoneFont);
|
||||
p.setPen(st::windowSubTextFg);
|
||||
p.drawTextLeft(
|
||||
st::mainMenuCoverStatusLeft,
|
||||
st::mainMenuCoverStatusTop,
|
||||
width(),
|
||||
_phoneText);
|
||||
} else {
|
||||
p.setFont(st::mainMenuCoverNameOnlyFont);
|
||||
auto name = _name.toString();
|
||||
auto nameStr = Ui::Text::String();
|
||||
nameStr.setText(st::mainMenuCoverNameOnlyStyle, name, Ui::NameTextOptions());
|
||||
nameStr.drawLeftElided(
|
||||
p,
|
||||
st::mainMenuCoverNameLeft,
|
||||
st::mainMenuCoverNameOnlyTop,
|
||||
widthText,
|
||||
width());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue