2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00
Files
kotatogram-desktop/Telegram/SourceFiles/kotato/settings_menu.cpp

710 lines
20 KiB
C++
Raw Normal View History

2019-10-10 19:57:03 +03:00
/*
This file is part of Kotatogram Desktop,
the unofficial app based on Telegram Desktop.
For license and copyright information please follow this link:
https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
*/
2020-04-21 06:26:36 +03:00
#include "kotato/settings_menu.h"
2019-10-10 19:57:03 +03:00
#include "base/platform/base_platform_info.h"
2019-10-10 19:57:03 +03:00
#include "settings/settings_common.h"
#include "settings/settings_chat.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/wrap/slide_wrap.h"
2019-11-06 16:22:25 +03:00
#include "ui/widgets/buttons.h"
2019-10-10 19:57:03 +03:00
#include "ui/widgets/labels.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/continuous_sliders.h"
#include "ui/text/text_utilities.h" // Ui::Text::ToUpper
#include "boxes/connection_box.h"
#include "kotato/customboxes/fonts_box.h"
#include "kotato/customboxes/radio_box.h"
2019-10-10 19:57:03 +03:00
#include "boxes/about_box.h"
#include "boxes/confirm_box.h"
#include "platform/platform_specific.h"
2021-05-30 01:25:29 +00:00
#include "platform/platform_file_utilities.h"
2019-10-10 19:57:03 +03:00
#include "window/window_session_controller.h"
#include "lang/lang_keys.h"
#include "core/update_checker.h"
2020-04-21 06:20:14 +03:00
#include "kotato/json_settings.h"
2019-10-10 19:57:03 +03:00
#include "core/application.h"
#include "storage/localstorage.h"
#include "data/data_session.h"
#include "main/main_session.h"
#include "layout.h"
2020-03-30 19:36:59 +03:00
#include "mainwindow.h"
2019-10-10 19:57:03 +03:00
#include "facades.h"
#include "app.h"
#include "styles/style_settings.h"
namespace Settings {
2020-04-23 17:38:15 +03:00
namespace {
2021-03-31 12:34:17 +04:00
QString FileDialogTypeLabel(int value) {
const auto typedValue = Platform::FileDialog::ImplementationType(value);
switch (typedValue) {
case Platform::FileDialog::ImplementationType::Default:
return tr::ktg_file_dialog_type_default(tr::now);
}
return Platform::FileDialog::ImplementationTypeLabel(typedValue);
}
QString FileDialogTypeDescription(int value) {
const auto typedValue = Platform::FileDialog::ImplementationType(value);
return Platform::FileDialog::ImplementationTypeDescription(typedValue);
}
2020-04-23 17:38:15 +03:00
QString NetBoostLabel(int boost) {
switch (boost) {
case 0:
return tr::ktg_net_speed_boost_default(tr::now);
case 1:
return tr::ktg_net_speed_boost_slight(tr::now);
case 2:
return tr::ktg_net_speed_boost_medium(tr::now);
case 3:
return tr::ktg_net_speed_boost_big(tr::now);
default:
Unexpected("Boost in Settings::NetBoostLabel.");
}
return QString();
}
2020-04-23 19:56:49 +03:00
QString UserpicRoundingLabel(int rounding) {
switch (rounding) {
case 0:
return tr::ktg_settings_userpic_rounding_none(tr::now);
case 1:
return tr::ktg_settings_userpic_rounding_small(tr::now);
case 2:
return tr::ktg_settings_userpic_rounding_big(tr::now);
case 3:
return tr::ktg_settings_userpic_rounding_full(tr::now);
default:
Unexpected("Rounding in Settings::UserpicRoundingLabel.");
}
return QString();
}
QString TrayIconLabel(int icon) {
switch (icon) {
case 0:
return tr::ktg_settings_tray_icon_default(tr::now);
case 1:
return tr::ktg_settings_tray_icon_blue(tr::now);
case 2:
return tr::ktg_settings_tray_icon_green(tr::now);
case 3:
return tr::ktg_settings_tray_icon_orange(tr::now);
case 4:
return tr::ktg_settings_tray_icon_red(tr::now);
case 5:
return tr::ktg_settings_tray_icon_legacy(tr::now);
default:
Unexpected("Icon in Settings::TrayIconLabel.");
}
return QString();
}
2020-05-05 06:46:11 +03:00
QString ChatIdLabel(int option) {
switch (option) {
case 0:
return tr::ktg_settings_chat_id_disable(tr::now);
case 1:
return tr::ktg_settings_chat_id_telegram(tr::now);
case 2:
return tr::ktg_settings_chat_id_bot(tr::now);
default:
Unexpected("Option in Settings::ChatIdLabel.");
}
return QString();
}
2020-04-23 17:38:15 +03:00
} // namespace
2020-04-24 20:38:11 +03:00
#define SettingsMenuCSwitch(LangKey, Option) AddButton( \
2020-04-23 13:00:53 +03:00
container, \
tr::LangKey(), \
st::settingsButton \
)->toggleOn( \
rpl::single(c##Option()) \
)->toggledValue( \
) | rpl::filter([](bool enabled) { \
return (enabled != c##Option()); \
}) | rpl::start_with_next([](bool enabled) { \
cSet##Option(enabled); \
::Kotato::JsonSettings::Write(); \
}, container->lifetime());
2020-04-24 20:38:11 +03:00
#define SettingsMenuCFilterSwitch(LangKey, Option) AddButton( \
2020-04-23 13:00:53 +03:00
container, \
tr::LangKey(), \
st::settingsButton \
)->toggleOn( \
rpl::single(c##Option()) \
)->toggledValue( \
) | rpl::filter([](bool enabled) { \
return (enabled != c##Option()); \
}) | rpl::start_with_next([controller](bool enabled) { \
cSet##Option(enabled); \
::Kotato::JsonSettings::Write(); \
controller->reloadFiltersMenu(); \
App::wnd()->fixOrder(); \
}, container->lifetime());
#define SettingsMenuSwitch(LangKey, Option) AddButton( \
container, \
tr::LangKey(), \
st::settingsButton \
)->toggleOn( \
rpl::single(Option()) \
)->toggledValue( \
) | rpl::filter([](bool enabled) { \
return (enabled != Option()); \
}) | rpl::start_with_next([](bool enabled) { \
Set##Option(enabled); \
::Kotato::JsonSettings::Write(); \
}, container->lifetime());
void SetupKotatoChats(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container) {
2019-10-10 19:57:03 +03:00
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_chats());
2020-02-23 04:53:24 +03:00
const auto recentStickersLimitLabel = container->add(
object_ptr<Ui::LabelSimple>(
container,
st::settingsAudioVolumeLabel),
st::settingsAudioVolumeLabelPadding);
const auto recentStickersLimitSlider = container->add(
object_ptr<Ui::MediaSlider>(
container,
st::settingsAudioVolumeSlider),
st::settingsAudioVolumeSliderPadding);
const auto updateRecentStickersLimitLabel = [=](int value) {
if (value == 0) {
recentStickersLimitLabel->setText(
tr::ktg_settings_recent_stickers_limit_none(tr::now));
} else {
recentStickersLimitLabel->setText(
tr::ktg_settings_recent_stickers_limit(tr::now, lt_count_decimal, value));
}
};
const auto updateRecentStickersLimitHeight = [=](int value) {
updateRecentStickersLimitLabel(value);
SetRecentStickersLimit(value);
2020-04-21 06:26:36 +03:00
::Kotato::JsonSettings::Write();
2020-02-23 04:53:24 +03:00
};
recentStickersLimitSlider->resize(st::settingsAudioVolumeSlider.seekSize);
recentStickersLimitSlider->setPseudoDiscrete(
201,
[](int val) { return val; },
RecentStickersLimit(),
updateRecentStickersLimitHeight);
updateRecentStickersLimitLabel(RecentStickersLimit());
2020-04-24 20:38:11 +03:00
SettingsMenuCSwitch(ktg_settings_top_bar_mute, ProfileTopBarNotifications);
SettingsMenuCSwitch(ktg_settings_disable_up_edit, DisableUpEdit);
SettingsMenuCSwitch(ktg_settings_auto_scroll_unfocused, AutoScrollUnfocused);
2019-10-10 19:57:03 +03:00
AddButton(
container,
tr::ktg_settings_chat_list_compact(),
st::settingsButton
)->toggleOn(
rpl::single(DialogListLines() == 1)
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != (DialogListLines() == 1));
}) | rpl::start_with_next([](bool enabled) {
SetDialogListLines(enabled ? 1 : 2);
2020-04-21 06:26:36 +03:00
::Kotato::JsonSettings::Write();
}, container->lifetime());
AddButton(
container,
tr::ktg_settings_always_show_scheduled(),
st::settingsButton
)->toggleOn(
rpl::single(cAlwaysShowScheduled())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cAlwaysShowScheduled());
}) | rpl::start_with_next([controller](bool enabled) {
cSetAlwaysShowScheduled(enabled);
Notify::showScheduledButtonChanged(&controller->session());
::Kotato::JsonSettings::Write();
}, container->lifetime());
2020-05-15 20:20:12 +03:00
SettingsMenuSwitch(ktg_emoji_panel_hover, HoverEmojiPanel);
2019-10-14 02:17:53 +03:00
AddButton(
container,
tr::ktg_settings_fonts(),
st::settingsButton
)->addClickHandler([=] {
Ui::show(Box<FontsBox>());
});
2020-04-23 19:56:49 +03:00
AddButtonWithLabel(
container,
tr::ktg_settings_userpic_rounding(),
rpl::single(UserpicRoundingLabel(cUserpicCornersType())),
st::settingsButton
)->addClickHandler([=] {
Ui::show(Box<::Kotato::RadioBox>(
tr::ktg_settings_userpic_rounding(tr::now),
tr::ktg_settings_userpic_rounding_desc(tr::now),
cUserpicCornersType(),
2021-03-31 12:33:13 +04:00
4,
UserpicRoundingLabel,
2020-04-23 19:56:49 +03:00
[=] (int value) {
cSetUserpicCornersType(value);
::Kotato::JsonSettings::Write();
}, true));
});
AddSkip(container);
}
void SetupKotatoMessages(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_messages());
const auto stickerHeightLabel = container->add(
object_ptr<Ui::LabelSimple>(
container,
st::settingsAudioVolumeLabel),
st::settingsAudioVolumeLabelPadding);
const auto stickerHeightSlider = container->add(
object_ptr<Ui::MediaSlider>(
container,
st::settingsAudioVolumeSlider),
st::settingsAudioVolumeSliderPadding);
const auto updateStickerHeightLabel = [=](int value) {
const auto pixels = QString::number(value);
stickerHeightLabel->setText(
tr::ktg_settings_sticker_height(tr::now, lt_pixels, pixels));
};
const auto updateStickerHeight = [=](int value) {
updateStickerHeightLabel(value);
SetStickerHeight(value);
2020-04-21 06:26:36 +03:00
::Kotato::JsonSettings::Write();
};
stickerHeightSlider->resize(st::settingsAudioVolumeSlider.seekSize);
stickerHeightSlider->setPseudoDiscrete(
193,
[](int val) { return val + 64; },
StickerHeight(),
updateStickerHeight);
updateStickerHeightLabel(StickerHeight());
2020-05-06 02:27:04 +03:00
container->add(
object_ptr<Ui::Checkbox>(
container,
tr::ktg_settings_sticker_scale_both(tr::now),
StickerScaleBoth(),
st::settingsCheckbox),
st::settingsCheckboxPadding
)->checkedChanges(
) | rpl::filter([](bool checked) {
return (checked != StickerScaleBoth());
}) | rpl::start_with_next([](bool checked) {
SetStickerScaleBoth(checked);
::Kotato::JsonSettings::Write();
}, container->lifetime());
AddSkip(container);
AddDividerText(container, tr::ktg_settings_sticker_scale_both_about());
AddSkip(container);
auto adaptiveBubblesButton = AddButton(
container,
tr::ktg_settings_adaptive_bubbles(),
st::settingsButton
);
auto monospaceLargeBubblesButton = container->add(
object_ptr<Ui::SlideWrap<Button>>(
container,
CreateButton(
container,
tr::ktg_settings_monospace_large_bubbles(),
st::settingsButton)));
adaptiveBubblesButton->toggleOn(
rpl::single(AdaptiveBubbles())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != AdaptiveBubbles());
}) | rpl::start_with_next([monospaceLargeBubblesButton](bool enabled) {
monospaceLargeBubblesButton->toggle(!enabled, anim::type::normal);
SetAdaptiveBubbles(enabled);
::Kotato::JsonSettings::Write();
}, container->lifetime());
monospaceLargeBubblesButton->entity()->toggleOn(
rpl::single(MonospaceLargeBubbles())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != MonospaceLargeBubbles());
}) | rpl::start_with_next([](bool enabled) {
SetMonospaceLargeBubbles(enabled);
::Kotato::JsonSettings::Write();
}, container->lifetime());
if (adaptiveBubblesButton->toggled()) {
monospaceLargeBubblesButton->hide(anim::type::instant);
}
2020-04-23 13:00:53 +03:00
SettingsMenuSwitch(ktg_settings_emoji_outline, BigEmojiOutline);
2020-03-30 19:56:08 +03:00
2019-10-18 20:32:18 +03:00
AddSkip(container);
}
void SetupKotatoForward(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_forward());
SettingsMenuCSwitch(ktg_settings_forward_retain_selection, ForwardRetainSelection);
2020-07-09 11:42:10 +03:00
SettingsMenuCSwitch(ktg_settings_forward_chat_on_click, ForwardChatOnClick);
AddSkip(container);
2020-07-09 11:42:10 +03:00
AddDividerText(container, tr::ktg_settings_forward_chat_on_click_description());
}
2019-10-18 20:32:18 +03:00
void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container) {
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_network());
AddButtonWithLabel(
container,
tr::ktg_settings_net_speed_boost(),
2020-04-23 17:38:15 +03:00
rpl::single(NetBoostLabel(cNetSpeedBoost())),
2019-10-18 20:32:18 +03:00
st::settingsButton
)->addClickHandler([=] {
2020-04-23 17:38:15 +03:00
Ui::show(Box<::Kotato::RadioBox>(
tr::ktg_net_speed_boost_title(tr::now),
tr::ktg_net_speed_boost_desc(tr::now),
cNetSpeedBoost(),
2021-03-31 12:33:13 +04:00
4,
NetBoostLabel,
2020-04-23 17:38:15 +03:00
[=] (int value) {
SetNetworkBoost(value);
::Kotato::JsonSettings::Write();
}, true));
});
2019-10-10 19:57:03 +03:00
SettingsMenuCSwitch(ktg_settings_telegram_sites_autologin, TelegramSitesAutologin);
2019-10-10 19:57:03 +03:00
AddSkip(container);
}
2020-03-30 19:36:59 +03:00
void SetupKotatoFolders(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_filters());
2020-04-24 20:38:11 +03:00
SettingsMenuCFilterSwitch(ktg_settings_filters_only_unmuted_counter, UnmutedFilterCounterOnly);
SettingsMenuCFilterSwitch(ktg_settings_filters_hide_all, HideFilterAllChats);
SettingsMenuCFilterSwitch(ktg_settings_filters_hide_edit, HideFilterEditButton);
SettingsMenuCFilterSwitch(ktg_settings_filters_hide_folder_names, HideFilterNames);
2020-03-30 19:36:59 +03:00
AddSkip(container);
}
void SetupKotatoSystem(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container) {
2020-02-23 05:30:39 +03:00
AddDivider(container);
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_system());
const auto qtScaleToggled = Ui::CreateChild<rpl::event_stream<bool>>(
container.get());
AddButton(
container,
tr::ktg_settings_qt_scale(),
st::settingsButton
)->toggleOn(
qtScaleToggled->events_starting_with_copy(cQtScale())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cQtScale());
}) | rpl::start_with_next([=](bool enabled) {
const auto confirmed = [=] {
cSetQtScale(enabled);
::Kotato::JsonSettings::Write();
App::restart();
};
const auto cancelled = [=] {
qtScaleToggled->fire(cQtScale() == true);
};
Ui::show(Box<ConfirmBox>(
tr::lng_settings_need_restart(tr::now),
tr::lng_settings_restart_now(tr::now),
confirmed,
cancelled));
}, container->lifetime());
#ifndef DESKTOP_APP_DISABLE_GTK_INTEGRATION
if (Platform::IsLinux()) {
const auto gtkIntegrationToggled = Ui::CreateChild<rpl::event_stream<bool>>(
container.get());
AddButton(
container,
tr::ktg_settings_gtk_integration(),
st::settingsButton
)->toggleOn(
gtkIntegrationToggled->events_starting_with_copy(cGtkIntegration())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cGtkIntegration());
}) | rpl::start_with_next([=](bool enabled) {
const auto confirmed = [=] {
cSetGtkIntegration(enabled);
::Kotato::JsonSettings::Write();
App::restart();
};
const auto cancelled = [=] {
gtkIntegrationToggled->fire(cGtkIntegration() == true);
};
Ui::show(Box<ConfirmBox>(
tr::lng_settings_need_restart(tr::now),
tr::lng_settings_restart_now(tr::now),
confirmed,
cancelled));
}, container->lifetime());
}
#endif // !DESKTOP_APP_DISABLE_GTK_INTEGRATION
2021-03-31 23:26:33 +03:00
if (Platform::IsLinux()) {
auto fileDialogTypeText = rpl::single(
2021-04-01 17:52:18 +03:00
FileDialogType()
) | rpl::then(
FileDialogTypeChanges()
) | rpl::map([] {
2021-04-01 17:52:18 +03:00
return FileDialogTypeLabel(int(FileDialogType()));
});
2021-03-31 23:26:33 +03:00
AddButtonWithLabel(
container,
tr::ktg_settings_file_dialog_type(),
fileDialogTypeText,
2021-03-31 23:26:33 +03:00
st::settingsButton
)->addClickHandler([=] {
Ui::show(Box<::Kotato::RadioBox>(
tr::ktg_settings_file_dialog_type(tr::now),
int(FileDialogType()),
2021-03-31 23:26:33 +03:00
int(Platform::FileDialog::ImplementationType::Count),
FileDialogTypeLabel,
FileDialogTypeDescription,
2021-03-31 23:26:33 +03:00
[=](int value) {
SetFileDialogType(Platform::FileDialog::ImplementationType(value));
2021-03-31 23:26:33 +03:00
::Kotato::JsonSettings::Write();
}, false));
});
}
2021-03-31 12:34:17 +04:00
2020-12-25 20:47:03 +04:00
if (Platform::IsMac()) {
const auto useNativeDecorationsToggled = Ui::CreateChild<rpl::event_stream<bool>>(
container.get());
AddButton(
container,
tr::lng_settings_native_frame(),
st::settingsButton
)->toggleOn(
useNativeDecorationsToggled->events_starting_with_copy(cUseNativeDecorations())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cUseNativeDecorations());
}) | rpl::start_with_next([=](bool enabled) {
const auto confirmed = [=] {
cSetUseNativeDecorations(enabled);
::Kotato::JsonSettings::Write();
App::restart();
};
const auto cancelled = [=] {
useNativeDecorationsToggled->fire(cUseNativeDecorations() == true);
};
Ui::show(Box<ConfirmBox>(
tr::lng_settings_need_restart(tr::now),
tr::lng_settings_restart_now(tr::now),
confirmed,
cancelled));
}, container->lifetime());
}
AddButton(
container,
tr::ktg_settings_disable_tray_counter(),
st::settingsButton
)->toggleOn(
rpl::single(cDisableTrayCounter())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cDisableTrayCounter());
}) | rpl::start_with_next([controller](bool enabled) {
cSetDisableTrayCounter(enabled);
controller->session().data().notifyUnreadBadgeChanged();
::Kotato::JsonSettings::Write();
}, container->lifetime());
2020-12-25 20:47:03 +04:00
if (Platform::IsLinux()) {
AddButton(
container,
tr::ktg_settings_use_telegram_panel_icon(),
st::settingsButton
)->toggleOn(
rpl::single(cUseTelegramPanelIcon())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cUseTelegramPanelIcon());
}) | rpl::start_with_next([controller](bool enabled) {
cSetUseTelegramPanelIcon(enabled);
controller->session().data().notifyUnreadBadgeChanged();
::Kotato::JsonSettings::Write();
}, container->lifetime());
}
auto trayIconText = rpl::single(
rpl::empty_value()
) | rpl::then(
controller->session().data().unreadBadgeChanges()
) | rpl::map([] {
return TrayIconLabel(cCustomAppIcon());
});
2020-04-23 19:56:49 +03:00
AddButtonWithLabel(
container,
tr::ktg_settings_tray_icon(),
trayIconText,
2020-04-23 19:56:49 +03:00
st::settingsButton
)->addClickHandler([=] {
Ui::show(Box<::Kotato::RadioBox>(
tr::ktg_settings_tray_icon(tr::now),
tr::ktg_settings_tray_icon_desc(tr::now),
cCustomAppIcon(),
2021-03-31 12:33:13 +04:00
6,
TrayIconLabel,
2020-04-23 19:56:49 +03:00
[=] (int value) {
cSetCustomAppIcon(value);
controller->session().data().notifyUnreadBadgeChanged();
2020-04-23 19:56:49 +03:00
::Kotato::JsonSettings::Write();
}, false));
2020-04-23 19:56:49 +03:00
});
2020-02-23 05:30:39 +03:00
AddSkip(container);
}
2019-10-18 22:29:21 +03:00
void SetupKotatoOther(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_other());
2020-04-24 20:38:11 +03:00
SettingsMenuCSwitch(ktg_settings_show_phone_number, ShowPhoneInDrawer);
2020-05-05 06:46:11 +03:00
const auto chatIdButton = container->add(
object_ptr<Button>(
container,
tr::ktg_settings_chat_id(),
st::settingsButton));
auto chatIdText = rpl::single(
ChatIdLabel(ShowChatId())
) | rpl::then(
ShowChatIdChanges(
) | rpl::map([] (int chatIdType) {
return ChatIdLabel(chatIdType);
})
);
2020-05-05 06:46:11 +03:00
CreateRightLabel(
chatIdButton,
std::move(chatIdText),
st::settingsButton,
tr::ktg_settings_chat_id());
chatIdButton->addClickHandler([=] {
Ui::show(Box<::Kotato::RadioBox>(
tr::ktg_settings_chat_id(tr::now),
tr::ktg_settings_chat_id_desc(tr::now),
ShowChatId(),
2021-03-31 12:33:13 +04:00
3,
ChatIdLabel,
2020-05-05 06:46:11 +03:00
[=] (int value) {
SetShowChatId(value);
2020-05-05 06:46:11 +03:00
::Kotato::JsonSettings::Write();
}));
});
2020-04-24 20:38:11 +03:00
SettingsMenuCSwitch(ktg_settings_call_confirm, ConfirmBeforeCall);
2021-05-30 01:25:29 +00:00
SettingsMenuCSwitch(ktg_settings_ffmpeg_multithread, FFmpegMultithread);
2020-02-03 05:51:15 +03:00
2019-10-18 22:29:21 +03:00
AddSkip(container);
2021-05-30 01:25:29 +00:00
AddDividerText(container, tr::ktg_settings_ffmpeg_multithread_about());
AddSkip(container);
AddButton(
container,
tr::ktg_settings_external_video_player(),
st::settingsButton
)->toggleOn(
rpl::single(cUseExternalVideoPlayer())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cUseExternalVideoPlayer());
}) | rpl::start_with_next([](bool enabled) {
cSetUseExternalVideoPlayer(enabled);
Core::App().saveSettingsDelayed();
}, container->lifetime());
AddSkip(container);
AddDividerText(container, tr::ktg_settings_external_video_player_about());
2019-10-18 22:29:21 +03:00
}
2019-10-10 19:57:03 +03:00
Kotato::Kotato(
QWidget *parent,
not_null<Window::SessionController*> controller)
: Section(parent) {
setupContent(controller);
}
void Kotato::setupContent(not_null<Window::SessionController*> controller) {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
SetupKotatoChats(controller, content);
SetupKotatoMessages(content);
SetupKotatoForward(content);
2019-10-18 20:32:18 +03:00
SetupKotatoNetwork(content);
2020-03-30 19:36:59 +03:00
SetupKotatoFolders(controller, content);
SetupKotatoSystem(controller, content);
2019-10-18 22:29:21 +03:00
SetupKotatoOther(content);
2019-10-10 19:57:03 +03:00
Ui::ResizeFitChild(this, content);
}
} // namespace Settings
2019-10-14 02:17:53 +03:00