Add FutureDueShowBacklog as preferences

This commit is contained in:
Henrik Giesel 2021-01-27 01:15:19 +01:00
parent 322788133b
commit 677f4d340c
4 changed files with 17 additions and 4 deletions

View File

@ -1104,6 +1104,7 @@ message GraphPreferences {
Weekday calendar_first_day_of_week = 1;
bool card_counts_separate_inactive = 2;
bool browser_links_supported = 3;
bool future_due_show_backlog = 4;
}
message RevlogEntry {

View File

@ -49,6 +49,7 @@ pub(crate) enum ConfigKey {
NewReviewMix,
FirstDayOfWeek,
CardCountsSeparateInactive,
FutureDueShowBacklog,
AnswerTimeLimitSecs,
ShowDayLearningCardsFirst,
LastUnburiedDay,
@ -79,6 +80,7 @@ impl From<ConfigKey> for &'static str {
ConfigKey::NewReviewMix => "newSpread",
ConfigKey::FirstDayOfWeek => "firstDayOfWeek",
ConfigKey::CardCountsSeparateInactive => "cardCountsSeparateInactive",
ConfigKey::FutureDueShowBacklog => "futureDueShowBacklog",
ConfigKey::AnswerTimeLimitSecs => "timeLim",
ConfigKey::ShowDayLearningCardsFirst => "dayLearnFirst",
ConfigKey::LastUnburiedDay => "lastUnburied",
@ -249,6 +251,15 @@ impl Collection {
self.set_config(ConfigKey::CardCountsSeparateInactive, &separate)
}
pub(crate) fn get_future_due_show_backlog(&self) -> bool {
self.get_config_optional(ConfigKey::FutureDueShowBacklog)
.unwrap_or(true)
}
pub(crate) fn set_future_due_show_backlog(&self, show: bool) -> Result<()> {
self.set_config(ConfigKey::FutureDueShowBacklog, &show)
}
pub(crate) fn get_show_due_counts(&self) -> bool {
self.get_config_optional(ConfigKey::ShowRemainingDueCountsInStudy)
.unwrap_or(true)

View File

@ -52,6 +52,7 @@ impl Collection {
calendar_first_day_of_week: self.get_first_day_of_week() as i32,
card_counts_separate_inactive: self.get_card_counts_separate_inactive(),
browser_links_supported: true,
future_due_show_backlog: self.get_future_due_show_backlog(),
})
}
@ -63,6 +64,7 @@ impl Collection {
_ => Weekday::Sunday,
})?;
self.set_card_counts_separate_inactive(prefs.card_counts_separate_inactive)?;
self.set_future_due_show_backlog(prefs.future_due_show_backlog)?;
Ok(())
}
}

View File

@ -21,9 +21,8 @@
let graphData = null as GraphData | null;
let histogramData = null as HistogramData | null;
let tableData: TableDatum[] = [] as any;
let backlog: boolean = true;
let graphRange: GraphRange = GraphRange.Month;
let { browserLinksSupported } = preferences;
let { browserLinksSupported, futureDueShowBacklog } = preferences;
$: if (sourceData) {
graphData = gatherData(sourceData);
@ -33,7 +32,7 @@
({ histogramData, tableData } = buildHistogram(
graphData,
graphRange,
backlog,
$futureDueShowBacklog,
i18n,
dispatch,
$browserLinksSupported
@ -53,7 +52,7 @@
<div class="range-box-inner">
{#if graphData && graphData.haveBacklog}
<label>
<input type="checkbox" bind:checked={backlog} />
<input type="checkbox" bind:checked={$futureDueShowBacklog} />
{backlogLabel}
</label>
{/if}