UseThruToday: TreeMap

This commit is contained in:
Mark Liversedge
2013-01-14 10:05:48 +00:00
parent b250d663b0
commit 85ab604c1b
2 changed files with 10 additions and 3 deletions

View File

@@ -36,7 +36,7 @@
TreeMapWindow::TreeMapWindow(MainWindow *parent, bool useMetricUnits, const QDir &home) :
GcWindow(parent), main(parent), home(home),
useMetricUnits(useMetricUnits), active(false), dirty(true), useCustom(false)
useMetricUnits(useMetricUnits), active(false), dirty(true), useCustom(false), useToToday(false)
{
setInstanceName("Treemap Window");
@@ -171,6 +171,7 @@ TreeMapWindow::useCustomRange(DateRange range)
{
// plot using the supplied range
useCustom = true;
useToToday = false;
custom = range;
dateRangeChanged(custom);
}
@@ -178,7 +179,7 @@ TreeMapWindow::useCustomRange(DateRange range)
void
TreeMapWindow::useStandardRange()
{
useCustom = false;
useToToday = useCustom = false;
dateRangeChanged(myDateRange);
}
@@ -186,7 +187,8 @@ void
TreeMapWindow::useThruToday()
{
// plot using the supplied range
useCustom = true;
useCustom = false;
useToToday = true;
custom = myDateRange;
if (custom.to > QDate::currentDate()) custom.to = QDate::currentDate();
dateRangeChanged(custom);
@@ -214,6 +216,10 @@ TreeMapWindow::refresh()
if (useCustom) {
settings.from = custom.from;
settings.to = custom.to;
} else if (useToToday) {
QDate today = QDate::currentDate();
settings.from = myDateRange.from;
settings.to = myDateRange.to > today ? today : myDateRange.to;
} else {
settings.from = myDateRange.from;
settings.to = myDateRange.to;

View File

@@ -140,6 +140,7 @@ class TreeMapWindow : public GcWindow
bool active;
bool dirty;
bool useCustom;
bool useToToday;
DateRange custom; // custom date range supplied
QList<KeywordDefinition> keywordDefinitions;
QList<FieldDefinition> fieldDefinitions;