diff --git a/sources/mainwindow.cpp b/sources/mainwindow.cpp index 0e295c2..b342bc2 100644 --- a/sources/mainwindow.cpp +++ b/sources/mainwindow.cpp @@ -203,6 +203,8 @@ void MainWindow::compute_time() { overtime += (w->total() - week_template->total()) + w->getTimeDeltaInHours(); } } + late -= current_week->getTimeDeltaInHours(); + overtime += - current_week->getTimeDeltaInHours(); ui->late_time_label->setText(Tools::double_to_string_time((late > 0.0) ? late : 0.0)); ui->overtime_time_label->setText(Tools::double_to_string_time((overtime > 0.0) ? overtime : 0.0)); } diff --git a/sources/models/day.cpp b/sources/models/day.cpp index 0ce8f47..8ae883a 100644 --- a/sources/models/day.cpp +++ b/sources/models/day.cpp @@ -28,6 +28,9 @@ Day::~Day() } float Day::get_total() { + if (notWorking) { + return 0.0; + } int sec = start.secsTo(end); int minutes = sec / 60; float breakTime = get_time_break(); @@ -48,6 +51,11 @@ void Day::set_validate(bool value) { validate = value; } +void Day::set_working(bool value) +{ + this->notWorking = value; +} + void Day::setBreaks(QVector breaks) { this->breaks = breaks; @@ -119,6 +127,11 @@ bool Day::get_validate() { return validate; } +bool Day::not_working() +{ + return notWorking; +} + float Day::get_time_break() { float result = 0; @@ -133,6 +146,7 @@ void Day::update(Day *old) this->start = old->start; this->end = old->end; this->validate = old->validate; + this->notWorking = old->notWorking; foreach (BreakPoint *bp, breaks) { delete bp; diff --git a/sources/models/day.h b/sources/models/day.h index 8585da2..a30544e 100644 --- a/sources/models/day.h +++ b/sources/models/day.h @@ -21,6 +21,7 @@ private: QTime end; QVector breaks; bool validate; + bool notWorking; public: Day(); @@ -30,12 +31,14 @@ public: void set_start(QTime value); void set_end(QTime value); void set_validate(bool); + void set_working(bool); void setBreaks(QVector); QTime get_start(); QTime get_end(); QVector getBreaks(); bool get_validate(); + bool not_working(); float get_time_break(); void update(Day *); QJsonObject to_json(); diff --git a/sources/setdaydialog.cpp b/sources/setdaydialog.cpp index 528f6fb..6bbf703 100644 --- a/sources/setdaydialog.cpp +++ b/sources/setdaydialog.cpp @@ -55,7 +55,7 @@ void SetDayDialog::accept() } void SetDayDialog::validate_and_accept() { - copy->set_validate(true); + copy->set_validate(!copy->not_working()); this->accept(); } diff --git a/ui/setdaydialog.ui b/ui/setdaydialog.ui index 63132bd..4b9c704 100644 --- a/ui/setdaydialog.ui +++ b/ui/setdaydialog.ui @@ -34,9 +34,9 @@ - 200 - 373 - 201 + 10 + 410 + 191 23 @@ -137,74 +137,12 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - 18 - 372 - 156 - 62 - - - - - - - - 59 - 59 - - - - - 59 - 59 - - - - border-image: url(:/clock/pictures/clock-8-128.png) 0 0 0 0 stretch stretch; - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - font-size: 14px; - - - Temps total - - - - - - - font-size: 28px; -color: white; - - - 0h - - - - - - - - 200 - 403 - 201 + 220 + 410 + 191 23 @@ -273,7 +211,7 @@ color: white; 0 - 350 + 380 421 20 @@ -314,6 +252,52 @@ color: rgb(255, 255, 255); Qt::IgnoreAction + + + + 10 + 370 + 91 + 19 + + + + font-size: 14px; + + + Temps total + + + + + + 100 + 360 + 101 + 31 + + + + font-size: 28px; +color: white; + + + 0h + + + + + + 210 + 350 + 191 + 23 + + + + Jour non travaillé + + diff --git a/ui/weekoption.ui b/ui/weekoption.ui index 2fde678..fe674b1 100644 --- a/ui/weekoption.ui +++ b/ui/weekoption.ui @@ -121,67 +121,22 @@ Qt::Horizontal - + 10 - 90 - 156 - 62 + 107 + 152 + 41 - - - - - - 59 - 59 - - - - - 59 - 59 - - - - border-image: url(:/clock/pictures/clock-8-128.png) 0 0 0 0 stretch stretch; - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - font-size: 14px; - - - Temps total - - - - - - - font-size: 28px; + + font-size: 28px; color: white; - - - 0h - - - - - - + + + 0h +