Moved background colors into settings.
This commit is contained in:
@@ -850,7 +850,7 @@ void MainWindow::validateEntries()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_lastKontierungStart = startBuchung.time;
|
m_lastKontierungStart = startBuchung.time;
|
||||||
ui->verticalLayout2->addWidget(new BuchungStrip(startBuchung.id, startBuchung.time, startBuchung.type, ui->scrollAreaWidgetContents));
|
ui->verticalLayout2->addWidget(new BuchungStrip(startBuchung.id, startBuchung.time, startBuchung.type, m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierungenIter == m_kontierungenModel->constEnd())
|
if(kontierungenIter == m_kontierungenModel->constEnd())
|
||||||
{
|
{
|
||||||
@@ -870,7 +870,7 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
||||||
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
||||||
ui->scrollAreaWidgetContents));
|
m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierung.timespan == QTime(0, 0))
|
if(kontierung.timespan == QTime(0, 0))
|
||||||
{
|
{
|
||||||
@@ -923,7 +923,7 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
||||||
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
||||||
ui->scrollAreaWidgetContents));
|
m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierung.timespan == QTime(0, 0))
|
if(kontierung.timespan == QTime(0, 0))
|
||||||
{
|
{
|
||||||
@@ -984,7 +984,7 @@ void MainWindow::validateEntries()
|
|||||||
|
|
||||||
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
ui->verticalLayout2->addWidget(new KontierungStrip(kontierung.id, kontierung.timespan, buildProjektString(kontierung.projekt),
|
||||||
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
kontierung.subprojekt, kontierung.workpackage, kontierung.text,
|
||||||
ui->scrollAreaWidgetContents));
|
m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(kontierung.timespan == QTime(0, 0))
|
if(kontierung.timespan == QTime(0, 0))
|
||||||
{
|
{
|
||||||
@@ -1024,7 +1024,7 @@ void MainWindow::validateEntries()
|
|||||||
label->setMaximumHeight(20);
|
label->setMaximumHeight(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->verticalLayout2->addWidget(new BuchungStrip(endBuchung.id, endBuchung.time, endBuchung.type, ui->scrollAreaWidgetContents));
|
ui->verticalLayout2->addWidget(new BuchungStrip(endBuchung.id, endBuchung.time, endBuchung.type, m_settings, ui->scrollAreaWidgetContents));
|
||||||
|
|
||||||
if(m_kontierungTime > buchungTimespan)
|
if(m_kontierungTime > buchungTimespan)
|
||||||
{
|
{
|
||||||
|
@@ -2,8 +2,11 @@
|
|||||||
#include "ui_buchungstrip.h"
|
#include "ui_buchungstrip.h"
|
||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <QStringBuilder>
|
||||||
|
|
||||||
BuchungStrip::BuchungStrip(int id, const QTime &time, const QString &type, QWidget *parent) :
|
#include "zeiterfassungsettings.h"
|
||||||
|
|
||||||
|
BuchungStrip::BuchungStrip(int id, const QTime &time, const QString &type, const ZeiterfassungSettings &settings, QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
ui(new Ui::BuchungStrip)
|
ui(new Ui::BuchungStrip)
|
||||||
{
|
{
|
||||||
@@ -12,20 +15,20 @@ BuchungStrip::BuchungStrip(int id, const QTime &time, const QString &type, QWidg
|
|||||||
setMinimumHeight(minimumSizeHint().height());
|
setMinimumHeight(minimumSizeHint().height());
|
||||||
setMaximumHeight(minimumSizeHint().height());
|
setMaximumHeight(minimumSizeHint().height());
|
||||||
|
|
||||||
ui->labelTime->setText(time.toString("HH:mm"));
|
ui->labelTime->setText(time.toString(QStringLiteral("HH:mm")));
|
||||||
if(type == QStringLiteral("K"))
|
if(type == QStringLiteral("K"))
|
||||||
{
|
{
|
||||||
setStyleSheet("BuchungStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFF7F, stop:1 #6FBF6F); }");
|
setStyleSheet(QStringLiteral("%0 { background-color: %1; }").arg(staticMetaObject.className()).arg(settings.buchungKommenBackgroundColor()));
|
||||||
ui->labelType->setText(tr("KOMMEN"));
|
ui->labelType->setText(tr("KOMMEN"));
|
||||||
}
|
}
|
||||||
else if(type == QStringLiteral("G"))
|
else if(type == QStringLiteral("G"))
|
||||||
{
|
{
|
||||||
setStyleSheet("BuchungStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #FF7F7F, stop:1 #BF6F6F); }");
|
setStyleSheet(QStringLiteral("%0 { background-color: %1; }").arg(staticMetaObject.className()).arg(settings.buchungGehenBackgroundColor()));
|
||||||
ui->labelType->setText(tr("GEHEN"));
|
ui->labelType->setText(tr("GEHEN"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setStyleSheet("BuchungStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #FFFF7F, stop:1 #BFBF6F); }");
|
setStyleSheet(QStringLiteral("%0 { background-color: %1; }").arg(staticMetaObject.className()).arg(settings.buchungOtherBackgroundColor()));
|
||||||
ui->labelType->setText(tr("UNKNOWN"));
|
ui->labelType->setText(tr("UNKNOWN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
class QTime;
|
class QTime;
|
||||||
|
|
||||||
|
class ZeiterfassungSettings;
|
||||||
namespace Ui { class BuchungStrip; }
|
namespace Ui { class BuchungStrip; }
|
||||||
|
|
||||||
class BuchungStrip : public QFrame
|
class BuchungStrip : public QFrame
|
||||||
@@ -12,7 +13,7 @@ class BuchungStrip : public QFrame
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BuchungStrip(int id, const QTime &time, const QString &type, QWidget *parent = 0);
|
explicit BuchungStrip(int id, const QTime &time, const QString &type, const ZeiterfassungSettings &settings, QWidget *parent = 0);
|
||||||
~BuchungStrip();
|
~BuchungStrip();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -4,10 +4,11 @@
|
|||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "zeiterfassungsettings.h"
|
||||||
|
|
||||||
KontierungStrip::KontierungStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
KontierungStrip::KontierungStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
||||||
const QString &workpackage, const QString &text, QWidget *parent) :
|
const QString &workpackage, const QString &text, const ZeiterfassungSettings &settings,
|
||||||
|
QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
ui(new Ui::KontierungStrip)
|
ui(new Ui::KontierungStrip)
|
||||||
{
|
{
|
||||||
@@ -16,9 +17,9 @@ KontierungStrip::KontierungStrip(int id, const QTime &duration, const QString &p
|
|||||||
setMinimumHeight(minimumSizeHint().height());
|
setMinimumHeight(minimumSizeHint().height());
|
||||||
setMaximumHeight(minimumSizeHint().height());
|
setMaximumHeight(minimumSizeHint().height());
|
||||||
|
|
||||||
setStyleSheet("KontierungStrip { background-color: qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFFFF, stop:1 #6FBFBF); }");
|
setStyleSheet(QStringLiteral("%0 { background-color: %1; }").arg(staticMetaObject.className()).arg(settings.kontierungBackgroundColor()));
|
||||||
|
|
||||||
ui->labelTime->setText(duration == QTime(0, 0) ? tr("Open") : duration.toString("HH:mm"));
|
ui->labelTime->setText(duration == QTime(0, 0) ? tr("Open") : duration.toString(QStringLiteral("HH:mm")));
|
||||||
ui->labelProjekt->setText(projekt);
|
ui->labelProjekt->setText(projekt);
|
||||||
ui->labelId->setText(QString::number(id));
|
ui->labelId->setText(QString::number(id));
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
class QTime;
|
class QTime;
|
||||||
|
|
||||||
|
class ZeiterfassungSettings;
|
||||||
namespace Ui { class KontierungStrip; }
|
namespace Ui { class KontierungStrip; }
|
||||||
|
|
||||||
class KontierungStrip : public QFrame
|
class KontierungStrip : public QFrame
|
||||||
@@ -13,7 +14,8 @@ class KontierungStrip : public QFrame
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KontierungStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
explicit KontierungStrip(int id, const QTime &duration, const QString &projekt, const QString &subprojekt,
|
||||||
const QString &workpackage, const QString &text, QWidget *parent = 0);
|
const QString &workpackage, const QString &text, const ZeiterfassungSettings &settings,
|
||||||
|
QWidget *parent = 0);
|
||||||
~KontierungStrip();
|
~KontierungStrip();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
174
zeiterfassungsettings.cpp
Normal file
174
zeiterfassungsettings.cpp
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
#include "zeiterfassungsettings.h"
|
||||||
|
|
||||||
|
ZeiterfassungSettings::ZeiterfassungSettings(const QString &organization,
|
||||||
|
const QString &application, QObject *parent) :
|
||||||
|
QSettings(organization, application, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeiterfassungSettings::ZeiterfassungSettings(QSettings::Scope scope, const QString &organization,
|
||||||
|
const QString &application, QObject *parent) :
|
||||||
|
QSettings(scope, organization, application, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeiterfassungSettings::ZeiterfassungSettings(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application, QObject *parent) :
|
||||||
|
QSettings(format, scope, organization, application, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeiterfassungSettings::ZeiterfassungSettings(const QString &fileName, QSettings::Format format, QObject *parent) :
|
||||||
|
QSettings(fileName, format, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeiterfassungSettings::ZeiterfassungSettings(QObject *parent) :
|
||||||
|
QSettings(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ZeiterfassungSettings::url() const
|
||||||
|
{
|
||||||
|
return value("url", QStringLiteral("http://10.1.0.11:8080/evoApps/")).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setUrl(const QString &url)
|
||||||
|
{
|
||||||
|
setValue("url", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ZeiterfassungSettings::username() const
|
||||||
|
{
|
||||||
|
return value("username").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setUsername(const QString &username)
|
||||||
|
{
|
||||||
|
setValue("username", username);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ZeiterfassungSettings::password() const
|
||||||
|
{
|
||||||
|
return value("password").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setPassword(const QString &password)
|
||||||
|
{
|
||||||
|
setValue("password", password);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ZeiterfassungSettings::projekte() const
|
||||||
|
{
|
||||||
|
return value("projekte").toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setProjekte(const QStringList &projekte)
|
||||||
|
{
|
||||||
|
setValue("projekte", projekte);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::prependProjekt(const QString &projekt)
|
||||||
|
{
|
||||||
|
prepentItem("projekte", projekt);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ZeiterfassungSettings::subprojekte() const
|
||||||
|
{
|
||||||
|
return value("subprojekte").toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setSubprojekte(const QStringList &subprojekte)
|
||||||
|
{
|
||||||
|
setValue("subprojekte", subprojekte);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::prependSubprojekt(const QString &subprojekt)
|
||||||
|
{
|
||||||
|
prepentItem("subprojekte", subprojekt);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ZeiterfassungSettings::workpackages() const
|
||||||
|
{
|
||||||
|
return value("workpackages").toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setWorkpackages(const QStringList &workpackages)
|
||||||
|
{
|
||||||
|
setValue("workpackages", workpackages);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::prependWorkpackage(const QString &workpackage)
|
||||||
|
{
|
||||||
|
prepentItem("workpackages", workpackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ZeiterfassungSettings::texte() const
|
||||||
|
{
|
||||||
|
return value("texte").toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setTexte(const QStringList &texte)
|
||||||
|
{
|
||||||
|
setValue("texte", texte);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::prependText(const QString &text)
|
||||||
|
{
|
||||||
|
prepentItem("texte", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ZeiterfassungSettings::buchungKommenBackgroundColor() const
|
||||||
|
{
|
||||||
|
return value("buchungKommenBackgroundColor", QStringLiteral("qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFF7F, stop:1 #6FBF6F)")).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setBuchungKommenBackgroundColor(const QString &buchungKommenBackgroundColor)
|
||||||
|
{
|
||||||
|
setValue("buchungKommenBackgroundColor", buchungKommenBackgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ZeiterfassungSettings::buchungGehenBackgroundColor() const
|
||||||
|
{
|
||||||
|
return value("buchungGehenBackgroundColor", QStringLiteral("qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #FF7F7F, stop:1 #BF6F6F)")).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setBuchungGehenBackgroundColor(const QString &buchungGehenBackgroundColor)
|
||||||
|
{
|
||||||
|
setValue("buchungGehenBackgroundColor", buchungGehenBackgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ZeiterfassungSettings::buchungOtherBackgroundColor() const
|
||||||
|
{
|
||||||
|
return value("buchungOtherBackgroundColor", QStringLiteral("qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #FFFF7F, stop:1 #BFBF6F)")).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setBuchungOtherBackgroundColor(const QString &buchungOtherBackgroundColor)
|
||||||
|
{
|
||||||
|
setValue("buchungOtherBackgroundColor", buchungOtherBackgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ZeiterfassungSettings::kontierungBackgroundColor() const
|
||||||
|
{
|
||||||
|
return value("kontierungBackgroundColor", QStringLiteral("qlineargradient( x1:0 y1:0, x2:0 y2:1, stop:0 #7FFFFF, stop:1 #6FBFBF)")).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::setKontierungBackgroundColor(const QString kontierungBackgroundColor)
|
||||||
|
{
|
||||||
|
setValue("kontierungBackgroundColor", kontierungBackgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungSettings::prepentItem(const QString &name, const QString &item)
|
||||||
|
{
|
||||||
|
if(item.trimmed().isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto entries = value(name).toStringList();
|
||||||
|
entries.removeAll(item);
|
||||||
|
entries.prepend(item);
|
||||||
|
setValue(name, entries);
|
||||||
|
}
|
61
zeiterfassungsettings.h
Normal file
61
zeiterfassungsettings.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#ifndef ZEITERFASSUNGSETTINGS_H
|
||||||
|
#define ZEITERFASSUNGSETTINGS_H
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
class ZeiterfassungSettings : public QSettings
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ZeiterfassungSettings(const QString &organization,
|
||||||
|
const QString &application = QString(), QObject *parent = Q_NULLPTR);
|
||||||
|
ZeiterfassungSettings(Scope scope, const QString &organization,
|
||||||
|
const QString &application = QString(), QObject *parent = Q_NULLPTR);
|
||||||
|
ZeiterfassungSettings(Format format, Scope scope, const QString &organization,
|
||||||
|
const QString &application = QString(), QObject *parent = Q_NULLPTR);
|
||||||
|
ZeiterfassungSettings(const QString &fileName, Format format, QObject *parent = Q_NULLPTR);
|
||||||
|
explicit ZeiterfassungSettings(QObject *parent = Q_NULLPTR);
|
||||||
|
|
||||||
|
QString url() const;
|
||||||
|
void setUrl(const QString &url);
|
||||||
|
|
||||||
|
QString username() const;
|
||||||
|
void setUsername(const QString &username);
|
||||||
|
|
||||||
|
QString password() const;
|
||||||
|
void setPassword(const QString &password);
|
||||||
|
|
||||||
|
QStringList projekte() const;
|
||||||
|
void setProjekte(const QStringList &projekte);
|
||||||
|
void prependProjekt(const QString &projekt);
|
||||||
|
|
||||||
|
QStringList subprojekte() const;
|
||||||
|
void setSubprojekte(const QStringList &subprojekte);
|
||||||
|
void prependSubprojekt(const QString &subprojekt);
|
||||||
|
|
||||||
|
QStringList workpackages() const;
|
||||||
|
void setWorkpackages(const QStringList &workpackages);
|
||||||
|
void prependWorkpackage(const QString &workpackage);
|
||||||
|
|
||||||
|
QStringList texte() const;
|
||||||
|
void setTexte(const QStringList &texte);
|
||||||
|
void prependText(const QString &text);
|
||||||
|
|
||||||
|
QString buchungKommenBackgroundColor() const;
|
||||||
|
void setBuchungKommenBackgroundColor(const QString &buchungKommenBackgroundColor);
|
||||||
|
|
||||||
|
QString buchungGehenBackgroundColor() const;
|
||||||
|
void setBuchungGehenBackgroundColor(const QString &buchungGehenBackgroundColor);
|
||||||
|
|
||||||
|
QString buchungOtherBackgroundColor() const;
|
||||||
|
void setBuchungOtherBackgroundColor(const QString &buchungOtherBackgroundColor);
|
||||||
|
|
||||||
|
QString kontierungBackgroundColor() const;
|
||||||
|
void setKontierungBackgroundColor(const QString kontierungBackgroundColor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void prepentItem(const QString &name, const QString &item);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ZEITERFASSUNGSETTINGS_H
|
Reference in New Issue
Block a user