Skip to content

Commit

Permalink
Add shorter invervals for the backup thread
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Nov 12, 2016
1 parent d6f2bec commit 441b835
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/pref.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<option id="rewind_on_stop" type="bool" default="false" />
<option id="expand_menubar_on_mouseover" type="bool" default="false" migrate="Options.ExpandMenuBarOnMouseover" />
<option id="data_recovery" type="bool" default="true" />
<option id="data_recovery_period" type="int" default="2" />
<option id="data_recovery_period" type="double" default="2.0" />
<option id="show_full_path" type="bool" default="true" />
<option id="timeline_position" type="TimelinePosition" default="TimelinePosition::BOTTOM" />
</section>
Expand Down
3 changes: 3 additions & 0 deletions data/widgets/options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<hbox>
<check text="Automatically save recovery data every" id="enable_data_recovery" tooltip="With this option you can recover your documents&#10;if the program finalizes unexpectedly." />
<combobox id="data_recovery_period">
<listitem text="10 seconds" value="0.33" />
<listitem text="30 seconds" value="0.5" />
<listitem text="1 Minutes" value="1" />
<listitem text="2 Minutes" value="2" />
<listitem text="5 Minutes" value="5" />
<listitem text="10 Minutes" value="10" />
Expand Down
2 changes: 1 addition & 1 deletion src/app/commands/cmd_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class OptionsWindow : public app::gen::Options {

std::string warnings;

int newPeriod = base::convert_to<int>(dataRecoveryPeriod()->getValue());
double newPeriod = base::convert_to<double>(dataRecoveryPeriod()->getValue());
if (enableDataRecovery()->isSelected() != m_pref.general.dataRecovery() ||
newPeriod != m_pref.general.dataRecoveryPeriod()) {
m_pref.general.dataRecovery(enableDataRecovery()->isSelected());
Expand Down
4 changes: 2 additions & 2 deletions src/app/crash/backup_observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ void BackupObserver::onRemoveDocument(doc::Document* document)

void BackupObserver::backgroundThread()
{
int normalPeriod = 60*Preferences::instance().general.dataRecoveryPeriod();
int lockedPeriod = 10;
int normalPeriod = int(60.0*Preferences::instance().general.dataRecoveryPeriod());
int lockedPeriod = 5;
#if 0 // Just for testing purposes
normalPeriod = 5;
lockedPeriod = 5;
Expand Down

0 comments on commit 441b835

Please sign in to comment.