Minor bug fixes (theming)

This commit is contained in:
0xFEEDC0DE64
2017-12-13 16:50:57 +01:00
parent 87467818ec
commit 8a36cdf1fe
6 changed files with 88 additions and 25 deletions
+45 -17
View File
@@ -167,8 +167,7 @@ void MainWindow::getAuswertungFinished()
ui->actionAuswertung->setEnabled(true);
m_auswertung = m_getAuswertungReply->auswertung();
auto urlaubsAnspruch = tr("???");
auto gleitzeit = tr("???");
auto urlaubsAnspruch = tr("n/a");
{
static QRegularExpression regex(QStringLiteral("Urlaubsanspruch +([0-9]+\\.[0-9]+\\-?) +([0-9]+\\.[0-9]+\\-?)"));
@@ -178,6 +177,9 @@ void MainWindow::getAuswertungFinished()
else
qWarning() << "Urlaubsanspruch not found";
}
auto gleitzeit = tr("n/a");
{
static QRegularExpression regex(QStringLiteral("Gleitzeit +([0-9]+\\:[0-9]+\\-?) +([0-9]+\\:[0-9]+\\-?)"));
auto match = regex.match(m_auswertung);
@@ -441,6 +443,8 @@ void MainWindow::contextMenuTimeAssignment(const QPoint &pos)
void MainWindow::pushButtonStartPressed()
{
auto bookingsChanged = false;
if(m_currentStripWidget->bookings().rbegin() == m_currentStripWidget->bookings().rend() ||
m_currentStripWidget->bookings().rbegin()->type == QStringLiteral("G"))
{
@@ -463,6 +467,8 @@ void MainWindow::pushButtonStartPressed()
}
reply->deleteLater();
bookingsChanged = true;
}
auto timeAssignmentTime = m_currentStripWidget->timeAssignmentTime();
@@ -527,7 +533,20 @@ void MainWindow::pushButtonStartPressed()
updateComboboxes();
m_currentStripWidget->refresh();
if(bookingsChanged)
{
m_currentStripWidget->refresh();
refreshAuswertung();
}
else
m_currentStripWidget->refreshTimeAssignments();
ui->actionToday->setEnabled(false);
ui->actionRefresh->setEnabled(false);
ui->dateEditDate->setReadOnly(true);
ui->pushButtonPrev->setEnabled(false);
ui->pushButtonNext->setEnabled(false);
}
void MainWindow::pushButtonEndPressed()
@@ -583,6 +602,13 @@ void MainWindow::pushButtonEndPressed()
}
m_currentStripWidget->refresh();
refreshAuswertung();
ui->actionToday->setEnabled(false);
ui->actionRefresh->setEnabled(false);
ui->dateEditDate->setReadOnly(true);
ui->pushButtonPrev->setEnabled(false);
ui->pushButtonNext->setEnabled(false);
}
void MainWindow::dateChanged(bool force)
@@ -620,19 +646,8 @@ void MainWindow::dateChanged(bool force)
}
}
auto auswertungDate = QDate(ui->dateEditDate->date().year(), ui->dateEditDate->date().month(), 1);
if(force || m_auswertungDate != auswertungDate)
{
m_balanceLabel->setText(tr("%0: %1").arg(tr("Balance")).arg(tr("???")));
m_holidaysLabel->setText(tr("%0: %1").arg(tr("Holidays")).arg(tr("???")));
ui->actionAuswertung->setEnabled(false);
m_auswertung.clear();
m_auswertungDate = auswertungDate;
m_getAuswertungReply = m_erfassung.doGetAuswertung(m_userInfo.userId, auswertungDate);
connect(m_getAuswertungReply, &ZeiterfassungReply::finished, this, &MainWindow::getAuswertungFinished);
}
if(force || m_auswertungDate != QDate(ui->dateEditDate->date().year(), ui->dateEditDate->date().month(), 1))
refreshAuswertung();
if(std::any_of(std::begin(m_stripsWidgets), std::end(m_stripsWidgets), [](StripsWidget *stripsWidget) {
return stripsWidget->refreshing();
@@ -710,12 +725,25 @@ void MainWindow::endEnabledChanged()
auto startEnabled = m_currentStripWidget->startEnabled();
auto endEnabled = m_currentStripWidget->endEnabled();
ui->timeEditTime->setEnabled(startEnabled ||endEnabled);
ui->timeEditTime->setEnabled(startEnabled || endEnabled);
ui->pushButtonStart->setText(endEnabled ? tr("Switch") : tr("Start"));
ui->pushButtonEnd->setEnabled(endEnabled);
}
void MainWindow::refreshAuswertung()
{
m_balanceLabel->setText(tr("%0: %1").arg(tr("Balance")).arg(tr("???")));
m_holidaysLabel->setText(tr("%0: %1").arg(tr("Holidays")).arg(tr("???")));
ui->actionAuswertung->setEnabled(false);
m_auswertung.clear();
m_auswertungDate = QDate(ui->dateEditDate->date().year(), ui->dateEditDate->date().month(), 1);
m_getAuswertungReply = m_erfassung.doGetAuswertung(m_userInfo.userId, m_auswertungDate);
connect(m_getAuswertungReply, &ZeiterfassungReply::finished, this, &MainWindow::getAuswertungFinished);
}
void MainWindow::updateComboboxes()
{
ui->comboBoxProject->clear();
+1
View File
@@ -43,6 +43,7 @@ private Q_SLOTS:
void endEnabledChanged();
private:
void refreshAuswertung();
void updateComboboxes();
Ui::MainWindow *ui;
+9 -1
View File
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="styleSheet">
<string notr="true">#bookingEndStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #FF7F7F, stop:1 #BF6F6F); }</string>
<string notr="true">QLabel { color: black; } #bookingEndStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #FF7F7F, stop:1 #BF6F6F); }</string>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
@@ -40,6 +40,8 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@@ -63,6 +65,9 @@
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string>END</string>
</property>
@@ -70,6 +75,9 @@
</item>
<item>
<widget class="QLabel" name="labelId">
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string notr="true">0123456</string>
</property>
+9 -1
View File
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="styleSheet">
<string notr="true">#bookingStartStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFF7F, stop:1 #6FBF6F); }</string>
<string notr="true">QLabel { color: black; } #bookingStartStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFF7F, stop:1 #6FBF6F); }</string>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
@@ -40,6 +40,8 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@@ -63,6 +65,9 @@
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string>START</string>
</property>
@@ -70,6 +75,9 @@
</item>
<item>
<widget class="QLabel" name="labelId">
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string notr="true">0123456</string>
</property>
+23 -5
View File
@@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>500</width>
<height>68</height>
<height>73</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#timeAssignmentStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFFFF, stop:1 #6FBFBF); }</string>
<string notr="true">QLabel { color: black; } #timeAssignmentStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFFFF, stop:1 #6FBFBF); }</string>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
@@ -38,13 +38,15 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
<property name="spacing">
<number>20</number>
<number>10</number>
</property>
<item>
<widget class="QLabel" name="labelTime">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@@ -65,16 +67,23 @@
<widget class="QLabel" name="labelProject">
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string notr="true">PROJECT 1 (12345)</string>
<string notr="true">PROJECT 1
12345</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelId">
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string notr="true">0123456</string>
</property>
@@ -95,6 +104,9 @@
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string notr="true">Subproject</string>
</property>
@@ -108,6 +120,9 @@
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string notr="true">Workpackage</string>
</property>
@@ -115,6 +130,9 @@
</item>
<item>
<widget class="QLabel" name="labelText">
<property name="styleSheet">
<string notr="true">background-color: rgba(0,0,0,30);</string>
</property>
<property name="text">
<string notr="true">Text</string>
</property>
+1 -1
View File
@@ -534,7 +534,7 @@ void StripsWidget::invalidateValues()
QString StripsWidget::buildProjectString(const QString &project)
{
if(m_projects.contains(project))
return tr("%0 (%1)").arg(m_projects.value(project)).arg(project);
return m_projects.value(project) % "\n" % project;
else
{
qWarning() << "could not find project" << project;