[Improvement] Allow smaller cache time limits
This commit is contained in:
parent
81a748debb
commit
28e1a3f312
2 changed files with 22 additions and 3 deletions
|
|
@ -131,6 +131,14 @@
|
|||
"ktg_settings_chat_id_telegram": "Telegram API",
|
||||
"ktg_settings_chat_id_bot": "Bot API",
|
||||
"ktg_message_id": "Message ID: {id}",
|
||||
"ktg_local_storage_limit_days": {
|
||||
"zero": "{count} days",
|
||||
"one": "{count} day",
|
||||
"two": "{count} days",
|
||||
"few": "{count} days",
|
||||
"many": "{count} days",
|
||||
"other": "{count} days"
|
||||
},
|
||||
"ktg_settings_monospace_large_bubbles": "Expand bubbles with monospace",
|
||||
"ktg_bot_id_copied": "Bot ID copied to clipboard.",
|
||||
"ktg_user_id_copied": "User ID copied to clipboard.",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "boxes/local_storage_box.h"
|
||||
|
||||
#include "kotato/kotato_lang.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
|
|
@ -31,7 +32,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 +93,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 +114,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)
|
||||
? ktr("ktg_local_storage_limit_days", days, { "count", QString::number(days) })
|
||||
: tr::lng_local_storage_limit_never(tr::now);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue