Merge pull request #91 from 0xFEEDC0DE64/18-soll-ist-time

Implement comparison of soll-time [#18]
This commit is contained in:
Daniel Brunner
2018-05-25 20:38:33 +02:00
committed by 0xFEEDC0DE64
13 changed files with 279 additions and 52 deletions

View File

@@ -59,12 +59,12 @@ void GetAbsencesReply::requestFinished()
m_absences.append({
obj.value(QStringLiteral("altRepresentative")).toInt(),
obj.value(QStringLiteral("compositeId")).toString(),
QDate::fromString(QString::number(obj.value(QStringLiteral("end")).toInt()), QStringLiteral("yyyyMMdd")),
parseDate(obj.value(QStringLiteral("end"))),
obj.value(QStringLiteral("hourCategory")).toString(),
obj.value(QStringLiteral("openMarking")).toString(),
obj.value(QStringLiteral("persNr")).toInt(),
obj.value(QStringLiteral("representative")).toInt(),
QDate::fromString(QString::number(obj.value(QStringLiteral("start")).toInt()), QStringLiteral("yyyyMMdd")),
parseDate(obj.value(QStringLiteral("start"))),
obj.value(QStringLiteral("text")).toString()
});
}

View File

@@ -57,9 +57,9 @@ void GetBookingsReply::requestFinished()
m_bookings.append({
obj.value(QStringLiteral("bookingNr")).toInt(),
QDate::fromString(QString::number(obj.value(QStringLiteral("bookingDate")).toInt()), QStringLiteral("yyyyMMdd")),
QTime::fromString(QStringLiteral("%0").arg(obj.value(QStringLiteral("bookingTime")).toInt(), 6, 10, QChar('0')), QStringLiteral("HHmmss")),
QTime::fromString(QStringLiteral("%0").arg(obj.value(QStringLiteral("bookingTimespan")).toInt(), 6, 10, QChar('0')), QStringLiteral("HHmmss")),
parseDate(obj.value(QStringLiteral("bookingDate"))),
parseTime(obj.value(QStringLiteral("bookingTime"))),
parseTime(obj.value(QStringLiteral("bookingTimespan"))),
obj.value(QStringLiteral("bookingType")).toString(),
obj.value(QStringLiteral("text")).toString()
});

View File

@@ -0,0 +1,74 @@
#include "getdayinforeply.h"
#include <QDebug>
#include <QJsonParseError>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonValue>
#include <QJsonObject>
#include "zeiterfassungapi.h"
GetDayinfoReply::GetDayinfoReply(std::unique_ptr<QNetworkReply> &&reply, ZeiterfassungApi *zeiterfassung) :
ZeiterfassungReply(zeiterfassung),
m_reply(std::move(reply))
{
connect(m_reply.get(), &QNetworkReply::finished, this, &GetDayinfoReply::requestFinished);
}
const QVector<GetDayinfoReply::Dayinfo> &GetDayinfoReply::dayinfos() const
{
return m_dayinfos;
}
void GetDayinfoReply::requestFinished()
{
if(m_reply->error() != QNetworkReply::NoError)
{
setSuccess(false);
setMessage(tr("Request error occured: %0").arg(m_reply->errorString()));
goto end;
}
{
QJsonParseError error;
QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll(), &error);
if(error.error != QJsonParseError::NoError)
{
setSuccess(false);
setMessage(tr("Parsing JSON failed: %0").arg(error.errorString()));
goto end;
}
if(!document.isArray())
{
setSuccess(false);
setMessage(tr("JSON document is not an array!"));
goto end;
}
auto arr = document.array();
setSuccess(true);
m_dayinfos.clear();
m_dayinfos.reserve(arr.count());
for(const auto &val : arr)
{
auto obj = val.toObject();
m_dayinfos.append({
obj.value(QStringLiteral("className")).toString(),
obj.value(QStringLiteral("persNr")).toInt(),
parseDate(obj.value(QStringLiteral("date"))),
parseTime(obj.value(QStringLiteral("ist"))),
parseTime(obj.value(QStringLiteral("soll"))),
obj.value(QStringLiteral("compositeId")).toString()
});
}
}
end:
m_reply = Q_NULLPTR;
Q_EMIT finished();
}

View File

@@ -0,0 +1,40 @@
#pragma once
#include <memory>
#include <QString>
#include <QDate>
#include <QNetworkReply>
#include <QVector>
#include "zeiterfassungcorelib_global.h"
#include "zeiterfassungreply.h"
class ZeiterfassungApi;
class ZEITERFASSUNGCORELIBSHARED_EXPORT GetDayinfoReply : public ZeiterfassungReply
{
Q_OBJECT
public:
explicit GetDayinfoReply(std::unique_ptr<QNetworkReply> &&reply, ZeiterfassungApi *zeiterfassung);
struct Dayinfo
{
QString className;
int userId;
QDate date;
QTime ist;
QTime soll;
QString compositeId;
};
const QVector<Dayinfo> &dayinfos() const;
private Q_SLOTS:
void requestFinished();
private:
std::unique_ptr<QNetworkReply> m_reply;
QVector<Dayinfo> m_dayinfos;
};

View File

@@ -60,9 +60,9 @@ void GetTimeAssignmentsReply::requestFinished()
m_timeAssignments.append({
obj.value(QStringLiteral("bookingNr")).toInt(),
QDate::fromString(QString::number(obj.value(QStringLiteral("bookingDate")).toInt()), QStringLiteral("yyyyMMdd")),
QTime::fromString(QStringLiteral("%0").arg(obj.value(QStringLiteral("bookingTime")).toInt(), 6, 10, QChar('0')), QStringLiteral("HHmmss")),
QTime::fromString(QStringLiteral("%0").arg(obj.value(QStringLiteral("bookingTimespan")).toInt(), 6, 10, QChar('0')), QStringLiteral("HHmmss")),
parseDate(obj.value(QStringLiteral("bookingDate"))),
parseTime(obj.value(QStringLiteral("bookingTime"))),
parseTime(obj.value(QStringLiteral("bookingTimespan"))),
obj.value(QStringLiteral("text")).toString(),
koWertList.at(0).toObject().value(QStringLiteral("value")).toString(),
koWertList.at(1).toObject().value(QStringLiteral("value")).toString(),

View File

@@ -150,8 +150,8 @@ void GetUserInfoReply::request1Finished()
m_userInfo.street = obj.value(QStringLiteral("gemeinde")).toString();
m_userInfo.city = obj.value(QStringLiteral("ort")).toString();
m_userInfo.employedSince = QDate::fromString(QString::number(obj.value(QStringLiteral("angFrom")).toInt()), QStringLiteral("yyyyMMdd"));
m_userInfo.employedTill = QDate::fromString(QString::number(obj.value(QStringLiteral("angTill")).toInt()), QStringLiteral("yyyyMMdd"));
m_userInfo.employedSince = parseDate(obj.value(QStringLiteral("angFrom")));
m_userInfo.employedTill = parseDate(obj.value(QStringLiteral("angTill")));
m_userInfo.placeOfBirth = obj.value(QStringLiteral("gebOrt")).toString();
m_userInfo.zipcode = obj.value(QStringLiteral("plz")).toString();
m_userInfo.religion = obj.value(QStringLiteral("religion")).toString();

View File

@@ -1,6 +1,7 @@
#include "zeiterfassungreply.h"
#include <QEventLoop>
#include <QJsonValue>
#include "zeiterfassungapi.h"
@@ -29,6 +30,22 @@ void ZeiterfassungReply::waitForFinished()
eventLoop.exec();
}
QDate ZeiterfassungReply::parseDate(const QJsonValue &value)
{
if(value.isNull())
return QDate();
return QDate::fromString(QString::number(value.toInt()), QStringLiteral("yyyyMMdd"));
}
QTime ZeiterfassungReply::parseTime(const QJsonValue &value)
{
if(value.isNull())
return QTime();
return QTime::fromString(QStringLiteral("%0").arg(value.toInt(), 6, 10, QChar('0')), QStringLiteral("HHmmss"));
}
ZeiterfassungApi *ZeiterfassungReply::zeiterfassung() const
{
return m_zeiterfassung;

View File

@@ -4,6 +4,8 @@
#include "zeiterfassungcorelib_global.h"
class QJsonValue;
class ZeiterfassungApi;
class ZEITERFASSUNGCORELIBSHARED_EXPORT ZeiterfassungReply : public QObject
@@ -18,6 +20,9 @@ public:
void waitForFinished();
static QDate parseDate(const QJsonValue &value);
static QTime parseTime(const QJsonValue &value);
Q_SIGNALS:
void finished();

View File

@@ -24,6 +24,7 @@
#include "replies/getreportreply.h"
#include "replies/getpresencestatusreply.h"
#include "replies/getabsencesreply.h"
#include "replies/getdayinforeply.h"
ZeiterfassungApi::ZeiterfassungApi(const QUrl &url, QObject *parent) :
QObject(parent),
@@ -81,8 +82,8 @@ std::unique_ptr<GetBookingsReply> ZeiterfassungApi::doGetBookings(int userId, co
{
QNetworkRequest request(QUrl(QStringLiteral("%0json/bookings?start=%1&end=%2&pnrLst=%3")
.arg(m_url.toString())
.arg(start.toString(QStringLiteral("yyyyMMdd")))
.arg(end.toString(QStringLiteral("yyyyMMdd")))
.arg(formatDate(start))
.arg(formatDate(end))
.arg(userId)));
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
@@ -98,9 +99,9 @@ std::unique_ptr<CreateBookingReply> ZeiterfassungApi::doCreateBooking(int userId
QJsonObject obj;
obj[QStringLiteral("persNr")] = userId;
obj[QStringLiteral("bookingDate")] = date.toString(QStringLiteral("yyyyMMdd")).toInt();
obj[QStringLiteral("bookingTime")] = time.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingTimespan")] = timespan.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingDate")] = formatDate(date).toInt();
obj[QStringLiteral("bookingTime")] = formatTime(time).toInt();
obj[QStringLiteral("bookingTimespan")] = formatTime(timespan).toInt();
obj[QStringLiteral("bookingType")] = type;
obj[QStringLiteral("hourCategory")] = QStringLiteral("");
obj[QStringLiteral("empfEinh")] = QStringLiteral("");
@@ -122,9 +123,9 @@ std::unique_ptr<UpdateBookingReply> ZeiterfassungApi::doUpdateBooking(int bookin
QJsonObject obj;
obj[QStringLiteral("bookingNr")] = bookingId;
obj[QStringLiteral("persNr")] = userId;
obj[QStringLiteral("bookingDate")] = date.toString(QStringLiteral("yyyyMMdd")).toInt();
obj[QStringLiteral("bookingTime")] = time.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingTimespan")] = timespan.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingDate")] = formatDate(date).toInt();
obj[QStringLiteral("bookingTime")] = formatTime(time).toInt();
obj[QStringLiteral("bookingTimespan")] = formatTime(timespan).toInt();
obj[QStringLiteral("bookingType")] = type;
obj[QStringLiteral("hourCategory")] = QStringLiteral("");
obj[QStringLiteral("empfEinh")] = QStringLiteral("");
@@ -150,8 +151,8 @@ std::unique_ptr<GetTimeAssignmentsReply> ZeiterfassungApi::doGetTimeAssignments(
{
QNetworkRequest request(QUrl(QStringLiteral("%0json/azebooking?start=%1&end=%2&pnrLst=%3")
.arg(m_url.toString())
.arg(start.toString(QStringLiteral("yyyyMMdd")))
.arg(end.toString(QStringLiteral("yyyyMMdd")))
.arg(formatDate(start))
.arg(formatDate(end))
.arg(userId)));
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
@@ -170,9 +171,9 @@ std::unique_ptr<CreateTimeAssignmentReply> ZeiterfassungApi::doCreateTimeAssignm
QJsonObject obj;
obj[QStringLiteral("bookingNr")] = QJsonValue::Null;
obj[QStringLiteral("persNr")] = userId;
obj[QStringLiteral("bookingDate")] = date.toString(QStringLiteral("yyyyMMdd")).toInt();
obj[QStringLiteral("bookingTime")] = time.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingTimespan")] = timespan.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingDate")] = formatDate(date).toInt();
obj[QStringLiteral("bookingTime")] = formatTime(time).toInt();
obj[QStringLiteral("bookingTimespan")] = formatTime(timespan).toInt();
obj[QStringLiteral("text")] = text;
{
QJsonArray koWertList;
@@ -211,9 +212,9 @@ std::unique_ptr<UpdateTimeAssignmentReply> ZeiterfassungApi::doUpdateTimeAssignm
QJsonObject obj;
obj[QStringLiteral("bookingNr")] = timeAssignmentId;
obj[QStringLiteral("persNr")] = userId;
obj[QStringLiteral("bookingDate")] = date.toString(QStringLiteral("yyyyMMdd")).toInt();
obj[QStringLiteral("bookingTime")] = time.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingTimespan")] = timespan.toString(QStringLiteral("Hmmss")).toInt();
obj[QStringLiteral("bookingDate")] = formatDate(date).toInt();
obj[QStringLiteral("bookingTime")] = formatTime(time).toInt();
obj[QStringLiteral("bookingTimespan")] = formatTime(timespan).toInt();
obj[QStringLiteral("bookingType")] = QJsonValue::Null;
obj[QStringLiteral("hourCategory")] = QJsonValue::Null;
obj[QStringLiteral("bewEinh")] = QJsonValue::Null;
@@ -260,7 +261,7 @@ std::unique_ptr<GetProjectsReply> ZeiterfassungApi::doGetProjects(int userId, co
QNetworkRequest request(QUrl(QStringLiteral("%0json/combobox?persnr=%1&date=%2&dqkey=KOST&kowert0=&kowert1=&kowert2=&term=")
.arg(m_url.toString())
.arg(userId)
.arg(date.toString(QStringLiteral("yyyyMMdd")))));
.arg(formatDate(date))));
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
return std::make_unique<GetProjectsReply>(std::unique_ptr<QNetworkReply>(m_manager->get(request)), this);
@@ -271,7 +272,7 @@ std::unique_ptr<GetReportReply> ZeiterfassungApi::doGetReport(int userId, const
QNetworkRequest request(QUrl(QStringLiteral("%0json/auswertung/month?persNr=%1&date=%2")
.arg(m_url.toString())
.arg(userId)
.arg(date.toString(QStringLiteral("yyyyMMdd")))));
.arg(formatDate(date))));
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
return std::make_unique<GetReportReply>(std::unique_ptr<QNetworkReply>(m_manager->get(request)), this);
@@ -289,10 +290,32 @@ std::unique_ptr<GetAbsencesReply> ZeiterfassungApi::doGetAbsences(int userId, co
{
QNetworkRequest request(QUrl(QStringLiteral("%0json/fulldayAbsences?start=%1&end=%2&pnrLst=%3")
.arg(m_url.toString())
.arg(start.toString(QStringLiteral("yyyyMMdd")))
.arg(end.toString(QStringLiteral("yyyyMMdd")))
.arg(formatDate(start))
.arg(formatDate(end))
.arg(userId)));
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
return std::make_unique<GetAbsencesReply>(std::unique_ptr<QNetworkReply>(m_manager->get(request)), this);
}
std::unique_ptr<GetDayinfoReply> ZeiterfassungApi::doGetDayinfo(int userId, const QDate &start, const QDate &end)
{
QNetworkRequest request(QUrl(QStringLiteral("%0json/dayinfo?start=%1&end=%2&pnrLst=%3")
.arg(m_url.toString())
.arg(formatDate(start))
.arg(formatDate(end))
.arg(userId)));
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
return std::make_unique<GetDayinfoReply>(std::unique_ptr<QNetworkReply>(m_manager->get(request)), this);
}
QString ZeiterfassungApi::formatDate(const QDate &date)
{
return date.toString(QStringLiteral("yyyyMMdd"));
}
QString ZeiterfassungApi::formatTime(const QTime &time)
{
return time.toString(QStringLiteral("Hmmss"));
}

View File

@@ -27,6 +27,7 @@ class GetProjectsReply;
class GetReportReply;
class GetPresenceStatusReply;
class GetAbsencesReply;
class GetDayinfoReply;
class ZEITERFASSUNGCORELIBSHARED_EXPORT ZeiterfassungApi : public QObject
{
@@ -66,8 +67,12 @@ public:
std::unique_ptr<GetReportReply> doGetReport(int userId, const QDate &date);
std::unique_ptr<GetPresenceStatusReply> doGetPresenceStatus();
std::unique_ptr<GetAbsencesReply> doGetAbsences(int userId, const QDate &start, const QDate &end);
std::unique_ptr<GetDayinfoReply> doGetDayinfo(int userId, const QDate &start, const QDate &end);
private:
static QString formatDate(const QDate &date);
static QString formatTime(const QTime &time);
QUrl m_url;
QNetworkAccessManager *m_manager;
};

View File

@@ -17,6 +17,7 @@ SOURCES += timeutils.cpp \
replies/deletetimeassignmentreply.cpp \
replies/getabsencesreply.cpp \
replies/getbookingsreply.cpp \
replies/getdayinforeply.cpp \
replies/getpresencestatusreply.cpp \
replies/getprojectsreply.cpp \
replies/getreportreply.cpp \
@@ -38,6 +39,7 @@ HEADERS += timeutils.h \
replies/deletetimeassignmentreply.h \
replies/getabsencesreply.h \
replies/getbookingsreply.h \
replies/getdayinforeply.h \
replies/getpresencestatusreply.h \
replies/getprojectsreply.h \
replies/getreportreply.h \

View File

@@ -12,10 +12,14 @@
#include "timeutils.h"
#include "stripfactory.h"
const QStringList StripsWidget::m_weekDays { tr("Monday"), tr("Tuesday"),
tr("Wednesday"), tr("Thursday"), tr("Friday"), tr("Saturday"), tr("Sunday") };
StripsWidget::StripsWidget(MainWindow &mainWindow, QWidget *parent) :
QFrame(parent),
m_mainWindow(mainWindow),
m_refreshing(false),
m_refreshingDayinfo(false),
m_refreshingBookings(false),
m_refreshingTimeAssignments(false),
m_startEnabled(false),
@@ -24,15 +28,20 @@ StripsWidget::StripsWidget(MainWindow &mainWindow, QWidget *parent) :
auto layout = new QVBoxLayout(this);
m_headerLayout = new QHBoxLayout;
m_label = new QLabel;
m_label[0] = new QLabel;
{
auto font = m_label->font();
auto font = m_label[0]->font();
font.setBold(true);
m_label->setFont(font);
m_label[0]->setFont(font);
}
m_headerLayout->addWidget(m_label, 1);
m_headerLayout->addWidget(m_label[0], 1);
layout->addLayout(m_headerLayout);
m_label[1] = new QLabel;
layout->addWidget(m_label[1]);
m_stripsLayout = new QVBoxLayout;
layout->addLayout(m_stripsLayout);
@@ -56,9 +65,14 @@ QBoxLayout *StripsWidget::stripsLayout() const
return m_stripsLayout;
}
QLabel *StripsWidget::label() const
QLabel *StripsWidget::label0() const
{
return m_label;
return m_label[0];
}
QLabel *StripsWidget::label1() const
{
return m_label[1];
}
const QDate &StripsWidget::date() const
@@ -73,12 +87,11 @@ void StripsWidget::setDate(const QDate &date)
Q_EMIT dateChanged(m_date = date);
if(m_date.isValid())
m_label->setText(tr("%0 (%1)")
.arg(std::array<QString, 7> { tr("Monday"), tr("Tuesday"), tr("Wednesday"), tr("Thursday"),
tr("Friday"), tr("Saturday"), tr("Sunday") }[m_date.dayOfWeek() - 1])
m_label[0]->setText(tr("%0 (%1)")
.arg(m_weekDays.at(m_date.dayOfWeek() - 1))
.arg(m_date.toString(tr("dd.MM.yyyy"))));
else
m_label->setText(tr("Invalid"));
m_label[0]->setText(tr("Invalid"));
refresh();
}
@@ -98,6 +111,11 @@ void StripsWidget::setHighlighted(bool highlighted)
}
}
const GetDayinfoReply::Dayinfo &StripsWidget::dayinfo() const
{
return m_dayinfo;
}
const QVector<GetBookingsReply::Booking> &StripsWidget::bookings() const
{
return m_bookings;
@@ -128,6 +146,11 @@ bool StripsWidget::refreshing() const
return m_refreshing;
}
bool StripsWidget::refreshingDayinfo() const
{
return m_refreshingDayinfo;
}
bool StripsWidget::refreshingBookings() const
{
return m_refreshingBookings;
@@ -152,12 +175,34 @@ void StripsWidget::refresh()
{
clearStrips();
m_label[1]->setText(QString());
m_stripsLayout->addWidget(new QLabel(tr("Loading..."), this));
refreshDayinfo();
refreshBookings(false);
refreshTimeAssignments(false);
}
void StripsWidget::refreshDayinfo()
{
if(!m_date.isValid())
{
qWarning() << "invalid date";
return;
}
if(!m_refreshing)
Q_EMIT refreshingChanged(m_refreshing = true);
if(!m_refreshingDayinfo)
Q_EMIT refreshingDayinfoChanged(m_refreshingDayinfo = true);
invalidateValues();
m_getDayinfoReply = m_mainWindow.erfassung().doGetDayinfo(m_mainWindow.userInfo().userId, m_date, m_date);
connect(m_getDayinfoReply.get(), &ZeiterfassungReply::finished, this, &StripsWidget::getDayinfoFinished);
}
void StripsWidget::refreshBookings(bool createLabel)
{
if(!m_date.isValid())
@@ -483,6 +528,13 @@ void StripsWidget::clearStrips()
}
}
void StripsWidget::getDayinfoFinished()
{
Q_EMIT dayinfoChanged(m_dayinfo = m_getDayinfoReply->dayinfos().first());
m_label[1]->setText(QString("%0 - %1").arg(m_dayinfo.soll.toString("HH:mm")).arg(m_dayinfo.ist.toString("HH:mm")));
}
void StripsWidget::getBookingsFinished()
{
Q_EMIT bookingsChanged(m_bookings = m_getBookingsReply->bookings());
@@ -490,13 +542,11 @@ void StripsWidget::getBookingsFinished()
if(m_refreshingBookings)
Q_EMIT refreshingBookingsChanged(m_refreshingBookings = false);
if(!m_getTimeAssignmentsReply)
{
if(m_refreshing)
if(m_refreshing && !m_getDayinfoReply && !m_getTimeAssignmentsReply)
Q_EMIT refreshingChanged(m_refreshing = false);
if(!m_getTimeAssignmentsReply)
createStrips();
}
m_getBookingsReply = Q_NULLPTR;
}
@@ -508,13 +558,11 @@ void StripsWidget::getTimeAssignmentsFinished()
if(m_refreshingTimeAssignments)
Q_EMIT refreshingTimeAssignmentsChanged(m_refreshingTimeAssignments = false);
if(!m_getBookingsReply)
{
if(m_refreshing)
if(m_refreshing && !m_getDayinfoReply && !m_getBookingsReply)
Q_EMIT refreshingChanged(m_refreshing = false);
if(!m_getBookingsReply)
createStrips();
}
m_getTimeAssignmentsReply = Q_NULLPTR;
}

View File

@@ -6,6 +6,7 @@
#include <QTime>
#include "zeiterfassungguilib_global.h"
#include "replies/getdayinforeply.h"
#include "replies/getbookingsreply.h"
#include "replies/gettimeassignmentsreply.h"
@@ -27,7 +28,8 @@ public:
QBoxLayout *headerLayout() const;
QBoxLayout *stripsLayout() const;
QLabel *label() const;
QLabel *label0() const;
QLabel *label1() const;
const QDate &date() const;
void setDate(const QDate &date);
@@ -35,6 +37,7 @@ public:
bool highlighted() const;
void setHighlighted(bool highlighted);
const GetDayinfoReply::Dayinfo &dayinfo() const;
const QVector<GetBookingsReply::Booking> &bookings() const;
const QVector<GetTimeAssignmentsReply::TimeAssignment> &timeAssignments() const;
@@ -42,12 +45,14 @@ public:
const QTime &lastTimeAssignmentStart() const;
const QTime &minimumTime() const;
bool refreshing() const;
bool refreshingDayinfo() const;
bool refreshingBookings() const;
bool refreshingTimeAssignments() const;
bool startEnabled() const;
bool endEnabled() const;
void refresh();
void refreshDayinfo();
void refreshBookings(bool createLabel = true);
void refreshTimeAssignments(bool createLabel = true);
bool createStrips();
@@ -57,6 +62,7 @@ Q_SIGNALS:
void dateChanged(const QDate &date);
void highlightedChanged(bool highlighted);
void dayinfoChanged(const GetDayinfoReply::Dayinfo &dayinfo);
void bookingsChanged(const QVector<GetBookingsReply::Booking> &bookings);
void timeAssignmentsChanged(const QVector<GetTimeAssignmentsReply::TimeAssignment> &timeAssignments);
@@ -64,12 +70,14 @@ Q_SIGNALS:
void lastTimeAssignmentStartChanged(const QTime &lastTimeAssignmentStart);
void minimumTimeChanged(const QTime &minimumTime);
void refreshingChanged(bool refreshing);
void refreshingDayinfoChanged(bool refreshingDayinfo);
void refreshingBookingsChanged(bool refreshingBookings);
void refreshingTimeAssignmentsChanged(bool refreshingTimeAssignments);
void startEnabledChanged(bool startEnabled);
void endEnabledChanged(bool endEnabled);
private Q_SLOTS:
void getDayinfoFinished();
void getBookingsFinished();
void getTimeAssignmentsFinished();
@@ -87,11 +95,12 @@ private:
QBoxLayout *m_headerLayout;
QBoxLayout *m_stripsLayout;
QLabel *m_label;
QLabel *m_label[2];
QDate m_date;
bool m_highlighted;
GetDayinfoReply::Dayinfo m_dayinfo;
QVector<GetBookingsReply::Booking> m_bookings;
QVector<GetTimeAssignmentsReply::TimeAssignment> m_timeAssignments;
@@ -99,11 +108,15 @@ private:
QTime m_lastTimeAssignmentStart;
QTime m_minimumTime;
bool m_refreshing;
bool m_refreshingDayinfo;
bool m_refreshingBookings;
bool m_refreshingTimeAssignments;
bool m_startEnabled;
bool m_endEnabled;
std::unique_ptr<GetDayinfoReply> m_getDayinfoReply;
std::unique_ptr<GetBookingsReply> m_getBookingsReply;
std::unique_ptr<GetTimeAssignmentsReply> m_getTimeAssignmentsReply;
static const QStringList m_weekDays;
};