Dive pictures: automatically recalculate thumbnails

If a thumbnail and the original picture can be accessed and the
modification date of the thumbnail is before the modification date
of the picture, recalculate the thumbnail.

This causes more disk access and might give strange effects for
picture files with messed up file timestamps (i.e. lying in the
future) or messed up computer clocks (i.e. running in the past).
Therefore, add a preference option to disable the new behavior.
Default is set to enabled.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-05-27 15:42:22 +02:00 committed by Lubomir I. Ivanov
parent 23d38a982d
commit 308e079ad6
7 changed files with 64 additions and 15 deletions

View file

@ -47,6 +47,7 @@ void PreferencesGraph::refreshSettings()
ui->display_unused_tanks->setChecked(prefs.display_unused_tanks);
ui->show_average_depth->setChecked(prefs.show_average_depth);
ui->auto_recalculate_thumbnails->setChecked(prefs.auto_recalculate_thumbnails);
ui->show_icd->setChecked(prefs.show_icd);
}
@ -56,6 +57,7 @@ void PreferencesGraph::syncSettings()
general->setDefaultSetPoint(lrint(ui->defaultSetpoint->value() * 1000.0));
general->setO2Consumption(lrint(ui->psro2rate->value() *1000.0));
general->setPscrRatio(lrint(1000.0 / ui->pscrfactor->value()));
general->setAutoRecalculateThumbnails(ui->auto_recalculate_thumbnails->isChecked());
auto pp_gas = SettingsObjectWrapper::instance()->pp_gas;
pp_gas->setPheThreshold(ui->pheThreshold->value());

View file

@ -368,6 +368,13 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="auto_recalculate_thumbnails">
<property name="text">
<string>Recalculate thumbnails if older than image</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>