From 94781aea4aa170768bcbc7f2c34d15824a77a377 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 <0xFEEDC0DE64@gmail.com> Date: Sat, 2 Dec 2017 19:17:10 +0100 Subject: [PATCH] KontierenStrips now show projekt name --- mainwindow.cpp | 23 +++++++++++++++++------ mainwindow.h | 2 ++ strips/kontierungstrip.ui | 9 ++++++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 4596a8c..2857a6b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -891,8 +891,9 @@ void MainWindow::validateEntries() goto after; } - ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, kontierung.projekt, kontierung.subprojekt, - kontierung.workpackage, kontierung.text, ui->scrollAreaWidgetContents)); + ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt), + kontierung.subprojekt, kontierung.workpackage, kontierung.text, + ui->scrollAreaWidgetContents)); if(kontierung.timespan == QTime(0, 0)) { @@ -942,8 +943,9 @@ void MainWindow::validateEntries() goto after; } - ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, kontierung.projekt, kontierung.subprojekt, - kontierung.workpackage, kontierung.text, ui->scrollAreaWidgetContents)); + ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt), + kontierung.subprojekt, kontierung.workpackage, kontierung.text, + ui->scrollAreaWidgetContents)); if(kontierung.timespan == QTime(0, 0)) { @@ -1000,8 +1002,9 @@ void MainWindow::validateEntries() goto after; } - ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, kontierung.projekt, kontierung.subprojekt, - kontierung.workpackage, kontierung.text, ui->scrollAreaWidgetContents)); + ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt), + kontierung.subprojekt, kontierung.workpackage, kontierung.text, + ui->scrollAreaWidgetContents)); if(kontierung.timespan == QTime(0, 0)) { @@ -1170,3 +1173,11 @@ void MainWindow::clearStrips() delete item; } } + +QString MainWindow::buildProjektString(const QString &projekt) +{ + if(m_projekte.contains(projekt)) + return m_projekte.value(projekt) % " (" % projekt % ")"; + else + return projekt; +} diff --git a/mainwindow.h b/mainwindow.h index a8f8140..46e62e9 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -45,6 +45,8 @@ private: void updateAuswertung(); void clearStrips(); + QString buildProjektString(const QString &projekt); + Ui::MainWindow *ui; QSettings &m_settings; Zeiterfassung &m_erfassung; diff --git a/strips/kontierungstrip.ui b/strips/kontierungstrip.ui index bd87e52..265d629 100644 --- a/strips/kontierungstrip.ui +++ b/strips/kontierungstrip.ui @@ -7,7 +7,7 @@ 0 0 500 - 75 + 78 @@ -25,11 +25,14 @@ + + 20 + - 20 + 15 @@ -47,7 +50,7 @@ - 20 + 15