00001 #include "durationwidget.h" 00002 00003 #include <domain/duration.h> 00004 00005 using namespace ui; 00006 00007 DurationWidget::DurationWidget(QWidget* parent) : QWidget(parent) 00008 { 00009 widgets.setupUi(this); 00010 } 00011 00012 domain::Duration DurationWidget::currentDuration() const 00013 { 00014 return domain::Duration(widgets.weeksSpinBox->value(), 00015 widgets.daysSpinBox->value(), 00016 widgets.hoursSpinBox->value(), 00017 widgets.minutesSpinBox->value()); 00018 } 00019 00020 void DurationWidget::setDuration(const domain::Duration& duration) 00021 { 00022 widgets.weeksSpinBox->setValue(duration.weeks()); 00023 widgets.daysSpinBox->setValue(duration.days()); 00024 widgets.hoursSpinBox->setValue(duration.hours()); 00025 widgets.minutesSpinBox->setValue(duration.minutes()); 00026 }