From ece41d8663f225756a689244176226fcd01bd3e1 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 <0xFEEDC0DE64@gmail.com> Date: Sun, 10 Dec 2017 11:56:00 +0100 Subject: [PATCH] Added a bunch of API reply classes --- dialogs/aboutmedialog.cpp | 2 +- dialogs/aboutmedialog.h | 6 +- main.cpp | 16 ++-- mainwindow.cpp | 34 ++++----- mainwindow.h | 10 +-- models/bookingsmodel.cpp | 14 ++-- models/bookingsmodel.h | 14 ++-- models/timeassignmentsmodel.cpp | 14 ++-- models/timeassignmentsmodel.h | 14 ++-- replies/createbookingreply.cpp | 6 ++ replies/createbookingreply.h | 10 +++ replies/createtimeassignmentreply.cpp | 6 ++ replies/createtimeassignmentreply.h | 10 +++ replies/deletebookingreply.cpp | 6 ++ replies/deletebookingreply.h | 10 +++ replies/deletetimeassignment.cpp | 6 ++ replies/deletetimeassignment.h | 10 +++ replies/getauswertungreply.cpp | 6 ++ replies/getauswertungreply.h | 10 +++ replies/getbookingsreply.cpp | 6 ++ replies/getbookingsreply.h | 10 +++ replies/getprojectsreply.cpp | 6 ++ replies/getprojectsreply.h | 10 +++ replies/gettimeassignmentsreply.cpp | 6 ++ replies/gettimeassignmentsreply.h | 10 +++ replies/loginpagereply.cpp | 6 ++ replies/loginpagereply.h | 10 +++ replies/loginreply.cpp | 6 ++ replies/loginreply.h | 10 +++ replies/updatebookingreply.cpp | 6 ++ replies/updatebookingreply.h | 10 +++ replies/updatetimeassignmentreply.cpp | 6 ++ replies/updatetimeassignmentreply.h | 10 +++ replies/userinforeply.cpp | 6 ++ replies/userinforeply.h | 10 +++ stripswidget.cpp | 8 +- stripswidget.h | 6 +- zeiterfassung.pro | 34 ++++++++- zeiterfassung.cpp => zeiterfassungapi.cpp | 92 +++++++++++------------ zeiterfassung.h => zeiterfassungapi.h | 10 +-- 40 files changed, 358 insertions(+), 124 deletions(-) create mode 100644 replies/createbookingreply.cpp create mode 100644 replies/createbookingreply.h create mode 100644 replies/createtimeassignmentreply.cpp create mode 100644 replies/createtimeassignmentreply.h create mode 100644 replies/deletebookingreply.cpp create mode 100644 replies/deletebookingreply.h create mode 100644 replies/deletetimeassignment.cpp create mode 100644 replies/deletetimeassignment.h create mode 100644 replies/getauswertungreply.cpp create mode 100644 replies/getauswertungreply.h create mode 100644 replies/getbookingsreply.cpp create mode 100644 replies/getbookingsreply.h create mode 100644 replies/getprojectsreply.cpp create mode 100644 replies/getprojectsreply.h create mode 100644 replies/gettimeassignmentsreply.cpp create mode 100644 replies/gettimeassignmentsreply.h create mode 100644 replies/loginpagereply.cpp create mode 100644 replies/loginpagereply.h create mode 100644 replies/loginreply.cpp create mode 100644 replies/loginreply.h create mode 100644 replies/updatebookingreply.cpp create mode 100644 replies/updatebookingreply.h create mode 100644 replies/updatetimeassignmentreply.cpp create mode 100644 replies/updatetimeassignmentreply.h create mode 100644 replies/userinforeply.cpp create mode 100644 replies/userinforeply.h rename zeiterfassung.cpp => zeiterfassungapi.cpp (89%) rename zeiterfassung.h => zeiterfassungapi.h (96%) diff --git a/dialogs/aboutmedialog.cpp b/dialogs/aboutmedialog.cpp index 57e00cb..9747cb6 100644 --- a/dialogs/aboutmedialog.cpp +++ b/dialogs/aboutmedialog.cpp @@ -1,7 +1,7 @@ #include "aboutmedialog.h" #include "ui_aboutmedialog.h" -AboutMeDialog::AboutMeDialog(const Zeiterfassung::UserInfo &userInfo, QWidget *parent) : +AboutMeDialog::AboutMeDialog(const ZeiterfassungApi::UserInfo &userInfo, QWidget *parent) : QDialog(parent), ui(new Ui::AboutMeDialog), m_userInfo(userInfo) diff --git a/dialogs/aboutmedialog.h b/dialogs/aboutmedialog.h index bbb76e1..9327483 100644 --- a/dialogs/aboutmedialog.h +++ b/dialogs/aboutmedialog.h @@ -3,7 +3,7 @@ #include -#include "zeiterfassung.h" +#include "zeiterfassungapi.h" namespace Ui { class AboutMeDialog; } @@ -12,12 +12,12 @@ class AboutMeDialog : public QDialog Q_OBJECT public: - explicit AboutMeDialog(const Zeiterfassung::UserInfo &userInfo, QWidget *parent = 0); + explicit AboutMeDialog(const ZeiterfassungApi::UserInfo &userInfo, QWidget *parent = 0); ~AboutMeDialog(); private: Ui::AboutMeDialog *ui; - const Zeiterfassung::UserInfo &m_userInfo; + const ZeiterfassungApi::UserInfo &m_userInfo; }; #endif // ABOUTMEDIALOG_H diff --git a/main.cpp b/main.cpp index 41cd4d0..ca5fac1 100755 --- a/main.cpp +++ b/main.cpp @@ -10,7 +10,7 @@ #include "zeiterfassungsettings.h" #include "dialogs/languageselectiondialog.h" -#include "zeiterfassung.h" +#include "zeiterfassungapi.h" #include "eventloopwithstatus.h" #include "dialogs/authenticationdialog.h" #include "mainwindow.h" @@ -95,11 +95,11 @@ int main(int argc, char *argv[]) splashScreen.showMessage(QCoreApplication::translate("main", "Loading login page...")); - Zeiterfassung erfassung(settings.url(), &app); + ZeiterfassungApi erfassung(settings.url(), &app); { EventLoopWithStatus eventLoop; - QObject::connect(&erfassung, &Zeiterfassung::loginPageFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + QObject::connect(&erfassung, &ZeiterfassungApi::loginPageFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); again1: erfassung.doLoginPage(); @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) { EventLoopWithStatus eventLoop; - QObject::connect(&erfassung, &Zeiterfassung::loginFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + QObject::connect(&erfassung, &ZeiterfassungApi::loginFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); again2: erfassung.doLogin(settings.username(), settings.password()); @@ -160,17 +160,17 @@ int main(int argc, char *argv[]) splashScreen.showMessage(QCoreApplication::translate("main", "Getting user information...")); - Zeiterfassung::UserInfo userInfo; + ZeiterfassungApi::UserInfo userInfo; { EventLoopWithStatus eventLoop; - QObject::connect(&erfassung, &Zeiterfassung::userInfoFinished, - [&](bool success, const QString &message, const Zeiterfassung::UserInfo &_userInfo) { + QObject::connect(&erfassung, &ZeiterfassungApi::userInfoFinished, + [&](bool success, const QString &message, const ZeiterfassungApi::UserInfo &_userInfo) { Q_UNUSED(message) if(success) userInfo = _userInfo; }); - QObject::connect(&erfassung, &Zeiterfassung::userInfoFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + QObject::connect(&erfassung, &ZeiterfassungApi::userInfoFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); erfassung.doUserInfo(); eventLoop.exec(); diff --git a/mainwindow.cpp b/mainwindow.cpp index f68ec36..434d314 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -27,7 +27,7 @@ #include "models/bookingsmodel.h" #include "models/timeassignmentsmodel.h" -MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung, const Zeiterfassung::UserInfo &userInfo, QWidget *parent) : +MainWindow::MainWindow(ZeiterfassungSettings &settings, ZeiterfassungApi &erfassung, const ZeiterfassungApi::UserInfo &userInfo, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), m_settings(settings), @@ -107,7 +107,7 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung ui->timeEditTime->setTime(timeNormalise(QTime::currentTime())); - connect(&m_erfassung, &Zeiterfassung::getProjectsFinished, + connect(&m_erfassung, &ZeiterfassungApi::getProjectsFinished, this, &MainWindow::getProjekctsFinished); erfassung.doGetProjects(userInfo.userId, QDate::currentDate()); @@ -220,7 +220,7 @@ void MainWindow::refresh(bool forceAuswertung) if(m_erfassung.doGetAuswertung(m_userInfo.userId, auswertungDate)) { m_auswertungDate = auswertungDate; - connect(&m_erfassung, &Zeiterfassung::getAuswertungFinished, + connect(&m_erfassung, &ZeiterfassungApi::getAuswertungFinished, this, &MainWindow::getAuswertungFinished); } @@ -232,9 +232,9 @@ void MainWindow::refresh(bool forceAuswertung) } } -void MainWindow::getProjekctsFinished(bool success, const QString &message, const QVector &projects) +void MainWindow::getProjekctsFinished(bool success, const QString &message, const QVector &projects) { - disconnect(&m_erfassung, &Zeiterfassung::getProjectsFinished, + disconnect(&m_erfassung, &ZeiterfassungApi::getProjectsFinished, this, &MainWindow::getProjekctsFinished); if(!success) @@ -253,7 +253,7 @@ void MainWindow::getProjekctsFinished(bool success, const QString &message, cons void MainWindow::getAuswertungFinished(bool success, const QString &message, const QByteArray &content) { - disconnect(&m_erfassung, &Zeiterfassung::getAuswertungFinished, + disconnect(&m_erfassung, &ZeiterfassungApi::getAuswertungFinished, this, &MainWindow::getAuswertungFinished); if(!success) @@ -359,7 +359,7 @@ void MainWindow::contextMenuBooking(const QPoint &pos) if(dialog.exec() == QDialog::Accepted) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::updateBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::updateBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doUpdateBooking(booking.id, m_userInfo.userId, ui->dateEditDate->date(), dialog.getTime(), dialog.getTimespan(), @@ -416,7 +416,7 @@ void MainWindow::contextMenuBooking(const QPoint &pos) if(msgBox.exec() == QMessageBox::Yes) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::deleteBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::deleteBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doDeleteBooking(booking.id); eventLoop.exec(); @@ -473,7 +473,7 @@ void MainWindow::contextMenuBooking(const QPoint &pos) if(dialog.exec() == QDialog::Accepted) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::createBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::createBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doCreateBooking(m_userInfo.userId, ui->dateEditDate->date(), dialog.getTime(), dialog.getTimespan(), @@ -549,7 +549,7 @@ void MainWindow::contextMenuTimeAssignment(const QPoint &pos) if(dialog.exec() == QDialog::Accepted) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doUpdateTimeAssignment(timeAssignment.id, m_userInfo.userId, ui->dateEditDate->date(), dialog.getTime(), dialog.getTimespan(), @@ -612,7 +612,7 @@ void MainWindow::contextMenuTimeAssignment(const QPoint &pos) if(msgBox.exec() == QMessageBox::Yes) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::deleteTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::deleteTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doDeleteTimeAssignment(timeAssignment.id); eventLoop.exec(); @@ -668,7 +668,7 @@ void MainWindow::contextMenuTimeAssignment(const QPoint &pos) if(dialog.exec() == QDialog::Accepted) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::createTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::createTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doCreateTimeAssignment(m_userInfo.userId, ui->dateEditDate->date(), dialog.getTime(), dialog.getTimespan(), @@ -731,7 +731,7 @@ void MainWindow::pushButtonStartPressed() m_bookingsModel->bookings().rbegin()->type == QStringLiteral("G")) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::createBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::createBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doCreateBooking(m_userInfo.userId, ui->dateEditDate->date(), timeNormalise(ui->timeEditTime->time()), QTime(0, 0), @@ -754,7 +754,7 @@ void MainWindow::pushButtonStartPressed() if(timeAssignment.timespan == QTime(0, 0)) { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); auto timespan = timeBetween(m_stripsWidgets[0]->lastTimeAssignmentStart(), ui->timeEditTime->time()); @@ -776,7 +776,7 @@ void MainWindow::pushButtonStartPressed() } EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::createTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::createTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doCreateTimeAssignment(m_userInfo.userId, ui->dateEditDate->date(), timeAssignmentTime, QTime(0, 0), @@ -808,7 +808,7 @@ void MainWindow::pushButtonEndPressed() Q_ASSERT(timeAssignment.timespan == QTime(0, 0)); EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); auto timespan = timeBetween(m_stripsWidgets[0]->lastTimeAssignmentStart(), ui->timeEditTime->time()); @@ -828,7 +828,7 @@ void MainWindow::pushButtonEndPressed() { EventLoopWithStatus eventLoop; - connect(&m_erfassung, &Zeiterfassung::createBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); + connect(&m_erfassung, &ZeiterfassungApi::createBookingFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus); m_erfassung.doCreateBooking(m_userInfo.userId, ui->dateEditDate->date(), timeNormalise(ui->timeEditTime->time()), QTime(0, 0), diff --git a/mainwindow.h b/mainwindow.h index fd1d657..76e8b22 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -4,7 +4,7 @@ #include #include -#include "zeiterfassung.h" +#include "zeiterfassungapi.h" class QLabel; class QBoxLayout; @@ -21,12 +21,12 @@ class MainWindow : public QMainWindow Q_OBJECT public: - explicit MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung, const Zeiterfassung::UserInfo &userInfo, QWidget *parent = 0); + explicit MainWindow(ZeiterfassungSettings &settings, ZeiterfassungApi &erfassung, const ZeiterfassungApi::UserInfo &userInfo, QWidget *parent = 0); ~MainWindow(); private Q_SLOTS: void refresh(bool forceAuswertung = false); - void getProjekctsFinished(bool success, const QString &message, const QVector &projects); + void getProjekctsFinished(bool success, const QString &message, const QVector &projects); void getAuswertungFinished(bool success, const QString &message, const QByteArray &content); void refreshBookingsFinished(bool success, const QString &message); void refreshTimeAssignmentsFinished(bool success, const QString &message); @@ -41,8 +41,8 @@ private: Ui::MainWindow *ui; ZeiterfassungSettings &m_settings; - Zeiterfassung &m_erfassung; - const Zeiterfassung::UserInfo &m_userInfo; + ZeiterfassungApi &m_erfassung; + const ZeiterfassungApi::UserInfo &m_userInfo; QMap m_projects; QDate m_auswertungDate; diff --git a/models/bookingsmodel.cpp b/models/bookingsmodel.cpp index 86c8d87..4404520 100644 --- a/models/bookingsmodel.cpp +++ b/models/bookingsmodel.cpp @@ -1,6 +1,6 @@ #include "bookingsmodel.h" -BookingsModel::BookingsModel(Zeiterfassung &erfassung, QObject *parent) : +BookingsModel::BookingsModel(ZeiterfassungApi &erfassung, QObject *parent) : QAbstractListModel(parent), m_erfassung(erfassung) { @@ -66,10 +66,10 @@ QVariant BookingsModel::headerData(int section, Qt::Orientation orientation, int return QVariant(); } -Zeiterfassung::Booking BookingsModel::getBooking(const QModelIndex &index) const +ZeiterfassungApi::Booking BookingsModel::getBooking(const QModelIndex &index) const { if(!index.isValid()) - return Zeiterfassung::Booking(); + return ZeiterfassungApi::Booking(); Q_ASSERT(index.row() <= m_bookings.count()); return m_bookings.at(index.row()); @@ -84,20 +84,20 @@ bool BookingsModel::refresh(int userId, const QDate &from, const QDate &to) m_bookings.clear(); endResetModel(); - connect(&m_erfassung, &Zeiterfassung::getBookingsFinished, + connect(&m_erfassung, &ZeiterfassungApi::getBookingsFinished, this, &BookingsModel::getBookingsFinished); return true; } -const QVector BookingsModel::bookings() const +const QVector BookingsModel::bookings() const { return m_bookings; } -void BookingsModel::getBookingsFinished(bool success, const QString &message, const QVector &bookings) +void BookingsModel::getBookingsFinished(bool success, const QString &message, const QVector &bookings) { - disconnect(&m_erfassung, &Zeiterfassung::getBookingsFinished, + disconnect(&m_erfassung, &ZeiterfassungApi::getBookingsFinished, this, &BookingsModel::getBookingsFinished); if(success) diff --git a/models/bookingsmodel.h b/models/bookingsmodel.h index bc92785..e569f81 100644 --- a/models/bookingsmodel.h +++ b/models/bookingsmodel.h @@ -4,14 +4,14 @@ #include #include -#include "zeiterfassung.h" +#include "zeiterfassungapi.h" class BookingsModel : public QAbstractListModel { Q_OBJECT public: - explicit BookingsModel(Zeiterfassung &erfassung, QObject *parent = nullptr); + explicit BookingsModel(ZeiterfassungApi &erfassung, QObject *parent = nullptr); // QAbstractItemModel interface int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; @@ -19,21 +19,21 @@ public: QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; - Zeiterfassung::Booking getBooking(const QModelIndex &index) const; + ZeiterfassungApi::Booking getBooking(const QModelIndex &index) const; bool refresh(int userId, const QDate &from, const QDate &to); - const QVector bookings() const; + const QVector bookings() const; Q_SIGNALS: void refreshFinished(bool success, const QString &message); private Q_SLOTS: - void getBookingsFinished(bool success, const QString &message, const QVector &bookings); + void getBookingsFinished(bool success, const QString &message, const QVector &bookings); private: - Zeiterfassung &m_erfassung; - QVector m_bookings; + ZeiterfassungApi &m_erfassung; + QVector m_bookings; }; #endif // BOOKINGSMODEL_H diff --git a/models/timeassignmentsmodel.cpp b/models/timeassignmentsmodel.cpp index 31827b9..8da4d83 100644 --- a/models/timeassignmentsmodel.cpp +++ b/models/timeassignmentsmodel.cpp @@ -1,6 +1,6 @@ #include "timeassignmentsmodel.h" -TimeAssignmentsModel::TimeAssignmentsModel(Zeiterfassung &erfassung, QObject *parent) : +TimeAssignmentsModel::TimeAssignmentsModel(ZeiterfassungApi &erfassung, QObject *parent) : QAbstractListModel(parent), m_erfassung(erfassung) { @@ -70,10 +70,10 @@ QVariant TimeAssignmentsModel::headerData(int section, Qt::Orientation orientati return QVariant(); } -Zeiterfassung::TimeAssignment TimeAssignmentsModel::getTimeAssignment(const QModelIndex &index) const +ZeiterfassungApi::TimeAssignment TimeAssignmentsModel::getTimeAssignment(const QModelIndex &index) const { if(!index.isValid()) - return Zeiterfassung::TimeAssignment(); + return ZeiterfassungApi::TimeAssignment(); Q_ASSERT(index.row() <= m_timeAssignments.count()); return m_timeAssignments.at(index.row()); @@ -88,20 +88,20 @@ bool TimeAssignmentsModel::refresh(int userId, const QDate &from, const QDate &t m_timeAssignments.clear(); endResetModel(); - connect(&m_erfassung, &Zeiterfassung::getTimeAssignmentsFinished, + connect(&m_erfassung, &ZeiterfassungApi::getTimeAssignmentsFinished, this, &TimeAssignmentsModel::getTimeAssignmentsFinished); return true; } -const QVector TimeAssignmentsModel::timeAssignments() const +const QVector TimeAssignmentsModel::timeAssignments() const { return m_timeAssignments; } -void TimeAssignmentsModel::getTimeAssignmentsFinished(bool success, const QString &message, const QVector &timeAssignments) +void TimeAssignmentsModel::getTimeAssignmentsFinished(bool success, const QString &message, const QVector &timeAssignments) { - disconnect(&m_erfassung, &Zeiterfassung::getTimeAssignmentsFinished, + disconnect(&m_erfassung, &ZeiterfassungApi::getTimeAssignmentsFinished, this, &TimeAssignmentsModel::getTimeAssignmentsFinished); if(success) diff --git a/models/timeassignmentsmodel.h b/models/timeassignmentsmodel.h index 1294e0f..59ea28e 100644 --- a/models/timeassignmentsmodel.h +++ b/models/timeassignmentsmodel.h @@ -4,14 +4,14 @@ #include #include -#include "zeiterfassung.h" +#include "zeiterfassungapi.h" class TimeAssignmentsModel : public QAbstractListModel { Q_OBJECT public: - explicit TimeAssignmentsModel(Zeiterfassung &erfassung, QObject *parent = nullptr); + explicit TimeAssignmentsModel(ZeiterfassungApi &erfassung, QObject *parent = nullptr); // QAbstractItemModel interface int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; @@ -19,21 +19,21 @@ public: QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; - Zeiterfassung::TimeAssignment getTimeAssignment(const QModelIndex &index) const; + ZeiterfassungApi::TimeAssignment getTimeAssignment(const QModelIndex &index) const; bool refresh(int userId, const QDate &from, const QDate &to); - const QVector timeAssignments() const; + const QVector timeAssignments() const; Q_SIGNALS: void refreshFinished(bool success, const QString &message); private Q_SLOTS: - void getTimeAssignmentsFinished(bool success, const QString &message, const QVector &timeAssignments); + void getTimeAssignmentsFinished(bool success, const QString &message, const QVector &timeAssignments); private: - Zeiterfassung &m_erfassung; - QVector m_timeAssignments; + ZeiterfassungApi &m_erfassung; + QVector m_timeAssignments; }; #endif // TIMEASSIGNMENTSMODEL_H diff --git a/replies/createbookingreply.cpp b/replies/createbookingreply.cpp new file mode 100644 index 0000000..e73e840 --- /dev/null +++ b/replies/createbookingreply.cpp @@ -0,0 +1,6 @@ +#include "createbookingreply.h" + +CreateBookingReply::CreateBookingReply() +{ + +} diff --git a/replies/createbookingreply.h b/replies/createbookingreply.h new file mode 100644 index 0000000..90a7dc2 --- /dev/null +++ b/replies/createbookingreply.h @@ -0,0 +1,10 @@ +#ifndef CREATEBOOKINGREPLY_H +#define CREATEBOOKINGREPLY_H + +class CreateBookingReply +{ +public: + CreateBookingReply(); +}; + +#endif // CREATEBOOKINGREPLY_H diff --git a/replies/createtimeassignmentreply.cpp b/replies/createtimeassignmentreply.cpp new file mode 100644 index 0000000..c98fc53 --- /dev/null +++ b/replies/createtimeassignmentreply.cpp @@ -0,0 +1,6 @@ +#include "createtimeassignmentreply.h" + +CreateTimeAssignmentReply::CreateTimeAssignmentReply() +{ + +} diff --git a/replies/createtimeassignmentreply.h b/replies/createtimeassignmentreply.h new file mode 100644 index 0000000..af2d7b5 --- /dev/null +++ b/replies/createtimeassignmentreply.h @@ -0,0 +1,10 @@ +#ifndef CREATETIMEASSIGNMENTREPLY_H +#define CREATETIMEASSIGNMENTREPLY_H + +class CreateTimeAssignmentReply +{ +public: + CreateTimeAssignmentReply(); +}; + +#endif // CREATETIMEASSIGNMENTREPLY_H diff --git a/replies/deletebookingreply.cpp b/replies/deletebookingreply.cpp new file mode 100644 index 0000000..010cf0a --- /dev/null +++ b/replies/deletebookingreply.cpp @@ -0,0 +1,6 @@ +#include "deletebookingreply.h" + +DeleteBookingReply::DeleteBookingReply() +{ + +} diff --git a/replies/deletebookingreply.h b/replies/deletebookingreply.h new file mode 100644 index 0000000..0e3060c --- /dev/null +++ b/replies/deletebookingreply.h @@ -0,0 +1,10 @@ +#ifndef DELETEBOOKINGREPLY_H +#define DELETEBOOKINGREPLY_H + +class DeleteBookingReply +{ +public: + DeleteBookingReply(); +}; + +#endif // DELETEBOOKINGREPLY_H diff --git a/replies/deletetimeassignment.cpp b/replies/deletetimeassignment.cpp new file mode 100644 index 0000000..07fa176 --- /dev/null +++ b/replies/deletetimeassignment.cpp @@ -0,0 +1,6 @@ +#include "deletetimeassignment.h" + +DeleteTimeAssignment::DeleteTimeAssignment() +{ + +} diff --git a/replies/deletetimeassignment.h b/replies/deletetimeassignment.h new file mode 100644 index 0000000..f94ec07 --- /dev/null +++ b/replies/deletetimeassignment.h @@ -0,0 +1,10 @@ +#ifndef DELETETIMEASSIGNMENT_H +#define DELETETIMEASSIGNMENT_H + +class DeleteTimeAssignment +{ +public: + DeleteTimeAssignment(); +}; + +#endif // DELETETIMEASSIGNMENT_H diff --git a/replies/getauswertungreply.cpp b/replies/getauswertungreply.cpp new file mode 100644 index 0000000..cc27cea --- /dev/null +++ b/replies/getauswertungreply.cpp @@ -0,0 +1,6 @@ +#include "getauswertungreply.h" + +GetAuswertungReply::GetAuswertungReply() +{ + +} diff --git a/replies/getauswertungreply.h b/replies/getauswertungreply.h new file mode 100644 index 0000000..1baad08 --- /dev/null +++ b/replies/getauswertungreply.h @@ -0,0 +1,10 @@ +#ifndef GETAUSWERTUNGREPLY_H +#define GETAUSWERTUNGREPLY_H + +class GetAuswertungReply +{ +public: + GetAuswertungReply(); +}; + +#endif // GETAUSWERTUNGREPLY_H diff --git a/replies/getbookingsreply.cpp b/replies/getbookingsreply.cpp new file mode 100644 index 0000000..eae6e8b --- /dev/null +++ b/replies/getbookingsreply.cpp @@ -0,0 +1,6 @@ +#include "getbookingsreply.h" + +GetBookingsReply::GetBookingsReply() +{ + +} diff --git a/replies/getbookingsreply.h b/replies/getbookingsreply.h new file mode 100644 index 0000000..c7accc3 --- /dev/null +++ b/replies/getbookingsreply.h @@ -0,0 +1,10 @@ +#ifndef GETBOOKINGSREPLY_H +#define GETBOOKINGSREPLY_H + +class GetBookingsReply +{ +public: + GetBookingsReply(); +}; + +#endif // GETBOOKINGSREPLY_H diff --git a/replies/getprojectsreply.cpp b/replies/getprojectsreply.cpp new file mode 100644 index 0000000..2c18dc8 --- /dev/null +++ b/replies/getprojectsreply.cpp @@ -0,0 +1,6 @@ +#include "getprojectsreply.h" + +GetProjectsReply::GetProjectsReply() +{ + +} diff --git a/replies/getprojectsreply.h b/replies/getprojectsreply.h new file mode 100644 index 0000000..03d420f --- /dev/null +++ b/replies/getprojectsreply.h @@ -0,0 +1,10 @@ +#ifndef GETPROJECTSREPLY_H +#define GETPROJECTSREPLY_H + +class GetProjectsReply +{ +public: + GetProjectsReply(); +}; + +#endif // GETPROJECTSREPLY_H diff --git a/replies/gettimeassignmentsreply.cpp b/replies/gettimeassignmentsreply.cpp new file mode 100644 index 0000000..4049661 --- /dev/null +++ b/replies/gettimeassignmentsreply.cpp @@ -0,0 +1,6 @@ +#include "gettimeassignmentsreply.h" + +GetTimeAssignmentsReply::GetTimeAssignmentsReply() +{ + +} diff --git a/replies/gettimeassignmentsreply.h b/replies/gettimeassignmentsreply.h new file mode 100644 index 0000000..c780704 --- /dev/null +++ b/replies/gettimeassignmentsreply.h @@ -0,0 +1,10 @@ +#ifndef GETTIMEASSIGNMENTSREPLY_H +#define GETTIMEASSIGNMENTSREPLY_H + +class GetTimeAssignmentsReply +{ +public: + GetTimeAssignmentsReply(); +}; + +#endif // GETTIMEASSIGNMENTSREPLY_H diff --git a/replies/loginpagereply.cpp b/replies/loginpagereply.cpp new file mode 100644 index 0000000..ac637a3 --- /dev/null +++ b/replies/loginpagereply.cpp @@ -0,0 +1,6 @@ +#include "loginpagereply.h" + +LoginPageReply::LoginPageReply() +{ + +} diff --git a/replies/loginpagereply.h b/replies/loginpagereply.h new file mode 100644 index 0000000..6a6e22a --- /dev/null +++ b/replies/loginpagereply.h @@ -0,0 +1,10 @@ +#ifndef LOGINPAGEREPLY_H +#define LOGINPAGEREPLY_H + +class LoginPageReply +{ +public: + LoginPageReply(); +}; + +#endif // LOGINPAGEREPLY_H diff --git a/replies/loginreply.cpp b/replies/loginreply.cpp new file mode 100644 index 0000000..3dddf29 --- /dev/null +++ b/replies/loginreply.cpp @@ -0,0 +1,6 @@ +#include "loginreply.h" + +LoginReply::LoginReply() +{ + +} diff --git a/replies/loginreply.h b/replies/loginreply.h new file mode 100644 index 0000000..7cd087b --- /dev/null +++ b/replies/loginreply.h @@ -0,0 +1,10 @@ +#ifndef LOGINREPLY_H +#define LOGINREPLY_H + +class LoginReply +{ +public: + LoginReply(); +}; + +#endif // LOGINREPLY_H diff --git a/replies/updatebookingreply.cpp b/replies/updatebookingreply.cpp new file mode 100644 index 0000000..70c7e9d --- /dev/null +++ b/replies/updatebookingreply.cpp @@ -0,0 +1,6 @@ +#include "updatebookingreply.h" + +UpdateBookingReply::UpdateBookingReply() +{ + +} diff --git a/replies/updatebookingreply.h b/replies/updatebookingreply.h new file mode 100644 index 0000000..827b897 --- /dev/null +++ b/replies/updatebookingreply.h @@ -0,0 +1,10 @@ +#ifndef UPDATEBOOKINGREPLY_H +#define UPDATEBOOKINGREPLY_H + +class UpdateBookingReply +{ +public: + UpdateBookingReply(); +}; + +#endif // UPDATEBOOKINGREPLY_H diff --git a/replies/updatetimeassignmentreply.cpp b/replies/updatetimeassignmentreply.cpp new file mode 100644 index 0000000..542ed10 --- /dev/null +++ b/replies/updatetimeassignmentreply.cpp @@ -0,0 +1,6 @@ +#include "updatetimeassignmentreply.h" + +UpdateTimeAssignmentReply::UpdateTimeAssignmentReply() +{ + +} diff --git a/replies/updatetimeassignmentreply.h b/replies/updatetimeassignmentreply.h new file mode 100644 index 0000000..e260663 --- /dev/null +++ b/replies/updatetimeassignmentreply.h @@ -0,0 +1,10 @@ +#ifndef UPDATETIMEASSIGNMENTREPLY_H +#define UPDATETIMEASSIGNMENTREPLY_H + +class UpdateTimeAssignmentReply +{ +public: + UpdateTimeAssignmentReply(); +}; + +#endif // UPDATETIMEASSIGNMENTREPLY_H diff --git a/replies/userinforeply.cpp b/replies/userinforeply.cpp new file mode 100644 index 0000000..07ca66e --- /dev/null +++ b/replies/userinforeply.cpp @@ -0,0 +1,6 @@ +#include "userinforeply.h" + +UserInfoReply::UserInfoReply() +{ + +} diff --git a/replies/userinforeply.h b/replies/userinforeply.h new file mode 100644 index 0000000..ef65851 --- /dev/null +++ b/replies/userinforeply.h @@ -0,0 +1,10 @@ +#ifndef USERINFOREPLY_H +#define USERINFOREPLY_H + +class UserInfoReply +{ +public: + UserInfoReply(); +}; + +#endif // USERINFOREPLY_H diff --git a/stripswidget.cpp b/stripswidget.cpp index 94d1efc..216cfe1 100644 --- a/stripswidget.cpp +++ b/stripswidget.cpp @@ -21,8 +21,8 @@ StripsWidget::StripsWidget(StripFactory *stripFactory, const QMap &bookings, - const QVector &timeAssignments) +bool StripsWidget::createStrips(const QVector &bookings, + const QVector &timeAssignments) { auto bookingsIter = bookings.constBegin(); auto timeAssignmentsIter = timeAssignments.constBegin(); @@ -30,8 +30,8 @@ bool StripsWidget::createStrips(const QVector &bookings, m_timeAssignmentTime = QTime(0, 0); auto bookingTimespan = QTime(0, 0); - const Zeiterfassung::Booking *lastBooking = Q_NULLPTR; - const Zeiterfassung::TimeAssignment *lastTimeAssignment = Q_NULLPTR; + const ZeiterfassungApi::Booking *lastBooking = Q_NULLPTR; + const ZeiterfassungApi::TimeAssignment *lastTimeAssignment = Q_NULLPTR; QString errorMessage; diff --git a/stripswidget.h b/stripswidget.h index 8ea5d35..cb881c2 100644 --- a/stripswidget.h +++ b/stripswidget.h @@ -4,7 +4,7 @@ #include #include -#include "zeiterfassung.h" +#include "zeiterfassungapi.h" class QBoxLayout; template class QMap; @@ -20,8 +20,8 @@ public: explicit StripsWidget(StripFactory *stripFactory, const QMap &projects, QWidget *parent = 0); - bool createStrips(const QVector &bookings, - const QVector &timeAssignments); + bool createStrips(const QVector &bookings, + const QVector &timeAssignments); void clearStrips(); const QTime timeAssignmentTime() const; diff --git a/zeiterfassung.pro b/zeiterfassung.pro index bf30fcf..872a533 100755 --- a/zeiterfassung.pro +++ b/zeiterfassung.pro @@ -17,7 +17,6 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs depr RC_ICONS = icon.ico SOURCES += main.cpp \ - zeiterfassung.cpp \ mainwindow.cpp \ dialogs/aboutmedialog.cpp \ dialogs/authenticationdialog.cpp \ @@ -32,10 +31,23 @@ SOURCES += main.cpp \ dialogs/updatedialog.cpp \ stripswidget.cpp \ timeutils.cpp \ - stripfactory.cpp + stripfactory.cpp \ + zeiterfassungapi.cpp \ + replies/loginpagereply.cpp \ + replies/loginreply.cpp \ + replies/userinforeply.cpp \ + replies/getbookingsreply.cpp \ + replies/createbookingreply.cpp \ + replies/updatebookingreply.cpp \ + replies/deletebookingreply.cpp \ + replies/gettimeassignmentsreply.cpp \ + replies/createtimeassignmentreply.cpp \ + replies/updatetimeassignmentreply.cpp \ + replies/deletetimeassignment.cpp \ + replies/getprojectsreply.cpp \ + replies/getauswertungreply.cpp HEADERS += \ - zeiterfassung.h \ mainwindow.h \ dialogs/aboutmedialog.h \ dialogs/authenticationdialog.h \ @@ -50,7 +62,21 @@ HEADERS += \ dialogs/updatedialog.h \ stripswidget.h \ timeutils.h \ - stripfactory.h + stripfactory.h \ + zeiterfassungapi.h \ + replies/loginpagereply.h \ + replies/loginreply.h \ + replies/userinforeply.h \ + replies/getbookingsreply.h \ + replies/createbookingreply.h \ + replies/updatebookingreply.h \ + replies/deletebookingreply.h \ + replies/gettimeassignmentsreply.h \ + replies/createtimeassignmentreply.h \ + replies/updatetimeassignmentreply.h \ + replies/deletetimeassignment.h \ + replies/getprojectsreply.h \ + replies/getauswertungreply.h FORMS += \ mainwindow.ui \ diff --git a/zeiterfassung.cpp b/zeiterfassungapi.cpp similarity index 89% rename from zeiterfassung.cpp rename to zeiterfassungapi.cpp index 34932df..c546823 100644 --- a/zeiterfassung.cpp +++ b/zeiterfassungapi.cpp @@ -1,4 +1,4 @@ -#include "zeiterfassung.h" +#include "zeiterfassungapi.h" #include #include @@ -12,7 +12,7 @@ QString QJsonValue::toString() const{ return toString(QString()); } -Zeiterfassung::Zeiterfassung(const QString &url, QObject *parent) : +ZeiterfassungApi::ZeiterfassungApi(const QString &url, QObject *parent) : QObject(parent), m_url(url), m_manager(new QNetworkAccessManager(this)), @@ -22,23 +22,23 @@ Zeiterfassung::Zeiterfassung(const QString &url, QObject *parent) : { } -const QString &Zeiterfassung::url() const +const QString &ZeiterfassungApi::url() const { return m_url; } -void Zeiterfassung::setUrl(const QString &url) +void ZeiterfassungApi::setUrl(const QString &url) { if(m_url != url) Q_EMIT urlChanged(m_url = url); } -QNetworkAccessManager *Zeiterfassung::manager() const +QNetworkAccessManager *ZeiterfassungApi::manager() const { return m_manager; } -bool Zeiterfassung::doLoginPage() +bool ZeiterfassungApi::doLoginPage() { if(m_replies.login) { @@ -49,12 +49,12 @@ bool Zeiterfassung::doLoginPage() QNetworkRequest request(QUrl(m_url % "pages/login.jsp")); m_replies.loginPage = m_manager->get(request); - connect(m_replies.loginPage, &QNetworkReply::finished, this, &Zeiterfassung::loginPageRequestFinished); + connect(m_replies.loginPage, &QNetworkReply::finished, this, &ZeiterfassungApi::loginPageRequestFinished); return true; } -bool Zeiterfassung::doLogin(const QString &username, const QString &password) +bool ZeiterfassungApi::doLogin(const QString &username, const QString &password) { if(m_replies.login) { @@ -67,12 +67,12 @@ bool Zeiterfassung::doLogin(const QString &username, const QString &password) request.setMaximumRedirectsAllowed(0); m_replies.login = m_manager->post(request, QStringLiteral("j_username=%0&j_password=%1&login=Anmelden").arg(username).arg(password).toUtf8()); - connect(m_replies.login, &QNetworkReply::finished, this, &Zeiterfassung::loginRequestFinished); + connect(m_replies.login, &QNetworkReply::finished, this, &ZeiterfassungApi::loginRequestFinished); return true; } -bool Zeiterfassung::doUserInfo() +bool ZeiterfassungApi::doUserInfo() { if(m_replies.userInfo) { @@ -84,14 +84,14 @@ bool Zeiterfassung::doUserInfo() request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("home")); m_replies.userInfo = m_manager->get(request); - connect(m_replies.userInfo, &QNetworkReply::finished, this, &Zeiterfassung::userInfoRequestFinished); + connect(m_replies.userInfo, &QNetworkReply::finished, this, &ZeiterfassungApi::userInfoRequestFinished); return true; } #define NAMEOF(x) #x -bool Zeiterfassung::doGetBookings(int userId, const QDate &start, const QDate &end) +bool ZeiterfassungApi::doGetBookings(int userId, const QDate &start, const QDate &end) { if(m_replies.getBookings) { @@ -108,12 +108,12 @@ bool Zeiterfassung::doGetBookings(int userId, const QDate &start, const QDate &e m_replies.getBookings = m_manager->get(request); connect(m_replies.getBookings, &QNetworkReply::finished, - this, &Zeiterfassung::getBookingsRequestFinished); + this, &ZeiterfassungApi::getBookingsRequestFinished); return true; } -bool Zeiterfassung::doCreateBooking(int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &type, const QString &text) +bool ZeiterfassungApi::doCreateBooking(int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &type, const QString &text) { if(m_replies.createBooking) { @@ -138,12 +138,12 @@ bool Zeiterfassung::doCreateBooking(int userId, const QDate &date, const QTime & m_replies.createBooking = m_manager->post(request, QJsonDocument(obj).toJson()); connect(m_replies.createBooking, &QNetworkReply::finished, - this, &Zeiterfassung::createBookingRequestFinished); + this, &ZeiterfassungApi::createBookingRequestFinished); return true; } -bool Zeiterfassung::doUpdateBooking(int bookingId, int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &type, const QString &text) +bool ZeiterfassungApi::doUpdateBooking(int bookingId, int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &type, const QString &text) { if(m_replies.updateBooking) { @@ -169,12 +169,12 @@ bool Zeiterfassung::doUpdateBooking(int bookingId, int userId, const QDate &date m_replies.updateBooking = m_manager->put(request, QJsonDocument(obj).toJson()); connect(m_replies.updateBooking, &QNetworkReply::finished, - this, &Zeiterfassung::updateBookingRequestFinished); + this, &ZeiterfassungApi::updateBookingRequestFinished); return true; } -bool Zeiterfassung::doDeleteBooking(int bookingId) +bool ZeiterfassungApi::doDeleteBooking(int bookingId) { if(m_replies.deleteBooking) { @@ -189,12 +189,12 @@ bool Zeiterfassung::doDeleteBooking(int bookingId) m_replies.deleteBooking = m_manager->deleteResource(request); connect(m_replies.deleteBooking, &QNetworkReply::finished, - this, &Zeiterfassung::deleteBookingRequestFinished); + this, &ZeiterfassungApi::deleteBookingRequestFinished); return true; } -bool Zeiterfassung::doGetTimeAssignments(int userId, const QDate &start, const QDate &end) +bool ZeiterfassungApi::doGetTimeAssignments(int userId, const QDate &start, const QDate &end) { if(m_replies.getTimeAssignments) { @@ -211,12 +211,12 @@ bool Zeiterfassung::doGetTimeAssignments(int userId, const QDate &start, const Q m_replies.getTimeAssignments = m_manager->get(request); connect(m_replies.getTimeAssignments, &QNetworkReply::finished, - this, &Zeiterfassung::getTimeAssignmentsRequestFinished); + this, &ZeiterfassungApi::getTimeAssignmentsRequestFinished); return true; } -bool Zeiterfassung::doCreateTimeAssignment(int userId, const QDate &date, const QTime &time, const QTime ×pan, +bool ZeiterfassungApi::doCreateTimeAssignment(int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &project, const QString &subproject, const QString &workpackage, const QString &text) { @@ -259,12 +259,12 @@ bool Zeiterfassung::doCreateTimeAssignment(int userId, const QDate &date, const m_replies.createTimeAssignment = m_manager->post(request, QJsonDocument(obj).toJson()); connect(m_replies.createTimeAssignment, &QNetworkReply::finished, - this, &Zeiterfassung::createTimeAssignmentRequestFinished); + this, &ZeiterfassungApi::createTimeAssignmentRequestFinished); return true; } -bool Zeiterfassung::doUpdateTimeAssignment(int timeAssignmentId, int userId, const QDate &date, const QTime &time, +bool ZeiterfassungApi::doUpdateTimeAssignment(int timeAssignmentId, int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &project, const QString &subproject, const QString &workpackage, const QString &text) { @@ -312,12 +312,12 @@ bool Zeiterfassung::doUpdateTimeAssignment(int timeAssignmentId, int userId, con m_replies.updateTimeAssignment = m_manager->put(request, QJsonDocument(obj).toJson()); connect(m_replies.updateTimeAssignment, &QNetworkReply::finished, - this, &Zeiterfassung::updateTimeAssignmentRequestFinished); + this, &ZeiterfassungApi::updateTimeAssignmentRequestFinished); return true; } -bool Zeiterfassung::doDeleteTimeAssignment(int timeAssignmentId) +bool ZeiterfassungApi::doDeleteTimeAssignment(int timeAssignmentId) { if(m_replies.deleteTimeAssignment) { @@ -332,12 +332,12 @@ bool Zeiterfassung::doDeleteTimeAssignment(int timeAssignmentId) m_replies.deleteTimeAssignment = m_manager->deleteResource(request); connect(m_replies.deleteTimeAssignment, &QNetworkReply::finished, - this, &Zeiterfassung::deleteTimeAssignmentRequestFinished); + this, &ZeiterfassungApi::deleteTimeAssignmentRequestFinished); return true; } -bool Zeiterfassung::doGetProjects(int userId, const QDate &date) +bool ZeiterfassungApi::doGetProjects(int userId, const QDate &date) { if(m_replies.getProjects) { @@ -352,12 +352,12 @@ bool Zeiterfassung::doGetProjects(int userId, const QDate &date) request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar")); m_replies.getProjects = m_manager->get(request); - connect(m_replies.getProjects, &QNetworkReply::finished, this, &Zeiterfassung::getProjectsRequestFinished); + connect(m_replies.getProjects, &QNetworkReply::finished, this, &ZeiterfassungApi::getProjectsRequestFinished); return true; } -bool Zeiterfassung::doGetAuswertung(int userId, const QDate &date) +bool ZeiterfassungApi::doGetAuswertung(int userId, const QDate &date) { if(m_replies.getAuswertung) { @@ -372,12 +372,12 @@ bool Zeiterfassung::doGetAuswertung(int userId, const QDate &date) request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar")); m_replies.getAuswertung = m_manager->get(request); - connect(m_replies.getAuswertung, &QNetworkReply::finished, this, &Zeiterfassung::getAuswertungRequest0Finished); + connect(m_replies.getAuswertung, &QNetworkReply::finished, this, &ZeiterfassungApi::getAuswertungRequest0Finished); return true; } -void Zeiterfassung::loginPageRequestFinished() +void ZeiterfassungApi::loginPageRequestFinished() { if(m_replies.loginPage->error() != QNetworkReply::NoError) { @@ -398,7 +398,7 @@ void Zeiterfassung::loginPageRequestFinished() m_replies.loginPage = Q_NULLPTR; } -void Zeiterfassung::loginRequestFinished() +void ZeiterfassungApi::loginRequestFinished() { if(m_replies.login->error() != QNetworkReply::NoError) { @@ -437,7 +437,7 @@ void Zeiterfassung::loginRequestFinished() m_replies.login = Q_NULLPTR; } -void Zeiterfassung::userInfoRequestFinished() +void ZeiterfassungApi::userInfoRequestFinished() { if(m_replies.userInfo->error() != QNetworkReply::NoError) { @@ -492,7 +492,7 @@ void Zeiterfassung::userInfoRequestFinished() m_replies.userInfo = Q_NULLPTR; } -void Zeiterfassung::getBookingsRequestFinished() +void ZeiterfassungApi::getBookingsRequestFinished() { if(m_replies.getBookings->error() != QNetworkReply::NoError) { @@ -540,7 +540,7 @@ void Zeiterfassung::getBookingsRequestFinished() m_replies.getBookings = Q_NULLPTR; } -void Zeiterfassung::createBookingRequestFinished() +void ZeiterfassungApi::createBookingRequestFinished() { if(m_replies.createBooking->error() != QNetworkReply::NoError) { @@ -581,7 +581,7 @@ void Zeiterfassung::createBookingRequestFinished() m_replies.createBooking = Q_NULLPTR; } -void Zeiterfassung::updateBookingRequestFinished() +void ZeiterfassungApi::updateBookingRequestFinished() { if(m_replies.updateBooking->error() != QNetworkReply::NoError) { @@ -622,7 +622,7 @@ void Zeiterfassung::updateBookingRequestFinished() m_replies.updateBooking = Q_NULLPTR; } -void Zeiterfassung::deleteBookingRequestFinished() +void ZeiterfassungApi::deleteBookingRequestFinished() { if(m_replies.deleteBooking->error() != QNetworkReply::NoError) { @@ -638,7 +638,7 @@ void Zeiterfassung::deleteBookingRequestFinished() m_replies.deleteBooking = Q_NULLPTR; } -void Zeiterfassung::getTimeAssignmentsRequestFinished() +void ZeiterfassungApi::getTimeAssignmentsRequestFinished() { if(m_replies.getTimeAssignments->error() != QNetworkReply::NoError) { @@ -690,7 +690,7 @@ void Zeiterfassung::getTimeAssignmentsRequestFinished() m_replies.getTimeAssignments = Q_NULLPTR; } -void Zeiterfassung::createTimeAssignmentRequestFinished() +void ZeiterfassungApi::createTimeAssignmentRequestFinished() { if(m_replies.createTimeAssignment->error() != QNetworkReply::NoError) { @@ -731,7 +731,7 @@ void Zeiterfassung::createTimeAssignmentRequestFinished() m_replies.createTimeAssignment = Q_NULLPTR; } -void Zeiterfassung::updateTimeAssignmentRequestFinished() +void ZeiterfassungApi::updateTimeAssignmentRequestFinished() { if(m_replies.updateTimeAssignment->error() != QNetworkReply::NoError) { @@ -772,7 +772,7 @@ void Zeiterfassung::updateTimeAssignmentRequestFinished() m_replies.updateTimeAssignment = Q_NULLPTR; } -void Zeiterfassung::deleteTimeAssignmentRequestFinished() +void ZeiterfassungApi::deleteTimeAssignmentRequestFinished() { if(m_replies.deleteTimeAssignment->error() != QNetworkReply::NoError) { @@ -788,7 +788,7 @@ void Zeiterfassung::deleteTimeAssignmentRequestFinished() m_replies.deleteTimeAssignment = Q_NULLPTR; } -void Zeiterfassung::getProjectsRequestFinished() +void ZeiterfassungApi::getProjectsRequestFinished() { if(m_replies.getProjects->error() != QNetworkReply::NoError) { @@ -848,7 +848,7 @@ void Zeiterfassung::getProjectsRequestFinished() m_replies.getProjects = Q_NULLPTR; } -void Zeiterfassung::getAuswertungRequest0Finished() +void ZeiterfassungApi::getAuswertungRequest0Finished() { if(m_replies.getAuswertung->error() != QNetworkReply::NoError) { @@ -865,10 +865,10 @@ void Zeiterfassung::getAuswertungRequest0Finished() m_replies.getAuswertung = m_manager->get(QNetworkRequest(url)); connect(m_replies.getAuswertung, &QNetworkReply::finished, - this, &Zeiterfassung::getAuswertungRequest1Finished); + this, &ZeiterfassungApi::getAuswertungRequest1Finished); } -void Zeiterfassung::getAuswertungRequest1Finished() +void ZeiterfassungApi::getAuswertungRequest1Finished() { if(m_replies.getAuswertung->error() != QNetworkReply::NoError) { diff --git a/zeiterfassung.h b/zeiterfassungapi.h similarity index 96% rename from zeiterfassung.h rename to zeiterfassungapi.h index 6349414..5a22071 100644 --- a/zeiterfassung.h +++ b/zeiterfassungapi.h @@ -1,5 +1,5 @@ -#ifndef ZEITERFASSUNG_H -#define ZEITERFASSUNG_H +#ifndef ZEITERFASSUNGAPI_H +#define ZEITERFASSUNGAPI_H #include #include @@ -10,13 +10,13 @@ class QNetworkAccessManager; class QNetworkReply; class QByteArray; -class Zeiterfassung : public QObject +class ZeiterfassungApi : public QObject { Q_OBJECT Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) public: - explicit Zeiterfassung(const QString &url, QObject *parent = 0); + explicit ZeiterfassungApi(const QString &url, QObject *parent = 0); const QString &url() const; void setUrl(const QString &url); @@ -147,4 +147,4 @@ private: } m_replies; }; -#endif // ZEITERFASSUNG_H +#endif // ZEITERFASSUNGAPI_H