2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Adding two existing options to menu

This commit is contained in:
RadRussianRus
2020-04-23 19:56:49 +03:00
parent 7f4f9a6837
commit 7f348adc17
3 changed files with 133 additions and 1 deletions

View File

@@ -2483,4 +2483,24 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_context_show_messages_from" = "User messages";
"ktg_settings_userpic_rounding" = "Profile pictures rounding";
"ktg_settings_userpic_rounding_none" = "Square";
"ktg_settings_userpic_rounding_small" = "Small";
"ktg_settings_userpic_rounding_big" = "Big";
"ktg_settings_userpic_rounding_full" = "Circle";
"ktg_settings_userpic_rounding_desc" = "You'll need to restart app to save changes.";
"ktg_settings_tray_icon" = "Tray icon";
"ktg_settings_tray_icon_default" = "Default";
"ktg_settings_tray_icon_blue" = "Blue";
"ktg_settings_tray_icon_green" = "Green";
"ktg_settings_tray_icon_orange" = "Orange";
"ktg_settings_tray_icon_red" = "Red";
"ktg_settings_tray_icon_legacy" = "Legacy";
"ktg_settings_tray_icon_desc" = "If you don't like any of these icons, you can place icon.png in your profile folder.\n\nYou'll need to restart app to save changes.";
// Keys finished

View File

@@ -109,5 +109,19 @@
"ktg_hide_pinned_message": "Скрыть",
"ktg_stickers_copy_title": "Копировать название",
"ktg_stickers_title_copied": "Название набора стикеров скопировано в буфер обмена.",
"ktg_context_show_messages_from": "Сообщения пользователя"
"ktg_context_show_messages_from": "Сообщения пользователя",
"ktg_settings_userpic_rounding": "Скругление фото профиля",
"ktg_settings_userpic_rounding_none": "Квадрат",
"ktg_settings_userpic_rounding_small": "Слабое",
"ktg_settings_userpic_rounding_big": "Сильное",
"ktg_settings_userpic_rounding_full": "Круг",
"ktg_settings_userpic_rounding_desc": "Для применения и просмотра изменений требуется перезапуск.",
"ktg_settings_tray_icon": "Иконка в трее",
"ktg_settings_tray_icon_default": "Стандартная",
"ktg_settings_tray_icon_blue": "Синяя",
"ktg_settings_tray_icon_green": "Зелёная",
"ktg_settings_tray_icon_orange": "Оранжевая",
"ktg_settings_tray_icon_red": "Красная",
"ktg_settings_tray_icon_legacy": "Старая",
"ktg_settings_tray_icon_desc": "Если вам не нравится ни одна из этих иконок, вы можете положить icon.png в вашу папку профиля.\n\nДля применения и просмотра изменений требуется перезапуск."
}

View File

@@ -60,6 +60,52 @@ QString NetBoostLabel(int boost) {
return QString();
}
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();
}
} // namespace
#define SettingsMenuСSwitch(LangKey, Option) AddButton( \
@@ -169,6 +215,31 @@ void SetupKotatoChats(not_null<Ui::VerticalLayout*> container) {
Ui::show(Box<FontsBox>());
});
const QMap<int, QString> userpicRoundOptions = {
{ 0, UserpicRoundingLabel(0) },
{ 1, UserpicRoundingLabel(1) },
{ 2, UserpicRoundingLabel(2) },
{ 3, UserpicRoundingLabel(3) }
};
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(),
userpicRoundOptions,
[=] (int value) {
cSetUserpicCornersType(value);
::Kotato::JsonSettings::Write();
App::restart();
}, true));
});
AddSkip(container);
}
@@ -266,6 +337,33 @@ void SetupKotatoSystem(not_null<Ui::VerticalLayout*> container) {
SettingsMenuСSwitch(ktg_settings_no_taskbar_flash, NoTaskbarFlashing);
const QMap<int, QString> trayIconOptions = {
{ 0, TrayIconLabel(0) },
{ 1, TrayIconLabel(1) },
{ 2, TrayIconLabel(2) },
{ 3, TrayIconLabel(3) },
{ 4, TrayIconLabel(4) },
{ 5, TrayIconLabel(5) },
};
AddButtonWithLabel(
container,
tr::ktg_settings_tray_icon(),
rpl::single(TrayIconLabel(cCustomAppIcon())),
st::settingsButton
)->addClickHandler([=] {
Ui::show(Box<::Kotato::RadioBox>(
tr::ktg_settings_tray_icon(tr::now),
tr::ktg_settings_tray_icon_desc(tr::now),
cCustomAppIcon(),
trayIconOptions,
[=] (int value) {
cSetCustomAppIcon(value);
::Kotato::JsonSettings::Write();
App::restart();
}, true));
});
AddSkip(container);
}