diff --git a/daily.cpp b/daily.cpp index 66c09fb3..a04cafff 100644 --- a/daily.cpp +++ b/daily.cpp @@ -856,33 +856,35 @@ void Daily::on_JournalNotesUnderline_clicked() void Daily::on_prevDayButton_clicked() { - QDate d=previous_date; - bool found=false; - for (int i=0;i<90;i++) { - d=d.addDays(-1); - if (PROFILE.GetDay(d)) { - LoadDate(d); - found=true; - break; + if (!PREF.ExistsAndTrue("SkipEmptyDays")) { + LoadDate(previous_date.addDays(-1)); + } else { + QDate d=previous_date; + bool found=false; + for (int i=0;i<90;i++) { + d=d.addDays(-1); + if (PROFILE.GetDay(d)) { + LoadDate(d); + break; + } } } - if (!found) LoadDate(previous_date.addDays(-1)); } void Daily::on_nextDayButton_clicked() { - QDate d=previous_date; - bool found=false; - for (int i=0;i<90;i++) { - d=d.addDays(1); - if (PROFILE.GetDay(d)) { - LoadDate(d); - found=true; - break; + if (!PREF.ExistsAndTrue("SkipEmptyDays")) { + LoadDate(previous_date.addDays(1)); + } else { + QDate d=previous_date; + for (int i=0;i<90;i++) { + d=d.addDays(1); + if (PROFILE.GetDay(d)) { + LoadDate(d); + break; + } } } - if (!found) LoadDate(previous_date.addDays(1)); - //LoadDate(previous_date.addDays(1)); } void Daily::on_calButton_toggled(bool checked) diff --git a/preferencesdialog.cpp b/preferencesdialog.cpp index 64a1dcc7..88a3a8ec 100644 --- a/preferencesdialog.cpp +++ b/preferencesdialog.cpp @@ -66,6 +66,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : ui->bigFontBold->setChecked(bigfont->weight()==QFont::Bold); ui->bigFontItalic->setChecked(bigfont->italic()); + if (!PREF.Exists("SkipEmptyDays")) PREF["SkipEmptyDays"]=true; + ui->skipEmptyDays->setChecked(PREF["SkipEmptyDays"].toBool()); + if (!PREF.Exists("Updates_AutoCheck")) PREF["Updates_AutoCheck"]=true; ui->automaticallyCheckUpdates->setChecked(PREF["Updates_AutoCheck"].toBool()); @@ -193,6 +196,7 @@ void PreferencesDialog::Save() (*profile)["SyncOximetry"]=ui->oximetrySync->isChecked(); (*profile)["OximeterType"]=ui->oximetryType->currentText(); + PREF["SkipEmptyDays"]=ui->skipEmptyDays->isChecked(); PREF["Updates_AutoCheck"]=ui->automaticallyCheckUpdates->isChecked(); PREF["Updates_CheckFrequency"]=ui->updateCheckEvery->value(); diff --git a/preferencesdialog.ui b/preferencesdialog.ui index a904b302..44337d7f 100644 --- a/preferencesdialog.ui +++ b/preferencesdialog.ui @@ -38,7 +38,7 @@ - 6 + 0 @@ -209,6 +209,16 @@ It has no effect on single cpu machines. + + + + Skip empty days with Prev & Next buttons above daily view calendar + + + Skip Empty Days + + +