From 88fbc9d74639736264772a25b48969958daa5840 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 4 Jan 2012 11:28:03 +1000 Subject: [PATCH] Added Everything and Custom to Overview Range combo and set date bounds.. Greyed out dates when not custom. --- daily.ui | 7 ------- overview.cpp | 27 +++++++++++++++++++++++++-- overview.ui | 14 ++++++++++++-- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/daily.ui b/daily.ui index 5b6f86cd..23a8e56c 100644 --- a/daily.ui +++ b/daily.ui @@ -787,13 +787,6 @@ - - - - Yay.. Empty space.. what for? - - - diff --git a/overview.cpp b/overview.cpp index 34059e5f..da6063de 100644 --- a/overview.cpp +++ b/overview.cpp @@ -401,7 +401,7 @@ void Overview::on_dateEnd_dateChanged(const QDate &date) qint64 d1=qint64(QDateTime(ui->dateStart->date(),QTime(0,10,0),Qt::UTC).toTime_t())*1000L; qint64 d2=qint64(QDateTime(date,QTime(23,0,0),Qt::UTC).toTime_t())*1000L; GraphView->SetXBounds(d1,d2); - + ui->dateStart->setMaximumDate(date); } void Overview::on_dateStart_dateChanged(const QDate &date) @@ -409,7 +409,7 @@ void Overview::on_dateStart_dateChanged(const QDate &date) qint64 d1=qint64(QDateTime(date,QTime(0,10,0),Qt::UTC).toTime_t())*1000L; qint64 d2=qint64(QDateTime(ui->dateEnd->date(),QTime(23,0,0),Qt::UTC).toTime_t())*1000L; GraphView->SetXBounds(d1,d2); - + ui->dateEnd->setMinimumDate(date); } void Overview::on_toolButton_clicked() @@ -464,8 +464,26 @@ void Overview::on_printDailyButton_clicked() void Overview::on_rangeCombo_activated(int index) { + ui->dateStart->setMinimumDate(PROFILE.FirstDay()); + ui->dateEnd->setMaximumDate(PROFILE.LastDay()); + QDate end=PROFILE.LastDay(); QDate start; + if (index==8) { // Custom + ui->dateStartLabel->setEnabled(true); + ui->dateEndLabel->setEnabled(true); + ui->dateEnd->setEnabled(true); + ui->dateStart->setEnabled(true); + + ui->dateStart->setMaximumDate(ui->dateEnd->date()); + ui->dateEnd->setMinimumDate(ui->dateStart->date()); + return; + } + ui->dateEnd->setEnabled(false); + ui->dateStart->setEnabled(false); + ui->dateStartLabel->setEnabled(false); + ui->dateEndLabel->setEnabled(false); + if (index==0) { start=end.addDays(-6); } else if (index==1) { @@ -480,12 +498,17 @@ void Overview::on_rangeCombo_activated(int index) start=end.addMonths(-6).addDays(1); } else if (index==6) { start=end.addYears(-1).addDays(1); + } else if (index==7) { // Everything + start=PROFILE.FirstDay(); } if (startdateStart->setMaximumDate(end); + ui->dateEnd->setMinimumDate(start); + ui->dateEnd->blockSignals(true); ui->dateStart->blockSignals(true); ui->dateStart->setDate(start); diff --git a/overview.ui b/overview.ui index e4c32f03..8c947343 100644 --- a/overview.ui +++ b/overview.ui @@ -97,10 +97,20 @@ Last Year + + + Everything + + + + + Custom + + - + Start: @@ -117,7 +127,7 @@ - + End: