Removed legacy project / workspace comboboxes for new unified one
This commit is contained in:
@@ -6,8 +6,7 @@ const QString ZeiterfassungSettings::m_language("language");
|
|||||||
const QString ZeiterfassungSettings::m_url("url");
|
const QString ZeiterfassungSettings::m_url("url");
|
||||||
const QString ZeiterfassungSettings::m_username("username");
|
const QString ZeiterfassungSettings::m_username("username");
|
||||||
const QString ZeiterfassungSettings::m_password("password");
|
const QString ZeiterfassungSettings::m_password("password");
|
||||||
const QString ZeiterfassungSettings::m_projects("projects");
|
const QString ZeiterfassungSettings::m_lastWorkpackageIndex("lastWorkpackageIndex");
|
||||||
const QString ZeiterfassungSettings::m_workpackages("workpackages");
|
|
||||||
const QString ZeiterfassungSettings::m_texts("texte");
|
const QString ZeiterfassungSettings::m_texts("texte");
|
||||||
const QString ZeiterfassungSettings::m_theme("theme");
|
const QString ZeiterfassungSettings::m_theme("theme");
|
||||||
const QLocale::Language ZeiterfassungSettings::m_defaultLanguage(QLocale::AnyLanguage);
|
const QLocale::Language ZeiterfassungSettings::m_defaultLanguage(QLocale::AnyLanguage);
|
||||||
@@ -148,68 +147,29 @@ bool ZeiterfassungSettings::setPassword(const QString &password)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ZeiterfassungSettings::projects() const
|
int ZeiterfassungSettings::lastWorkpackageIndex() const
|
||||||
{
|
{
|
||||||
return value(m_projects).toStringList();
|
return value(m_lastWorkpackageIndex).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeiterfassungSettings::setProjects(const QStringList &projects)
|
bool ZeiterfassungSettings::setLastWorkpackageIndex(int lastWorkpackageIndex)
|
||||||
{
|
{
|
||||||
if(this->projects() == projects)
|
if (this->lastWorkpackageIndex() == lastWorkpackageIndex)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(projects.isEmpty())
|
setValue(m_lastWorkpackageIndex, lastWorkpackageIndex);
|
||||||
remove(m_projects);
|
|
||||||
else
|
|
||||||
setValue(m_projects, projects);
|
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
const auto success = status() == QSettings::NoError;
|
const auto success = status() == QSettings::NoError;
|
||||||
if(success)
|
if(success)
|
||||||
Q_EMIT projectsChanged(projects);
|
Q_EMIT lastWorkpackageIndexChanged(lastWorkpackageIndex);
|
||||||
else
|
else
|
||||||
Q_EMIT saveErrorOccured();
|
Q_EMIT saveErrorOccured();
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeiterfassungSettings::prependProject(const QString &project)
|
|
||||||
{
|
|
||||||
return setProjects(prependItem(projects(), project));
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList ZeiterfassungSettings::workpackages() const
|
|
||||||
{
|
|
||||||
return value(m_workpackages).toStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ZeiterfassungSettings::setWorkpackages(const QStringList &workpackages)
|
|
||||||
{
|
|
||||||
if(this->workpackages() == workpackages)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if(workpackages.isEmpty())
|
|
||||||
remove(m_workpackages);
|
|
||||||
else
|
|
||||||
setValue(m_workpackages, workpackages);
|
|
||||||
|
|
||||||
sync();
|
|
||||||
|
|
||||||
const auto success = status() == QSettings::NoError;
|
|
||||||
if(success)
|
|
||||||
Q_EMIT workpackagesChanged(workpackages);
|
|
||||||
else
|
|
||||||
Q_EMIT saveErrorOccured();
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ZeiterfassungSettings::prependWorkpackage(const QString &workpackage)
|
|
||||||
{
|
|
||||||
return setWorkpackages(prependItem(workpackages(), workpackage));
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList ZeiterfassungSettings::texts() const
|
QStringList ZeiterfassungSettings::texts() const
|
||||||
{
|
{
|
||||||
return value(m_texts).toStringList();
|
return value(m_texts).toStringList();
|
||||||
|
@@ -16,8 +16,7 @@ class ZEITERFASSUNGCORELIB_EXPORT ZeiterfassungSettings : public QSettings
|
|||||||
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
|
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
|
||||||
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
|
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
|
||||||
Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
|
Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
|
||||||
Q_PROPERTY(QStringList projects READ projects WRITE setProjects NOTIFY projectsChanged)
|
Q_PROPERTY(int lastWorkpackageIndex READ lastWorkpackageIndex WRITE setLastWorkpackageIndex NOTIFY lastWorkpackageIndexChanged)
|
||||||
Q_PROPERTY(QStringList workpackages READ workpackages WRITE setWorkpackages NOTIFY workpackagesChanged)
|
|
||||||
Q_PROPERTY(QStringList texts READ texts WRITE setTexts NOTIFY textsChanged)
|
Q_PROPERTY(QStringList texts READ texts WRITE setTexts NOTIFY textsChanged)
|
||||||
Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
|
Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
|
||||||
|
|
||||||
@@ -43,13 +42,8 @@ public:
|
|||||||
QString password() const;
|
QString password() const;
|
||||||
bool setPassword(const QString &password);
|
bool setPassword(const QString &password);
|
||||||
|
|
||||||
QStringList projects() const;
|
int lastWorkpackageIndex() const;
|
||||||
bool setProjects(const QStringList &projects);
|
bool setLastWorkpackageIndex(int lastWorkpackageIndex);
|
||||||
bool prependProject(const QString &project);
|
|
||||||
|
|
||||||
QStringList workpackages() const;
|
|
||||||
bool setWorkpackages(const QStringList &workpackages);
|
|
||||||
bool prependWorkpackage(const QString &workpackage);
|
|
||||||
|
|
||||||
QStringList texts() const;
|
QStringList texts() const;
|
||||||
bool setTexts(const QStringList &texts);
|
bool setTexts(const QStringList &texts);
|
||||||
@@ -65,8 +59,7 @@ Q_SIGNALS:
|
|||||||
void urlChanged(const QUrl &url);
|
void urlChanged(const QUrl &url);
|
||||||
void usernameChanged(const QString &username);
|
void usernameChanged(const QString &username);
|
||||||
void passwordChanged(const QString &password);
|
void passwordChanged(const QString &password);
|
||||||
void projectsChanged(const QStringList &projects);
|
void lastWorkpackageIndexChanged(int lastWorkpackageIndex);
|
||||||
void workpackagesChanged(const QStringList &workpackages);
|
|
||||||
void textsChanged(const QStringList &texts);
|
void textsChanged(const QStringList &texts);
|
||||||
void themeChanged(const QString &theme);
|
void themeChanged(const QString &theme);
|
||||||
|
|
||||||
@@ -77,8 +70,7 @@ private:
|
|||||||
static const QString m_url;
|
static const QString m_url;
|
||||||
static const QString m_username;
|
static const QString m_username;
|
||||||
static const QString m_password;
|
static const QString m_password;
|
||||||
static const QString m_projects;
|
static const QString m_lastWorkpackageIndex;
|
||||||
static const QString m_workpackages;
|
|
||||||
static const QString m_texts;
|
static const QString m_texts;
|
||||||
static const QString m_theme;
|
static const QString m_theme;
|
||||||
static const QLocale::Language m_defaultLanguage;
|
static const QLocale::Language m_defaultLanguage;
|
||||||
|
@@ -76,10 +76,7 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, ZeiterfassungApi &erfass
|
|||||||
|
|
||||||
connect(ui->pushButtonNow, &QAbstractButton::pressed, this, &MainWindow::pushButtonNowPressed);
|
connect(ui->pushButtonNow, &QAbstractButton::pressed, this, &MainWindow::pushButtonNowPressed);
|
||||||
|
|
||||||
m_getProjectsReply = erfassung.doGetProjects(userInfo.userId, QDate::currentDate());
|
ui->comboBoxProject->setModel(&m_projectsModel);
|
||||||
connect(m_getProjectsReply.get(), &ZeiterfassungReply::finished, this, &MainWindow::getProjectsFinished);
|
|
||||||
|
|
||||||
ui->comboBoxWorkpackage->lineEdit()->setPlaceholderText(tr("Workpackage"));
|
|
||||||
ui->comboBoxText->lineEdit()->setPlaceholderText(tr("Text"));
|
ui->comboBoxText->lineEdit()->setPlaceholderText(tr("Text"));
|
||||||
|
|
||||||
updateComboboxes();
|
updateComboboxes();
|
||||||
@@ -97,8 +94,6 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, ZeiterfassungApi &erfass
|
|||||||
}
|
}
|
||||||
|
|
||||||
dateChangedSlot(ui->dateEditDate->date());
|
dateChangedSlot(ui->dateEditDate->date());
|
||||||
|
|
||||||
ui->comboBoxDebug->setModel(&m_projectsModel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@@ -161,16 +156,21 @@ void MainWindow::setDate(const QDate &date)
|
|||||||
ui->dateEditDate->setDate(date);
|
ui->dateEditDate->setDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QMap<QString, QString> &MainWindow::projects() const
|
|
||||||
{
|
|
||||||
return m_projects;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::array<StripsWidget*, 7> &MainWindow::stripsWidgets() const
|
const std::array<StripsWidget*, 7> &MainWindow::stripsWidgets() const
|
||||||
{
|
{
|
||||||
return m_stripsWidgets;
|
return m_stripsWidgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectsModel &MainWindow::projectsModel()
|
||||||
|
{
|
||||||
|
return m_projectsModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ProjectsModel &MainWindow::projectsModel() const
|
||||||
|
{
|
||||||
|
return m_projectsModel;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::timerEvent(QTimerEvent *event)
|
void MainWindow::timerEvent(QTimerEvent *event)
|
||||||
{
|
{
|
||||||
if(event->timerId() == m_timerId)
|
if(event->timerId() == m_timerId)
|
||||||
@@ -182,24 +182,6 @@ void MainWindow::timerEvent(QTimerEvent *event)
|
|||||||
QMainWindow::timerEvent(event);
|
QMainWindow::timerEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::getProjectsFinished()
|
|
||||||
{
|
|
||||||
if(m_getProjectsReply->success())
|
|
||||||
{
|
|
||||||
m_projects.clear();
|
|
||||||
|
|
||||||
for(const auto &project : m_getProjectsReply->items())
|
|
||||||
m_projects.insert(project.value, project.label);
|
|
||||||
|
|
||||||
updateComboboxes();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
QMessageBox::warning(this, tr("Could not load bookings!"),
|
|
||||||
tr("Could not load bookings!") % "\n\n" % m_getProjectsReply->message());
|
|
||||||
|
|
||||||
m_getProjectsReply = Q_NULLPTR;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::pushButtonNowPressed()
|
void MainWindow::pushButtonNowPressed()
|
||||||
{
|
{
|
||||||
ui->dateEditDate->setDate(QDate::currentDate());
|
ui->dateEditDate->setDate(QDate::currentDate());
|
||||||
@@ -208,6 +190,12 @@ void MainWindow::pushButtonNowPressed()
|
|||||||
|
|
||||||
void MainWindow::pushButtonStartPressed()
|
void MainWindow::pushButtonStartPressed()
|
||||||
{
|
{
|
||||||
|
if (ui->comboBoxProject->currentIndex() == -1)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Could not create booking!"), tr("Could not create booking!") % "\n\n" % tr("Please select a project/workpackage!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(m_timerId != -1)
|
if(m_timerId != -1)
|
||||||
{
|
{
|
||||||
killTimer(m_timerId);
|
killTimer(m_timerId);
|
||||||
@@ -261,8 +249,8 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
{
|
{
|
||||||
auto reply = m_erfassung.doCreateTimeAssignment(m_userInfo.userId, ui->dateEditDate->date(),
|
auto reply = m_erfassung.doCreateTimeAssignment(m_userInfo.userId, ui->dateEditDate->date(),
|
||||||
timeAssignmentTime, QTime(0, 0),
|
timeAssignmentTime, QTime(0, 0),
|
||||||
ui->comboBoxProject->currentData().toString(),
|
ui->comboBoxProject->currentData(Qt::UserRole).toString(),
|
||||||
ui->comboBoxWorkpackage->currentText(),
|
ui->comboBoxProject->currentData(Qt::EditRole).toString(),
|
||||||
ui->comboBoxText->currentText());
|
ui->comboBoxText->currentText());
|
||||||
|
|
||||||
reply->waitForFinished();
|
reply->waitForFinished();
|
||||||
@@ -276,8 +264,7 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_settings.prependProject(ui->comboBoxProject->currentData().toString());
|
m_settings.setLastWorkpackageIndex(ui->comboBoxProject->currentIndex());
|
||||||
m_settings.prependWorkpackage(ui->comboBoxWorkpackage->currentText());
|
|
||||||
m_settings.prependText(ui->comboBoxText->currentText());
|
m_settings.prependText(ui->comboBoxText->currentText());
|
||||||
|
|
||||||
updateComboboxes();
|
updateComboboxes();
|
||||||
@@ -392,7 +379,6 @@ void MainWindow::startEnabledChanged()
|
|||||||
ui->pushButtonNow->setEnabled(startEnabled || endEnabled);
|
ui->pushButtonNow->setEnabled(startEnabled || endEnabled);
|
||||||
|
|
||||||
ui->comboBoxProject->setEnabled(startEnabled);
|
ui->comboBoxProject->setEnabled(startEnabled);
|
||||||
ui->comboBoxWorkpackage->setEnabled(startEnabled);
|
|
||||||
ui->comboBoxText->setEnabled(startEnabled);
|
ui->comboBoxText->setEnabled(startEnabled);
|
||||||
|
|
||||||
ui->pushButtonStart->setEnabled(startEnabled);
|
ui->pushButtonStart->setEnabled(startEnabled);
|
||||||
@@ -413,40 +399,6 @@ void MainWindow::endEnabledChanged()
|
|||||||
|
|
||||||
void MainWindow::updateComboboxes()
|
void MainWindow::updateComboboxes()
|
||||||
{
|
{
|
||||||
ui->comboBoxProject->clear();
|
|
||||||
|
|
||||||
{
|
|
||||||
auto preferedProjects = m_settings.projects();
|
|
||||||
|
|
||||||
for(const auto &preferedProject : preferedProjects)
|
|
||||||
{
|
|
||||||
if(!m_projects.contains(preferedProject))
|
|
||||||
{
|
|
||||||
qWarning() << "cannot find project" << preferedProject;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->comboBoxProject->addItem(tr("%0 (%1)").arg(m_projects.value(preferedProject)).arg(preferedProject), preferedProject);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(preferedProjects.count())
|
|
||||||
ui->comboBoxProject->insertSeparator(ui->comboBoxProject->count());
|
|
||||||
|
|
||||||
for(auto iter = m_projects.constBegin(); iter != m_projects.constEnd(); iter++)
|
|
||||||
{
|
|
||||||
if(!preferedProjects.contains(iter.key()))
|
|
||||||
ui->comboBoxProject->addItem(tr("%0 (%1)").arg(iter.value()).arg(iter.key()), iter.key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->comboBoxWorkpackage->clear();
|
|
||||||
|
|
||||||
{
|
|
||||||
auto workpackages = m_settings.workpackages();
|
|
||||||
for(const auto &workpackage : workpackages)
|
|
||||||
ui->comboBoxWorkpackage->addItem(workpackage);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->comboBoxText->clear();
|
ui->comboBoxText->clear();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@@ -46,9 +46,11 @@ public:
|
|||||||
QDate date() const;
|
QDate date() const;
|
||||||
void setDate(const QDate &date);
|
void setDate(const QDate &date);
|
||||||
|
|
||||||
const QMap<QString, QString> &projects() const;
|
|
||||||
const std::array<StripsWidget*, 7> &stripsWidgets() const;
|
const std::array<StripsWidget*, 7> &stripsWidgets() const;
|
||||||
|
|
||||||
|
ProjectsModel &projectsModel();
|
||||||
|
const ProjectsModel &projectsModel() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void dateChanged(const QDate &date);
|
void dateChanged(const QDate &date);
|
||||||
void refreshEverything();
|
void refreshEverything();
|
||||||
@@ -58,7 +60,6 @@ protected:
|
|||||||
virtual void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
virtual void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void getProjectsFinished();
|
|
||||||
void pushButtonNowPressed();
|
void pushButtonNowPressed();
|
||||||
void pushButtonStartPressed();
|
void pushButtonStartPressed();
|
||||||
void pushButtonEndPressed();
|
void pushButtonEndPressed();
|
||||||
@@ -78,10 +79,6 @@ private:
|
|||||||
StripFactory &m_stripFactory;
|
StripFactory &m_stripFactory;
|
||||||
const QSet<ZeiterfassungPlugin*> &m_plugins;
|
const QSet<ZeiterfassungPlugin*> &m_plugins;
|
||||||
|
|
||||||
std::unique_ptr<GetComboboxReply> m_getProjectsReply;
|
|
||||||
|
|
||||||
QMap<QString, QString> m_projects;
|
|
||||||
|
|
||||||
std::array<StripsWidget*, 7> m_stripsWidgets;
|
std::array<StripsWidget*, 7> m_stripsWidgets;
|
||||||
StripsWidget *m_currentStripWidget;
|
StripsWidget *m_currentStripWidget;
|
||||||
|
|
||||||
|
@@ -108,30 +108,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxProject">
|
<widget class="QComboBox" name="comboBoxProject"/>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBoxWorkpackage">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="insertPolicy">
|
|
||||||
<enum>QComboBox::NoInsert</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxText">
|
<widget class="QComboBox" name="comboBoxText">
|
||||||
@@ -176,22 +153,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBoxDebug"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|
||||||
#include "zeiterfassungapi.h"
|
#include "zeiterfassungapi.h"
|
||||||
#include "replies/getcomboboxreply.h"
|
|
||||||
|
|
||||||
ProjectsModel::ProjectsModel(int userId, const QDate &date, ZeiterfassungApi &api, QObject *parent) :
|
ProjectsModel::ProjectsModel(int userId, const QDate &date, ZeiterfassungApi &api, QObject *parent) :
|
||||||
QAbstractListModel(parent),
|
QAbstractListModel(parent),
|
||||||
@@ -48,7 +47,6 @@ QVariant ProjectsModel::data(const QModelIndex &index, int role) const
|
|||||||
switch (role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
case Qt::EditRole:
|
|
||||||
if (m_getProjectsReply->isFinished())
|
if (m_getProjectsReply->isFinished())
|
||||||
{
|
{
|
||||||
Q_ASSERT(!m_getProjectsReply->success());
|
Q_ASSERT(!m_getProjectsReply->success());
|
||||||
@@ -90,7 +88,6 @@ QVariant ProjectsModel::data(const QModelIndex &index, int role) const
|
|||||||
switch (role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
case Qt::EditRole:
|
|
||||||
if (project.getWorkpackagesReply->isFinished())
|
if (project.getWorkpackagesReply->isFinished())
|
||||||
{
|
{
|
||||||
Q_ASSERT(!project.getWorkpackagesReply->success());
|
Q_ASSERT(!project.getWorkpackagesReply->success());
|
||||||
@@ -112,9 +109,11 @@ QVariant ProjectsModel::data(const QModelIndex &index, int role) const
|
|||||||
switch (role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return std::get<0>(workpackage) + " (" + std::get<1>(workpackage) + ')';
|
return workpackage.label + " (" + workpackage.value + ')';
|
||||||
case Qt::EditRole:
|
case Qt::EditRole:
|
||||||
return std::get<0>(workpackage);
|
return workpackage.label;
|
||||||
|
case Qt::UserRole:
|
||||||
|
return project.value;
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -134,6 +133,15 @@ Qt::ItemFlags ProjectsModel::flags(const QModelIndex &index) const
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ProjectsModel::getProjectLabel(const QString &projectId) const
|
||||||
|
{
|
||||||
|
const auto iter = std::find_if(m_projects.begin(), m_projects.end(), [&projectId](const Project &project){ return project.value == projectId; });
|
||||||
|
if (iter == m_projects.end())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return iter->label;
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectsModel::getProjectsFinished()
|
void ProjectsModel::getProjectsFinished()
|
||||||
{
|
{
|
||||||
if (!m_getProjectsReply->success())
|
if (!m_getProjectsReply->success())
|
||||||
@@ -169,7 +177,7 @@ void ProjectsModel::getWorkspacesFinished(ProjectsModel::Project &project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &item : project.getWorkpackagesReply->items())
|
for (const auto &item : project.getWorkpackagesReply->items())
|
||||||
project.workpackages.push_back(std::make_pair(item.value, item.label));
|
project.workpackages.emplace_back(item.value, item.label);
|
||||||
|
|
||||||
project.getWorkpackagesReply = nullptr;
|
project.getWorkpackagesReply = nullptr;
|
||||||
|
|
||||||
|
@@ -6,24 +6,23 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "replies/getcomboboxreply.h"
|
||||||
|
|
||||||
class ZeiterfassungApi;
|
class ZeiterfassungApi;
|
||||||
class GetComboboxReply;
|
|
||||||
|
|
||||||
class ProjectsModel : public QAbstractListModel
|
class ProjectsModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
struct Project {
|
struct Project : public GetComboboxReply::Item {
|
||||||
Project(const QString &label, const QString &value, std::unique_ptr<GetComboboxReply> getWorkpackagesReply) :
|
Project(const QString &label, const QString &value, std::unique_ptr<GetComboboxReply> getWorkpackagesReply) :
|
||||||
label(label), value(value), getWorkpackagesReply(std::move(getWorkpackagesReply))
|
GetComboboxReply::Item(label, value),
|
||||||
|
getWorkpackagesReply(std::move(getWorkpackagesReply))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QString label;
|
|
||||||
QString value;
|
|
||||||
|
|
||||||
std::unique_ptr<GetComboboxReply> getWorkpackagesReply;
|
std::unique_ptr<GetComboboxReply> getWorkpackagesReply;
|
||||||
|
|
||||||
std::vector<std::pair<QString, QString> > workpackages;
|
std::vector<GetComboboxReply::Item> workpackages;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -33,6 +32,8 @@ public:
|
|||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
|
|
||||||
|
QString getProjectLabel(const QString &projectId) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void getProjectsFinished();
|
void getProjectsFinished();
|
||||||
void getWorkspacesFinished(int index);
|
void getWorkspacesFinished(int index);
|
||||||
|
@@ -326,7 +326,7 @@ bool StripsWidget::createStrips()
|
|||||||
|
|
||||||
auto timeAssignment = *timeAssignmentsIter++;
|
auto timeAssignment = *timeAssignmentsIter++;
|
||||||
|
|
||||||
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjectString(timeAssignment.project),
|
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, timeAssignment.project,
|
||||||
timeAssignment.workpackage, timeAssignment.text);
|
timeAssignment.workpackage, timeAssignment.text);
|
||||||
|
|
||||||
if(timeAssignment.timespan == QTime(0, 0))
|
if(timeAssignment.timespan == QTime(0, 0))
|
||||||
@@ -369,7 +369,7 @@ bool StripsWidget::createStrips()
|
|||||||
|
|
||||||
timeAssignment = *timeAssignmentsIter++;
|
timeAssignment = *timeAssignmentsIter++;
|
||||||
|
|
||||||
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjectString(timeAssignment.project),
|
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, timeAssignment.project,
|
||||||
timeAssignment.workpackage, timeAssignment.text);
|
timeAssignment.workpackage, timeAssignment.text);
|
||||||
|
|
||||||
if(timeAssignment.timespan == QTime(0, 0))
|
if(timeAssignment.timespan == QTime(0, 0))
|
||||||
@@ -425,7 +425,7 @@ bool StripsWidget::createStrips()
|
|||||||
|
|
||||||
timeAssignment = *timeAssignmentsIter++;
|
timeAssignment = *timeAssignmentsIter++;
|
||||||
|
|
||||||
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjectString(timeAssignment.project),
|
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, timeAssignment.project,
|
||||||
timeAssignment.workpackage, timeAssignment.text);
|
timeAssignment.workpackage, timeAssignment.text);
|
||||||
|
|
||||||
if(timeAssignment.timespan == QTime(0, 0))
|
if(timeAssignment.timespan == QTime(0, 0))
|
||||||
@@ -582,17 +582,6 @@ void StripsWidget::invalidateValues()
|
|||||||
Q_EMIT endEnabledChanged(m_endEnabled = false);
|
Q_EMIT endEnabledChanged(m_endEnabled = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StripsWidget::buildProjectString(const QString &project) const
|
|
||||||
{
|
|
||||||
if(m_mainWindow.projects().contains(project))
|
|
||||||
return m_mainWindow.projects().value(project) % "\n" % project;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qWarning() << "could not find project" << project;
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *StripsWidget::appendBookingStartStrip(int id, const QTime &time)
|
QWidget *StripsWidget::appendBookingStartStrip(int id, const QTime &time)
|
||||||
{
|
{
|
||||||
auto widget = m_mainWindow.stripFactory().createBookingStartStrip(this).release();
|
auto widget = m_mainWindow.stripFactory().createBookingStartStrip(this).release();
|
||||||
@@ -646,7 +635,7 @@ QWidget *StripsWidget::appendTimeAssignmentStrip(int id, const QTime &duration,
|
|||||||
qWarning() << "no labelTime found!";
|
qWarning() << "no labelTime found!";
|
||||||
|
|
||||||
if(auto labelProject = widget->findChild<QWidget*>(QStringLiteral("labelProject")))
|
if(auto labelProject = widget->findChild<QWidget*>(QStringLiteral("labelProject")))
|
||||||
labelProject->setProperty("text", project);
|
labelProject->setProperty("text", m_mainWindow.projectsModel().getProjectLabel(project) + "\n" + project);
|
||||||
else
|
else
|
||||||
qWarning() << "no labelProject found!";
|
qWarning() << "no labelProject found!";
|
||||||
|
|
||||||
|
@@ -82,8 +82,7 @@ private Q_SLOTS:
|
|||||||
void getTimeAssignmentsFinished();
|
void getTimeAssignmentsFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void invalidateValues();
|
void invalidateValues();
|
||||||
QString buildProjectString(const QString &project) const;
|
|
||||||
|
|
||||||
QWidget *appendBookingStartStrip(int id, const QTime &time);
|
QWidget *appendBookingStartStrip(int id, const QTime &time);
|
||||||
QWidget *appendBookingEndStrip(int id, const QTime &time, const QTime &duration);
|
QWidget *appendBookingEndStrip(int id, const QTime &time, const QTime &duration);
|
||||||
|
@@ -77,74 +77,74 @@
|
|||||||
<translation>Jetzt</translation>
|
<translation>Jetzt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="155"/>
|
<location filename="../mainwindow.ui" line="132"/>
|
||||||
<location filename="../mainwindow.cpp" line="399"/>
|
<location filename="../mainwindow.cpp" line="385"/>
|
||||||
<location filename="../mainwindow.cpp" line="410"/>
|
<location filename="../mainwindow.cpp" line="396"/>
|
||||||
<source>Start</source>
|
<source>Start</source>
|
||||||
<translation>Kommen</translation>
|
<translation>Kommen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="175"/>
|
<location filename="../mainwindow.ui" line="152"/>
|
||||||
<source>End</source>
|
<source>End</source>
|
||||||
<translation>Gehen</translation>
|
<translation>Gehen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="234"/>
|
<location filename="../mainwindow.ui" line="195"/>
|
||||||
<source>&File</source>
|
<source>&File</source>
|
||||||
<translation>&Datei</translation>
|
<translation>&Datei</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="240"/>
|
<location filename="../mainwindow.ui" line="201"/>
|
||||||
<source>&About</source>
|
<source>&About</source>
|
||||||
<translation>&Über</translation>
|
<translation>&Über</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="250"/>
|
<location filename="../mainwindow.ui" line="211"/>
|
||||||
<source>&View</source>
|
<source>&View</source>
|
||||||
<translation>&Ansicht</translation>
|
<translation>&Ansicht</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="257"/>
|
<location filename="../mainwindow.ui" line="218"/>
|
||||||
<source>&Tools</source>
|
<source>&Tools</source>
|
||||||
<translation>&Werkzeuge</translation>
|
<translation>&Werkzeuge</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="282"/>
|
<location filename="../mainwindow.ui" line="243"/>
|
||||||
<source>&Quit</source>
|
<source>&Quit</source>
|
||||||
<translation>&Beenden</translation>
|
<translation>&Beenden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="291"/>
|
<location filename="../mainwindow.ui" line="252"/>
|
||||||
<source>About &Me</source>
|
<source>About &Me</source>
|
||||||
<translation>Über &mich</translation>
|
<translation>Über &mich</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="300"/>
|
<location filename="../mainwindow.ui" line="261"/>
|
||||||
<source>About &zeiterfassung</source>
|
<source>About &zeiterfassung</source>
|
||||||
<translation>Über &zeiterfassung</translation>
|
<translation>Über &zeiterfassung</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="309"/>
|
<location filename="../mainwindow.ui" line="270"/>
|
||||||
<source>About &Qt</source>
|
<source>About &Qt</source>
|
||||||
<translation>Über &Qt</translation>
|
<translation>Über &Qt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="318"/>
|
<location filename="../mainwindow.ui" line="279"/>
|
||||||
<source>&Today</source>
|
<source>&Today</source>
|
||||||
<translation>&Heute</translation>
|
<translation>&Heute</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="327"/>
|
<location filename="../mainwindow.ui" line="288"/>
|
||||||
<source>&Refresh everything</source>
|
<source>&Refresh everything</source>
|
||||||
<translation>Alles &neu laden</translation>
|
<translation>Alles &neu laden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="336"/>
|
<location filename="../mainwindow.ui" line="297"/>
|
||||||
<source>&Settings</source>
|
<source>&Settings</source>
|
||||||
<translation>&Einstellungen</translation>
|
<translation>&Einstellungen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="345"/>
|
<location filename="../mainwindow.ui" line="306"/>
|
||||||
<source>Help</source>
|
<source>Help</source>
|
||||||
<translation>Hilfe</translation>
|
<translation>Hilfe</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -154,47 +154,36 @@
|
|||||||
<translation>Zeiterfassung - %0 (%1)</translation>
|
<translation>Zeiterfassung - %0 (%1)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="82"/>
|
<location filename="../mainwindow.cpp" line="80"/>
|
||||||
<source>Workpackage</source>
|
|
||||||
<translation>Arbeitspaket</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../mainwindow.cpp" line="83"/>
|
|
||||||
<source>Text</source>
|
<source>Text</source>
|
||||||
<translation>Text</translation>
|
<translation>Text</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="197"/>
|
<location filename="../mainwindow.cpp" line="195"/>
|
||||||
<location filename="../mainwindow.cpp" line="198"/>
|
<location filename="../mainwindow.cpp" line="216"/>
|
||||||
<source>Could not load bookings!</source>
|
<location filename="../mainwindow.cpp" line="317"/>
|
||||||
<translation>Konnte Buchungen nicht laden!</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../mainwindow.cpp" line="228"/>
|
|
||||||
<location filename="../mainwindow.cpp" line="330"/>
|
|
||||||
<source>Could not create booking!</source>
|
<source>Could not create booking!</source>
|
||||||
<translation>Konnte Buchung nicht erstellen!</translation>
|
<translation>Konnte Buchung nicht erstellen!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="254"/>
|
<location filename="../mainwindow.cpp" line="195"/>
|
||||||
<location filename="../mainwindow.cpp" line="315"/>
|
<source>Please select a project/workpackage!</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="242"/>
|
||||||
|
<location filename="../mainwindow.cpp" line="302"/>
|
||||||
<source>Could not edit time assignment!</source>
|
<source>Could not edit time assignment!</source>
|
||||||
<translation>Konnte Kontierung nicht bearbeiten!</translation>
|
<translation>Konnte Kontierung nicht bearbeiten!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="429"/>
|
<location filename="../mainwindow.cpp" line="260"/>
|
||||||
<location filename="../mainwindow.cpp" line="438"/>
|
|
||||||
<source>%0 (%1)</source>
|
|
||||||
<translation>%0 (%1)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../mainwindow.cpp" line="272"/>
|
|
||||||
<source>Could not create time assignment!</source>
|
<source>Could not create time assignment!</source>
|
||||||
<translation>Konnte Kontierung nicht erstellen!</translation>
|
<translation>Konnte Kontierung nicht erstellen!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="399"/>
|
<location filename="../mainwindow.cpp" line="385"/>
|
||||||
<location filename="../mainwindow.cpp" line="410"/>
|
<location filename="../mainwindow.cpp" line="396"/>
|
||||||
<source>Switch</source>
|
<source>Switch</source>
|
||||||
<translation>Wechseln</translation>
|
<translation>Wechseln</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -202,12 +191,12 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>ProjectsModel</name>
|
<name>ProjectsModel</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../projectsmodel.cpp" line="58"/>
|
<location filename="../projectsmodel.cpp" line="56"/>
|
||||||
<source>Loading projects...</source>
|
<source>Loading projects...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../projectsmodel.cpp" line="100"/>
|
<location filename="../projectsmodel.cpp" line="97"/>
|
||||||
<source>Loading workpackages...</source>
|
<source>Loading workpackages...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -340,7 +329,7 @@ Booking ID: %1</source>
|
|||||||
<location filename="../stripswidget.cpp" line="312"/>
|
<location filename="../stripswidget.cpp" line="312"/>
|
||||||
<location filename="../stripswidget.cpp" line="419"/>
|
<location filename="../stripswidget.cpp" line="419"/>
|
||||||
<location filename="../stripswidget.cpp" line="482"/>
|
<location filename="../stripswidget.cpp" line="482"/>
|
||||||
<location filename="../stripswidget.cpp" line="625"/>
|
<location filename="../stripswidget.cpp" line="614"/>
|
||||||
<source>%0h</source>
|
<source>%0h</source>
|
||||||
<translation>%0h</translation>
|
<translation>%0h</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -407,7 +396,7 @@ Your bookings and time assignments for this day are in an illegal state!</source
|
|||||||
<translation>Ungültig</translation>
|
<translation>Ungültig</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../stripswidget.cpp" line="644"/>
|
<location filename="../stripswidget.cpp" line="633"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>Offen</translation>
|
<translation>Offen</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@@ -77,74 +77,74 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="155"/>
|
<location filename="../mainwindow.ui" line="132"/>
|
||||||
<location filename="../mainwindow.cpp" line="399"/>
|
<location filename="../mainwindow.cpp" line="385"/>
|
||||||
<location filename="../mainwindow.cpp" line="410"/>
|
<location filename="../mainwindow.cpp" line="396"/>
|
||||||
<source>Start</source>
|
<source>Start</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="175"/>
|
<location filename="../mainwindow.ui" line="152"/>
|
||||||
<source>End</source>
|
<source>End</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="234"/>
|
<location filename="../mainwindow.ui" line="195"/>
|
||||||
<source>&File</source>
|
<source>&File</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="240"/>
|
<location filename="../mainwindow.ui" line="201"/>
|
||||||
<source>&About</source>
|
<source>&About</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="250"/>
|
<location filename="../mainwindow.ui" line="211"/>
|
||||||
<source>&View</source>
|
<source>&View</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="257"/>
|
<location filename="../mainwindow.ui" line="218"/>
|
||||||
<source>&Tools</source>
|
<source>&Tools</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="282"/>
|
<location filename="../mainwindow.ui" line="243"/>
|
||||||
<source>&Quit</source>
|
<source>&Quit</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="291"/>
|
<location filename="../mainwindow.ui" line="252"/>
|
||||||
<source>About &Me</source>
|
<source>About &Me</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="300"/>
|
<location filename="../mainwindow.ui" line="261"/>
|
||||||
<source>About &zeiterfassung</source>
|
<source>About &zeiterfassung</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="309"/>
|
<location filename="../mainwindow.ui" line="270"/>
|
||||||
<source>About &Qt</source>
|
<source>About &Qt</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="318"/>
|
<location filename="../mainwindow.ui" line="279"/>
|
||||||
<source>&Today</source>
|
<source>&Today</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="327"/>
|
<location filename="../mainwindow.ui" line="288"/>
|
||||||
<source>&Refresh everything</source>
|
<source>&Refresh everything</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="336"/>
|
<location filename="../mainwindow.ui" line="297"/>
|
||||||
<source>&Settings</source>
|
<source>&Settings</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.ui" line="345"/>
|
<location filename="../mainwindow.ui" line="306"/>
|
||||||
<source>Help</source>
|
<source>Help</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -154,60 +154,49 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="82"/>
|
<location filename="../mainwindow.cpp" line="80"/>
|
||||||
<source>Workpackage</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../mainwindow.cpp" line="83"/>
|
|
||||||
<source>Text</source>
|
<source>Text</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="197"/>
|
<location filename="../mainwindow.cpp" line="195"/>
|
||||||
<location filename="../mainwindow.cpp" line="198"/>
|
<location filename="../mainwindow.cpp" line="216"/>
|
||||||
<source>Could not load bookings!</source>
|
<location filename="../mainwindow.cpp" line="317"/>
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../mainwindow.cpp" line="228"/>
|
|
||||||
<location filename="../mainwindow.cpp" line="330"/>
|
|
||||||
<source>Could not create booking!</source>
|
<source>Could not create booking!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="272"/>
|
<location filename="../mainwindow.cpp" line="195"/>
|
||||||
|
<source>Please select a project/workpackage!</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="260"/>
|
||||||
<source>Could not create time assignment!</source>
|
<source>Could not create time assignment!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="254"/>
|
<location filename="../mainwindow.cpp" line="242"/>
|
||||||
<location filename="../mainwindow.cpp" line="315"/>
|
<location filename="../mainwindow.cpp" line="302"/>
|
||||||
<source>Could not edit time assignment!</source>
|
<source>Could not edit time assignment!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="399"/>
|
<location filename="../mainwindow.cpp" line="385"/>
|
||||||
<location filename="../mainwindow.cpp" line="410"/>
|
<location filename="../mainwindow.cpp" line="396"/>
|
||||||
<source>Switch</source>
|
<source>Switch</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<location filename="../mainwindow.cpp" line="429"/>
|
|
||||||
<location filename="../mainwindow.cpp" line="438"/>
|
|
||||||
<source>%0 (%1)</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ProjectsModel</name>
|
<name>ProjectsModel</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../projectsmodel.cpp" line="58"/>
|
<location filename="../projectsmodel.cpp" line="56"/>
|
||||||
<source>Loading projects...</source>
|
<source>Loading projects...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../projectsmodel.cpp" line="100"/>
|
<location filename="../projectsmodel.cpp" line="97"/>
|
||||||
<source>Loading workpackages...</source>
|
<source>Loading workpackages...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -340,7 +329,7 @@ Booking ID: %1</source>
|
|||||||
<location filename="../stripswidget.cpp" line="312"/>
|
<location filename="../stripswidget.cpp" line="312"/>
|
||||||
<location filename="../stripswidget.cpp" line="419"/>
|
<location filename="../stripswidget.cpp" line="419"/>
|
||||||
<location filename="../stripswidget.cpp" line="482"/>
|
<location filename="../stripswidget.cpp" line="482"/>
|
||||||
<location filename="../stripswidget.cpp" line="625"/>
|
<location filename="../stripswidget.cpp" line="614"/>
|
||||||
<source>%0h</source>
|
<source>%0h</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -407,7 +396,7 @@ Your bookings and time assignments for this day are in an illegal state!</source
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../stripswidget.cpp" line="644"/>
|
<location filename="../stripswidget.cpp" line="633"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@@ -15,7 +15,7 @@ GetComboboxReply::GetComboboxReply(std::unique_ptr<QNetworkReply> &&reply, Zeite
|
|||||||
connect(m_reply.get(), &QNetworkReply::finished, this, &GetComboboxReply::requestFinished);
|
connect(m_reply.get(), &QNetworkReply::finished, this, &GetComboboxReply::requestFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<GetComboboxReply::Item> &GetComboboxReply::items() const
|
const std::vector<GetComboboxReply::Item> &GetComboboxReply::items() const
|
||||||
{
|
{
|
||||||
return m_items;
|
return m_items;
|
||||||
}
|
}
|
||||||
@@ -69,14 +69,14 @@ void GetComboboxReply::requestFinished()
|
|||||||
setSuccess(true);
|
setSuccess(true);
|
||||||
m_items.clear();
|
m_items.clear();
|
||||||
m_items.reserve(elementsArr.count());
|
m_items.reserve(elementsArr.count());
|
||||||
for(const auto &val : elementsArr)
|
for(const auto val : elementsArr)
|
||||||
{
|
{
|
||||||
auto obj = val.toObject();
|
auto obj = val.toObject();
|
||||||
|
|
||||||
m_items.append({
|
m_items.emplace_back(
|
||||||
obj.value(QStringLiteral("label")).toString(),
|
obj.value(QStringLiteral("label")).toString(),
|
||||||
obj.value(QStringLiteral("value")).toString()
|
obj.value(QStringLiteral("value")).toString()
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
#include "zeiterfassungnetworklib_global.h"
|
#include "zeiterfassungnetworklib_global.h"
|
||||||
#include "zeiterfassungreply.h"
|
#include "zeiterfassungreply.h"
|
||||||
@@ -19,16 +19,20 @@ public:
|
|||||||
|
|
||||||
struct Item
|
struct Item
|
||||||
{
|
{
|
||||||
|
Item(const QString &label, const QString &value) :
|
||||||
|
label(label), value(value)
|
||||||
|
{}
|
||||||
|
|
||||||
QString label;
|
QString label;
|
||||||
QString value;
|
QString value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const QVector<Item> &items() const;
|
const std::vector<Item> &items() const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void requestFinished();
|
void requestFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<QNetworkReply> m_reply;
|
std::unique_ptr<QNetworkReply> m_reply;
|
||||||
QVector<Item> m_items;
|
std::vector<Item> m_items;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user