Add support of leaves
This commit is contained in:
@@ -22,6 +22,8 @@ SetDayDialog::~SetDayDialog()
|
||||
void SetDayDialog::init() {
|
||||
ui->start_edit->setTime(copy->get_start());
|
||||
ui->end_edit->setTime(copy->get_end());
|
||||
ui->notWorkingCheckbox->setCheckState((copy->not_working()) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
|
||||
lockControls(copy->not_working());
|
||||
updateBreakList();
|
||||
connect(ui->start_edit, &QTimeEdit::timeChanged, this, &SetDayDialog::compute_time);
|
||||
connect(ui->end_edit, &QTimeEdit::timeChanged, this, &SetDayDialog::compute_time);
|
||||
@@ -30,6 +32,7 @@ void SetDayDialog::init() {
|
||||
connect(ui->addBreakButton, &QPushButton::clicked, this, &SetDayDialog::add_break_point);
|
||||
connect(ui->removeBreakButton, &QPushButton::clicked, this, &SetDayDialog::remove_break_point);
|
||||
connect(ui->breakList, &QListWidget::currentRowChanged, this, &SetDayDialog::break_selected);
|
||||
connect(ui->notWorkingCheckbox, &QCheckBox::stateChanged, this, &SetDayDialog::change_not_working);
|
||||
ui->total_label->setText(Tools::double_to_string_time(d->get_total()));
|
||||
}
|
||||
|
||||
@@ -41,6 +44,17 @@ void SetDayDialog::updateBreakList()
|
||||
}
|
||||
}
|
||||
|
||||
void SetDayDialog::lockControls(bool lock)
|
||||
{
|
||||
ui->addBreakButton->setDisabled(lock);
|
||||
ui->start_edit->setDisabled(lock);
|
||||
ui->end_edit->setDisabled(lock);
|
||||
ui->breakList->setDisabled(lock);
|
||||
if (ui->breakList->currentRow() != -1) {
|
||||
ui->removeBreakButton->setDisabled(lock);
|
||||
}
|
||||
}
|
||||
|
||||
void SetDayDialog::compute_time() {
|
||||
copy->set_validate(false);
|
||||
copy->set_start(ui->start_edit->time());
|
||||
@@ -91,3 +105,10 @@ void SetDayDialog::break_selected(int i)
|
||||
{
|
||||
ui->removeBreakButton->setEnabled(i > -1);
|
||||
}
|
||||
|
||||
void SetDayDialog::change_not_working(int state)
|
||||
{
|
||||
copy->set_not_working(state != 0);
|
||||
lockControls(copy->not_working());
|
||||
compute_time();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user