2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 14:17:45 +00:00

Started work on settings

This commit is contained in:
RadRussianRus
2019-10-10 19:57:03 +03:00
parent f540525e08
commit c55c606af6
13 changed files with 171 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -2253,4 +2253,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_profile_subscribers_section" = "Subscribers";
"ktg_settings_kotato" = "Kotatogram Settings";
"ktg_settings_chats" = "Chats";
"ktg_settings_sticker_height" = "Sticker height: {pixels}px";
"ktg_settings_emoji_outline" = "Big emoji outline";
"ktg_settings_always_show_scheduled" = "Always show scheduled";
// Keys finished

View File

@@ -26,5 +26,10 @@
"many": "{count} подписчиков",
"other": "{count} подписчиков"
},
"ktg_profile_subscribers_section": "Подписчики"
"ktg_profile_subscribers_section": "Подписчики",
"ktg_settings_kotato": "Настройки Kotatogram",
"ktg_settings_chats": "Чаты",
"ktg_settings_sticker_height": "Высота стикеров: {pixels} пикс.",
"ktg_settings_emoji_outline": "Обводка у больших эмодзи",
"ktg_settings_always_show_scheduled": "Всегда показывать отложенные"
}

View File

@@ -631,6 +631,8 @@ rpl::producer<QString> TitleValue(
return tr::lng_settings_section_chat_settings();
case Section::SettingsType::Calls:
return tr::lng_settings_section_call_settings();
case Section::SettingsType::Kotato:
return tr::ktg_settings_kotato();
}
Unexpected("Bad settings type in Info::TitleValue()");
}

View File

@@ -60,6 +60,7 @@ settingsIconFaq: icon {{ "settings_faq", menuIconFg }};
settingsIconStickers: icon {{ "settings_stickers", menuIconFg }};
settingsIconEmoji: icon {{ "settings_emoji", menuIconFg }};
settingsIconThemes: icon {{ "settings_themes", menuIconFg }};
settingsIconKotato: icon {{ "settings_kotato", menuIconFg }};
settingsSetPhotoSkip: 7px;

View File

@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "settings/settings_notifications.h"
#include "settings/settings_privacy_security.h"
#include "settings/settings_calls.h"
#include "settings/settings_kotato.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/widgets/labels.h"
@@ -51,6 +52,8 @@ object_ptr<Section> CreateSection(
return object_ptr<Chat>(parent, controller);
case Type::Calls:
return object_ptr<Calls>(parent, controller);
case Type::Kotato:
return object_ptr<Kotato>(parent, controller);
}
Unexpected("Settings section type in Widget::createInnerWidget.");
}

View File

@@ -43,6 +43,7 @@ enum class Type {
Advanced,
Chat,
Calls,
Kotato,
};
using Button = Info::Profile::Button;

View File

@@ -0,0 +1,116 @@
/*
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);
cSetStickerHeight(value);
};
stickerHeightSlider->resize(st::settingsAudioVolumeSlider.seekSize);
stickerHeightSlider->setPseudoDiscrete(
129,
[](int val) { return val + 128; },
cStickerHeight(),
updateStickerHeight);
updateStickerHeightLabel(cStickerHeight());
AddButton(
container,
tr::ktg_settings_emoji_outline(),
st::settingsButton
)->toggleOn(
rpl::single(cBigEmojiOutline())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cBigEmojiOutline());
}) | rpl::start_with_next([](bool enabled) {
cSetBigEmojiOutline(enabled);
}, 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);
}, 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

View File

@@ -0,0 +1,30 @@
/*
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
*/
#pragma once
#include "settings/settings_common.h"
namespace Settings {
void SetupKotatoChats(not_null<Ui::VerticalLayout*> container);
//void SetupKotatoFonts(not_null<Ui::VerticalLayout*> container);
//void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container);
//void SetupKotatoOther(not_null<Ui::VerticalLayout*> container);
class Kotato : public Section {
public:
Kotato(
QWidget *parent,
not_null<Window::SessionController*> controller);
private:
void setupContent(not_null<Window::SessionController*> controller);
};
} // namespace Settings

View File

@@ -104,6 +104,10 @@ void SetupSections(
tr::lng_settings_advanced(),
Type::Advanced,
&st::settingsIconGeneral);
addSection(
tr::ktg_settings_kotato(),
Type::Kotato,
&st::settingsIconKotato);
SetupLanguageButton(container);

View File

@@ -699,6 +699,8 @@
<(src_loc)/settings/settings_information.h
<(src_loc)/settings/settings_intro.cpp
<(src_loc)/settings/settings_intro.h
<(src_loc)/settings/settings_kotato.cpp
<(src_loc)/settings/settings_kotato.h
<(src_loc)/settings/settings_main.cpp
<(src_loc)/settings/settings_main.h
<(src_loc)/settings/settings_notifications.cpp