From 88b4e79282ecfa85019b1fc21ddc6cb9a7f6a7fe Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 <0xFEEDC0DE64@gmail.com> Date: Thu, 21 Dec 2017 20:32:10 +0100 Subject: [PATCH] Added duration of current booking to booking end strip #40 --- zeiterfassung/strips/bookingendstrip.ui | 12 ++++- zeiterfassungguilib/stripswidget.cpp | 14 ++++-- zeiterfassungguilib/stripswidget.h | 2 +- .../translations/zeiterfassungguilib_de.ts | 44 ++++++++++--------- .../translations/zeiterfassungguilib_en.ts | 44 ++++++++++--------- 5 files changed, 68 insertions(+), 48 deletions(-) diff --git a/zeiterfassung/strips/bookingendstrip.ui b/zeiterfassung/strips/bookingendstrip.ui index 0116a4f..e901bb5 100644 --- a/zeiterfassung/strips/bookingendstrip.ui +++ b/zeiterfassung/strips/bookingendstrip.ui @@ -19,7 +19,7 @@ QFrame::Raised - + 10 @@ -73,6 +73,16 @@ + + + + background-color: rgba(0,0,0,30); + + + 9:99h + + + diff --git a/zeiterfassungguilib/stripswidget.cpp b/zeiterfassungguilib/stripswidget.cpp index 1984ef5..2abac45 100644 --- a/zeiterfassungguilib/stripswidget.cpp +++ b/zeiterfassungguilib/stripswidget.cpp @@ -352,7 +352,8 @@ bool StripsWidget::createStrips() lastBooking = &endBooking; - bookingTimespan = timeAdd(bookingTimespan, timeBetween(startBooking.time, endBooking.time)); + auto currBookingDuration = timeBetween(startBooking.time, endBooking.time); + bookingTimespan = timeAdd(bookingTimespan, currBookingDuration); minimumTime = timeAdd(endBooking.time, QTime(0, 1)); while(timeAssignmentTime < bookingTimespan) @@ -362,7 +363,7 @@ bool StripsWidget::createStrips() errorMessage = tr("Missing time assignment! Missing: %0") .arg(tr("%0h").arg(timeBetween(timeAssignmentTime, bookingTimespan).toString(tr("HH:mm:ss")))); - appendBookingEndStrip(endBooking.id, endBooking.time); + appendBookingEndStrip(endBooking.id, endBooking.time, currBookingDuration); goto after; } @@ -408,7 +409,7 @@ bool StripsWidget::createStrips() .arg(bookingTimespan.toString(tr("HH:mm:ss"))); } - appendBookingEndStrip(endBooking.id, endBooking.time); + appendBookingEndStrip(endBooking.id, endBooking.time, currBookingDuration); if(timeAssignmentTime > bookingTimespan) goto after; @@ -552,7 +553,7 @@ QWidget *StripsWidget::appendBookingStartStrip(int id, const QTime &time) return widget; } -QWidget *StripsWidget::appendBookingEndStrip(int id, const QTime &time) +QWidget *StripsWidget::appendBookingEndStrip(int id, const QTime &time, const QTime &duration) { auto widget = m_mainWindow.stripFactory().createBookingEndStrip(this).release(); @@ -561,6 +562,11 @@ QWidget *StripsWidget::appendBookingEndStrip(int id, const QTime &time) else qWarning() << "no labelTime found!"; + if(auto labelDuration = widget->findChild(QStringLiteral("labelDuration"))) + labelDuration->setProperty("text", tr("%0h").arg(duration.toString(tr("HH:mm")))); + else + qWarning() << "no labelDuration found!"; + if(auto labelId = widget->findChild(QStringLiteral("labelId"))) labelId->setProperty("text", QString::number(id)); else diff --git a/zeiterfassungguilib/stripswidget.h b/zeiterfassungguilib/stripswidget.h index 182c9ce..38f1b61 100644 --- a/zeiterfassungguilib/stripswidget.h +++ b/zeiterfassungguilib/stripswidget.h @@ -74,7 +74,7 @@ private: QString buildProjectString(const QString &project) const; QWidget *appendBookingStartStrip(int id, const QTime &time); - QWidget *appendBookingEndStrip(int id, const QTime &time); + QWidget *appendBookingEndStrip(int id, const QTime &time, const QTime &duration); QWidget *appendTimeAssignmentStrip(int id, const QTime &duration, const QString &project, const QString &subproject, const QString &workpackage, const QString &text); diff --git a/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts b/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts index f2c1ce6..5c5b234 100644 --- a/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts +++ b/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts @@ -214,27 +214,27 @@ Über &zeiterfassung - + About &Qt Über &Qt - + &Today &Heute - + &Refresh everything Alles &neu laden - + &Settings &Einstellungen - + Help Hilfe @@ -393,7 +393,7 @@ Booking ID: %1 - + %0: %1 %0: %1 @@ -404,17 +404,19 @@ Booking ID: %1 - - + + + %0h %0h - - - - + + + + + HH:mm HH:mm @@ -424,15 +426,15 @@ Booking ID: %1 Kontierung fehlend! - - + + HH:mm:ss HH:mm:ss - + There is another booking after an unfinished time assignment. Booking ID: %0 Time assignment ID: %1 @@ -441,7 +443,7 @@ Time assignment ID: %1 - + There is another time assignment after an unfinished time assignment. Time assignment ID: %0 Time assignment ID: %1 @@ -460,12 +462,12 @@ Booking ID: %1 - + Missing time assignment! Missing: %0 Kontierung fehlend! %0 nicht kontiert - + Assigned time Kontierte Zeit @@ -480,14 +482,14 @@ Booking ID: %1 %0 (%1) - + Time assignment time longer than booking time! Time assignment: %0 Booking: %1 - + Strip rendering aborted due error. Your bookings and time assignments for this day are in an illegal state! @@ -533,7 +535,7 @@ Your bookings and time assignments for this day are in an illegal state!Ungültig - + Open Offen diff --git a/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts b/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts index 3c57104..d2dbf7d 100644 --- a/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts +++ b/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts @@ -214,27 +214,27 @@ - + About &Qt - + &Today - + &Refresh everything - + &Settings - + Help @@ -393,7 +393,7 @@ Booking ID: %1 - + %0: %1 @@ -404,17 +404,19 @@ Booking ID: %1 - - + + + %0h - - - - + + + + + HH:mm @@ -424,15 +426,15 @@ Booking ID: %1 - - + + HH:mm:ss - + There is another booking after an unfinished time assignment. Booking ID: %0 Time assignment ID: %1 @@ -441,7 +443,7 @@ Time assignment ID: %1 - + There is another time assignment after an unfinished time assignment. Time assignment ID: %0 Time assignment ID: %1 @@ -460,24 +462,24 @@ Booking ID: %1 - + Missing time assignment! Missing: %0 - + Time assignment time longer than booking time! Time assignment: %0 Booking: %1 - + Assigned time - + Strip rendering aborted due error. Your bookings and time assignments for this day are in an illegal state! @@ -533,7 +535,7 @@ Your bookings and time assignments for this day are in an illegal state! - + Open