from Justin: "It should fix the bugs with creating a new power.zones file plus

adds two DateEdits to show the start and end of a zone range."
This commit is contained in:
Sean C. Rhea
2008-05-19 15:03:26 +00:00
parent ff59009f86
commit 80e113d347
2 changed files with 40 additions and 0 deletions

View File

@@ -251,9 +251,13 @@ void ConfigDialog::new_Clicked()
//Create the Zone
cyclistPage->calendar->setMinimumDate(zones->getStartDate(zones->getRangeSize() - 1));
zones->addZoneRange(zones->getStartDate(cyclistPage->getCurrentRange()), cyclistPage->calendar->selectedDate(), 0);
cyclistPage->setCurrentRange(zones->getRangeSize() - 1);
cyclistPage->lblCurRange->setText(QString("Current Zone Range: %1").arg(cyclistPage->getCurrentRange() + 1));
if(cyclistPage->getCurrentRange() > 1)
cyclistPage->calendar->setMinimumDate(zones->getEndDate(zones->getRangeSize() - 1));
QDate date;
cyclistPage->calendar->setSelectedDate(date.currentDate());

View File

@@ -71,6 +71,42 @@ CyclistPage::CyclistPage(QWidget *parent, Zones *_zones, bool emptyZone)
txtStartDate->setEnabled(false);
txtEndDate->setEnabled(false);
if(emptyZone)
{
setCurrentRange(0);
QDate date;
btnNew->setEnabled(false);
calendar->setSelectedDate(date.currentDate());
calendar->setEnabled(true);
btnBack->setEnabled(false);
txtEndDate->setDate(date.currentDate());
}
else if(zones->getRangeSize() == 1)
{
setCurrentRange(0);
QDate date;
btnNew->setEnabled(true);
btnBack->setEnabled(false);
calendar->setSelectedDate(date.currentDate());
calendar->setEnabled(false);
//txtStartDate->setDate(date.currentDate()));
//txtEndDate->setDate(date.currentDate()));
}
else
{
setCurrentRange(zones->getRangeSize() - 1);
QDate date = zones->getStartDate(getCurrentRange());
calendar->setSelectedDate(date);
calendar->setMinimumDate(date);
calendar->setEnabled(false);
txtStartDate->setDate(zones->getStartDate(getCurrentRange()));
txtEndDate->setDate(zones->getEndDate(getCurrentRange()));
}
txtStartDate->setEnabled(false);
txtEndDate->setEnabled(false);
if(emptyZone)
{
setCurrentRange(0);