Skip to content

Commit

Permalink
added unified userpic corners for forums
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdnx committed Oct 28, 2023
1 parent e09d7a6 commit 33cbdcd
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/alttg.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "Добавлять запятую после упоминания",
"rtg_settings_auto_hide_notifications": "Скрывать уведомления автоматически",
"rtg_settings_hide_notifications_after": "Скрыть по истечении {seconds} секунд",
"rtg_general_roundness": "Единые скругления",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "أضف فاصلة بعد الإشارة",
"rtg_settings_auto_hide_notifications": "إخفاء الإشعارات تلقائيًا",
"rtg_settings_hide_notifications_after": "إخفاء بعد {seconds} ثانية",
"rtg_general_roundness": "التدوير الموحد",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "Komma nach Erwähnung hinzufügen",
"rtg_settings_auto_hide_notifications": "Benachrichtigungen automatisch ausblenden",
"rtg_settings_hide_notifications_after": "Verbergen nach {seconds} Sekunden",
"rtg_general_roundness": "Einheitliche Rundung",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,6 @@
"rtg_settings_comma_after_mention": "Add comma after mention",
"rtg_settings_auto_hide_notifications": "Hide notifications automatically",
"rtg_settings_hide_notifications_after": "Hide after {seconds} seconds",
"rtg_general_roundness": "Single Corner Radius",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,6 @@
"rtg_settings_comma_after_mention": "Agregar coma después de la mención",
"rtg_settings_auto_hide_notifications": "Ocultar notificaciones automáticamente",
"rtg_settings_hide_notifications_after": "Ocultar después de {seconds} segundos",
"rtg_general_roundness": "Curvatura Unificada",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "پس از اشاره کاما اضافه کنید",
"rtg_settings_auto_hide_notifications": "مخفی کردن آگاهی‌ها به صورت خودکار",
"rtg_settings_hide_notifications_after": "پنهان شدن پس از {seconds} ثانیه",
"rtg_general_roundness": "خمیدگی یکپارچه",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,6 @@
"rtg_settings_comma_after_mention": "Ajouter une virgule après la mention",
"rtg_settings_auto_hide_notifications": "Masquer les notifications automatiquement",
"rtg_settings_hide_notifications_after": "Cacher après {seconds} secondes",
"rtg_general_roundness": "Courbure Unifiée",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "הוסף פסיק אחרי ההזכרה",
"rtg_settings_auto_hide_notifications": "הסתר הודעות באופן אוטומטי",
"rtg_settings_hide_notifications_after": "הסתר לאחר {seconds} שניות",
"rtg_general_roundness": "מעגלות מאוחדות",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "Aggiungi virgola dopo la menzione",
"rtg_settings_auto_hide_notifications": "Nascondi le notifiche automaticamente",
"rtg_settings_hide_notifications_after": "Nascondi dopo {seconds} secondi",
"rtg_general_roundness": "Curvatura Unificata",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "Dodaj przecinek po wspomnieniu",
"rtg_settings_auto_hide_notifications": "Automatycznie ukrywaj powiadomienia",
"rtg_settings_hide_notifications_after": "Ukryj po {seconds} sekundach",
"rtg_general_roundness": "Jednolite Zaokrąglenie",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "Adicionar vírgula após a menção",
"rtg_settings_auto_hide_notifications": "Ocultar notificações automaticamente",
"rtg_settings_hide_notifications_after": "Ocultar após {seconds} segundos",
"rtg_general_roundness": "Curvatura Unificada",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,6 @@
"rtg_settings_comma_after_mention": "Запятая после упоминания",
"rtg_settings_auto_hide_notifications": "Скрывать уведомления автоматически",
"rtg_settings_hide_notifications_after": "Скрывать через {seconds} секунд",
"rtg_general_roundness": "Единое закругление",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "Bahseden sonra virgül ekleyin",
"rtg_settings_auto_hide_notifications": "Bildirimleri otomatik olarak gizle",
"rtg_settings_hide_notifications_after": "{seconds} saniye sonra gizle",
"rtg_general_roundness": "Birleşik Yuvarlaklık",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"rtg_settings_comma_after_mention": "Додати кому після згадки",
"rtg_settings_auto_hide_notifications": "Приховувати сповіщення автоматично",
"rtg_settings_hide_notifications_after": "Сховати через {seconds} секунд",
"rtg_general_roundness": "Єдине закруглення",
"dummy_last_string": ""
}
1 change: 1 addition & 0 deletions Telegram/Resources/langs/rabbit/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,6 @@
"rtg_settings_comma_after_mention": "在提及后添加逗号",
"rtg_settings_auto_hide_notifications": "自动隐藏通知",
"rtg_settings_hide_notifications_after": "在 {seconds} 秒后隐藏",
"rtg_general_roundness": "统一曲率",
"dummy_last_string": ""
}
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/rabbit/rabbit_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
.type = SettingType::IntSetting,
.defaultValue = 50,
.limitHandler = IntLimit(0, 50, 50), }},
{ "general_roundness", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
// Side menu elements
{ "side_menu_create_group", {
.type = SettingType::BoolSetting,
Expand Down
6 changes: 4 additions & 2 deletions Telegram/SourceFiles/rabbit/rabbit_settings_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ namespace Settings {
::RabbitSettings::JsonSettings::Set("hide_notifications_after", value);
::RabbitSettings::JsonSettings::Write();
};
updateNotificationHideTimeLabelSlider->resize(st::settingsAudioVolumeSlider.seekSize);
updateNotificationHideTimeLabelSlider->setPseudoDiscrete(
notificationHideTimeSlider->resize(st::settingsAudioVolumeSlider.seekSize);
notificationHideTimeSlider->setPseudoDiscrete(
31,
[](int val) { return val; },
::RabbitSettings::JsonSettings::GetInt("hide_notifications_after"),
Expand Down Expand Up @@ -125,6 +125,8 @@ namespace Settings {
updateUserpicRoundness);
updateUserpicRoundnessLabel(::RabbitSettings::JsonSettings::GetInt("userpic_roundness"));

SettingsMenuJsonSwitch(rtg_general_roundness, general_roundness);

AddSubsectionTitle(container, rktr("rtg_side_menu_elements"));

AddButton(
Expand Down
6 changes: 3 additions & 3 deletions Telegram/SourceFiles/ui/userpic_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ void ValidateUserpicCache(
view.cached = Images::Round(
std::move(view.cached),
Images::CornersMask(
forum
? size * Ui::ForumUserpicRadiusMultiplier() / style::DevicePixelRatio()
: size * (RabbitSettings::JsonSettings::GetInt("userpic_roundness")) / 100 / style::DevicePixelRatio()
(forum && !RabbitSettings::JsonSettings::GetBool("general_roundness"))
? size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100 * Ui::ForumUserpicRadiusMultiplier() / style::DevicePixelRatio()
: size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100 / style::DevicePixelRatio()
)
);
} else {
Expand Down

0 comments on commit 33cbdcd

Please sign in to comment.