mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 23:25:15 +00:00
Updated repo to latest patches-track-wip (TD 5.0.6)
This commit is contained in:
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "kotato/kotato_settings_menu.h"
|
||||
#include "core/application.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "settings/settings_business.h"
|
||||
#include "settings/settings_codes.h"
|
||||
#include "settings/settings_chat.h"
|
||||
@@ -29,13 +30,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/basic_click_handlers.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/controls/userpic_button.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/widgets/menu/menu_add_action_callback.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/new_badges.h"
|
||||
@@ -46,9 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_cloud_themes.h"
|
||||
#include "data/data_chat_filters.h"
|
||||
#include "data/data_peer_values.h" // Data::AmPremiumValue
|
||||
#include "lang/lang_cloud_manager.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "lang/lang_instance.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "main/main_session.h"
|
||||
@@ -65,13 +60,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "core/application.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
|
||||
@@ -177,16 +168,7 @@ Cover::Cover(
|
||||
}, _name->lifetime());
|
||||
}
|
||||
|
||||
Cover::~Cover() {
|
||||
if (_emojiStatusPanel.hasFocus()) {
|
||||
// Panel will try to return focus to the layer widget, the problem is
|
||||
// we are destroying the layer widget probably right now and focusing
|
||||
// it will lead to a crash, because it destroys its children (how we
|
||||
// got here) after it clears focus out of itself. So if you return
|
||||
// the focus inside a child destructor, it won't be cleared at all.
|
||||
window()->setFocus();
|
||||
}
|
||||
}
|
||||
Cover::~Cover() = default;
|
||||
|
||||
void Cover::setupChildGeometry() {
|
||||
using namespace rpl::mappers;
|
||||
@@ -227,7 +209,7 @@ void Cover::initViewers() {
|
||||
}, lifetime());
|
||||
|
||||
_username->overrideLinkClickHandler([=] {
|
||||
const auto username = _user->userName();
|
||||
const auto username = _user->username();
|
||||
if (username.isEmpty()) {
|
||||
_controller->show(Box(UsernamesBox, _user));
|
||||
} else {
|
||||
@@ -381,7 +363,7 @@ void SetupSections(
|
||||
} else {
|
||||
const auto enabled = [=] {
|
||||
const auto result = account->appConfig().get<bool>(
|
||||
"dialog_filters_enabled",
|
||||
u"dialog_filters_enabled"_q,
|
||||
false);
|
||||
if (result) {
|
||||
preload();
|
||||
@@ -453,10 +435,7 @@ void SetupPremium(
|
||||
button->addClickHandler([=] {
|
||||
showOther(BusinessId());
|
||||
});
|
||||
constexpr auto kNewExpiresAt = int(1711958400);
|
||||
if (base::unixtime::now() < kNewExpiresAt) {
|
||||
Ui::NewBadge::AddToRight(button);
|
||||
}
|
||||
Ui::NewBadge::AddToRight(button);
|
||||
|
||||
if (controller->session().premiumCanBuy()) {
|
||||
const auto button = AddButtonWithIcon(
|
||||
@@ -627,26 +606,20 @@ void SetupInterfaceScale(
|
||||
}
|
||||
}
|
||||
|
||||
void OpenFaq() {
|
||||
File::OpenUrl(telegramFaqLink());
|
||||
}
|
||||
|
||||
void SetupFaq(not_null<Ui::VerticalLayout*> container, bool icon) {
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_faq(),
|
||||
icon ? st::settingsButton : st::settingsButtonNoIcon,
|
||||
{ icon ? &st::menuIconFaq : nullptr }
|
||||
)->addClickHandler(OpenFaq);
|
||||
}
|
||||
|
||||
void SetupHelp(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
Ui::AddDivider(container);
|
||||
Ui::AddSkip(container);
|
||||
|
||||
SetupFaq(container);
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_faq(),
|
||||
st::settingsButton,
|
||||
{ &st::menuIconFaq }
|
||||
)->addClickHandler([=] {
|
||||
OpenFaq(controller);
|
||||
});
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
@@ -690,7 +663,10 @@ void SetupHelp(
|
||||
auto box = Ui::MakeConfirmBox({
|
||||
.text = tr::lng_settings_ask_sure(),
|
||||
.confirmed = sure,
|
||||
.cancelled = OpenFaq,
|
||||
.cancelled = [=](Fn<void()> close) {
|
||||
OpenFaq(controller);
|
||||
close();
|
||||
},
|
||||
.confirmText = tr::lng_settings_ask_ok(),
|
||||
.cancelText = tr::lng_settings_faq_button(),
|
||||
.strictCancel = true,
|
||||
@@ -782,4 +758,12 @@ void Main::setupContent(not_null<Window::SessionController*> controller) {
|
||||
controller->session().data().cloudThemes().refresh();
|
||||
}
|
||||
|
||||
void OpenFaq(base::weak_ptr<Window::SessionController> weak) {
|
||||
UrlClickHandler::Open(
|
||||
tr::lng_settings_faq_link(tr::now),
|
||||
QVariant::fromValue(ClickHandlerContext{
|
||||
.sessionWindow = weak,
|
||||
}));
|
||||
}
|
||||
|
||||
} // namespace Settings
|
||||
|
Reference in New Issue
Block a user