mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
fix: make it build
This commit is contained in:
parent
0f8187fa36
commit
66b1fe7beb
6 changed files with 31 additions and 93 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
#include "ui/effects/scroll_content_shadow.h"
|
#include "ui/effects/scroll_content_shadow.h"
|
||||||
|
#include "ui/vertical_list.h"
|
||||||
|
|
||||||
using namespace Settings;
|
using namespace Settings;
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "styles/style_ayu_icons.h"
|
#include "styles/style_ayu_icons.h"
|
||||||
|
#include "ui/vertical_list.h"
|
||||||
|
|
||||||
|
|
||||||
class PainterHighQualityEnabler;
|
class PainterHighQualityEnabler;
|
||||||
|
@ -263,66 +264,6 @@ Ayu::Ayu(
|
||||||
setupContent(controller);
|
setupContent(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ayu::AddPlatformOption(
|
|
||||||
not_null<Window::SessionController *> window,
|
|
||||||
not_null<Ui::VerticalLayout *> container,
|
|
||||||
base::options::option<bool> &option,
|
|
||||||
rpl::producer<> resetClicks)
|
|
||||||
{
|
|
||||||
auto &lifetime = container->lifetime();
|
|
||||||
const auto name = option.name().isEmpty() ? option.id() : option.name();
|
|
||||||
const auto toggles = lifetime.make_state<rpl::event_stream<bool>>();
|
|
||||||
std::move(
|
|
||||||
resetClicks
|
|
||||||
) | rpl::map_to(
|
|
||||||
option.defaultValue()
|
|
||||||
) | start_to_stream(*toggles, lifetime);
|
|
||||||
|
|
||||||
const auto button = AddButton(
|
|
||||||
container,
|
|
||||||
rpl::single(name),
|
|
||||||
(option.relevant()
|
|
||||||
? st::settingsButtonNoIcon
|
|
||||||
: st::settingsOptionDisabled)
|
|
||||||
)->toggleOn(toggles->events_starting_with(option.value()));
|
|
||||||
|
|
||||||
const auto restarter = (option.relevant() && option.restartRequired())
|
|
||||||
? button->lifetime().make_state<base::Timer>()
|
|
||||||
: nullptr;
|
|
||||||
if (restarter) {
|
|
||||||
restarter->setCallback([=]
|
|
||||||
{
|
|
||||||
window->show(Ui::MakeConfirmBox({
|
|
||||||
.text = tr::lng_settings_need_restart(),
|
|
||||||
.confirmed = []
|
|
||||||
{ Core::Restart(); },
|
|
||||||
.confirmText = tr::lng_settings_restart_now(),
|
|
||||||
.cancelText = tr::lng_settings_restart_later(),
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
button->toggledChanges(
|
|
||||||
) | start_with_next([=, &option](bool toggled)
|
|
||||||
{
|
|
||||||
if (!option.relevant() && toggled != option.defaultValue()) {
|
|
||||||
toggles->fire_copy(option.defaultValue());
|
|
||||||
window->showToast(
|
|
||||||
tr::lng_settings_experimental_irrelevant(tr::now));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
option.set(toggled);
|
|
||||||
if (restarter) {
|
|
||||||
restarter->callOnce(st::settingsButtonNoIcon.toggle.duration);
|
|
||||||
}
|
|
||||||
}, container->lifetime());
|
|
||||||
|
|
||||||
const auto &description = option.description();
|
|
||||||
if (!description.isEmpty()) {
|
|
||||||
AddSkip(container);
|
|
||||||
AddDividerText(container, rpl::single(description));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
||||||
{
|
{
|
||||||
auto settings = &AyuSettings::getInstance();
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
@ -586,7 +527,7 @@ void Ayu::SetupGhostEssentials(not_null<Ui::VerticalLayout *> container)
|
||||||
SetupGhostModeToggle(container);
|
SetupGhostModeToggle(container);
|
||||||
SetupReadAfterActionToggle(container);
|
SetupReadAfterActionToggle(container);
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_UseScheduledMessages(),
|
tr::ayu_UseScheduledMessages(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -609,7 +550,7 @@ void Ayu::SetupSpyEssentials(not_null<Ui::VerticalLayout *> container)
|
||||||
|
|
||||||
AddSubsectionTitle(container, tr::ayu_SpyEssentialsHeader());
|
AddSubsectionTitle(container, tr::ayu_SpyEssentialsHeader());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_SaveDeletedMessages(),
|
tr::ayu_SaveDeletedMessages(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -625,7 +566,7 @@ void Ayu::SetupSpyEssentials(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_SaveMessagesHistory(),
|
tr::ayu_SaveMessagesHistory(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -648,7 +589,7 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||||
|
|
||||||
AddSubsectionTitle(container, tr::ayu_QoLTogglesHeader());
|
AddSubsectionTitle(container, tr::ayu_QoLTogglesHeader());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_DisableAds(),
|
tr::ayu_DisableAds(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -664,7 +605,7 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_DisableStories(),
|
tr::ayu_DisableStories(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -680,7 +621,7 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_DisableNotificationsDelay(),
|
tr::ayu_DisableNotificationsDelay(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -696,7 +637,7 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_LocalPremium(),
|
tr::ayu_LocalPremium(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -712,7 +653,7 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_CopyUsernameAsLink(),
|
tr::ayu_CopyUsernameAsLink(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -733,7 +674,7 @@ void Ayu::SetupAppIcon(not_null<Ui::VerticalLayout *> container)
|
||||||
{
|
{
|
||||||
container->add(
|
container->add(
|
||||||
object_ptr<IconPicker>(container),
|
object_ptr<IconPicker>(container),
|
||||||
st::settingsSubsectionTitlePadding);
|
st::settingsCheckboxPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||||
|
@ -773,7 +714,7 @@ void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||||
|
|
||||||
SetupShowPeerId(container, controller);
|
SetupShowPeerId(container, controller);
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_HideAllChats(),
|
tr::ayu_HideAllChats(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -789,7 +730,7 @@ void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_SimpleQuotesAndReplies(),
|
tr::ayu_SimpleQuotesAndReplies(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -805,7 +746,7 @@ void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_SettingsShowMessageSeconds(),
|
tr::ayu_SettingsShowMessageSeconds(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -840,7 +781,7 @@ void Ayu::SetupDrawerElements(not_null<Ui::VerticalLayout *> container)
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, tr::ayu_DrawerElementsHeader());
|
AddSubsectionTitle(container, tr::ayu_DrawerElementsHeader());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_LReadMessages(),
|
tr::ayu_LReadMessages(),
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
|
@ -857,7 +798,7 @@ void Ayu::SetupDrawerElements(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_SReadMessages(),
|
tr::ayu_SReadMessages(),
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
|
@ -874,7 +815,7 @@ void Ayu::SetupDrawerElements(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_GhostModeToggle(),
|
tr::ayu_GhostModeToggle(),
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
|
@ -891,7 +832,7 @@ void Ayu::SetupDrawerElements(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_StreamerModeToggle(),
|
tr::ayu_StreamerModeToggle(),
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
|
@ -916,7 +857,7 @@ void Ayu::SetupTrayElements(not_null<Ui::VerticalLayout *> container)
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, tr::ayu_TrayElementsHeader());
|
AddSubsectionTitle(container, tr::ayu_TrayElementsHeader());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_EnableGhostModeTray(),
|
tr::ayu_EnableGhostModeTray(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -932,7 +873,7 @@ void Ayu::SetupTrayElements(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_EnableStreamerModeTray(),
|
tr::ayu_EnableStreamerModeTray(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -994,10 +935,9 @@ void Ayu::SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> containe
|
||||||
auto settings = &AyuSettings::getInstance();
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
container->add(
|
container->add(
|
||||||
CreateButton(
|
object_ptr<Button>(container,
|
||||||
container,
|
tr::ayu_SettingsRecentStickersCount(),
|
||||||
tr::ayu_SettingsRecentStickersCount(),
|
st::settingsButtonNoIcon)
|
||||||
st::settingsButtonNoIcon)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
auto recentStickersLimitSlider = MakeSliderWithLabel(
|
auto recentStickersLimitSlider = MakeSliderWithLabel(
|
||||||
|
@ -1086,7 +1026,7 @@ void Ayu::SetupAyuSync(not_null<Ui::VerticalLayout *> container)
|
||||||
|
|
||||||
auto text = AyuSync::isAgentDownloaded() ? tr::ayu_AyuSyncOpenPreferences() : tr::ayu_AyuSyncDownloadAgent();
|
auto text = AyuSync::isAgentDownloaded() ? tr::ayu_AyuSyncOpenPreferences() : tr::ayu_AyuSyncDownloadAgent();
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
text,
|
text,
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -1103,7 +1043,7 @@ void Ayu::SetupSendConfirmations(not_null<Ui::VerticalLayout *> container)
|
||||||
|
|
||||||
AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle());
|
AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_StickerConfirmation(),
|
tr::ayu_StickerConfirmation(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -1119,7 +1059,7 @@ void Ayu::SetupSendConfirmations(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_GIFConfirmation(),
|
tr::ayu_GIFConfirmation(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
@ -1135,7 +1075,7 @@ void Ayu::SetupSendConfirmations(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_VoiceConfirmation(),
|
tr::ayu_VoiceConfirmation(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/options.h"
|
#include "base/options.h"
|
||||||
|
#include "settings/settings_common_session.h"
|
||||||
#include "settings/settings_common.h"
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
class BoxContent;
|
class BoxContent;
|
||||||
|
@ -28,12 +29,6 @@ public:
|
||||||
[[nodiscard]] rpl::producer<QString> title() override;
|
[[nodiscard]] rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddPlatformOption(
|
|
||||||
not_null<Window::SessionController *> window,
|
|
||||||
not_null<Ui::VerticalLayout *> container,
|
|
||||||
base::options::option<bool> &option,
|
|
||||||
rpl::producer<> resetClicks);
|
|
||||||
|
|
||||||
void SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container);
|
void SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container);
|
||||||
|
|
||||||
void SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container);
|
void SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container);
|
||||||
|
|
|
@ -47,6 +47,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
|
|
|
@ -57,6 +57,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
|
|
|
@ -81,8 +81,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
#include "ayu/utils/telegram_helpers.h"
|
#include "ayu/utils/telegram_helpers.h"
|
||||||
#include "ayu/ui/settings/settings_ayu.h"
|
|
||||||
#include "ayu/ui/boxes/confirmation_box.h"
|
#include "ayu/ui/boxes/confirmation_box.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
#include "ayu/features/streamer_mode/streamer_mode.h"
|
#include "ayu/features/streamer_mode/streamer_mode.h"
|
||||||
#include "styles/style_ayu_icons.h"
|
#include "styles/style_ayu_icons.h"
|
||||||
#include "tray.h"
|
#include "tray.h"
|
||||||
|
|
Loading…
Add table
Reference in a new issue