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
|
|
|
|
*/
|
|
|
|
#include "settings/settings_kotato.h"
|
|
|
|
|
|
|
|
#include "settings/settings_common.h"
|
|
|
|
#include "settings/settings_chat.h"
|
|
|
|
#include "ui/wrap/vertical_layout.h"
|
|
|
|
#include "ui/wrap/slide_wrap.h"
|
|
|
|
#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 "boxes/about_box.h"
|
|
|
|
#include "boxes/confirm_box.h"
|
|
|
|
#include "info/profile/info_profile_button.h"
|
|
|
|
#include "platform/platform_specific.h"
|
|
|
|
#include "platform/platform_info.h"
|
|
|
|
#include "window/window_session_controller.h"
|
|
|
|
#include "lang/lang_keys.h"
|
|
|
|
#include "core/update_checker.h"
|
|
|
|
#include "core/application.h"
|
|
|
|
#include "storage/localstorage.h"
|
|
|
|
#include "data/data_session.h"
|
|
|
|
#include "main/main_session.h"
|
|
|
|
#include "layout.h"
|
|
|
|
#include "facades.h"
|
|
|
|
#include "app.h"
|
|
|
|
#include "styles/style_settings.h"
|
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
|
|
|
void SetupKotatoChats(not_null<Ui::VerticalLayout*> container) {
|
|
|
|
AddSkip(container);
|
|
|
|
AddSubsectionTitle(container, tr::ktg_settings_chats());
|
|
|
|
|
|
|
|
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);
|
2019-10-11 02:39:38 +03:00
|
|
|
SetStickerHeight(value);
|
2019-10-10 19:57:03 +03:00
|
|
|
};
|
|
|
|
stickerHeightSlider->resize(st::settingsAudioVolumeSlider.seekSize);
|
|
|
|
stickerHeightSlider->setPseudoDiscrete(
|
|
|
|
129,
|
|
|
|
[](int val) { return val + 128; },
|
2019-10-11 02:39:38 +03:00
|
|
|
StickerHeight(),
|
2019-10-10 19:57:03 +03:00
|
|
|
updateStickerHeight);
|
2019-10-11 02:39:38 +03:00
|
|
|
updateStickerHeightLabel(StickerHeight());
|
2019-10-10 19:57:03 +03:00
|
|
|
|
|
|
|
AddButton(
|
|
|
|
container,
|
|
|
|
tr::ktg_settings_emoji_outline(),
|
|
|
|
st::settingsButton
|
|
|
|
)->toggleOn(
|
2019-10-11 00:54:02 +03:00
|
|
|
rpl::single(BigEmojiOutline())
|
2019-10-10 19:57:03 +03:00
|
|
|
)->toggledValue(
|
|
|
|
) | rpl::filter([](bool enabled) {
|
2019-10-11 00:54:02 +03:00
|
|
|
return (enabled != BigEmojiOutline());
|
2019-10-10 19:57:03 +03:00
|
|
|
}) | rpl::start_with_next([](bool enabled) {
|
2019-10-11 00:54:02 +03:00
|
|
|
SetBigEmojiOutline(enabled);
|
2019-10-10 19:57:03 +03:00
|
|
|
}, 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([](bool enabled) {
|
|
|
|
cSetAlwaysShowScheduled(enabled);
|
2019-10-10 23:51:46 +03:00
|
|
|
Notify::showScheduledButtonChanged();
|
2019-10-10 19:57:03 +03:00
|
|
|
}, container->lifetime());
|
|
|
|
|
|
|
|
AddSkip(container);
|
|
|
|
}
|
|
|
|
|
|
|
|
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(content);
|
|
|
|
//SetupKotatoFonts(content);
|
|
|
|
//SetupKotatoNetwork(content);
|
|
|
|
//SetupKotatoOther(content);
|
|
|
|
|
|
|
|
Ui::ResizeFitChild(this, content);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Settings
|