Removed legacy project / workspace comboboxes for new unified one

This commit is contained in:
2019-04-10 22:01:17 +02:00
parent 171184d3f3
commit 2bc0c9d1a2
13 changed files with 142 additions and 301 deletions

View File

@@ -6,8 +6,7 @@ const QString ZeiterfassungSettings::m_language("language");
const QString ZeiterfassungSettings::m_url("url");
const QString ZeiterfassungSettings::m_username("username");
const QString ZeiterfassungSettings::m_password("password");
const QString ZeiterfassungSettings::m_projects("projects");
const QString ZeiterfassungSettings::m_workpackages("workpackages");
const QString ZeiterfassungSettings::m_lastWorkpackageIndex("lastWorkpackageIndex");
const QString ZeiterfassungSettings::m_texts("texte");
const QString ZeiterfassungSettings::m_theme("theme");
const QLocale::Language ZeiterfassungSettings::m_defaultLanguage(QLocale::AnyLanguage);
@@ -148,68 +147,29 @@ bool ZeiterfassungSettings::setPassword(const QString &password)
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;
if(projects.isEmpty())
remove(m_projects);
else
setValue(m_projects, projects);
setValue(m_lastWorkpackageIndex, lastWorkpackageIndex);
sync();
const auto success = status() == QSettings::NoError;
if(success)
Q_EMIT projectsChanged(projects);
Q_EMIT lastWorkpackageIndexChanged(lastWorkpackageIndex);
else
Q_EMIT saveErrorOccured();
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
{
return value(m_texts).toStringList();

View File

@@ -16,8 +16,7 @@ class ZEITERFASSUNGCORELIB_EXPORT ZeiterfassungSettings : public QSettings
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
Q_PROPERTY(QStringList projects READ projects WRITE setProjects NOTIFY projectsChanged)
Q_PROPERTY(QStringList workpackages READ workpackages WRITE setWorkpackages NOTIFY workpackagesChanged)
Q_PROPERTY(int lastWorkpackageIndex READ lastWorkpackageIndex WRITE setLastWorkpackageIndex NOTIFY lastWorkpackageIndexChanged)
Q_PROPERTY(QStringList texts READ texts WRITE setTexts NOTIFY textsChanged)
Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
@@ -43,13 +42,8 @@ public:
QString password() const;
bool setPassword(const QString &password);
QStringList projects() const;
bool setProjects(const QStringList &projects);
bool prependProject(const QString &project);
QStringList workpackages() const;
bool setWorkpackages(const QStringList &workpackages);
bool prependWorkpackage(const QString &workpackage);
int lastWorkpackageIndex() const;
bool setLastWorkpackageIndex(int lastWorkpackageIndex);
QStringList texts() const;
bool setTexts(const QStringList &texts);
@@ -65,8 +59,7 @@ Q_SIGNALS:
void urlChanged(const QUrl &url);
void usernameChanged(const QString &username);
void passwordChanged(const QString &password);
void projectsChanged(const QStringList &projects);
void workpackagesChanged(const QStringList &workpackages);
void lastWorkpackageIndexChanged(int lastWorkpackageIndex);
void textsChanged(const QStringList &texts);
void themeChanged(const QString &theme);
@@ -77,8 +70,7 @@ private:
static const QString m_url;
static const QString m_username;
static const QString m_password;
static const QString m_projects;
static const QString m_workpackages;
static const QString m_lastWorkpackageIndex;
static const QString m_texts;
static const QString m_theme;
static const QLocale::Language m_defaultLanguage;

View File

@@ -76,10 +76,7 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, ZeiterfassungApi &erfass
connect(ui->pushButtonNow, &QAbstractButton::pressed, this, &MainWindow::pushButtonNowPressed);
m_getProjectsReply = erfassung.doGetProjects(userInfo.userId, QDate::currentDate());
connect(m_getProjectsReply.get(), &ZeiterfassungReply::finished, this, &MainWindow::getProjectsFinished);
ui->comboBoxWorkpackage->lineEdit()->setPlaceholderText(tr("Workpackage"));
ui->comboBoxProject->setModel(&m_projectsModel);
ui->comboBoxText->lineEdit()->setPlaceholderText(tr("Text"));
updateComboboxes();
@@ -97,8 +94,6 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, ZeiterfassungApi &erfass
}
dateChangedSlot(ui->dateEditDate->date());
ui->comboBoxDebug->setModel(&m_projectsModel);
}
MainWindow::~MainWindow()
@@ -161,16 +156,21 @@ void MainWindow::setDate(const QDate &date)
ui->dateEditDate->setDate(date);
}
const QMap<QString, QString> &MainWindow::projects() const
{
return m_projects;
}
const std::array<StripsWidget*, 7> &MainWindow::stripsWidgets() const
{
return m_stripsWidgets;
}
ProjectsModel &MainWindow::projectsModel()
{
return m_projectsModel;
}
const ProjectsModel &MainWindow::projectsModel() const
{
return m_projectsModel;
}
void MainWindow::timerEvent(QTimerEvent *event)
{
if(event->timerId() == m_timerId)
@@ -182,24 +182,6 @@ void MainWindow::timerEvent(QTimerEvent *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()
{
ui->dateEditDate->setDate(QDate::currentDate());
@@ -208,6 +190,12 @@ void MainWindow::pushButtonNowPressed()
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)
{
killTimer(m_timerId);
@@ -261,8 +249,8 @@ void MainWindow::pushButtonStartPressed()
{
auto reply = m_erfassung.doCreateTimeAssignment(m_userInfo.userId, ui->dateEditDate->date(),
timeAssignmentTime, QTime(0, 0),
ui->comboBoxProject->currentData().toString(),
ui->comboBoxWorkpackage->currentText(),
ui->comboBoxProject->currentData(Qt::UserRole).toString(),
ui->comboBoxProject->currentData(Qt::EditRole).toString(),
ui->comboBoxText->currentText());
reply->waitForFinished();
@@ -276,8 +264,7 @@ void MainWindow::pushButtonStartPressed()
}
}
m_settings.prependProject(ui->comboBoxProject->currentData().toString());
m_settings.prependWorkpackage(ui->comboBoxWorkpackage->currentText());
m_settings.setLastWorkpackageIndex(ui->comboBoxProject->currentIndex());
m_settings.prependText(ui->comboBoxText->currentText());
updateComboboxes();
@@ -392,7 +379,6 @@ void MainWindow::startEnabledChanged()
ui->pushButtonNow->setEnabled(startEnabled || endEnabled);
ui->comboBoxProject->setEnabled(startEnabled);
ui->comboBoxWorkpackage->setEnabled(startEnabled);
ui->comboBoxText->setEnabled(startEnabled);
ui->pushButtonStart->setEnabled(startEnabled);
@@ -413,40 +399,6 @@ void MainWindow::endEnabledChanged()
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();
{

View File

@@ -46,9 +46,11 @@ public:
QDate date() const;
void setDate(const QDate &date);
const QMap<QString, QString> &projects() const;
const std::array<StripsWidget*, 7> &stripsWidgets() const;
ProjectsModel &projectsModel();
const ProjectsModel &projectsModel() const;
Q_SIGNALS:
void dateChanged(const QDate &date);
void refreshEverything();
@@ -58,7 +60,6 @@ protected:
virtual void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private Q_SLOTS:
void getProjectsFinished();
void pushButtonNowPressed();
void pushButtonStartPressed();
void pushButtonEndPressed();
@@ -78,10 +79,6 @@ private:
StripFactory &m_stripFactory;
const QSet<ZeiterfassungPlugin*> &m_plugins;
std::unique_ptr<GetComboboxReply> m_getProjectsReply;
QMap<QString, QString> m_projects;
std::array<StripsWidget*, 7> m_stripsWidgets;
StripsWidget *m_currentStripWidget;

View File

@@ -108,30 +108,7 @@
</widget>
</item>
<item>
<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>
<widget class="QComboBox" name="comboBoxProject"/>
</item>
<item>
<widget class="QComboBox" name="comboBoxText">
@@ -176,22 +153,6 @@
</property>
</widget>
</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>
</item>
<item>

View File

@@ -3,7 +3,6 @@
#include <QFont>
#include "zeiterfassungapi.h"
#include "replies/getcomboboxreply.h"
ProjectsModel::ProjectsModel(int userId, const QDate &date, ZeiterfassungApi &api, QObject *parent) :
QAbstractListModel(parent),
@@ -48,7 +47,6 @@ QVariant ProjectsModel::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DisplayRole:
case Qt::EditRole:
if (m_getProjectsReply->isFinished())
{
Q_ASSERT(!m_getProjectsReply->success());
@@ -90,7 +88,6 @@ QVariant ProjectsModel::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DisplayRole:
case Qt::EditRole:
if (project.getWorkpackagesReply->isFinished())
{
Q_ASSERT(!project.getWorkpackagesReply->success());
@@ -112,9 +109,11 @@ QVariant ProjectsModel::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DisplayRole:
return std::get<0>(workpackage) + " (" + std::get<1>(workpackage) + ')';
return workpackage.label + " (" + workpackage.value + ')';
case Qt::EditRole:
return std::get<0>(workpackage);
return workpackage.label;
case Qt::UserRole:
return project.value;
default:
return {};
}
@@ -134,6 +133,15 @@ Qt::ItemFlags ProjectsModel::flags(const QModelIndex &index) const
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()
{
if (!m_getProjectsReply->success())
@@ -169,7 +177,7 @@ void ProjectsModel::getWorkspacesFinished(ProjectsModel::Project &project)
}
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;

View File

@@ -6,24 +6,23 @@
#include <memory>
#include <vector>
#include "replies/getcomboboxreply.h"
class ZeiterfassungApi;
class GetComboboxReply;
class ProjectsModel : public QAbstractListModel
{
Q_OBJECT
struct Project {
struct Project : public GetComboboxReply::Item {
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::vector<std::pair<QString, QString> > workpackages;
std::vector<GetComboboxReply::Item> workpackages;
};
public:
@@ -33,6 +32,8 @@ public:
QVariant data(const QModelIndex &index, int role) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QString getProjectLabel(const QString &projectId) const;
private slots:
void getProjectsFinished();
void getWorkspacesFinished(int index);

View File

@@ -326,7 +326,7 @@ bool StripsWidget::createStrips()
auto timeAssignment = *timeAssignmentsIter++;
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjectString(timeAssignment.project),
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, timeAssignment.project,
timeAssignment.workpackage, timeAssignment.text);
if(timeAssignment.timespan == QTime(0, 0))
@@ -369,7 +369,7 @@ bool StripsWidget::createStrips()
timeAssignment = *timeAssignmentsIter++;
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjectString(timeAssignment.project),
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, timeAssignment.project,
timeAssignment.workpackage, timeAssignment.text);
if(timeAssignment.timespan == QTime(0, 0))
@@ -425,7 +425,7 @@ bool StripsWidget::createStrips()
timeAssignment = *timeAssignmentsIter++;
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, buildProjectString(timeAssignment.project),
appendTimeAssignmentStrip(timeAssignment.id, timeAssignment.timespan, timeAssignment.project,
timeAssignment.workpackage, timeAssignment.text);
if(timeAssignment.timespan == QTime(0, 0))
@@ -582,17 +582,6 @@ void StripsWidget::invalidateValues()
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)
{
auto widget = m_mainWindow.stripFactory().createBookingStartStrip(this).release();
@@ -646,7 +635,7 @@ QWidget *StripsWidget::appendTimeAssignmentStrip(int id, const QTime &duration,
qWarning() << "no labelTime found!";
if(auto labelProject = widget->findChild<QWidget*>(QStringLiteral("labelProject")))
labelProject->setProperty("text", project);
labelProject->setProperty("text", m_mainWindow.projectsModel().getProjectLabel(project) + "\n" + project);
else
qWarning() << "no labelProject found!";

View File

@@ -83,7 +83,6 @@ private Q_SLOTS:
private:
void invalidateValues();
QString buildProjectString(const QString &project) const;
QWidget *appendBookingStartStrip(int id, const QTime &time);
QWidget *appendBookingEndStrip(int id, const QTime &time, const QTime &duration);

View File

@@ -77,74 +77,74 @@
<translation>Jetzt</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="155"/>
<location filename="../mainwindow.cpp" line="399"/>
<location filename="../mainwindow.cpp" line="410"/>
<location filename="../mainwindow.ui" line="132"/>
<location filename="../mainwindow.cpp" line="385"/>
<location filename="../mainwindow.cpp" line="396"/>
<source>Start</source>
<translation>Kommen</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="175"/>
<location filename="../mainwindow.ui" line="152"/>
<source>End</source>
<translation>Gehen</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="234"/>
<location filename="../mainwindow.ui" line="195"/>
<source>&amp;File</source>
<translation>&amp;Datei</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="240"/>
<location filename="../mainwindow.ui" line="201"/>
<source>&amp;About</source>
<translation>&amp;Über</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="250"/>
<location filename="../mainwindow.ui" line="211"/>
<source>&amp;View</source>
<translation>&amp;Ansicht</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="257"/>
<location filename="../mainwindow.ui" line="218"/>
<source>&amp;Tools</source>
<translation>&amp;Werkzeuge</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="282"/>
<location filename="../mainwindow.ui" line="243"/>
<source>&amp;Quit</source>
<translation>&amp;Beenden</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="291"/>
<location filename="../mainwindow.ui" line="252"/>
<source>About &amp;Me</source>
<translation>Über &amp;mich</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="300"/>
<location filename="../mainwindow.ui" line="261"/>
<source>About &amp;zeiterfassung</source>
<translation>Über &amp;zeiterfassung</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="309"/>
<location filename="../mainwindow.ui" line="270"/>
<source>About &amp;Qt</source>
<translation>Über &amp;Qt</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="318"/>
<location filename="../mainwindow.ui" line="279"/>
<source>&amp;Today</source>
<translation>&amp;Heute</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="327"/>
<location filename="../mainwindow.ui" line="288"/>
<source>&amp;Refresh everything</source>
<translation>Alles &amp;neu laden</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="336"/>
<location filename="../mainwindow.ui" line="297"/>
<source>&amp;Settings</source>
<translation>&amp;Einstellungen</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="345"/>
<location filename="../mainwindow.ui" line="306"/>
<source>Help</source>
<translation>Hilfe</translation>
</message>
@@ -154,47 +154,36 @@
<translation>Zeiterfassung - %0 (%1)</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="82"/>
<source>Workpackage</source>
<translation>Arbeitspaket</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="83"/>
<location filename="../mainwindow.cpp" line="80"/>
<source>Text</source>
<translation>Text</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="197"/>
<location filename="../mainwindow.cpp" line="198"/>
<source>Could not load bookings!</source>
<translation>Konnte Buchungen nicht laden!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="228"/>
<location filename="../mainwindow.cpp" line="330"/>
<location filename="../mainwindow.cpp" line="195"/>
<location filename="../mainwindow.cpp" line="216"/>
<location filename="../mainwindow.cpp" line="317"/>
<source>Could not create booking!</source>
<translation>Konnte Buchung nicht erstellen!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="254"/>
<location filename="../mainwindow.cpp" line="315"/>
<location filename="../mainwindow.cpp" line="195"/>
<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>
<translation>Konnte Kontierung nicht bearbeiten!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="429"/>
<location filename="../mainwindow.cpp" line="438"/>
<source>%0 (%1)</source>
<translation>%0 (%1)</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="272"/>
<location filename="../mainwindow.cpp" line="260"/>
<source>Could not create time assignment!</source>
<translation>Konnte Kontierung nicht erstellen!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="399"/>
<location filename="../mainwindow.cpp" line="410"/>
<location filename="../mainwindow.cpp" line="385"/>
<location filename="../mainwindow.cpp" line="396"/>
<source>Switch</source>
<translation>Wechseln</translation>
</message>
@@ -202,12 +191,12 @@
<context>
<name>ProjectsModel</name>
<message>
<location filename="../projectsmodel.cpp" line="58"/>
<location filename="../projectsmodel.cpp" line="56"/>
<source>Loading projects...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../projectsmodel.cpp" line="100"/>
<location filename="../projectsmodel.cpp" line="97"/>
<source>Loading workpackages...</source>
<translation type="unfinished"></translation>
</message>
@@ -340,7 +329,7 @@ Booking ID: %1</source>
<location filename="../stripswidget.cpp" line="312"/>
<location filename="../stripswidget.cpp" line="419"/>
<location filename="../stripswidget.cpp" line="482"/>
<location filename="../stripswidget.cpp" line="625"/>
<location filename="../stripswidget.cpp" line="614"/>
<source>%0h</source>
<translation>%0h</translation>
</message>
@@ -407,7 +396,7 @@ Your bookings and time assignments for this day are in an illegal state!</source
<translation>Ungültig</translation>
</message>
<message>
<location filename="../stripswidget.cpp" line="644"/>
<location filename="../stripswidget.cpp" line="633"/>
<source>Open</source>
<translation>Offen</translation>
</message>

View File

@@ -77,74 +77,74 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="155"/>
<location filename="../mainwindow.cpp" line="399"/>
<location filename="../mainwindow.cpp" line="410"/>
<location filename="../mainwindow.ui" line="132"/>
<location filename="../mainwindow.cpp" line="385"/>
<location filename="../mainwindow.cpp" line="396"/>
<source>Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="175"/>
<location filename="../mainwindow.ui" line="152"/>
<source>End</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="234"/>
<location filename="../mainwindow.ui" line="195"/>
<source>&amp;File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="240"/>
<location filename="../mainwindow.ui" line="201"/>
<source>&amp;About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="250"/>
<location filename="../mainwindow.ui" line="211"/>
<source>&amp;View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="257"/>
<location filename="../mainwindow.ui" line="218"/>
<source>&amp;Tools</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="282"/>
<location filename="../mainwindow.ui" line="243"/>
<source>&amp;Quit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="291"/>
<location filename="../mainwindow.ui" line="252"/>
<source>About &amp;Me</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="300"/>
<location filename="../mainwindow.ui" line="261"/>
<source>About &amp;zeiterfassung</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="309"/>
<location filename="../mainwindow.ui" line="270"/>
<source>About &amp;Qt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="318"/>
<location filename="../mainwindow.ui" line="279"/>
<source>&amp;Today</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="327"/>
<location filename="../mainwindow.ui" line="288"/>
<source>&amp;Refresh everything</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="336"/>
<location filename="../mainwindow.ui" line="297"/>
<source>&amp;Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="345"/>
<location filename="../mainwindow.ui" line="306"/>
<source>Help</source>
<translation type="unfinished"></translation>
</message>
@@ -154,60 +154,49 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="82"/>
<source>Workpackage</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="83"/>
<location filename="../mainwindow.cpp" line="80"/>
<source>Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="197"/>
<location filename="../mainwindow.cpp" line="198"/>
<source>Could not load bookings!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="228"/>
<location filename="../mainwindow.cpp" line="330"/>
<location filename="../mainwindow.cpp" line="195"/>
<location filename="../mainwindow.cpp" line="216"/>
<location filename="../mainwindow.cpp" line="317"/>
<source>Could not create booking!</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="254"/>
<location filename="../mainwindow.cpp" line="315"/>
<location filename="../mainwindow.cpp" line="242"/>
<location filename="../mainwindow.cpp" line="302"/>
<source>Could not edit time assignment!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="399"/>
<location filename="../mainwindow.cpp" line="410"/>
<location filename="../mainwindow.cpp" line="385"/>
<location filename="../mainwindow.cpp" line="396"/>
<source>Switch</source>
<translation type="unfinished"></translation>
</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>
<name>ProjectsModel</name>
<message>
<location filename="../projectsmodel.cpp" line="58"/>
<location filename="../projectsmodel.cpp" line="56"/>
<source>Loading projects...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../projectsmodel.cpp" line="100"/>
<location filename="../projectsmodel.cpp" line="97"/>
<source>Loading workpackages...</source>
<translation type="unfinished"></translation>
</message>
@@ -340,7 +329,7 @@ Booking ID: %1</source>
<location filename="../stripswidget.cpp" line="312"/>
<location filename="../stripswidget.cpp" line="419"/>
<location filename="../stripswidget.cpp" line="482"/>
<location filename="../stripswidget.cpp" line="625"/>
<location filename="../stripswidget.cpp" line="614"/>
<source>%0h</source>
<translation type="unfinished"></translation>
</message>
@@ -407,7 +396,7 @@ Your bookings and time assignments for this day are in an illegal state!</source
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../stripswidget.cpp" line="644"/>
<location filename="../stripswidget.cpp" line="633"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>

View File

@@ -15,7 +15,7 @@ GetComboboxReply::GetComboboxReply(std::unique_ptr<QNetworkReply> &&reply, Zeite
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;
}
@@ -69,14 +69,14 @@ void GetComboboxReply::requestFinished()
setSuccess(true);
m_items.clear();
m_items.reserve(elementsArr.count());
for(const auto &val : elementsArr)
for(const auto val : elementsArr)
{
auto obj = val.toObject();
m_items.append({
m_items.emplace_back(
obj.value(QStringLiteral("label")).toString(),
obj.value(QStringLiteral("value")).toString()
});
);
}
}

View File

@@ -1,9 +1,9 @@
#pragma once
#include <memory>
#include <vector>
#include <QNetworkReply>
#include <QVector>
#include "zeiterfassungnetworklib_global.h"
#include "zeiterfassungreply.h"
@@ -19,16 +19,20 @@ public:
struct Item
{
Item(const QString &label, const QString &value) :
label(label), value(value)
{}
QString label;
QString value;
};
const QVector<Item> &items() const;
const std::vector<Item> &items() const;
private Q_SLOTS:
void requestFinished();
private:
std::unique_ptr<QNetworkReply> m_reply;
QVector<Item> m_items;
std::vector<Item> m_items;
};