mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
inline scheduling settings into preferences
This commit is contained in:
parent
4bcd2b68ab
commit
24ad7c1f35
4 changed files with 31 additions and 32 deletions
|
@ -402,7 +402,7 @@ class DeckBrowser:
|
||||||
defaultno=True,
|
defaultno=True,
|
||||||
):
|
):
|
||||||
prefs = self.mw.col.get_preferences()
|
prefs = self.mw.col.get_preferences()
|
||||||
prefs.sched.new_timezone = False
|
prefs.scheduling.new_timezone = False
|
||||||
self.mw.col.set_preferences(prefs)
|
self.mw.col.set_preferences(prefs)
|
||||||
|
|
||||||
showInfo(tr(TR.SCHEDULING_UPDATE_DONE))
|
showInfo(tr(TR.SCHEDULING_UPDATE_DONE))
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Preferences(QDialog):
|
||||||
|
|
||||||
f.useCurrent.setCurrentIndex(int(not qc.get("addToCur", True)))
|
f.useCurrent.setCurrentIndex(int(not qc.get("addToCur", True)))
|
||||||
|
|
||||||
s = self.prefs.sched
|
s = self.prefs.scheduling
|
||||||
f.lrnCutoff.setValue(int(s.learn_ahead_secs / 60.0))
|
f.lrnCutoff.setValue(int(s.learn_ahead_secs / 60.0))
|
||||||
f.timeLimit.setValue(int(s.time_limit_secs / 60.0))
|
f.timeLimit.setValue(int(s.time_limit_secs / 60.0))
|
||||||
f.showEstimates.setChecked(s.show_intervals_on_buttons)
|
f.showEstimates.setChecked(s.show_intervals_on_buttons)
|
||||||
|
@ -153,7 +153,7 @@ class Preferences(QDialog):
|
||||||
qc = d.conf
|
qc = d.conf
|
||||||
qc["addToCur"] = not f.useCurrent.currentIndex()
|
qc["addToCur"] = not f.useCurrent.currentIndex()
|
||||||
|
|
||||||
s = self.prefs.sched
|
s = self.prefs.scheduling
|
||||||
s.show_remaining_due_counts = f.showProgress.isChecked()
|
s.show_remaining_due_counts = f.showProgress.isChecked()
|
||||||
s.show_intervals_on_buttons = f.showEstimates.isChecked()
|
s.show_intervals_on_buttons = f.showEstimates.isChecked()
|
||||||
s.new_review_mix = f.newSpread.currentIndex()
|
s.new_review_mix = f.newSpread.currentIndex()
|
||||||
|
|
|
@ -1022,7 +1022,8 @@ message CheckDatabaseOut {
|
||||||
repeated string problems = 1;
|
repeated string problems = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CollectionSchedulingSettings {
|
message Preferences {
|
||||||
|
message Scheduling {
|
||||||
enum NewReviewMix {
|
enum NewReviewMix {
|
||||||
DISTRIBUTE = 0;
|
DISTRIBUTE = 0;
|
||||||
REVIEWS_FIRST = 1;
|
REVIEWS_FIRST = 1;
|
||||||
|
@ -1042,10 +1043,9 @@ message CollectionSchedulingSettings {
|
||||||
// v2 only
|
// v2 only
|
||||||
bool new_timezone = 8;
|
bool new_timezone = 8;
|
||||||
bool day_learn_first = 9;
|
bool day_learn_first = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Preferences {
|
Scheduling scheduling = 1;
|
||||||
CollectionSchedulingSettings sched = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ClozeNumbersInNoteOut {
|
message ClozeNumbersInNoteOut {
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend_proto::{
|
backend_proto::{
|
||||||
collection_scheduling_settings::NewReviewMix as NewRevMixPB, CollectionSchedulingSettings,
|
preferences::scheduling::NewReviewMix as NewRevMixPB, preferences::Scheduling, Preferences,
|
||||||
Preferences,
|
|
||||||
},
|
},
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
config::BoolKey,
|
config::BoolKey,
|
||||||
|
@ -15,20 +14,20 @@ use crate::{
|
||||||
impl Collection {
|
impl Collection {
|
||||||
pub fn get_preferences(&self) -> Result<Preferences> {
|
pub fn get_preferences(&self) -> Result<Preferences> {
|
||||||
Ok(Preferences {
|
Ok(Preferences {
|
||||||
sched: Some(self.get_collection_scheduling_settings()?),
|
scheduling: Some(self.get_collection_scheduling_settings()?),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_preferences(&mut self, prefs: Preferences) -> Result<()> {
|
pub fn set_preferences(&mut self, prefs: Preferences) -> Result<()> {
|
||||||
if let Some(sched) = prefs.sched {
|
if let Some(sched) = prefs.scheduling {
|
||||||
self.set_collection_scheduling_settings(sched)?;
|
self.set_collection_scheduling_settings(sched)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_collection_scheduling_settings(&self) -> Result<CollectionSchedulingSettings> {
|
pub fn get_collection_scheduling_settings(&self) -> Result<Scheduling> {
|
||||||
Ok(CollectionSchedulingSettings {
|
Ok(Scheduling {
|
||||||
scheduler_version: match self.scheduler_version() {
|
scheduler_version: match self.scheduler_version() {
|
||||||
crate::config::SchedulerVersion::V1 => 1,
|
crate::config::SchedulerVersion::V1 => 1,
|
||||||
crate::config::SchedulerVersion::V2 => 2,
|
crate::config::SchedulerVersion::V2 => 2,
|
||||||
|
@ -50,7 +49,7 @@ impl Collection {
|
||||||
|
|
||||||
pub(crate) fn set_collection_scheduling_settings(
|
pub(crate) fn set_collection_scheduling_settings(
|
||||||
&mut self,
|
&mut self,
|
||||||
settings: CollectionSchedulingSettings,
|
settings: Scheduling,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let s = settings;
|
let s = settings;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue