mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
Reorder chat settings sections.
This commit is contained in:
parent
7ee1af5348
commit
d485a05935
11 changed files with 52 additions and 34 deletions
BIN
Telegram/Resources/icons/settings_stickers.png
Normal file
BIN
Telegram/Resources/icons/settings_stickers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/settings_stickers@2x.png
Normal file
BIN
Telegram/Resources/icons/settings_stickers@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
Telegram/Resources/icons/settings_themes.png
Normal file
BIN
Telegram/Resources/icons/settings_themes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
Telegram/Resources/icons/settings_themes@2x.png
Normal file
BIN
Telegram/Resources/icons/settings_themes@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -20,9 +20,15 @@ using vector = std::vector<type>;
|
|||
template <gsl::index Size>
|
||||
using array = std::array<type, Size>;
|
||||
|
||||
inline span make_detached_span(QByteArray &container) {
|
||||
return gsl::as_writeable_bytes(gsl::make_span(container));
|
||||
}
|
||||
|
||||
template <
|
||||
typename Container,
|
||||
typename = std::enable_if_t<!std::is_const_v<Container>>>
|
||||
typename = std::enable_if_t<
|
||||
!std::is_const_v<Container>
|
||||
&& !std::is_same_v<Container, QByteArray>>>
|
||||
inline span make_span(Container &container) {
|
||||
return gsl::as_writeable_bytes(gsl::make_span(container));
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ settingsIconPrivacySecurity: icon {{ "settings_privacy_security", menuIconFg }};
|
|||
settingsIconLanguage: icon {{ "settings_language", menuIconFg }};
|
||||
settingsIconInterfaceScale: icon {{ "settings_interface_scale", menuIconFg }};
|
||||
settingsIconFaq: icon {{ "settings_faq", menuIconFg }};
|
||||
settingsIconStickers: icon {{ "settings_stickers", menuIconFg }};
|
||||
settingsIconThemes: icon {{ "settings_themes", menuIconFg }};
|
||||
|
||||
settingsSetPhotoSkip: 7px;
|
||||
|
||||
|
@ -64,7 +66,6 @@ settingsLink: boxLinkButton;
|
|||
settingsAdvancedNotificationsPadding: margins(22px, 20px, 10px, 10px);
|
||||
settingsLinkLabel: defaultFlatLabel;
|
||||
settingsCheckboxesSkip: 12px;
|
||||
settingsStickersEmojiPadding: 17px;
|
||||
|
||||
settingsSendType: settingsCheckbox;
|
||||
settingsSendTypePadding: margins(22px, 5px, 10px, 5px);
|
||||
|
@ -153,6 +154,13 @@ settingsBioLabelPadding: margins(22px, 11px, 22px, 0px);
|
|||
|
||||
settingsPrivacyEditLabelPadding: margins(22px, 11px, 22px, 11px);
|
||||
|
||||
settingsChatButton: InfoProfileButton(settingsSectionButton) {
|
||||
padding: margins(59px, 13px, 22px, 11px);
|
||||
}
|
||||
settingsChatIconLeft: 19px;
|
||||
|
||||
settingsThemesTopSkip: 10px;
|
||||
settingsThemesBottomSkip: 8px;
|
||||
settingsTheme: Checkbox(defaultCheckbox) {
|
||||
textFg: windowSubTextFg;
|
||||
textFgActive: windowActiveTextFg;
|
||||
|
@ -160,7 +168,7 @@ settingsTheme: Checkbox(defaultCheckbox) {
|
|||
width: 80px;
|
||||
margin: margins(0px, 0px, 0px, 0px);
|
||||
|
||||
textPosition: point(0px, 88px);
|
||||
textPosition: point(0px, 86px);
|
||||
checkPosition: point(0px, 0px);
|
||||
|
||||
style: defaultTextStyle;
|
||||
|
|
|
@ -416,7 +416,8 @@ QString DownloadPathText() {
|
|||
}
|
||||
|
||||
void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container, st::settingsStickersEmojiPadding);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_stickers_emoji);
|
||||
|
||||
|
@ -472,7 +473,9 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
|
|||
AddButton(
|
||||
container,
|
||||
lng_stickers_you_have,
|
||||
st::settingsButton
|
||||
st::settingsChatButton,
|
||||
&st::settingsIconStickers,
|
||||
st::settingsChatIconLeft
|
||||
)->addClickHandler([] {
|
||||
Ui::show(Box<StickersBox>(StickersBox::Section::Installed));
|
||||
});
|
||||
|
@ -910,19 +913,22 @@ void SetupDefaultThemes(not_null<Ui::VerticalLayout*> container) {
|
|||
}
|
||||
|
||||
void SetupThemeOptions(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSkip(container, st::settingsPrivacySkip);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_themes);
|
||||
|
||||
AddSkip(container, st::settingsThemesTopSkip);
|
||||
SetupDefaultThemes(container);
|
||||
AddSkip(container, st::settingsThemesBottomSkip);
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_bg_edit_theme,
|
||||
st::settingsButton
|
||||
st::settingsChatButton,
|
||||
&st::settingsIconThemes,
|
||||
st::settingsChatIconLeft
|
||||
)->addClickHandler(App::LambdaDelayed(
|
||||
st::settingsButton.ripple.hideDuration,
|
||||
st::settingsChatButton.ripple.hideDuration,
|
||||
container,
|
||||
[] { Window::Theme::Editor::Start(); }));
|
||||
|
||||
|
@ -940,10 +946,10 @@ Chat::Chat(QWidget *parent, not_null<UserData*> self)
|
|||
void Chat::setupContent() {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
|
||||
SetupThemeOptions(content);
|
||||
SetupChatBackground(content);
|
||||
SetupStickersEmoji(content);
|
||||
SetupMessages(content);
|
||||
SetupChatBackground(content);
|
||||
SetupThemeOptions(content);
|
||||
|
||||
Ui::ResizeFitChild(this, content);
|
||||
}
|
||||
|
|
|
@ -77,15 +77,17 @@ not_null<Button*> AddButton(
|
|||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon) {
|
||||
return AddButton(container, Lang::Viewer(text), st, leftIcon);
|
||||
const style::icon *leftIcon,
|
||||
int iconLeft) {
|
||||
return AddButton(container, Lang::Viewer(text), st, leftIcon, iconLeft);
|
||||
}
|
||||
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon) {
|
||||
const style::icon *leftIcon,
|
||||
int iconLeft) {
|
||||
const auto result = container->add(object_ptr<Button>(
|
||||
container,
|
||||
std::move(text),
|
||||
|
@ -97,7 +99,7 @@ not_null<Button*> AddButton(
|
|||
result->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
icon->moveToLeft(
|
||||
st::settingsSectionIconLeft,
|
||||
iconLeft ? iconLeft : st::settingsSectionIconLeft,
|
||||
(size.height() - icon->height()) / 2,
|
||||
size.width());
|
||||
}, icon->lifetime());
|
||||
|
@ -150,8 +152,9 @@ not_null<Button*> AddButtonWithLabel(
|
|||
LangKey text,
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon) {
|
||||
const auto button = AddButton(container, text, st, leftIcon);
|
||||
const style::icon *leftIcon,
|
||||
int iconLeft) {
|
||||
const auto button = AddButton(container, text, st, leftIcon, iconLeft);
|
||||
CreateRightLabel(button, std::move(label), st, text);
|
||||
return button;
|
||||
}
|
||||
|
|
|
@ -74,18 +74,21 @@ not_null<Button*> AddButton(
|
|||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon = nullptr);
|
||||
const style::icon *leftIcon = nullptr,
|
||||
int iconLeft = 0);
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon = nullptr);
|
||||
const style::icon *leftIcon = nullptr,
|
||||
int iconLeft = 0);
|
||||
not_null<Button*> AddButtonWithLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon = nullptr);
|
||||
const style::icon *leftIcon = nullptr,
|
||||
int iconLeft = 0);
|
||||
void CreateRightLabel(
|
||||
not_null<Button*> button,
|
||||
rpl::producer<QString> label,
|
||||
|
|
|
@ -797,7 +797,7 @@ void DatabaseObject::put(
|
|||
|
||||
case File::Result::Success: {
|
||||
const auto success = data.writeWithPadding(
|
||||
bytes::make_span(value.bytes));
|
||||
bytes::make_detached_span(value.bytes));
|
||||
if (!success) {
|
||||
data.close();
|
||||
remove(key, nullptr);
|
||||
|
@ -964,7 +964,7 @@ QByteArray DatabaseObject::readValueData(PlaceId place, size_type size) const {
|
|||
case File::Result::WrongKey: return QByteArray();
|
||||
case File::Result::Success: {
|
||||
auto result = QByteArray(size, Qt::Uninitialized);
|
||||
const auto bytes = bytes::make_span(result);
|
||||
const auto bytes = bytes::make_detached_span(result);
|
||||
const auto read = data.readWithPadding(bytes);
|
||||
if (read != size) {
|
||||
return QByteArray();
|
||||
|
|
|
@ -783,7 +783,7 @@ void mtpFileLoader::cdnPartLoaded(const MTPupload_CdnFile &result, mtpRequestId
|
|||
state.ivec[12] = static_cast<uchar>((counterOffset >> 24) & 0xFF);
|
||||
|
||||
auto decryptInPlace = result.c_upload_cdnFile().vbytes.v;
|
||||
auto buffer = bytes::make_span(decryptInPlace);
|
||||
auto buffer = bytes::make_detached_span(decryptInPlace);
|
||||
MTP::aesCtrEncrypt(buffer, key.data(), &state);
|
||||
|
||||
switch (checkCdnFileHash(offset, buffer)) {
|
||||
|
@ -910,17 +910,7 @@ bool mtpFileLoader::feedPart(int offset, bytes::const_span buffer) {
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
if (offset > 100 * 1024 * 1024) {
|
||||
// Debugging weird out of memory crashes.
|
||||
auto info = QString("offset: %1, size: %2, cancelled: %3, finished: %4, filename: '%5', tocache: %6, fromcloud: %7, data: %8, fullsize: %9").arg(offset).arg(buffer.size()).arg(Logs::b(_cancelled)).arg(Logs::b(_finished)).arg(_filename).arg(int(_toCache)).arg(int(_fromCloud)).arg(_data.size()).arg(_size);
|
||||
info += QString(", locationtype: %1, inqueue: %2, localstatus: %3").arg(int(_locationType)).arg(Logs::b(_inQueue)).arg(int(_localStatus));
|
||||
CrashReports::SetAnnotation("DebugInfo", info);
|
||||
}
|
||||
_data.reserve(offset + buffer.size());
|
||||
if (offset > 100 * 1024 * 1024) {
|
||||
CrashReports::ClearAnnotation("DebugInfo");
|
||||
}
|
||||
|
||||
if (offset > _data.size()) {
|
||||
_skippedBytes += offset - _data.size();
|
||||
_data.resize(offset);
|
||||
|
@ -932,7 +922,9 @@ bool mtpFileLoader::feedPart(int offset, bytes::const_span buffer) {
|
|||
if (int64(offset + buffer.size()) > _data.size()) {
|
||||
_data.resize(offset + buffer.size());
|
||||
}
|
||||
auto dst = bytes::make_span(_data).subspan(offset, buffer.size());
|
||||
const auto dst = bytes::make_detached_span(_data).subspan(
|
||||
offset,
|
||||
buffer.size());
|
||||
bytes::copy(dst, buffer);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue