Replaced Kontierung with TimeAssignment for better translations
This commit is contained in:
@@ -7,9 +7,15 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>236</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -10,6 +10,12 @@
|
|||||||
<height>181</height>
|
<height>181</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -7,9 +7,15 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>237</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -13,7 +13,7 @@ SettingsDialog::SettingsDialog(ZeiterfassungSettings &settings, QWidget *parent)
|
|||||||
ui->lineEditBuchungKommenBackgroundColor->setText(settings.buchungKommenBackgroundColor());
|
ui->lineEditBuchungKommenBackgroundColor->setText(settings.buchungKommenBackgroundColor());
|
||||||
ui->lineEditBuchungGehenBackgroundColor->setText(settings.buchungGehenBackgroundColor());
|
ui->lineEditBuchungGehenBackgroundColor->setText(settings.buchungGehenBackgroundColor());
|
||||||
ui->lineEditBuchungOtherBackgroundColor->setText(settings.buchungOtherBackgroundColor());
|
ui->lineEditBuchungOtherBackgroundColor->setText(settings.buchungOtherBackgroundColor());
|
||||||
ui->lineEditKontierungBackgroundColor->setText(settings.kontierungBackgroundColor());
|
ui->lineEditTimeAssignmentBackgroundColor->setText(settings.timeAssignmentBackgroundColor());
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::submit);
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::submit);
|
||||||
}
|
}
|
||||||
@@ -31,8 +31,8 @@ void SettingsDialog::submit()
|
|||||||
m_settings.setBuchungGehenBackgroundColor(ui->lineEditBuchungGehenBackgroundColor->text());
|
m_settings.setBuchungGehenBackgroundColor(ui->lineEditBuchungGehenBackgroundColor->text());
|
||||||
if(ui->lineEditBuchungOtherBackgroundColor->text() != m_settings.buchungOtherBackgroundColor())
|
if(ui->lineEditBuchungOtherBackgroundColor->text() != m_settings.buchungOtherBackgroundColor())
|
||||||
m_settings.setBuchungOtherBackgroundColor(ui->lineEditBuchungOtherBackgroundColor->text());
|
m_settings.setBuchungOtherBackgroundColor(ui->lineEditBuchungOtherBackgroundColor->text());
|
||||||
if(ui->lineEditKontierungBackgroundColor->text() != m_settings.kontierungBackgroundColor())
|
if(ui->lineEditTimeAssignmentBackgroundColor->text() != m_settings.timeAssignmentBackgroundColor())
|
||||||
m_settings.setKontierungBackgroundColor(ui->lineEditKontierungBackgroundColor->text());
|
m_settings.setTimeAssignmentBackgroundColor(ui->lineEditTimeAssignmentBackgroundColor->text());
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
@@ -7,9 +7,15 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>647</width>
|
<width>647</width>
|
||||||
<height>300</height>
|
<height>235</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -54,12 +60,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="kontierungBackgroundColor">
|
<widget class="QLabel" name="labelTimeAssignmentBackgroundColor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>kontierungBackgroundColor</string>
|
<string>timeAssignmentBackgroundColor</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>lineEditKontierungBackgroundColor</cstring>
|
<cstring>lineEditTimeAssignmentBackgroundColor</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -73,7 +79,7 @@
|
|||||||
<widget class="QLineEdit" name="lineEditBuchungOtherBackgroundColor"/>
|
<widget class="QLineEdit" name="lineEditBuchungOtherBackgroundColor"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="lineEditKontierungBackgroundColor"/>
|
<widget class="QLineEdit" name="lineEditTimeAssignmentBackgroundColor"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#include "kontierungdialog.h"
|
#include "timeassignmentdialog.h"
|
||||||
#include "ui_kontierungdialog.h"
|
#include "ui_timeassignmentdialog.h"
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
@@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
#include "zeiterfassungsettings.h"
|
#include "zeiterfassungsettings.h"
|
||||||
|
|
||||||
KontierungDialog::KontierungDialog(const QMap<QString, QString> &projekte, const ZeiterfassungSettings &settings,
|
TimeAssignmentDialog::TimeAssignmentDialog(const QMap<QString, QString> &projekte, const ZeiterfassungSettings &settings,
|
||||||
QWidget *parent) :
|
QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::KontierungDialog)
|
ui(new Ui::TimeAssignmentDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@@ -49,37 +49,37 @@ KontierungDialog::KontierungDialog(const QMap<QString, QString> &projekte, const
|
|||||||
ui->comboBoxText->clearEditText();
|
ui->comboBoxText->clearEditText();
|
||||||
}
|
}
|
||||||
|
|
||||||
KontierungDialog::~KontierungDialog()
|
TimeAssignmentDialog::~TimeAssignmentDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTime KontierungDialog::getTime() const
|
QTime TimeAssignmentDialog::getTime() const
|
||||||
{
|
{
|
||||||
return ui->timeEditTime->time();
|
return ui->timeEditTime->time();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KontierungDialog::setTime(const QTime &time)
|
void TimeAssignmentDialog::setTime(const QTime &time)
|
||||||
{
|
{
|
||||||
ui->timeEditTime->setTime(time);
|
ui->timeEditTime->setTime(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTime KontierungDialog::getTimespan() const
|
QTime TimeAssignmentDialog::getTimespan() const
|
||||||
{
|
{
|
||||||
return ui->timeEditTimespan->time();
|
return ui->timeEditTimespan->time();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KontierungDialog::setTimespan(const QTime ×pan)
|
void TimeAssignmentDialog::setTimespan(const QTime ×pan)
|
||||||
{
|
{
|
||||||
ui->timeEditTimespan->setTime(timespan);
|
ui->timeEditTimespan->setTime(timespan);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KontierungDialog::getProjekt() const
|
QString TimeAssignmentDialog::getProjekt() const
|
||||||
{
|
{
|
||||||
return ui->comboBoxProjekt->currentData().toString();
|
return ui->comboBoxProjekt->currentData().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KontierungDialog::setProjekt(const QString &projekt)
|
void TimeAssignmentDialog::setProjekt(const QString &projekt)
|
||||||
{
|
{
|
||||||
auto index = ui->comboBoxProjekt->findData(projekt);
|
auto index = ui->comboBoxProjekt->findData(projekt);
|
||||||
if(index >= 0)
|
if(index >= 0)
|
||||||
@@ -88,32 +88,32 @@ void KontierungDialog::setProjekt(const QString &projekt)
|
|||||||
qWarning() << "could not find projekt" << projekt;
|
qWarning() << "could not find projekt" << projekt;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KontierungDialog::getSubprojekt() const
|
QString TimeAssignmentDialog::getSubprojekt() const
|
||||||
{
|
{
|
||||||
return ui->comboBoxSubprojekt->currentText();
|
return ui->comboBoxSubprojekt->currentText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KontierungDialog::setSubprojekt(const QString &subprojekt)
|
void TimeAssignmentDialog::setSubprojekt(const QString &subprojekt)
|
||||||
{
|
{
|
||||||
ui->comboBoxSubprojekt->setCurrentText(subprojekt);
|
ui->comboBoxSubprojekt->setCurrentText(subprojekt);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KontierungDialog::getWorkpackage() const
|
QString TimeAssignmentDialog::getWorkpackage() const
|
||||||
{
|
{
|
||||||
return ui->comboBoxWorkpackage->currentText();
|
return ui->comboBoxWorkpackage->currentText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KontierungDialog::setWorkpackage(const QString &workpackage)
|
void TimeAssignmentDialog::setWorkpackage(const QString &workpackage)
|
||||||
{
|
{
|
||||||
ui->comboBoxWorkpackage->setCurrentText(workpackage);
|
ui->comboBoxWorkpackage->setCurrentText(workpackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KontierungDialog::getText() const
|
QString TimeAssignmentDialog::getText() const
|
||||||
{
|
{
|
||||||
return ui->comboBoxText->currentText();
|
return ui->comboBoxText->currentText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KontierungDialog::setText(const QString &text)
|
void TimeAssignmentDialog::setText(const QString &text)
|
||||||
{
|
{
|
||||||
ui->comboBoxText->setCurrentText(text);
|
ui->comboBoxText->setCurrentText(text);
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
#ifndef KONTIERUNGDIALOG_H
|
#ifndef TIMEASSIGNMENTDIALOG_H
|
||||||
#define KONTIERUNGDIALOG_H
|
#define TIMEASSIGNMENTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
@@ -8,16 +8,16 @@ template <class Key, class T> class QMap;
|
|||||||
|
|
||||||
class ZeiterfassungSettings;
|
class ZeiterfassungSettings;
|
||||||
|
|
||||||
namespace Ui { class KontierungDialog; }
|
namespace Ui { class TimeAssignmentDialog; }
|
||||||
|
|
||||||
class KontierungDialog : public QDialog
|
class TimeAssignmentDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KontierungDialog(const QMap<QString, QString> &projekte, const ZeiterfassungSettings &settings,
|
explicit TimeAssignmentDialog(const QMap<QString, QString> &projekte, const ZeiterfassungSettings &settings,
|
||||||
QWidget *parent = 0);
|
QWidget *parent = 0);
|
||||||
~KontierungDialog();
|
~TimeAssignmentDialog();
|
||||||
|
|
||||||
QTime getTime() const;
|
QTime getTime() const;
|
||||||
void setTime(const QTime &time);
|
void setTime(const QTime &time);
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::KontierungDialog *ui;
|
Ui::TimeAssignmentDialog *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KONTIERUNGDIALOG_H
|
#endif // TIMEASSIGNMENTDIALOG_H
|
@@ -1,15 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>KontierungDialog</class>
|
<class>TimeAssignmentDialog</class>
|
||||||
<widget class="QDialog" name="KontierungDialog">
|
<widget class="QDialog" name="TimeAssignmentDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>307</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -17,7 +23,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelTitle">
|
<widget class="QLabel" name="labelTitle">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><h1>Kontierung</h1></string>
|
<string><h1>Time assignment</h1></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -140,7 +146,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>KontierungDialog</receiver>
|
<receiver>TimeAssignmentDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -156,7 +162,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>KontierungDialog</receiver>
|
<receiver>TimeAssignmentDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
356
mainwindow.cpp
356
mainwindow.cpp
@@ -18,12 +18,12 @@
|
|||||||
#include "eventloopwithstatus.h"
|
#include "eventloopwithstatus.h"
|
||||||
#include "dialogs/aboutmedialog.h"
|
#include "dialogs/aboutmedialog.h"
|
||||||
#include "dialogs/buchungdialog.h"
|
#include "dialogs/buchungdialog.h"
|
||||||
#include "dialogs/kontierungdialog.h"
|
#include "dialogs/timeassignmentdialog.h"
|
||||||
#include "dialogs/settingsdialog.h"
|
#include "dialogs/settingsdialog.h"
|
||||||
#include "strips/buchungstrip.h"
|
#include "strips/buchungstrip.h"
|
||||||
#include "strips/kontierungstrip.h"
|
#include "strips/timeassignmentstrip.h"
|
||||||
#include "models/buchungenmodel.h"
|
#include "models/buchungenmodel.h"
|
||||||
#include "models/kontierungenmodel.h"
|
#include "models/timeassignmentsmodel.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung, const Zeiterfassung::UserInfo &userInfo, QWidget *parent) :
|
MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung, const Zeiterfassung::UserInfo &userInfo, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@@ -32,7 +32,7 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung
|
|||||||
m_erfassung(erfassung),
|
m_erfassung(erfassung),
|
||||||
m_userInfo(userInfo),
|
m_userInfo(userInfo),
|
||||||
m_buchungenModel(new BuchungenModel(erfassung, this)),
|
m_buchungenModel(new BuchungenModel(erfassung, this)),
|
||||||
m_kontierungenModel(new KontierungenModel(erfassung, this)),
|
m_timeAssignmentsModel(new TimeAssignmentsModel(erfassung, this)),
|
||||||
m_flag(false)
|
m_flag(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@@ -51,8 +51,7 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung
|
|||||||
file.setAutoRemove(false);
|
file.setAutoRemove(false);
|
||||||
if(!file.open())
|
if(!file.open())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not open auswertung!"), tr("Auswertung could not be written:\n\n%0")
|
QMessageBox::warning(this, tr("Could not open auswertung!"), tr("Could not open auswertung!") % "\n\n" % file.errorString());
|
||||||
.arg(file.errorString()));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,12 +94,12 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung
|
|||||||
connect(ui->pushButtonEnd, &QAbstractButton::pressed, this, &MainWindow::pushButtonEndPressed);
|
connect(ui->pushButtonEnd, &QAbstractButton::pressed, this, &MainWindow::pushButtonEndPressed);
|
||||||
|
|
||||||
ui->treeViewBuchungen->setModel(m_buchungenModel);
|
ui->treeViewBuchungen->setModel(m_buchungenModel);
|
||||||
ui->treeViewKontierungen->setModel(m_kontierungenModel);
|
ui->treeViewTimeAssignments->setModel(m_timeAssignmentsModel);
|
||||||
|
|
||||||
connect(ui->treeViewBuchungen, &QWidget::customContextMenuRequested,
|
connect(ui->treeViewBuchungen, &QWidget::customContextMenuRequested,
|
||||||
this, &MainWindow::contextMenuBuchung);
|
this, &MainWindow::contextMenuBuchung);
|
||||||
connect(ui->treeViewKontierungen, &QWidget::customContextMenuRequested,
|
connect(ui->treeViewTimeAssignments, &QWidget::customContextMenuRequested,
|
||||||
this, &MainWindow::contextMenuKontierung);
|
this, &MainWindow::contextMenuTimeAssignment);
|
||||||
|
|
||||||
ui->statusbar->addPermanentWidget(m_workingTimeLabel = new QLabel(ui->statusbar));
|
ui->statusbar->addPermanentWidget(m_workingTimeLabel = new QLabel(ui->statusbar));
|
||||||
m_workingTimeLabel->setFrameShape(QFrame::Panel);
|
m_workingTimeLabel->setFrameShape(QFrame::Panel);
|
||||||
@@ -157,9 +156,9 @@ void MainWindow::refresh(bool forceAuswertung)
|
|||||||
ui->pushButtonStart->setEnabled(false);
|
ui->pushButtonStart->setEnabled(false);
|
||||||
ui->pushButtonEnd->setEnabled(false);
|
ui->pushButtonEnd->setEnabled(false);
|
||||||
ui->treeViewBuchungen->setEnabled(false);
|
ui->treeViewBuchungen->setEnabled(false);
|
||||||
ui->treeViewKontierungen->setEnabled(false);
|
ui->treeViewTimeAssignments->setEnabled(false);
|
||||||
|
|
||||||
m_workingTimeLabel->setText(tr("Working time: %0").arg(tr("???")));
|
m_workingTimeLabel->setText(tr("%0: %1").arg(tr("Working time")).arg(tr("???")));
|
||||||
|
|
||||||
auto waitForBuchugen = m_buchungenModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date());
|
auto waitForBuchugen = m_buchungenModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date());
|
||||||
if(waitForBuchugen)
|
if(waitForBuchugen)
|
||||||
@@ -168,18 +167,18 @@ void MainWindow::refresh(bool forceAuswertung)
|
|||||||
this, &MainWindow::refreshBuchungenFinished);
|
this, &MainWindow::refreshBuchungenFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waitForKontierungen = m_kontierungenModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date());
|
auto waitForTimeAssignments = m_timeAssignmentsModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date());
|
||||||
if(waitForKontierungen)
|
if(waitForTimeAssignments)
|
||||||
{
|
{
|
||||||
connect(m_kontierungenModel, &KontierungenModel::refreshFinished,
|
connect(m_timeAssignmentsModel, &TimeAssignmentsModel::refreshFinished,
|
||||||
this, &MainWindow::refreshKontierungenFinished);
|
this, &MainWindow::refreshTimeAssignmentsFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!waitForBuchugen || !waitForKontierungen)
|
if(!waitForBuchugen || !waitForTimeAssignments)
|
||||||
QMessageBox::warning(this, tr("Unknown error occured."), tr("An unknown error occured."));
|
QMessageBox::warning(this, tr("Unknown error occured."), tr("An unknown error occured."));
|
||||||
|
|
||||||
if(waitForBuchugen || waitForKontierungen)
|
if(waitForBuchugen || waitForTimeAssignments)
|
||||||
m_flag = waitForBuchugen == waitForKontierungen;
|
m_flag = waitForBuchugen == waitForTimeAssignments;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->actionToday->setEnabled(true);
|
ui->actionToday->setEnabled(true);
|
||||||
@@ -194,8 +193,8 @@ void MainWindow::refresh(bool forceAuswertung)
|
|||||||
auto auswertungDate = QDate(ui->dateEditDate->date().year(), ui->dateEditDate->date().month(), 1);
|
auto auswertungDate = QDate(ui->dateEditDate->date().year(), ui->dateEditDate->date().month(), 1);
|
||||||
if(forceAuswertung || m_auswertungDate != auswertungDate)
|
if(forceAuswertung || m_auswertungDate != auswertungDate)
|
||||||
{
|
{
|
||||||
m_balanceLabel->setText(tr("Balance: %0").arg(tr("???")));
|
m_balanceLabel->setText(tr("%0: %1").arg(tr("Balance")).arg(tr("???")));
|
||||||
m_holidaysLabel->setText(tr("Holidays: %0").arg(tr("???")));
|
m_holidaysLabel->setText(tr("%0: %1").arg(tr("Holidays")).arg(tr("???")));
|
||||||
|
|
||||||
ui->actionAuswertung->setEnabled(false);
|
ui->actionAuswertung->setEnabled(false);
|
||||||
m_auswertung.clear();
|
m_auswertung.clear();
|
||||||
@@ -222,7 +221,7 @@ void MainWindow::getProjekteFinished(bool success, const QString &message, const
|
|||||||
|
|
||||||
if(!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not load Buchungen!"), tr("Could not load Buchungen:\n\n%0").arg(message));
|
QMessageBox::warning(this, tr("Could not load Buchungen!"), tr("Could not load Buchungen!") % "\n\n" % message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +241,7 @@ void MainWindow::getAuswertungFinished(bool success, const QString &message, con
|
|||||||
if(!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
m_auswertungDate = QDate();
|
m_auswertungDate = QDate();
|
||||||
QMessageBox::warning(this, tr("Could not load Auswertung!"), tr("Could not load Auswertung:\n\n%0").arg(message));
|
QMessageBox::warning(this, tr("Could not load Auswertung!"), tr("Could not load Auswertung!") % "\n\n" % message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,13 +263,21 @@ void MainWindow::getAuswertungFinished(bool success, const QString &message, con
|
|||||||
static QRegularExpression regex(QStringLiteral("Gleitzeit +([0-9]+\\:[0-9]+\\-?) +([0-9]+\\:[0-9]+\\-?)"));
|
static QRegularExpression regex(QStringLiteral("Gleitzeit +([0-9]+\\:[0-9]+\\-?) +([0-9]+\\:[0-9]+\\-?)"));
|
||||||
auto match = regex.match(content);
|
auto match = regex.match(content);
|
||||||
if(match.hasMatch())
|
if(match.hasMatch())
|
||||||
|
{
|
||||||
gleitzeit = match.captured(2);
|
gleitzeit = match.captured(2);
|
||||||
|
if(gleitzeit.endsWith(QChar('-')))
|
||||||
|
{
|
||||||
|
gleitzeit.chop(1);
|
||||||
|
gleitzeit = QChar('-') % gleitzeit;
|
||||||
|
}
|
||||||
|
gleitzeit = tr("%0h").arg(gleitzeit);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
qWarning() << "Gleitzeit not found";
|
qWarning() << "Gleitzeit not found";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_balanceLabel->setText(tr("Balance: %0").arg(gleitzeit));
|
m_balanceLabel->setText(tr("%0: %1").arg(tr("Balance")).arg(gleitzeit));
|
||||||
m_holidaysLabel->setText(tr("Holidays: %0").arg(urlaubsAnspruch));
|
m_holidaysLabel->setText(tr("%0: %1").arg(tr("Holidays")).arg(urlaubsAnspruch));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshBuchungenFinished(bool success, const QString &message)
|
void MainWindow::refreshBuchungenFinished(bool success, const QString &message)
|
||||||
@@ -287,16 +294,16 @@ void MainWindow::refreshBuchungenFinished(bool success, const QString &message)
|
|||||||
validateEntries();
|
validateEntries();
|
||||||
|
|
||||||
if(!success)
|
if(!success)
|
||||||
QMessageBox::warning(Q_NULLPTR, tr("Could not refresh Buchungen!"), tr("Could not refresh Buchungen:\n\n%0").arg(message));
|
QMessageBox::warning(Q_NULLPTR, tr("Could not refresh Buchungen!"), tr("Could not refresh Buchungen!") % "\n\n" % message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshKontierungenFinished(bool success, const QString &message)
|
void MainWindow::refreshTimeAssignmentsFinished(bool success, const QString &message)
|
||||||
{
|
{
|
||||||
disconnect(m_kontierungenModel, &KontierungenModel::refreshFinished,
|
disconnect(m_timeAssignmentsModel, &TimeAssignmentsModel::refreshFinished,
|
||||||
this, &MainWindow::refreshKontierungenFinished);
|
this, &MainWindow::refreshTimeAssignmentsFinished);
|
||||||
|
|
||||||
if(success)
|
if(success)
|
||||||
ui->treeViewKontierungen->setEnabled(true);
|
ui->treeViewTimeAssignments->setEnabled(true);
|
||||||
|
|
||||||
if(m_flag)
|
if(m_flag)
|
||||||
m_flag = false;
|
m_flag = false;
|
||||||
@@ -304,7 +311,7 @@ void MainWindow::refreshKontierungenFinished(bool success, const QString &messag
|
|||||||
validateEntries();
|
validateEntries();
|
||||||
|
|
||||||
if(!success)
|
if(!success)
|
||||||
QMessageBox::warning(Q_NULLPTR, tr("Could not refresh Kontierungen!"), tr("Could not refresh Kontierungen:\n\n%0").arg(message));
|
QMessageBox::warning(Q_NULLPTR, tr("Could not refresh time assignments!"), tr("Could not refresh time assignments!") % "\n\n" % message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::contextMenuBuchung(const QPoint &pos)
|
void MainWindow::contextMenuBuchung(const QPoint &pos)
|
||||||
@@ -372,7 +379,7 @@ void MainWindow::contextMenuBuchung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not update Buchung!"), tr("Could not update Buchung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not update Buchung!"), tr("Could not update Buchung!") % "\n\n" % eventLoop.message());
|
||||||
goto again1;
|
goto again1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -425,7 +432,7 @@ void MainWindow::contextMenuBuchung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
QMessageBox::warning(this, tr("Could not delete Buchung!"), tr("Could not delete Buchung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not delete Buchung!"), tr("Could not delete Buchung!") % "\n\n" % eventLoop.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -484,7 +491,7 @@ void MainWindow::contextMenuBuchung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not create Buchung!"), tr("Could not create Buchung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not create Buchung!"), tr("Could not create Buchung!") % "\n\n" % eventLoop.message());
|
||||||
goto again2;
|
goto again2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -492,34 +499,34 @@ void MainWindow::contextMenuBuchung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::contextMenuKontierung(const QPoint &pos)
|
void MainWindow::contextMenuTimeAssignment(const QPoint &pos)
|
||||||
{
|
{
|
||||||
auto index = ui->treeViewKontierungen->indexAt(pos);
|
auto index = ui->treeViewTimeAssignments->indexAt(pos);
|
||||||
|
|
||||||
if(index.isValid())
|
if(index.isValid())
|
||||||
{
|
{
|
||||||
auto kontierung = m_kontierungenModel->getKontierung(index);
|
auto timeAssignment = m_timeAssignmentsModel->getTimeAssignment(index);
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
auto editAction = menu.addAction(tr("Edit"));
|
auto editAction = menu.addAction(tr("Edit"));
|
||||||
auto deleteAction = menu.addAction(tr("Delete"));
|
auto deleteAction = menu.addAction(tr("Delete"));
|
||||||
auto selectedAction = menu.exec(ui->treeViewKontierungen->viewport()->mapToGlobal(pos));
|
auto selectedAction = menu.exec(ui->treeViewTimeAssignments->viewport()->mapToGlobal(pos));
|
||||||
if(selectedAction == editAction)
|
if(selectedAction == editAction)
|
||||||
{
|
{
|
||||||
KontierungDialog dialog(m_projekte, m_settings, this);
|
TimeAssignmentDialog dialog(m_projekte, m_settings, this);
|
||||||
dialog.setTime(kontierung.time);
|
dialog.setTime(timeAssignment.time);
|
||||||
dialog.setTimespan(kontierung.timespan);
|
dialog.setTimespan(timeAssignment.timespan);
|
||||||
dialog.setProjekt(kontierung.projekt);
|
dialog.setProjekt(timeAssignment.projekt);
|
||||||
dialog.setSubprojekt(kontierung.subprojekt);
|
dialog.setSubprojekt(timeAssignment.subprojekt);
|
||||||
dialog.setWorkpackage(kontierung.workpackage);
|
dialog.setWorkpackage(timeAssignment.workpackage);
|
||||||
dialog.setText(kontierung.text);
|
dialog.setText(timeAssignment.text);
|
||||||
again1:
|
again1:
|
||||||
if(dialog.exec() == QDialog::Accepted)
|
if(dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
EventLoopWithStatus eventLoop;
|
EventLoopWithStatus eventLoop;
|
||||||
connect(&m_erfassung, &Zeiterfassung::updateKontierungFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
connect(&m_erfassung, &Zeiterfassung::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
||||||
|
|
||||||
m_erfassung.doUpdateKontierung(kontierung.id, m_userInfo.userId, ui->dateEditDate->date(),
|
m_erfassung.doUpdateTimeAssignment(timeAssignment.id, m_userInfo.userId, ui->dateEditDate->date(),
|
||||||
dialog.getTime(), dialog.getTimespan(),
|
dialog.getTime(), dialog.getTimespan(),
|
||||||
dialog.getProjekt(), dialog.getSubprojekt(),
|
dialog.getProjekt(), dialog.getSubprojekt(),
|
||||||
dialog.getWorkpackage(), dialog.getText());
|
dialog.getWorkpackage(), dialog.getText());
|
||||||
@@ -539,7 +546,7 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
ui->comboBoxText->setEnabled(false);
|
ui->comboBoxText->setEnabled(false);
|
||||||
ui->pushButtonStart->setEnabled(false);
|
ui->pushButtonStart->setEnabled(false);
|
||||||
ui->pushButtonEnd->setEnabled(false);
|
ui->pushButtonEnd->setEnabled(false);
|
||||||
ui->treeViewKontierungen->setEnabled(false);
|
ui->treeViewTimeAssignments->setEnabled(false);
|
||||||
|
|
||||||
m_settings.prependProjekt(dialog.getProjekt());
|
m_settings.prependProjekt(dialog.getProjekt());
|
||||||
m_settings.prependSubprojekt(dialog.getSubprojekt());
|
m_settings.prependSubprojekt(dialog.getSubprojekt());
|
||||||
@@ -548,10 +555,10 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
|
|
||||||
clearStrips();
|
clearStrips();
|
||||||
|
|
||||||
if(m_kontierungenModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date()))
|
if(m_timeAssignmentsModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date()))
|
||||||
{
|
{
|
||||||
connect(m_kontierungenModel, &KontierungenModel::refreshFinished,
|
connect(m_timeAssignmentsModel, &TimeAssignmentsModel::refreshFinished,
|
||||||
this, &MainWindow::refreshKontierungenFinished);
|
this, &MainWindow::refreshTimeAssignmentsFinished);
|
||||||
m_flag = false;
|
m_flag = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -565,7 +572,7 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not update Kontierung!"), tr("Could not update Kontierung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not update time assignment!"), tr("Could not update time assignment!") % "\n\n" % eventLoop.message());
|
||||||
goto again1;
|
goto again1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -573,15 +580,15 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
else if(selectedAction == deleteAction)
|
else if(selectedAction == deleteAction)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText("Do you really want to delete the Kontierung?");
|
msgBox.setText("Do you really want to delete the time assignment?");
|
||||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
|
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
|
||||||
msgBox.setDefaultButton(QMessageBox::Cancel);
|
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||||
if(msgBox.exec() == QMessageBox::Yes)
|
if(msgBox.exec() == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
EventLoopWithStatus eventLoop;
|
EventLoopWithStatus eventLoop;
|
||||||
connect(&m_erfassung, &Zeiterfassung::deleteKontierungFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
connect(&m_erfassung, &Zeiterfassung::deleteTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
||||||
|
|
||||||
m_erfassung.doDeleteKontierung(kontierung.id);
|
m_erfassung.doDeleteTimeAssignment(timeAssignment.id);
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
|
|
||||||
if(eventLoop.success())
|
if(eventLoop.success())
|
||||||
@@ -598,14 +605,14 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
ui->comboBoxText->setEnabled(false);
|
ui->comboBoxText->setEnabled(false);
|
||||||
ui->pushButtonStart->setEnabled(false);
|
ui->pushButtonStart->setEnabled(false);
|
||||||
ui->pushButtonEnd->setEnabled(false);
|
ui->pushButtonEnd->setEnabled(false);
|
||||||
ui->treeViewKontierungen->setEnabled(false);
|
ui->treeViewTimeAssignments->setEnabled(false);
|
||||||
|
|
||||||
clearStrips();
|
clearStrips();
|
||||||
|
|
||||||
if(m_kontierungenModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date()))
|
if(m_timeAssignmentsModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date()))
|
||||||
{
|
{
|
||||||
connect(m_kontierungenModel, &KontierungenModel::refreshFinished,
|
connect(m_timeAssignmentsModel, &TimeAssignmentsModel::refreshFinished,
|
||||||
this, &MainWindow::refreshKontierungenFinished);
|
this, &MainWindow::refreshTimeAssignmentsFinished);
|
||||||
m_flag = false;
|
m_flag = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -618,7 +625,7 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
QMessageBox::warning(this, tr("Could not delete Kontierung!"), tr("Could not delete Kontierung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not delete time assignment!"), tr("Could not delete time assignment!") % "\n\n" % eventLoop.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -626,17 +633,17 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
auto createAction = menu.addAction(tr("Create"));
|
auto createAction = menu.addAction(tr("Create"));
|
||||||
auto selectedAction = menu.exec(ui->treeViewKontierungen->viewport()->mapToGlobal(pos));
|
auto selectedAction = menu.exec(ui->treeViewTimeAssignments->viewport()->mapToGlobal(pos));
|
||||||
if(selectedAction == createAction)
|
if(selectedAction == createAction)
|
||||||
{
|
{
|
||||||
KontierungDialog dialog(m_projekte, m_settings, this);
|
TimeAssignmentDialog dialog(m_projekte, m_settings, this);
|
||||||
again2:
|
again2:
|
||||||
if(dialog.exec() == QDialog::Accepted)
|
if(dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
EventLoopWithStatus eventLoop;
|
EventLoopWithStatus eventLoop;
|
||||||
connect(&m_erfassung, &Zeiterfassung::createKontierungFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
connect(&m_erfassung, &Zeiterfassung::createTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
||||||
|
|
||||||
m_erfassung.doCreateKontierung(m_userInfo.userId, ui->dateEditDate->date(),
|
m_erfassung.doCreateTimeAssignment(m_userInfo.userId, ui->dateEditDate->date(),
|
||||||
dialog.getTime(), dialog.getTimespan(),
|
dialog.getTime(), dialog.getTimespan(),
|
||||||
dialog.getProjekt(), dialog.getSubprojekt(),
|
dialog.getProjekt(), dialog.getSubprojekt(),
|
||||||
dialog.getWorkpackage(), dialog.getText());
|
dialog.getWorkpackage(), dialog.getText());
|
||||||
@@ -656,7 +663,7 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
ui->comboBoxText->setEnabled(false);
|
ui->comboBoxText->setEnabled(false);
|
||||||
ui->pushButtonStart->setEnabled(false);
|
ui->pushButtonStart->setEnabled(false);
|
||||||
ui->pushButtonEnd->setEnabled(false);
|
ui->pushButtonEnd->setEnabled(false);
|
||||||
ui->treeViewKontierungen->setEnabled(false);
|
ui->treeViewTimeAssignments->setEnabled(false);
|
||||||
|
|
||||||
m_settings.prependProjekt(dialog.getProjekt());
|
m_settings.prependProjekt(dialog.getProjekt());
|
||||||
m_settings.prependSubprojekt(dialog.getSubprojekt());
|
m_settings.prependSubprojekt(dialog.getSubprojekt());
|
||||||
@@ -665,10 +672,10 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
|
|
||||||
clearStrips();
|
clearStrips();
|
||||||
|
|
||||||
if(m_kontierungenModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date()))
|
if(m_timeAssignmentsModel->refresh(m_userInfo.userId, ui->dateEditDate->date(), ui->dateEditDate->date()))
|
||||||
{
|
{
|
||||||
connect(m_kontierungenModel, &KontierungenModel::refreshFinished,
|
connect(m_timeAssignmentsModel, &TimeAssignmentsModel::refreshFinished,
|
||||||
this, &MainWindow::refreshKontierungenFinished);
|
this, &MainWindow::refreshTimeAssignmentsFinished);
|
||||||
m_flag = false;
|
m_flag = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -682,7 +689,7 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not create Kontierung!"), tr("Could not create Kontierung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not create time assignment!"), tr("Could not create time assignment!") % "\n\n" % eventLoop.message());
|
||||||
goto again2;
|
goto again2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -705,33 +712,33 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
|
|
||||||
if(!eventLoop.success())
|
if(!eventLoop.success())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not create Buchung!"), tr("Could not create Buchung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not create Buchung!"), tr("Could not create Buchung!") % "\n\n" % eventLoop.message());
|
||||||
refresh(true);
|
refresh(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_kontierungenModel->rbegin() != m_kontierungenModel->rend())
|
if(m_timeAssignmentsModel->rbegin() != m_timeAssignmentsModel->rend())
|
||||||
{
|
{
|
||||||
auto kontierung = *m_kontierungenModel->rbegin();
|
auto timeAssignment = *m_timeAssignmentsModel->rbegin();
|
||||||
if(kontierung.timespan == QTime(0, 0))
|
if(timeAssignment.timespan == QTime(0, 0))
|
||||||
{
|
{
|
||||||
EventLoopWithStatus eventLoop;
|
EventLoopWithStatus eventLoop;
|
||||||
connect(&m_erfassung, &Zeiterfassung::updateKontierungFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
connect(&m_erfassung, &Zeiterfassung::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
||||||
|
|
||||||
auto timespan = timeBetween(m_lastKontierungStart, ui->timeEditTime->time());
|
auto timespan = timeBetween(m_lastTimeAssignmentStart, ui->timeEditTime->time());
|
||||||
|
|
||||||
m_erfassung.doUpdateKontierung(kontierung.id, m_userInfo.userId, kontierung.date,
|
m_erfassung.doUpdateTimeAssignment(timeAssignment.id, m_userInfo.userId, timeAssignment.date,
|
||||||
kontierung.time, timespan,
|
timeAssignment.time, timespan,
|
||||||
kontierung.projekt, kontierung.subprojekt,
|
timeAssignment.projekt, timeAssignment.subprojekt,
|
||||||
kontierung.workpackage, kontierung.text);
|
timeAssignment.workpackage, timeAssignment.text);
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
|
|
||||||
if(eventLoop.success())
|
if(eventLoop.success())
|
||||||
m_kontierungTime = timeAdd(m_kontierungTime, timespan);
|
m_timeAssignmentTime = timeAdd(m_timeAssignmentTime, timespan);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not update Kontierung!"), tr("Could not update Kontierung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not update time assignment!"), tr("Could not update time assignment!") % "\n\n" % eventLoop.message());
|
||||||
refresh(true);
|
refresh(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -739,17 +746,17 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
EventLoopWithStatus eventLoop;
|
EventLoopWithStatus eventLoop;
|
||||||
connect(&m_erfassung, &Zeiterfassung::createKontierungFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
connect(&m_erfassung, &Zeiterfassung::createTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
||||||
|
|
||||||
m_erfassung.doCreateKontierung(m_userInfo.userId, ui->dateEditDate->date(),
|
m_erfassung.doCreateTimeAssignment(m_userInfo.userId, ui->dateEditDate->date(),
|
||||||
m_kontierungTime, QTime(0, 0),
|
m_timeAssignmentTime, QTime(0, 0),
|
||||||
ui->comboBoxProjekt->currentData().toString(), ui->comboBoxSubprojekt->currentText(),
|
ui->comboBoxProjekt->currentData().toString(), ui->comboBoxSubprojekt->currentText(),
|
||||||
ui->comboBoxWorkpackage->currentText(), ui->comboBoxText->currentText());
|
ui->comboBoxWorkpackage->currentText(), ui->comboBoxText->currentText());
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
|
|
||||||
if(!eventLoop.success())
|
if(!eventLoop.success())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not create Kontierung!"), tr("Could not create Kontierung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not create time assignment!"), tr("Could not create time assignment!") % "\n\n" % eventLoop.message());
|
||||||
refresh(true);
|
refresh(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -777,32 +784,32 @@ void MainWindow::pushButtonEndPressed()
|
|||||||
|
|
||||||
if(!eventLoop.success())
|
if(!eventLoop.success())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not create Buchung!"), tr("Could not create Buchung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not create Buchung!"), tr("Could not create Buchung!") % "\n\n" % eventLoop.message());
|
||||||
refresh(true);
|
refresh(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto kontierung = *m_kontierungenModel->rbegin();
|
auto timeAssignment = *m_timeAssignmentsModel->rbegin();
|
||||||
Q_ASSERT(kontierung.timespan == QTime(0, 0));
|
Q_ASSERT(timeAssignment.timespan == QTime(0, 0));
|
||||||
|
|
||||||
EventLoopWithStatus eventLoop;
|
EventLoopWithStatus eventLoop;
|
||||||
connect(&m_erfassung, &Zeiterfassung::updateKontierungFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
connect(&m_erfassung, &Zeiterfassung::updateTimeAssignmentFinished, &eventLoop, &EventLoopWithStatus::quitWithStatus);
|
||||||
|
|
||||||
auto timespan = timeBetween(m_lastKontierungStart, ui->timeEditTime->time());
|
auto timespan = timeBetween(m_lastTimeAssignmentStart, ui->timeEditTime->time());
|
||||||
|
|
||||||
m_erfassung.doUpdateKontierung(kontierung.id, m_userInfo.userId, kontierung.date,
|
m_erfassung.doUpdateTimeAssignment(timeAssignment.id, m_userInfo.userId, timeAssignment.date,
|
||||||
kontierung.time, timespan,
|
timeAssignment.time, timespan,
|
||||||
kontierung.projekt, kontierung.subprojekt,
|
timeAssignment.projekt, timeAssignment.subprojekt,
|
||||||
kontierung.workpackage, kontierung.text);
|
timeAssignment.workpackage, timeAssignment.text);
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
|
|
||||||
if(eventLoop.success())
|
if(eventLoop.success())
|
||||||
m_kontierungTime = timeAdd(m_kontierungTime, timespan);
|
m_timeAssignmentTime = timeAdd(m_timeAssignmentTime, timespan);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not update Kontierung!"), tr("Could not update Kontierung:\n\n%0").arg(eventLoop.message()));
|
QMessageBox::warning(this, tr("Could not update time assignment!"), tr("Could not update time assignment!") % "\n\n" % eventLoop.message());
|
||||||
refresh(true);
|
refresh(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -824,24 +831,24 @@ void MainWindow::validateEntries()
|
|||||||
if(!ui->treeViewBuchungen->isEnabled())
|
if(!ui->treeViewBuchungen->isEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!ui->treeViewKontierungen->isEnabled())
|
if(!ui->treeViewTimeAssignments->isEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto buchungenIter = m_buchungenModel->constBegin();
|
auto buchungenIter = m_buchungenModel->constBegin();
|
||||||
auto kontierungenIter = m_kontierungenModel->constBegin();
|
auto timeAssignmentsIter = m_timeAssignmentsModel->constBegin();
|
||||||
|
|
||||||
m_kontierungTime = QTime(0, 0);
|
m_timeAssignmentTime = QTime(0, 0);
|
||||||
auto buchungTimespan = QTime(0, 0);
|
auto buchungTimespan = QTime(0, 0);
|
||||||
|
|
||||||
const Zeiterfassung::Buchung *lastBuchung = Q_NULLPTR;
|
const Zeiterfassung::Buchung *lastBuchung = Q_NULLPTR;
|
||||||
const Zeiterfassung::Kontierung *lastKontierung = Q_NULLPTR;
|
const Zeiterfassung::TimeAssignment *lastTimeAssignment = Q_NULLPTR;
|
||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
if(buchungenIter == m_buchungenModel->constEnd() &&
|
if(buchungenIter == m_buchungenModel->constEnd() &&
|
||||||
kontierungenIter == m_kontierungenModel->constEnd())
|
timeAssignmentsIter == m_timeAssignmentsModel->constEnd())
|
||||||
{
|
{
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
@@ -863,7 +870,10 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
if(lastBuchung)
|
if(lastBuchung)
|
||||||
{
|
{
|
||||||
auto label = new QLabel(tr("Pause: %0h").arg(timeBetween(lastBuchung->time, startBuchung.time).toString(QStringLiteral("HH:mm"))), ui->scrollAreaWidgetContents);
|
auto label = new QLabel(tr("%0: %1")
|
||||||
|
.arg(tr("Break"))
|
||||||
|
.arg(tr("%0h").arg(timeBetween(lastBuchung->time, startBuchung.time).toString(QStringLiteral("HH:mm")))),
|
||||||
|
ui->scrollAreaWidgetContents);
|
||||||
ui->verticalLayout2->addWidget(label);
|
ui->verticalLayout2->addWidget(label);
|
||||||
label->setMinimumHeight(20);
|
label->setMinimumHeight(20);
|
||||||
label->setMaximumHeight(20);
|
label->setMaximumHeight(20);
|
||||||
@@ -871,106 +881,106 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
lastBuchung = &startBuchung;
|
lastBuchung = &startBuchung;
|
||||||
|
|
||||||
m_lastKontierungStart = startBuchung.time;
|
m_lastTimeAssignmentStart = startBuchung.time;
|
||||||
ui->verticalLayout2->addWidget(new BuchungStrip(startBuchung.id, startBuchung.time, startBuchung.type, m_settings, ui->scrollAreaWidgetContents));
|
ui->verticalLayout2->addWidget(new BuchungStrip(startBuchung.id, startBuchung.time, startBuchung.type, m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierungenIter == m_kontierungenModel->constEnd())
|
if(timeAssignmentsIter == m_timeAssignmentsModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("Missing Kontierung.");
|
errorMessage = tr("Missing time assignment.");
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto kontierung = *kontierungenIter++;
|
auto timeAssignment = *timeAssignmentsIter++;
|
||||||
if(kontierung.time != m_kontierungTime)
|
if(timeAssignment.time != m_timeAssignmentTime)
|
||||||
{
|
{
|
||||||
errorMessage = tr("Expected time %0 but got %1 Kontierung.\nKontierung ID: %2")
|
errorMessage = tr("Expected %0 but received %1 in time assignment.\nTime assignment ID: %2")
|
||||||
.arg(m_kontierungTime.toString("HH:mm:ss"))
|
.arg(m_timeAssignmentTime.toString("HH:mm:ss"))
|
||||||
.arg(kontierung.time.toString("HH:mm:ss"))
|
.arg(timeAssignment.time.toString("HH:mm:ss"))
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastKontierung = &kontierung;
|
lastTimeAssignment = &timeAssignment;
|
||||||
|
|
||||||
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
ui->verticalLayout2->addWidget(new TimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjektString(timeAssignment.projekt),
|
||||||
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
timeAssignment.subprojekt, timeAssignment.workpackage, timeAssignment.text,
|
||||||
m_settings, ui->scrollAreaWidgetContents));
|
m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierung.timespan == QTime(0, 0))
|
if(timeAssignment.timespan == QTime(0, 0))
|
||||||
{
|
{
|
||||||
if(buchungenIter != m_buchungenModel->constEnd())
|
if(buchungenIter != m_buchungenModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("There is another Buchung after an unfinished Kontierung.\nBuchung ID: %0\nKontierung ID: %1")
|
errorMessage = tr("There is another Buchung after an unfinished time assignment.\nBuchung ID: %0\nTime assignment ID: %1")
|
||||||
.arg(buchungenIter->id)
|
.arg(buchungenIter->id)
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(kontierungenIter != m_kontierungenModel->constEnd())
|
if(timeAssignmentsIter != m_timeAssignmentsModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("There is another Kontierung after an unfinished Kontierung.\nKontierung ID: %0\nKontierung ID: %1")
|
errorMessage = tr("There is another time assignment after an unfinished time assignment.\nTime assignment ID: %0\nTime assignment ID: %1")
|
||||||
.arg(kontierungenIter->id)
|
.arg(timeAssignmentsIter->id)
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->timeEditTime->setMinimumTime(timeAdd(m_lastKontierungStart, QTime(0, 1)));
|
ui->timeEditTime->setMinimumTime(timeAdd(m_lastTimeAssignmentStart, QTime(0, 1)));
|
||||||
ui->pushButtonStart->setText(tr("Switch"));
|
ui->pushButtonStart->setText(tr("Switch"));
|
||||||
ui->pushButtonEnd->setEnabled(true);
|
ui->pushButtonEnd->setEnabled(true);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_kontierungTime = timeAdd(m_kontierungTime, kontierung.timespan);
|
m_timeAssignmentTime = timeAdd(m_timeAssignmentTime, timeAssignment.timespan);
|
||||||
m_lastKontierungStart = timeAdd(m_lastKontierungStart, kontierung.timespan);
|
m_lastTimeAssignmentStart = timeAdd(m_lastTimeAssignmentStart, timeAssignment.timespan);
|
||||||
|
|
||||||
if(buchungenIter == m_buchungenModel->constEnd())
|
if(buchungenIter == m_buchungenModel->constEnd())
|
||||||
{
|
{
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
if(kontierungenIter == m_kontierungenModel->constEnd())
|
if(timeAssignmentsIter == m_timeAssignmentsModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("The last Kontierung is finished without Gehen-Buchung\nKontierung ID: %0")
|
errorMessage = tr("The last time assignment is finished without Gehen-Buchung\nTime assignment ID: %0")
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
kontierung = *kontierungenIter++;
|
timeAssignment = *timeAssignmentsIter++;
|
||||||
if(kontierung.time != m_kontierungTime)
|
if(timeAssignment.time != m_timeAssignmentTime)
|
||||||
{
|
{
|
||||||
errorMessage = tr("Expected time %0 but got %1 Kontierung.\nKontierung ID: %2")
|
errorMessage = tr("Expected %0 but received %1 in time assignment.\nTime assignment ID: %2")
|
||||||
.arg(m_kontierungTime.toString("HH:mm:ss"))
|
.arg(m_timeAssignmentTime.toString("HH:mm:ss"))
|
||||||
.arg(kontierung.time.toString("HH:mm:ss"))
|
.arg(timeAssignment.time.toString("HH:mm:ss"))
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastKontierung = &kontierung;
|
lastTimeAssignment = &timeAssignment;
|
||||||
|
|
||||||
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
ui->verticalLayout2->addWidget(new TimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjektString(timeAssignment.projekt),
|
||||||
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
timeAssignment.subprojekt, timeAssignment.workpackage, timeAssignment.text,
|
||||||
m_settings, ui->scrollAreaWidgetContents));
|
m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierung.timespan == QTime(0, 0))
|
if(timeAssignment.timespan == QTime(0, 0))
|
||||||
{
|
{
|
||||||
if(kontierungenIter != m_kontierungenModel->constEnd())
|
if(timeAssignmentsIter != m_timeAssignmentsModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("There is another Kontierung after an unfinished Kontierung.\n"
|
errorMessage = tr("There is another time assignment after an unfinished time assignment.\n"
|
||||||
"Kontierung ID: %0\nKontierung ID: %1")
|
"Time assignment ID: %0\nTime assignment ID: %1")
|
||||||
.arg(kontierung.id)
|
.arg(timeAssignment.id)
|
||||||
.arg(kontierungenIter->id);
|
.arg(timeAssignmentsIter->id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->timeEditTime->setMinimumTime(timeAdd(m_lastKontierungStart, QTime(0, 1)));
|
ui->timeEditTime->setMinimumTime(timeAdd(m_lastTimeAssignmentStart, QTime(0, 1)));
|
||||||
ui->pushButtonStart->setText(tr("Switch"));
|
ui->pushButtonStart->setText(tr("Switch"));
|
||||||
ui->pushButtonEnd->setEnabled(true);
|
ui->pushButtonEnd->setEnabled(true);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_kontierungTime = timeAdd(m_kontierungTime, kontierung.timespan);
|
m_timeAssignmentTime = timeAdd(m_timeAssignmentTime, timeAssignment.timespan);
|
||||||
m_lastKontierungStart = timeAdd(m_lastKontierungStart, kontierung.timespan);
|
m_lastTimeAssignmentStart = timeAdd(m_lastTimeAssignmentStart, timeAssignment.timespan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -990,12 +1000,12 @@ void MainWindow::validateEntries()
|
|||||||
buchungTimespan = timeAdd(buchungTimespan, timeBetween(startBuchung.time, endBuchung.time));
|
buchungTimespan = timeAdd(buchungTimespan, timeBetween(startBuchung.time, endBuchung.time));
|
||||||
ui->timeEditTime->setMinimumTime(timeAdd(endBuchung.time, QTime(0, 1)));
|
ui->timeEditTime->setMinimumTime(timeAdd(endBuchung.time, QTime(0, 1)));
|
||||||
|
|
||||||
while(m_kontierungTime < buchungTimespan)
|
while(m_timeAssignmentTime < buchungTimespan)
|
||||||
{
|
{
|
||||||
if(kontierungenIter == m_kontierungenModel->constEnd())
|
if(timeAssignmentsIter == m_timeAssignmentsModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("Missing Kontierung! Missing: %0h")
|
errorMessage = tr("Missing time assignment(s)! Missing: %0h")
|
||||||
.arg(timeBetween(m_kontierungTime, buchungTimespan).toString("HH:mm:ss"));
|
.arg(timeBetween(m_timeAssignmentTime, buchungTimespan).toString("HH:mm:ss"));
|
||||||
|
|
||||||
{
|
{
|
||||||
auto label = new QLabel(errorMessage, ui->scrollAreaWidgetContents);
|
auto label = new QLabel(errorMessage, ui->scrollAreaWidgetContents);
|
||||||
@@ -1009,56 +1019,56 @@ void MainWindow::validateEntries()
|
|||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
kontierung = *kontierungenIter++;
|
timeAssignment = *timeAssignmentsIter++;
|
||||||
if(kontierung.time != m_kontierungTime)
|
if(timeAssignment.time != m_timeAssignmentTime)
|
||||||
{
|
{
|
||||||
errorMessage = tr("Expected time %0 but got %1 Kontierung.\nKontierung ID: %2")
|
errorMessage = tr("Expected %0 but received %1 in time assignment.\nTime assignment ID: %2")
|
||||||
.arg(m_kontierungTime.toString("HH:mm:ss"))
|
.arg(m_timeAssignmentTime.toString("HH:mm:ss"))
|
||||||
.arg(kontierung.time.toString("HH:mm:ss"))
|
.arg(timeAssignment.time.toString("HH:mm:ss"))
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastKontierung = &kontierung;
|
lastTimeAssignment = &timeAssignment;
|
||||||
|
|
||||||
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
ui->verticalLayout2->addWidget(new TimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjektString(timeAssignment.projekt),
|
||||||
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
timeAssignment.subprojekt, timeAssignment.workpackage, timeAssignment.text,
|
||||||
m_settings, ui->scrollAreaWidgetContents));
|
m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierung.timespan == QTime(0, 0))
|
if(timeAssignment.timespan == QTime(0, 0))
|
||||||
{
|
{
|
||||||
if(buchungenIter != m_buchungenModel->constEnd())
|
if(buchungenIter != m_buchungenModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("There is another Buchung after an unfinished Kontierung.\n"
|
errorMessage = tr("There is another Buchung after an unfinished time assignment.\n"
|
||||||
"Buchung ID: %0\nKontierung ID: %1")
|
"Buchung ID: %0\nTime assignment ID: %1")
|
||||||
.arg(buchungenIter->id)
|
.arg(buchungenIter->id)
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(kontierungenIter != m_kontierungenModel->constEnd())
|
if(timeAssignmentsIter != m_timeAssignmentsModel->constEnd())
|
||||||
{
|
{
|
||||||
errorMessage = tr("There is another Kontierung after an unfinished Kontierung.\nKontierung ID: %0\nKontierung ID: %1")
|
errorMessage = tr("There is another time assignment after an unfinished time assignment.\nTime assignment ID: %0\nTime assignment ID: %1")
|
||||||
.arg(kontierungenIter->id)
|
.arg(timeAssignmentsIter->id)
|
||||||
.arg(kontierung.id);
|
.arg(timeAssignment.id);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->timeEditTime->setMinimumTime(timeAdd(m_lastKontierungStart, QTime(0, 1)));
|
ui->timeEditTime->setMinimumTime(timeAdd(m_lastTimeAssignmentStart, QTime(0, 1)));
|
||||||
ui->pushButtonStart->setText(tr("Switch"));
|
ui->pushButtonStart->setText(tr("Switch"));
|
||||||
ui->pushButtonEnd->setEnabled(true);
|
ui->pushButtonEnd->setEnabled(true);
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_kontierungTime = timeAdd(m_kontierungTime, kontierung.timespan);
|
m_timeAssignmentTime = timeAdd(m_timeAssignmentTime, timeAssignment.timespan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_kontierungTime > buchungTimespan)
|
if(m_timeAssignmentTime > buchungTimespan)
|
||||||
{
|
{
|
||||||
errorMessage = tr("Kontierung time longer than Buchung time! Kontierung: %0 Buchung: %1")
|
errorMessage = tr("Time assignment time longer than Buchung time! Time assignment: %0 Buchung: %1")
|
||||||
.arg(m_kontierungTime.toString("HH:mm:ss"))
|
.arg(m_timeAssignmentTime.toString("HH:mm:ss"))
|
||||||
.arg(buchungTimespan.toString("HH:mm:ss"));
|
.arg(buchungTimespan.toString("HH:mm:ss"));
|
||||||
|
|
||||||
auto label = new QLabel(errorMessage, ui->scrollAreaWidgetContents);
|
auto label = new QLabel(errorMessage, ui->scrollAreaWidgetContents);
|
||||||
@@ -1069,7 +1079,7 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
ui->verticalLayout2->addWidget(new BuchungStrip(endBuchung.id, endBuchung.time, endBuchung.type, m_settings, ui->scrollAreaWidgetContents));
|
ui->verticalLayout2->addWidget(new BuchungStrip(endBuchung.id, endBuchung.time, endBuchung.type, m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(m_kontierungTime > buchungTimespan)
|
if(m_timeAssignmentTime > buchungTimespan)
|
||||||
goto after;
|
goto after;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1077,7 +1087,7 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
after:
|
after:
|
||||||
if(errorMessage.isEmpty())
|
if(errorMessage.isEmpty())
|
||||||
m_workingTimeLabel->setText(tr("Working time: %0").arg(m_kontierungTime.toString(QStringLiteral("HH:mm"))));
|
m_workingTimeLabel->setText(tr("%0: %1").arg(tr("Working time")).arg(tr("%0h").arg(m_timeAssignmentTime.toString(QStringLiteral("HH:mm")))));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto label = new QLabel(tr("Strip rendering aborted due error."), ui->scrollAreaWidgetContents);
|
auto label = new QLabel(tr("Strip rendering aborted due error."), ui->scrollAreaWidgetContents);
|
||||||
@@ -1090,7 +1100,7 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
if(!errorMessage.isEmpty())
|
if(!errorMessage.isEmpty())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Illegal state!"), tr("Your Buchungen and Kontierungen for this day are in an invalid state:\n\n%0")
|
QMessageBox::warning(this, tr("Illegal state!"), tr("Your Buchungen and time assignments for this day are in an invalid state:\n\n%0")
|
||||||
.arg(errorMessage));
|
.arg(errorMessage));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
12
mainwindow.h
12
mainwindow.h
@@ -11,7 +11,7 @@ class QLabel;
|
|||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
class ZeiterfassungSettings;
|
class ZeiterfassungSettings;
|
||||||
class BuchungenModel;
|
class BuchungenModel;
|
||||||
class KontierungenModel;
|
class TimeAssignmentsModel;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
@@ -31,9 +31,9 @@ private Q_SLOTS:
|
|||||||
void getProjekteFinished(bool success, const QString &message, const QVector<Zeiterfassung::Projekt> &projekte);
|
void getProjekteFinished(bool success, const QString &message, const QVector<Zeiterfassung::Projekt> &projekte);
|
||||||
void getAuswertungFinished(bool success, const QString &message, const QByteArray &content);
|
void getAuswertungFinished(bool success, const QString &message, const QByteArray &content);
|
||||||
void refreshBuchungenFinished(bool success, const QString &message);
|
void refreshBuchungenFinished(bool success, const QString &message);
|
||||||
void refreshKontierungenFinished(bool success, const QString &message);
|
void refreshTimeAssignmentsFinished(bool success, const QString &message);
|
||||||
void contextMenuBuchung(const QPoint &pos);
|
void contextMenuBuchung(const QPoint &pos);
|
||||||
void contextMenuKontierung(const QPoint &pos);
|
void contextMenuTimeAssignment(const QPoint &pos);
|
||||||
void pushButtonStartPressed();
|
void pushButtonStartPressed();
|
||||||
void pushButtonEndPressed();
|
void pushButtonEndPressed();
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ private:
|
|||||||
QLabel *m_holidaysLabel;
|
QLabel *m_holidaysLabel;
|
||||||
|
|
||||||
BuchungenModel *m_buchungenModel;
|
BuchungenModel *m_buchungenModel;
|
||||||
KontierungenModel *m_kontierungenModel;
|
TimeAssignmentsModel *m_timeAssignmentsModel;
|
||||||
|
|
||||||
bool m_flag;
|
bool m_flag;
|
||||||
QTime m_kontierungTime;
|
QTime m_timeAssignmentTime;
|
||||||
QTime m_lastKontierungStart;
|
QTime m_lastTimeAssignmentStart;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@@ -233,13 +233,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QGroupBox" name="groupBoxKontierungen">
|
<widget class="QGroupBox" name="groupBoxTimeAssignments">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Kontierungen</string>
|
<string>Time assignments</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="treeViewKontierungen">
|
<widget class="QTreeView" name="treeViewTimeAssignments">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@@ -273,7 +273,7 @@
|
|||||||
<widget class="QMenu" name="menu_About">
|
<widget class="QMenu" name="menu_About">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&About</string>
|
<string>&About</string>
|
||||||
</property>v
|
</property>
|
||||||
<addaction name="actionAboutMe"/>
|
<addaction name="actionAboutMe"/>
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
@@ -1,110 +0,0 @@
|
|||||||
#include "kontierungenmodel.h"
|
|
||||||
|
|
||||||
KontierungenModel::KontierungenModel(Zeiterfassung &erfassung, QObject *parent) :
|
|
||||||
QAbstractListModel(parent),
|
|
||||||
m_erfassung(erfassung)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int KontierungenModel::rowCount(const QModelIndex &parent) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(parent)
|
|
||||||
|
|
||||||
return m_kontierungen.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
int KontierungenModel::columnCount(const QModelIndex &parent) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(parent)
|
|
||||||
|
|
||||||
return 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant KontierungenModel::data(const QModelIndex &index, int role) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(index.row() < m_kontierungen.count());
|
|
||||||
const auto &kontierung = m_kontierungen.at(index.row());
|
|
||||||
|
|
||||||
switch(role)
|
|
||||||
{
|
|
||||||
case Qt::DisplayRole:
|
|
||||||
case Qt::EditRole:
|
|
||||||
switch(index.column())
|
|
||||||
{
|
|
||||||
case 0: return kontierung.id;
|
|
||||||
case 1: return kontierung.time;
|
|
||||||
case 2: return kontierung.timespan;
|
|
||||||
case 3: return kontierung.projekt;
|
|
||||||
case 4: return kontierung.subprojekt;
|
|
||||||
case 5: return kontierung.workpackage;
|
|
||||||
case 6: return kontierung.text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant KontierungenModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|
||||||
{
|
|
||||||
switch(orientation)
|
|
||||||
{
|
|
||||||
case Qt::Horizontal:
|
|
||||||
switch(role)
|
|
||||||
{
|
|
||||||
case Qt::DisplayRole:
|
|
||||||
case Qt::EditRole:
|
|
||||||
switch(section)
|
|
||||||
{
|
|
||||||
case 0: return tr("ID");
|
|
||||||
case 1: return tr("Time");
|
|
||||||
case 2: return tr("Timespan");
|
|
||||||
case 3: return tr("Projekt");
|
|
||||||
case 4: return tr("Subprojekt");
|
|
||||||
case 5: return tr("Workpackage");
|
|
||||||
case 6: return tr("Text");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
Zeiterfassung::Kontierung KontierungenModel::getKontierung(const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
if(!index.isValid())
|
|
||||||
return Zeiterfassung::Kontierung();
|
|
||||||
|
|
||||||
Q_ASSERT(index.row() <= m_kontierungen.count());
|
|
||||||
return m_kontierungen.at(index.row());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KontierungenModel::refresh(int userId, const QDate &from, const QDate &to)
|
|
||||||
{
|
|
||||||
if(!m_erfassung.doGetKontierungen(userId, from, to))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
beginResetModel();
|
|
||||||
m_kontierungen.clear();
|
|
||||||
endResetModel();
|
|
||||||
|
|
||||||
connect(&m_erfassung, &Zeiterfassung::getKontierungenFinished,
|
|
||||||
this, &KontierungenModel::getKontierungenFinished);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KontierungenModel::getKontierungenFinished(bool success, const QString &message, const QVector<Zeiterfassung::Kontierung> &kontierungen)
|
|
||||||
{
|
|
||||||
disconnect(&m_erfassung, &Zeiterfassung::getKontierungenFinished,
|
|
||||||
this, &KontierungenModel::getKontierungenFinished);
|
|
||||||
|
|
||||||
if(success)
|
|
||||||
{
|
|
||||||
beginResetModel();
|
|
||||||
m_kontierungen = kontierungen;
|
|
||||||
endResetModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_EMIT refreshFinished(success, message);
|
|
||||||
}
|
|
@@ -1,68 +0,0 @@
|
|||||||
#ifndef KONTIERUNGENMODEL_H
|
|
||||||
#define KONTIERUNGENMODEL_H
|
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
#include "zeiterfassung.h"
|
|
||||||
|
|
||||||
class KontierungenModel : public QAbstractListModel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit KontierungenModel(Zeiterfassung &erfassung, QObject *parent = nullptr);
|
|
||||||
|
|
||||||
// QAbstractItemModel interface
|
|
||||||
int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
|
|
||||||
int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
|
|
||||||
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::Kontierung getKontierung(const QModelIndex &index) const;
|
|
||||||
|
|
||||||
bool refresh(int userId, const QDate &from, const QDate &to);
|
|
||||||
|
|
||||||
typedef QVector<Zeiterfassung::Kontierung>::iterator iterator;
|
|
||||||
typedef QVector<Zeiterfassung::Kontierung>::const_iterator const_iterator;
|
|
||||||
typedef QVector<Zeiterfassung::Kontierung>::reverse_iterator reverse_iterator;
|
|
||||||
typedef QVector<Zeiterfassung::Kontierung>::const_reverse_iterator const_reverse_iterator;
|
|
||||||
|
|
||||||
#if !defined(QT_STRICT_ITERATORS) || defined(Q_QDOC)
|
|
||||||
//inline iterator begin() { return m_kontierungen.begin(); }
|
|
||||||
inline const_iterator begin() const Q_DECL_NOTHROW { return m_kontierungen.begin(); }
|
|
||||||
inline const_iterator cbegin() const Q_DECL_NOTHROW { return m_kontierungen.cbegin(); }
|
|
||||||
inline const_iterator constBegin() const Q_DECL_NOTHROW { return m_kontierungen.constBegin(); }
|
|
||||||
//inline iterator end() { return m_kontierungen.end(); }
|
|
||||||
inline const_iterator end() const Q_DECL_NOTHROW { return m_kontierungen.end(); }
|
|
||||||
inline const_iterator cend() const Q_DECL_NOTHROW { return m_kontierungen.cend(); }
|
|
||||||
inline const_iterator constEnd() const Q_DECL_NOTHROW { return m_kontierungen.constEnd(); }
|
|
||||||
#else
|
|
||||||
//inline iterator begin(iterator = iterator()) { return m_kontierungen.begin(); }
|
|
||||||
inline const_iterator begin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_kontierungen.begin(); }
|
|
||||||
inline const_iterator cbegin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constBegin(); }
|
|
||||||
inline const_iterator constBegin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_kontierungen.constBegin(); }
|
|
||||||
//inline iterator end(iterator = iterator()) { return m_kontierungen.end(); }
|
|
||||||
inline const_iterator end(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_kontierungen.end(); }
|
|
||||||
inline const_iterator cend(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_kontierungen.cend(); }
|
|
||||||
inline const_iterator constEnd(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_kontierungen.constEnd(); }
|
|
||||||
#endif
|
|
||||||
//reverse_iterator rbegin() { return m_kontierungen.rbegin(); }
|
|
||||||
//reverse_iterator rend() { return m_kontierungen.rbegin(); }
|
|
||||||
const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return m_kontierungen.rbegin(); }
|
|
||||||
const_reverse_iterator rend() const Q_DECL_NOTHROW { return m_kontierungen.rend(); }
|
|
||||||
const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return m_kontierungen.crbegin(); }
|
|
||||||
const_reverse_iterator crend() const Q_DECL_NOTHROW { return m_kontierungen.crend(); }
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void refreshFinished(bool success, const QString &message);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void getKontierungenFinished(bool success, const QString &message, const QVector<Zeiterfassung::Kontierung> &kontierungen);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Zeiterfassung &m_erfassung;
|
|
||||||
QVector<Zeiterfassung::Kontierung> m_kontierungen;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // KONTIERUNGENMODEL_H
|
|
110
models/timeassignmentsmodel.cpp
Normal file
110
models/timeassignmentsmodel.cpp
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
#include "timeassignmentsmodel.h"
|
||||||
|
|
||||||
|
TimeAssignmentsModel::TimeAssignmentsModel(Zeiterfassung &erfassung, QObject *parent) :
|
||||||
|
QAbstractListModel(parent),
|
||||||
|
m_erfassung(erfassung)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int TimeAssignmentsModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
return m_timeAssignments.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
int TimeAssignmentsModel::columnCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant TimeAssignmentsModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(index.row() < m_timeAssignments.count());
|
||||||
|
const auto &timeAssignment = m_timeAssignments.at(index.row());
|
||||||
|
|
||||||
|
switch(role)
|
||||||
|
{
|
||||||
|
case Qt::DisplayRole:
|
||||||
|
case Qt::EditRole:
|
||||||
|
switch(index.column())
|
||||||
|
{
|
||||||
|
case 0: return timeAssignment.id;
|
||||||
|
case 1: return timeAssignment.time;
|
||||||
|
case 2: return timeAssignment.timespan;
|
||||||
|
case 3: return timeAssignment.projekt;
|
||||||
|
case 4: return timeAssignment.subprojekt;
|
||||||
|
case 5: return timeAssignment.workpackage;
|
||||||
|
case 6: return timeAssignment.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant TimeAssignmentsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
{
|
||||||
|
switch(orientation)
|
||||||
|
{
|
||||||
|
case Qt::Horizontal:
|
||||||
|
switch(role)
|
||||||
|
{
|
||||||
|
case Qt::DisplayRole:
|
||||||
|
case Qt::EditRole:
|
||||||
|
switch(section)
|
||||||
|
{
|
||||||
|
case 0: return tr("ID");
|
||||||
|
case 1: return tr("Time");
|
||||||
|
case 2: return tr("Timespan");
|
||||||
|
case 3: return tr("Projekt");
|
||||||
|
case 4: return tr("Subprojekt");
|
||||||
|
case 5: return tr("Workpackage");
|
||||||
|
case 6: return tr("Text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
Zeiterfassung::TimeAssignment TimeAssignmentsModel::getTimeAssignment(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if(!index.isValid())
|
||||||
|
return Zeiterfassung::TimeAssignment();
|
||||||
|
|
||||||
|
Q_ASSERT(index.row() <= m_timeAssignments.count());
|
||||||
|
return m_timeAssignments.at(index.row());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TimeAssignmentsModel::refresh(int userId, const QDate &from, const QDate &to)
|
||||||
|
{
|
||||||
|
if(!m_erfassung.doGetTimeAssignments(userId, from, to))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
beginResetModel();
|
||||||
|
m_timeAssignments.clear();
|
||||||
|
endResetModel();
|
||||||
|
|
||||||
|
connect(&m_erfassung, &Zeiterfassung::getTimeAssignmentsFinished,
|
||||||
|
this, &TimeAssignmentsModel::getTimeAssignmentsFinished);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TimeAssignmentsModel::getTimeAssignmentsFinished(bool success, const QString &message, const QVector<Zeiterfassung::TimeAssignment> &timeAssignments)
|
||||||
|
{
|
||||||
|
disconnect(&m_erfassung, &Zeiterfassung::getTimeAssignmentsFinished,
|
||||||
|
this, &TimeAssignmentsModel::getTimeAssignmentsFinished);
|
||||||
|
|
||||||
|
if(success)
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
m_timeAssignments = timeAssignments;
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EMIT refreshFinished(success, message);
|
||||||
|
}
|
68
models/timeassignmentsmodel.h
Normal file
68
models/timeassignmentsmodel.h
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#ifndef TIMEASSIGNMENTSMODEL_H
|
||||||
|
#define TIMEASSIGNMENTSMODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "zeiterfassung.h"
|
||||||
|
|
||||||
|
class TimeAssignmentsModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TimeAssignmentsModel(Zeiterfassung &erfassung, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
// QAbstractItemModel interface
|
||||||
|
int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
|
||||||
|
int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
|
||||||
|
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;
|
||||||
|
|
||||||
|
bool refresh(int userId, const QDate &from, const QDate &to);
|
||||||
|
|
||||||
|
typedef QVector<Zeiterfassung::TimeAssignment>::iterator iterator;
|
||||||
|
typedef QVector<Zeiterfassung::TimeAssignment>::const_iterator const_iterator;
|
||||||
|
typedef QVector<Zeiterfassung::TimeAssignment>::reverse_iterator reverse_iterator;
|
||||||
|
typedef QVector<Zeiterfassung::TimeAssignment>::const_reverse_iterator const_reverse_iterator;
|
||||||
|
|
||||||
|
#if !defined(QT_STRICT_ITERATORS)
|
||||||
|
//inline iterator begin() { return m_timeAssignments.begin(); }
|
||||||
|
inline const_iterator begin() const Q_DECL_NOTHROW { return m_timeAssignments.begin(); }
|
||||||
|
inline const_iterator cbegin() const Q_DECL_NOTHROW { return m_timeAssignments.cbegin(); }
|
||||||
|
inline const_iterator constBegin() const Q_DECL_NOTHROW { return m_timeAssignments.constBegin(); }
|
||||||
|
//inline iterator end() { return m_timeAssignments.end(); }
|
||||||
|
inline const_iterator end() const Q_DECL_NOTHROW { return m_timeAssignments.end(); }
|
||||||
|
inline const_iterator cend() const Q_DECL_NOTHROW { return m_timeAssignments.cend(); }
|
||||||
|
inline const_iterator constEnd() const Q_DECL_NOTHROW { return m_timeAssignments.constEnd(); }
|
||||||
|
#else
|
||||||
|
//inline iterator begin(iterator = iterator()) { return m_timeAssignments.begin(); }
|
||||||
|
inline const_iterator begin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_timeAssignments.begin(); }
|
||||||
|
inline const_iterator cbegin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constBegin(); }
|
||||||
|
inline const_iterator constBegin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_timeAssignments.constBegin(); }
|
||||||
|
//inline iterator end(iterator = iterator()) { return m_timeAssignments.end(); }
|
||||||
|
inline const_iterator end(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_timeAssignments.end(); }
|
||||||
|
inline const_iterator cend(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_timeAssignments.cend(); }
|
||||||
|
inline const_iterator constEnd(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return m_timeAssignments.constEnd(); }
|
||||||
|
#endif
|
||||||
|
//reverse_iterator rbegin() { return m_timeAssignments.rbegin(); }
|
||||||
|
//reverse_iterator rend() { return m_timeAssignments.rbegin(); }
|
||||||
|
const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return m_timeAssignments.rbegin(); }
|
||||||
|
const_reverse_iterator rend() const Q_DECL_NOTHROW { return m_timeAssignments.rend(); }
|
||||||
|
const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return m_timeAssignments.crbegin(); }
|
||||||
|
const_reverse_iterator crend() const Q_DECL_NOTHROW { return m_timeAssignments.crend(); }
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void refreshFinished(bool success, const QString &message);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void getTimeAssignmentsFinished(bool success, const QString &message, const QVector<Zeiterfassung::TimeAssignment> &timeAssignments);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Zeiterfassung &m_erfassung;
|
||||||
|
QVector<Zeiterfassung::TimeAssignment> m_timeAssignments;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TIMEASSIGNMENTSMODEL_H
|
@@ -1,25 +0,0 @@
|
|||||||
#ifndef KONTIERUNGSTRIP_H
|
|
||||||
#define KONTIERUNGSTRIP_H
|
|
||||||
|
|
||||||
#include <QFrame>
|
|
||||||
|
|
||||||
class QTime;
|
|
||||||
|
|
||||||
class ZeiterfassungSettings;
|
|
||||||
namespace Ui { class KontierungStrip; }
|
|
||||||
|
|
||||||
class KontierungStrip : public QFrame
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit KontierungStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
|
||||||
const QString &workpackage, const QString &text, const ZeiterfassungSettings &settings,
|
|
||||||
QWidget *parent = 0);
|
|
||||||
~KontierungStrip();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::KontierungStrip *ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // KONTIERUNGSTRIP_H
|
|
@@ -1,23 +1,23 @@
|
|||||||
#include "kontierungstrip.h"
|
#include "timeassignmentstrip.h"
|
||||||
#include "ui_kontierungstrip.h"
|
#include "ui_timeassignmentstrip.h"
|
||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
|
||||||
#include "zeiterfassungsettings.h"
|
#include "zeiterfassungsettings.h"
|
||||||
|
|
||||||
KontierungStrip::KontierungStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
TimeAssignmentStrip::TimeAssignmentStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
||||||
const QString &workpackage, const QString &text, const ZeiterfassungSettings &settings,
|
const QString &workpackage, const QString &text, const ZeiterfassungSettings &settings,
|
||||||
QWidget *parent) :
|
QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
ui(new Ui::KontierungStrip)
|
ui(new Ui::TimeAssignmentStrip)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setMinimumHeight(minimumSizeHint().height());
|
setMinimumHeight(minimumSizeHint().height());
|
||||||
setMaximumHeight(minimumSizeHint().height());
|
setMaximumHeight(minimumSizeHint().height());
|
||||||
|
|
||||||
setStyleSheet(QStringLiteral("%0 { background-color: %1; }").arg(staticMetaObject.className()).arg(settings.kontierungBackgroundColor()));
|
setStyleSheet(QStringLiteral("%0 { background-color: %1; }").arg(staticMetaObject.className()).arg(settings.timeAssignmentBackgroundColor()));
|
||||||
|
|
||||||
ui->labelTime->setText(duration == QTime(0, 0) ? tr("Open") : duration.toString(QStringLiteral("HH:mm")));
|
ui->labelTime->setText(duration == QTime(0, 0) ? tr("Open") : duration.toString(QStringLiteral("HH:mm")));
|
||||||
ui->labelProjekt->setText(projekt);
|
ui->labelProjekt->setText(projekt);
|
||||||
@@ -28,7 +28,7 @@ KontierungStrip::KontierungStrip(int id, const QTime &duration, const QString &p
|
|||||||
ui->labelText->setText(text);
|
ui->labelText->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
KontierungStrip::~KontierungStrip()
|
TimeAssignmentStrip::~TimeAssignmentStrip()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
25
strips/timeassignmentstrip.h
Normal file
25
strips/timeassignmentstrip.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#ifndef TIMEASSIGNMENTSTRIP_H
|
||||||
|
#define TIMEASSIGNMENTSTRIP_H
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
|
|
||||||
|
class QTime;
|
||||||
|
|
||||||
|
class ZeiterfassungSettings;
|
||||||
|
namespace Ui { class TimeAssignmentStrip; }
|
||||||
|
|
||||||
|
class TimeAssignmentStrip : public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TimeAssignmentStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
||||||
|
const QString &workpackage, const QString &text, const ZeiterfassungSettings &settings,
|
||||||
|
QWidget *parent = 0);
|
||||||
|
~TimeAssignmentStrip();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::TimeAssignmentStrip *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TIMEASSIGNMENTSTRIP_H
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>KontierungStrip</class>
|
<class>TimeAssignmentStrip</class>
|
||||||
<widget class="QFrame" name="KontierungStrip">
|
<widget class="QFrame" name="TimeAssignmentStrip">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
@@ -187,11 +187,11 @@ bool Zeiterfassung::doDeleteBuchung(int buchungId)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Zeiterfassung::doGetKontierungen(int userId, const QDate &start, const QDate &end)
|
bool Zeiterfassung::doGetTimeAssignments(int userId, const QDate &start, const QDate &end)
|
||||||
{
|
{
|
||||||
if(m_replies.getKontierungen)
|
if(m_replies.getTimeAssignments)
|
||||||
{
|
{
|
||||||
qWarning() << "another getKontierungen already processing!";
|
qWarning() << "another getTimeAssignments already processing!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,18 +202,20 @@ bool Zeiterfassung::doGetKontierungen(int userId, const QDate &start, const QDat
|
|||||||
.arg(userId)));
|
.arg(userId)));
|
||||||
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
|
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
|
||||||
|
|
||||||
m_replies.getKontierungen = m_manager->get(request);
|
m_replies.getTimeAssignments = m_manager->get(request);
|
||||||
connect(m_replies.getKontierungen, &QNetworkReply::finished,
|
connect(m_replies.getTimeAssignments, &QNetworkReply::finished,
|
||||||
this, &Zeiterfassung::getKontierungenRequestFinished);
|
this, &Zeiterfassung::getTimeAssignmentsRequestFinished);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Zeiterfassung::doCreateKontierung(int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &projekt, const QString &subprojekt, const QString &workpackage, const QString &text)
|
bool Zeiterfassung::doCreateTimeAssignment(int userId, const QDate &date, const QTime &time, const QTime ×pan,
|
||||||
|
const QString &projekt, const QString &subprojekt, const QString &workpackage,
|
||||||
|
const QString &text)
|
||||||
{
|
{
|
||||||
if(m_replies.createKontierung)
|
if(m_replies.createTimeAssignment)
|
||||||
{
|
{
|
||||||
qWarning() << "another createKontierung already processing!";
|
qWarning() << "another createTimeAssignment already processing!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,27 +250,29 @@ bool Zeiterfassung::doCreateKontierung(int userId, const QDate &date, const QTim
|
|||||||
obj[QStringLiteral("koWertList")] = koWertList;
|
obj[QStringLiteral("koWertList")] = koWertList;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_replies.createKontierung = m_manager->post(request, QJsonDocument(obj).toJson());
|
m_replies.createTimeAssignment = m_manager->post(request, QJsonDocument(obj).toJson());
|
||||||
connect(m_replies.createKontierung, &QNetworkReply::finished,
|
connect(m_replies.createTimeAssignment, &QNetworkReply::finished,
|
||||||
this, &Zeiterfassung::createKontierungRequestFinished);
|
this, &Zeiterfassung::createTimeAssignmentRequestFinished);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Zeiterfassung::doUpdateKontierung(int kontierungId, int userId, const QDate &date, const QTime &time, const QTime ×pan, const QString &projekt, const QString &subprojekt, const QString &workpackage, const QString &text)
|
bool Zeiterfassung::doUpdateTimeAssignment(int timeAssignmentId, int userId, const QDate &date, const QTime &time,
|
||||||
|
const QTime ×pan, const QString &projekt, const QString &subprojekt,
|
||||||
|
const QString &workpackage, const QString &text)
|
||||||
{
|
{
|
||||||
if(m_replies.updateKontierung)
|
if(m_replies.updateTimeAssignment)
|
||||||
{
|
{
|
||||||
qWarning() << "another updateKontierung already processing!";
|
qWarning() << "another updateTimeAssignment already processing!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkRequest request(QUrl(QStringLiteral("%0json/azebooking/%1").arg(m_url).arg(kontierungId)));
|
QNetworkRequest request(QUrl(QStringLiteral("%0json/azebooking/%1").arg(m_url).arg(timeAssignmentId)));
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/json"));
|
request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/json"));
|
||||||
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
|
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
|
||||||
|
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
obj[QStringLiteral("bookingNr")] = kontierungId;
|
obj[QStringLiteral("bookingNr")] = timeAssignmentId;
|
||||||
obj[QStringLiteral("persNr")] = userId;
|
obj[QStringLiteral("persNr")] = userId;
|
||||||
obj[QStringLiteral("bookingDate")] = date.toString("yyyyMMdd").toInt();
|
obj[QStringLiteral("bookingDate")] = date.toString("yyyyMMdd").toInt();
|
||||||
obj[QStringLiteral("bookingTime")] = time.toString("Hmmss").toInt();
|
obj[QStringLiteral("bookingTime")] = time.toString("Hmmss").toInt();
|
||||||
@@ -299,29 +303,29 @@ bool Zeiterfassung::doUpdateKontierung(int kontierungId, int userId, const QDate
|
|||||||
obj[QStringLiteral("koWertList")] = koWertList;
|
obj[QStringLiteral("koWertList")] = koWertList;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_replies.updateKontierung = m_manager->put(request, QJsonDocument(obj).toJson());
|
m_replies.updateTimeAssignment = m_manager->put(request, QJsonDocument(obj).toJson());
|
||||||
connect(m_replies.updateKontierung, &QNetworkReply::finished,
|
connect(m_replies.updateTimeAssignment, &QNetworkReply::finished,
|
||||||
this, &Zeiterfassung::updateKontierungRequestFinished);
|
this, &Zeiterfassung::updateTimeAssignmentRequestFinished);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Zeiterfassung::doDeleteKontierung(int kontierungId)
|
bool Zeiterfassung::doDeleteTimeAssignment(int timeAssignmentId)
|
||||||
{
|
{
|
||||||
if(m_replies.deleteKontierung)
|
if(m_replies.deleteTimeAssignment)
|
||||||
{
|
{
|
||||||
qWarning() << "another deleteKontierung already processing!";
|
qWarning() << "another deleteTimeAssignment already processing!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkRequest request(QUrl(QStringLiteral("%0json/azebooking/%1")
|
QNetworkRequest request(QUrl(QStringLiteral("%0json/azebooking/%1")
|
||||||
.arg(m_url)
|
.arg(m_url)
|
||||||
.arg(kontierungId)));
|
.arg(timeAssignmentId)));
|
||||||
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
|
request.setRawHeader(QByteArrayLiteral("sisAppName"), QByteArrayLiteral("bookingCalendar"));
|
||||||
|
|
||||||
m_replies.deleteKontierung = m_manager->deleteResource(request);
|
m_replies.deleteTimeAssignment = m_manager->deleteResource(request);
|
||||||
connect(m_replies.deleteKontierung, &QNetworkReply::finished,
|
connect(m_replies.deleteTimeAssignment, &QNetworkReply::finished,
|
||||||
this, &Zeiterfassung::deleteKontierungRequestFinished);
|
this, &Zeiterfassung::deleteTimeAssignmentRequestFinished);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -627,31 +631,31 @@ void Zeiterfassung::deleteBuchungRequestFinished()
|
|||||||
m_replies.deleteBuchung = Q_NULLPTR;
|
m_replies.deleteBuchung = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zeiterfassung::getKontierungenRequestFinished()
|
void Zeiterfassung::getTimeAssignmentsRequestFinished()
|
||||||
{
|
{
|
||||||
if(m_replies.getKontierungen->error() != QNetworkReply::NoError)
|
if(m_replies.getTimeAssignments->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
Q_EMIT getKontierungenFinished(false, tr("Request error occured: %0").arg(m_replies.getKontierungen->error()), {});
|
Q_EMIT getTimeAssignmentsFinished(false, tr("Request error occured: %0").arg(m_replies.getTimeAssignments->error()), {});
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument document = QJsonDocument::fromJson(m_replies.getKontierungen->readAll(), &error);
|
QJsonDocument document = QJsonDocument::fromJson(m_replies.getTimeAssignments->readAll(), &error);
|
||||||
if(error.error != QJsonParseError::NoError)
|
if(error.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
Q_EMIT getKontierungenFinished(false, tr("Parsing JSON failed: %0").arg(error.errorString()), {});
|
Q_EMIT getTimeAssignmentsFinished(false, tr("Parsing JSON failed: %0").arg(error.errorString()), {});
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!document.isArray())
|
if(!document.isArray())
|
||||||
{
|
{
|
||||||
Q_EMIT getKontierungenFinished(false, tr("JSON document is not an array!"), {});
|
Q_EMIT getTimeAssignmentsFinished(false, tr("JSON document is not an array!"), {});
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto arr = document.array();
|
auto arr = document.array();
|
||||||
QVector<Kontierung> kontierungen;
|
QVector<TimeAssignment> timeAssignments;
|
||||||
|
|
||||||
for(const auto &val : arr)
|
for(const auto &val : arr)
|
||||||
{
|
{
|
||||||
@@ -659,7 +663,7 @@ void Zeiterfassung::getKontierungenRequestFinished()
|
|||||||
|
|
||||||
auto koWertList = obj.value(QStringLiteral("koWertList")).toArray();
|
auto koWertList = obj.value(QStringLiteral("koWertList")).toArray();
|
||||||
|
|
||||||
kontierungen.append({
|
timeAssignments.append({
|
||||||
obj.value(QStringLiteral("bookingNr")).toInt(),
|
obj.value(QStringLiteral("bookingNr")).toInt(),
|
||||||
QDate::fromString(QString::number(obj.value(QStringLiteral("bookingDate")).toInt()), QStringLiteral("yyyyMMdd")),
|
QDate::fromString(QString::number(obj.value(QStringLiteral("bookingDate")).toInt()), QStringLiteral("yyyyMMdd")),
|
||||||
QTime::fromString(QString("%0").arg(obj.value(QStringLiteral("bookingTime")).toInt(), 6, 10, QChar('0')), QStringLiteral("HHmmss")),
|
QTime::fromString(QString("%0").arg(obj.value(QStringLiteral("bookingTime")).toInt(), 6, 10, QChar('0')), QStringLiteral("HHmmss")),
|
||||||
@@ -671,34 +675,34 @@ void Zeiterfassung::getKontierungenRequestFinished()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT getKontierungenFinished(true, QString(), kontierungen);
|
Q_EMIT getTimeAssignmentsFinished(true, QString(), timeAssignments);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
m_replies.getKontierungen->deleteLater();
|
m_replies.getTimeAssignments->deleteLater();
|
||||||
m_replies.getKontierungen = Q_NULLPTR;
|
m_replies.getTimeAssignments = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zeiterfassung::createKontierungRequestFinished()
|
void Zeiterfassung::createTimeAssignmentRequestFinished()
|
||||||
{
|
{
|
||||||
if(m_replies.createKontierung->error() != QNetworkReply::NoError)
|
if(m_replies.createTimeAssignment->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
Q_EMIT createKontierungFinished(false, tr("Request error occured: %0").arg(m_replies.createKontierung->error()), -1);
|
Q_EMIT createTimeAssignmentFinished(false, tr("Request error occured: %0").arg(m_replies.createTimeAssignment->error()), -1);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument document = QJsonDocument::fromJson(m_replies.createKontierung->readAll(), &error);
|
QJsonDocument document = QJsonDocument::fromJson(m_replies.createTimeAssignment->readAll(), &error);
|
||||||
if(error.error != QJsonParseError::NoError)
|
if(error.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
Q_EMIT createKontierungFinished(false, tr("Parsing JSON failed: %0").arg(error.errorString()), -1);
|
Q_EMIT createTimeAssignmentFinished(false, tr("Parsing JSON failed: %0").arg(error.errorString()), -1);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!document.isObject())
|
if(!document.isObject())
|
||||||
{
|
{
|
||||||
Q_EMIT createKontierungFinished(false, tr("JSON document is not an object!"), -1);
|
Q_EMIT createTimeAssignmentFinished(false, tr("JSON document is not an object!"), -1);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,40 +710,40 @@ void Zeiterfassung::createKontierungRequestFinished()
|
|||||||
|
|
||||||
if(!obj.contains(QStringLiteral("bookingNr")))
|
if(!obj.contains(QStringLiteral("bookingNr")))
|
||||||
{
|
{
|
||||||
Q_EMIT createKontierungFinished(false, tr("JSON does not contain bookingNr!"), -1);
|
Q_EMIT createTimeAssignmentFinished(false, tr("JSON does not contain bookingNr!"), -1);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto kontierungId = obj.value(QStringLiteral("bookingNr")).toInt();
|
auto timeAssignmentId = obj.value(QStringLiteral("bookingNr")).toInt();
|
||||||
|
|
||||||
Q_EMIT createKontierungFinished(true, QString(), kontierungId);
|
Q_EMIT createTimeAssignmentFinished(true, QString(), timeAssignmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
m_replies.createKontierung->deleteLater();
|
m_replies.createTimeAssignment->deleteLater();
|
||||||
m_replies.createKontierung = Q_NULLPTR;
|
m_replies.createTimeAssignment = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zeiterfassung::updateKontierungRequestFinished()
|
void Zeiterfassung::updateTimeAssignmentRequestFinished()
|
||||||
{
|
{
|
||||||
if(m_replies.updateKontierung->error() != QNetworkReply::NoError)
|
if(m_replies.updateTimeAssignment->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
Q_EMIT updateKontierungFinished(false, tr("Request error occured: %0").arg(m_replies.updateKontierung->error()), -1);
|
Q_EMIT updateTimeAssignmentFinished(false, tr("Request error occured: %0").arg(m_replies.updateTimeAssignment->error()), -1);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument document = QJsonDocument::fromJson(m_replies.updateKontierung->readAll(), &error);
|
QJsonDocument document = QJsonDocument::fromJson(m_replies.updateTimeAssignment->readAll(), &error);
|
||||||
if(error.error != QJsonParseError::NoError)
|
if(error.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
Q_EMIT updateKontierungFinished(false, tr("Parsing JSON failed: %0").arg(error.errorString()), -1);
|
Q_EMIT updateTimeAssignmentFinished(false, tr("Parsing JSON failed: %0").arg(error.errorString()), -1);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!document.isObject())
|
if(!document.isObject())
|
||||||
{
|
{
|
||||||
Q_EMIT updateKontierungFinished(false, tr("JSON document is not an object!"), 0);
|
Q_EMIT updateTimeAssignmentFinished(false, tr("JSON document is not an object!"), 0);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -747,34 +751,34 @@ void Zeiterfassung::updateKontierungRequestFinished()
|
|||||||
|
|
||||||
if(!obj.contains(QStringLiteral("bookingNr")))
|
if(!obj.contains(QStringLiteral("bookingNr")))
|
||||||
{
|
{
|
||||||
Q_EMIT updateKontierungFinished(false, tr("JSON does not contain bookingNr!"), 0);
|
Q_EMIT updateTimeAssignmentFinished(false, tr("JSON does not contain bookingNr!"), 0);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto kontierungId = obj.value(QStringLiteral("bookingNr")).toInt();
|
auto timeAssignmentId = obj.value(QStringLiteral("bookingNr")).toInt();
|
||||||
|
|
||||||
Q_EMIT updateKontierungFinished(true, QString(), kontierungId);
|
Q_EMIT updateTimeAssignmentFinished(true, QString(), timeAssignmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
m_replies.updateKontierung->deleteLater();
|
m_replies.updateTimeAssignment->deleteLater();
|
||||||
m_replies.updateKontierung = Q_NULLPTR;
|
m_replies.updateTimeAssignment = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zeiterfassung::deleteKontierungRequestFinished()
|
void Zeiterfassung::deleteTimeAssignmentRequestFinished()
|
||||||
{
|
{
|
||||||
if(m_replies.deleteKontierung->error() != QNetworkReply::NoError)
|
if(m_replies.deleteTimeAssignment->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
Q_EMIT deleteKontierungFinished(false, tr("Request error occured: %0").arg(m_replies.deleteKontierung->error()));
|
Q_EMIT deleteTimeAssignmentFinished(false, tr("Request error occured: %0").arg(m_replies.deleteTimeAssignment->error()));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
//only contains deleted id, so nothing to check here
|
//only contains deleted id, so nothing to check here
|
||||||
Q_EMIT deleteKontierungFinished(true, QString());
|
Q_EMIT deleteTimeAssignmentFinished(true, QString());
|
||||||
|
|
||||||
end:
|
end:
|
||||||
m_replies.deleteKontierung->deleteLater();
|
m_replies.deleteTimeAssignment->deleteLater();
|
||||||
m_replies.deleteKontierung = Q_NULLPTR;
|
m_replies.deleteTimeAssignment = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zeiterfassung::getProjekteRequestFinished()
|
void Zeiterfassung::getProjekteRequestFinished()
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
QString text;
|
QString text;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Kontierung
|
struct TimeAssignment
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
QDate date;
|
QDate date;
|
||||||
@@ -70,14 +70,14 @@ public Q_SLOTS:
|
|||||||
const QTime ×pan, const QString &type, const QString &text);
|
const QTime ×pan, const QString &type, const QString &text);
|
||||||
bool doDeleteBuchung(int buchungId);
|
bool doDeleteBuchung(int buchungId);
|
||||||
|
|
||||||
bool doGetKontierungen(int userId, const QDate &start, const QDate &end);
|
bool doGetTimeAssignments(int userId, const QDate &start, const QDate &end);
|
||||||
bool doCreateKontierung(int userId, const QDate &date, const QTime &time, const QTime ×pan,
|
bool doCreateTimeAssignment(int userId, const QDate &date, const QTime &time, const QTime ×pan,
|
||||||
const QString &projekt, const QString &subprojekt, const QString &workpackage,
|
const QString &projekt, const QString &subprojekt, const QString &workpackage,
|
||||||
const QString &text);
|
const QString &text);
|
||||||
bool doUpdateKontierung(int kontierungId, int userId, const QDate &date, const QTime &time,
|
bool doUpdateTimeAssignment(int timeAssignmentId, int userId, const QDate &date, const QTime &time,
|
||||||
const QTime ×pan, const QString &projekt, const QString &subprojekt,
|
const QTime ×pan, const QString &projekt, const QString &subprojekt,
|
||||||
const QString &workpackage, const QString &text);
|
const QString &workpackage, const QString &text);
|
||||||
bool doDeleteKontierung(int kontierungId);
|
bool doDeleteTimeAssignment(int timeAssignmentId);
|
||||||
|
|
||||||
bool doGetProjekte(int userId, const QDate &date);
|
bool doGetProjekte(int userId, const QDate &date);
|
||||||
bool doGetAuswertung(int userId, const QDate &date);
|
bool doGetAuswertung(int userId, const QDate &date);
|
||||||
@@ -94,10 +94,10 @@ Q_SIGNALS:
|
|||||||
void updateBuchungFinished(bool success, const QString &message, int buchungId);
|
void updateBuchungFinished(bool success, const QString &message, int buchungId);
|
||||||
void deleteBuchungFinished(bool success, const QString &message);
|
void deleteBuchungFinished(bool success, const QString &message);
|
||||||
|
|
||||||
void getKontierungenFinished(bool success, const QString &message, const QVector<Kontierung> &kontierungen);
|
void getTimeAssignmentsFinished(bool success, const QString &message, const QVector<TimeAssignment> &timeAssignments);
|
||||||
void createKontierungFinished(bool success, const QString &message, int buchungId);
|
void createTimeAssignmentFinished(bool success, const QString &message, int timeAssignmentId);
|
||||||
void updateKontierungFinished(bool success, const QString &message, int buchungId);
|
void updateTimeAssignmentFinished(bool success, const QString &message, int timeAssignmentId);
|
||||||
void deleteKontierungFinished(bool success, const QString &message);
|
void deleteTimeAssignmentFinished(bool success, const QString &message);
|
||||||
|
|
||||||
void getProjekteFinished(bool success, const QString &message, const QVector<Projekt> &projekte);
|
void getProjekteFinished(bool success, const QString &message, const QVector<Projekt> &projekte);
|
||||||
void getAuswertungFinished(bool success, const QString &message, const QByteArray &content);
|
void getAuswertungFinished(bool success, const QString &message, const QByteArray &content);
|
||||||
@@ -112,10 +112,10 @@ private Q_SLOTS:
|
|||||||
void updateBuchungRequestFinished();
|
void updateBuchungRequestFinished();
|
||||||
void deleteBuchungRequestFinished();
|
void deleteBuchungRequestFinished();
|
||||||
|
|
||||||
void getKontierungenRequestFinished();
|
void getTimeAssignmentsRequestFinished();
|
||||||
void createKontierungRequestFinished();
|
void createTimeAssignmentRequestFinished();
|
||||||
void updateKontierungRequestFinished();
|
void updateTimeAssignmentRequestFinished();
|
||||||
void deleteKontierungRequestFinished();
|
void deleteTimeAssignmentRequestFinished();
|
||||||
|
|
||||||
void getProjekteRequestFinished();
|
void getProjekteRequestFinished();
|
||||||
void getAuswertungRequest0Finished();
|
void getAuswertungRequest0Finished();
|
||||||
@@ -135,10 +135,10 @@ private:
|
|||||||
QNetworkReply *updateBuchung;
|
QNetworkReply *updateBuchung;
|
||||||
QNetworkReply *deleteBuchung;
|
QNetworkReply *deleteBuchung;
|
||||||
|
|
||||||
QNetworkReply *getKontierungen;
|
QNetworkReply *getTimeAssignments;
|
||||||
QNetworkReply *createKontierung;
|
QNetworkReply *createTimeAssignment;
|
||||||
QNetworkReply *updateKontierung;
|
QNetworkReply *updateTimeAssignment;
|
||||||
QNetworkReply *deleteKontierung;
|
QNetworkReply *deleteTimeAssignment;
|
||||||
|
|
||||||
QNetworkReply *getProjekte;
|
QNetworkReply *getProjekte;
|
||||||
QNetworkReply *getAuswertung;
|
QNetworkReply *getAuswertung;
|
||||||
|
@@ -23,14 +23,14 @@ SOURCES += main.cpp \
|
|||||||
dialogs/authenticationdialog.cpp \
|
dialogs/authenticationdialog.cpp \
|
||||||
dialogs/buchungdialog.cpp \
|
dialogs/buchungdialog.cpp \
|
||||||
models/buchungenmodel.cpp \
|
models/buchungenmodel.cpp \
|
||||||
dialogs/kontierungdialog.cpp \
|
|
||||||
models/kontierungenmodel.cpp \
|
|
||||||
eventloopwithstatus.cpp \
|
eventloopwithstatus.cpp \
|
||||||
strips/buchungstrip.cpp \
|
strips/buchungstrip.cpp \
|
||||||
strips/kontierungstrip.cpp \
|
|
||||||
zeiterfassungsettings.cpp \
|
zeiterfassungsettings.cpp \
|
||||||
dialogs/settingsdialog.cpp \
|
dialogs/settingsdialog.cpp \
|
||||||
dialogs/languageselectiondialog.cpp
|
dialogs/languageselectiondialog.cpp \
|
||||||
|
dialogs/timeassignmentdialog.cpp \
|
||||||
|
models/timeassignmentsmodel.cpp \
|
||||||
|
strips/timeassignmentstrip.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
zeiterfassung.h \
|
zeiterfassung.h \
|
||||||
@@ -39,25 +39,25 @@ HEADERS += \
|
|||||||
dialogs/authenticationdialog.h \
|
dialogs/authenticationdialog.h \
|
||||||
dialogs/buchungdialog.h \
|
dialogs/buchungdialog.h \
|
||||||
models/buchungenmodel.h \
|
models/buchungenmodel.h \
|
||||||
dialogs/kontierungdialog.h \
|
|
||||||
models/kontierungenmodel.h \
|
|
||||||
eventloopwithstatus.h \
|
eventloopwithstatus.h \
|
||||||
strips/buchungstrip.h \
|
strips/buchungstrip.h \
|
||||||
strips/kontierungstrip.h \
|
|
||||||
zeiterfassungsettings.h \
|
zeiterfassungsettings.h \
|
||||||
dialogs/settingsdialog.h \
|
dialogs/settingsdialog.h \
|
||||||
dialogs/languageselectiondialog.h
|
dialogs/languageselectiondialog.h \
|
||||||
|
dialogs/timeassignmentdialog.h \
|
||||||
|
models/timeassignmentsmodel.h \
|
||||||
|
strips/timeassignmentstrip.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
dialogs/aboutmedialog.ui \
|
dialogs/aboutmedialog.ui \
|
||||||
dialogs/authenticationdialog.ui \
|
dialogs/authenticationdialog.ui \
|
||||||
dialogs/buchungdialog.ui \
|
dialogs/buchungdialog.ui \
|
||||||
dialogs/kontierungdialog.ui \
|
|
||||||
strips/buchungstrip.ui \
|
strips/buchungstrip.ui \
|
||||||
strips/kontierungstrip.ui \
|
|
||||||
dialogs/settingsdialog.ui \
|
dialogs/settingsdialog.ui \
|
||||||
dialogs/languageselectiondialog.ui
|
dialogs/languageselectiondialog.ui \
|
||||||
|
dialogs/timeassignmentdialog.ui \
|
||||||
|
strips/timeassignmentstrip.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc
|
resources.qrc
|
||||||
|
@@ -162,14 +162,14 @@ void ZeiterfassungSettings::setBuchungOtherBackgroundColor(const QString &buchun
|
|||||||
setValue("buchungOtherBackgroundColor", buchungOtherBackgroundColor);
|
setValue("buchungOtherBackgroundColor", buchungOtherBackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ZeiterfassungSettings::kontierungBackgroundColor() const
|
QString ZeiterfassungSettings::timeAssignmentBackgroundColor() const
|
||||||
{
|
{
|
||||||
return value("kontierungBackgroundColor", QStringLiteral("qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFFFF, stop:1 #6FBFBF)")).toString();
|
return value("timeAssignmentBackgroundColor", QStringLiteral("qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFFFF, stop:1 #6FBFBF)")).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeiterfassungSettings::setKontierungBackgroundColor(const QString kontierungBackgroundColor)
|
void ZeiterfassungSettings::setTimeAssignmentBackgroundColor(const QString timeAssignmentBackgroundColor)
|
||||||
{
|
{
|
||||||
setValue("kontierungBackgroundColor", kontierungBackgroundColor);
|
setValue("timeAssignmentBackgroundColor", timeAssignmentBackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeiterfassungSettings::prepentItem(const QString &name, const QString &item)
|
void ZeiterfassungSettings::prepentItem(const QString &name, const QString &item)
|
||||||
|
@@ -55,8 +55,8 @@ public:
|
|||||||
QString buchungOtherBackgroundColor() const;
|
QString buchungOtherBackgroundColor() const;
|
||||||
void setBuchungOtherBackgroundColor(const QString &buchungOtherBackgroundColor);
|
void setBuchungOtherBackgroundColor(const QString &buchungOtherBackgroundColor);
|
||||||
|
|
||||||
QString kontierungBackgroundColor() const;
|
QString timeAssignmentBackgroundColor() const;
|
||||||
void setKontierungBackgroundColor(const QString kontierungBackgroundColor);
|
void setTimeAssignmentBackgroundColor(const QString timeAssignmentBackgroundColor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void prepentItem(const QString &name, const QString &item);
|
void prepentItem(const QString &name, const QString &item);
|
||||||
|
Reference in New Issue
Block a user