Expand cache clear limit option

This commit is contained in:
Eric Kotato 2020-05-20 17:00:25 +03:00
parent cd14a1bed1
commit c240776525
3 changed files with 23 additions and 4 deletions

View file

@ -2515,6 +2515,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_settings_disable_tray_counter" = "Disable tray icon counter";
"ktg_settings_use_telegram_panel_icon" = "Ask the system for telegram icon";
"ktg_local_storage_limit_days#one" = "{count} day";
"ktg_local_storage_limit_days#other" = "{count} days";
"ktg_settings_chat_id" = "Chat ID in profile";
"ktg_settings_chat_id_desc" = "You can choose desired format here.\n\nTelegram API uses IDs as-is, but Bot API adds minus in the beginning for groups, and -100 for channels and supergroups to fit it in one field.\n\nIf you have profile panel opened, re-open it to see changes.";
"ktg_settings_chat_id_disable" = "Hide";

View file

@ -125,5 +125,11 @@
"ktg_settings_chat_id_telegram": "Telegram API",
"ktg_settings_chat_id_bot": "Bot API",
"ktg_message_id": "ID сообщения: {id}",
"ktg_emoji_panel_hover": "Панель эмодзи по наведению"
"ktg_emoji_panel_hover": "Панель эмодзи по наведению",
"ktg_local_storage_limit_days": {
"one": "{count} дня",
"few": "{count} дней",
"many": "{count} дней",
"other": "{count} дней"
}
}

View file

@ -31,7 +31,7 @@ constexpr auto kMegabyte = int64(1024 * 1024);
constexpr auto kTotalSizeLimitsCount = 18;
constexpr auto kMediaSizeLimitsCount = 18;
constexpr auto kMinimalSizeLimit = 100 * kMegabyte;
constexpr auto kTimeLimitsCount = 16;
constexpr auto kTimeLimitsCount = 22;
constexpr auto kMaxTimeLimitValue = std::numeric_limits<size_type>::max();
constexpr auto kFakeMediaCacheTag = uint16(0xFFFF);
@ -92,8 +92,16 @@ size_type TimeLimitInDays(int index) {
return 0;
}
size_type TimeLimitInDaysKotato(int index) {
if (index < 6) {
const auto days = (index + 1);
return size_type(days);
}
return TimeLimitInDays(index - 6);
}
size_type TimeLimit(int index) {
const auto days = TimeLimitInDays(index);
const auto days = TimeLimitInDaysKotato(index);
return days
? (days * 24 * 60 * 60)
: kMaxTimeLimitValue;
@ -105,8 +113,10 @@ QString TimeLimitText(size_type limit) {
const auto months = (days / 29);
return (months > 0)
? tr::lng_local_storage_limit_months(tr::now, lt_count, months)
: (limit > 0)
: (weeks > 0)
? tr::lng_local_storage_limit_weeks(tr::now, lt_count, weeks)
: (limit > 0)
? tr::ktg_local_storage_limit_days(tr::now, lt_count, days)
: tr::lng_local_storage_limit_never(tr::now);
}