mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Move Settings::Advanced class to anonymous namespace
- Move Advanced class definition into .cpp file anonymous namespace - Export only Type AdvancedId() in header - Keep exported helper functions (SetupConnectionType, HasUpdate, etc.) - Remove unused SetupWindowCloseBehaviorContent declaration - Update callers to use AdvancedId() instead of Advanced::Id() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1658,7 +1658,7 @@ void UpdateApplication() {
|
||||
controller->showSection(
|
||||
std::make_shared<Info::Memento>(
|
||||
Info::Settings::Tag{ controller->session().user() },
|
||||
::Settings::Advanced::Id()),
|
||||
::Settings::AdvancedId()),
|
||||
Window::SectionShow());
|
||||
} else {
|
||||
window->widget()->showSpecialLayer(
|
||||
|
||||
@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "settings/sections/settings_advanced.h"
|
||||
|
||||
#include "settings/settings_common_session.h"
|
||||
|
||||
#include "api/api_global_privacy.h"
|
||||
#include "apiwrap.h"
|
||||
#include "base/call_delayed.h"
|
||||
@@ -1112,6 +1114,19 @@ void BuildExportSection(SectionBuilder &builder) {
|
||||
});
|
||||
}
|
||||
|
||||
class Advanced : public Section<Advanced> {
|
||||
public:
|
||||
Advanced(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller);
|
||||
|
||||
[[nodiscard]] rpl::producer<QString> title() override;
|
||||
|
||||
private:
|
||||
void setupContent();
|
||||
|
||||
};
|
||||
|
||||
const auto kMeta = BuildHelper({
|
||||
.id = Advanced::Id(),
|
||||
.parentId = MainId(),
|
||||
@@ -1135,6 +1150,27 @@ const auto kMeta = BuildHelper({
|
||||
BuildExportSection(builder);
|
||||
});
|
||||
|
||||
const SectionBuildMethod kAdvancedSection = kMeta.build;
|
||||
|
||||
Advanced::Advanced(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller)
|
||||
: Section(parent, controller) {
|
||||
setupContent();
|
||||
}
|
||||
|
||||
rpl::producer<QString> Advanced::title() {
|
||||
return tr::lng_settings_advanced();
|
||||
}
|
||||
|
||||
void Advanced::setupContent() {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
|
||||
build(content, kAdvancedSection);
|
||||
|
||||
Ui::ResizeFitChild(this, content);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void SetupConnectionType(
|
||||
@@ -1771,28 +1807,8 @@ void PreloadArchiveSettings(not_null<::Main::Session*> session) {
|
||||
session->api().globalPrivacy().reload();
|
||||
}
|
||||
|
||||
Advanced::Advanced(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller)
|
||||
: Section(parent, controller) {
|
||||
setupContent();
|
||||
Type AdvancedId() {
|
||||
return Advanced::Id();
|
||||
}
|
||||
|
||||
rpl::producer<QString> Advanced::title() {
|
||||
return tr::lng_settings_advanced();
|
||||
}
|
||||
|
||||
void Advanced::setupContent() {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
|
||||
build(content, Builder::AdvancedSection);
|
||||
|
||||
Ui::ResizeFitChild(this, content);
|
||||
}
|
||||
|
||||
namespace Builder {
|
||||
|
||||
SectionBuildMethod AdvancedSection = kMeta.build;
|
||||
|
||||
} // namespace Builder
|
||||
} // namespace Settings
|
||||
|
||||
@@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "settings/settings_common_session.h"
|
||||
#include "settings/settings_type.h"
|
||||
|
||||
namespace Main {
|
||||
@@ -27,6 +26,8 @@ class SessionController;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
[[nodiscard]] Type AdvancedId();
|
||||
|
||||
void SetupConnectionType(
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<::Main::Account*> account,
|
||||
@@ -36,9 +37,6 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupWindowTitleContent(
|
||||
Window::SessionController *controller,
|
||||
not_null<Ui::VerticalLayout*> container);
|
||||
void SetupWindowCloseBehaviorContent(
|
||||
Window::SessionController *controller,
|
||||
not_null<Ui::VerticalLayout*> container);
|
||||
void SetupSystemIntegrationContent(
|
||||
Window::SessionController *controller,
|
||||
not_null<Ui::VerticalLayout*> container);
|
||||
@@ -51,22 +49,4 @@ void ArchiveSettingsBox(
|
||||
not_null<Window::SessionController*> controller);
|
||||
void PreloadArchiveSettings(not_null<::Main::Session*> session);
|
||||
|
||||
class Advanced : public Section<Advanced> {
|
||||
public:
|
||||
Advanced(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller);
|
||||
|
||||
[[nodiscard]] rpl::producer<QString> title() override;
|
||||
|
||||
private:
|
||||
void setupContent();
|
||||
|
||||
};
|
||||
|
||||
namespace Builder {
|
||||
|
||||
extern SectionBuildMethod AdvancedSection;
|
||||
|
||||
} // namespace Builder
|
||||
} // namespace Settings
|
||||
|
||||
@@ -400,7 +400,7 @@ void BuildSectionButtons(SectionBuilder &builder) {
|
||||
builder.addSectionButton({
|
||||
.id = u"main/advanced"_q,
|
||||
.title = tr::lng_settings_advanced(),
|
||||
.targetSection = Advanced::Id(),
|
||||
.targetSection = AdvancedId(),
|
||||
.icon = { &st::menuIconManage },
|
||||
.keywords = { u"performance"_q, u"proxy"_q, u"experimental"_q },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user