Added SettingsDialog
This commit is contained in:
38
dialogs/settingsdialog.cpp
Normal file
38
dialogs/settingsdialog.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#include "settingsdialog.h"
|
||||||
|
#include "ui_settingsdialog.h"
|
||||||
|
|
||||||
|
#include "zeiterfassungsettings.h"
|
||||||
|
|
||||||
|
SettingsDialog::SettingsDialog(ZeiterfassungSettings &settings, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::SettingsDialog),
|
||||||
|
m_settings(settings)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->lineEditBuchungKommenBackgroundColor->setText(settings.buchungKommenBackgroundColor());
|
||||||
|
ui->lineEditBuchungGehenBackgroundColor->setText(settings.buchungGehenBackgroundColor());
|
||||||
|
ui->lineEditBuchungOtherBackgroundColor->setText(settings.buchungOtherBackgroundColor());
|
||||||
|
ui->lineEditKontierungBackgroundColor->setText(settings.kontierungBackgroundColor());
|
||||||
|
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::submit);
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsDialog::~SettingsDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::submit()
|
||||||
|
{
|
||||||
|
if(ui->lineEditBuchungKommenBackgroundColor->text() != m_settings.buchungKommenBackgroundColor())
|
||||||
|
m_settings.setBuchungKommenBackgroundColor(ui->lineEditBuchungKommenBackgroundColor->text());
|
||||||
|
if(ui->lineEditBuchungGehenBackgroundColor->text() != m_settings.buchungGehenBackgroundColor())
|
||||||
|
m_settings.setBuchungGehenBackgroundColor(ui->lineEditBuchungGehenBackgroundColor->text());
|
||||||
|
if(ui->lineEditBuchungOtherBackgroundColor->text() != m_settings.buchungOtherBackgroundColor())
|
||||||
|
m_settings.setBuchungOtherBackgroundColor(ui->lineEditBuchungOtherBackgroundColor->text());
|
||||||
|
if(ui->lineEditKontierungBackgroundColor->text() != m_settings.kontierungBackgroundColor())
|
||||||
|
m_settings.setKontierungBackgroundColor(ui->lineEditKontierungBackgroundColor->text());
|
||||||
|
|
||||||
|
accept();
|
||||||
|
}
|
25
dialogs/settingsdialog.h
Normal file
25
dialogs/settingsdialog.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#ifndef SETTINGSDIALOG_H
|
||||||
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class ZeiterfassungSettings;
|
||||||
|
namespace Ui { class SettingsDialog; }
|
||||||
|
|
||||||
|
class SettingsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SettingsDialog(ZeiterfassungSettings &settings, QWidget *parent = 0);
|
||||||
|
~SettingsDialog();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void submit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::SettingsDialog *ui;
|
||||||
|
ZeiterfassungSettings &m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SETTINGSDIALOG_H
|
111
dialogs/settingsdialog.ui
Normal file
111
dialogs/settingsdialog.ui
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>SettingsDialog</class>
|
||||||
|
<widget class="QDialog" name="SettingsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>647</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelTitle">
|
||||||
|
<property name="text">
|
||||||
|
<string><h1>Settings</h1></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelbuchungKommenBackgroundColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>buchungKommenBackgroundColor</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>lineEditBuchungKommenBackgroundColor</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelbuchungGehenBackgroundColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>buchungGehenBackgroundColor</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>lineEditBuchungGehenBackgroundColor</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelbuchungOtherBackgroundColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>buchungOtherBackgroundColor</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>lineEditBuchungOtherBackgroundColor</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="kontierungBackgroundColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>kontierungBackgroundColor</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>lineEditKontierungBackgroundColor</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditBuchungKommenBackgroundColor"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditBuchungGehenBackgroundColor"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditBuchungOtherBackgroundColor"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditKontierungBackgroundColor"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>SettingsDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@@ -19,6 +19,7 @@
|
|||||||
#include "dialogs/aboutmedialog.h"
|
#include "dialogs/aboutmedialog.h"
|
||||||
#include "dialogs/buchungdialog.h"
|
#include "dialogs/buchungdialog.h"
|
||||||
#include "dialogs/kontierungdialog.h"
|
#include "dialogs/kontierungdialog.h"
|
||||||
|
#include "dialogs/settingsdialog.h"
|
||||||
#include "strips/buchungstrip.h"
|
#include "strips/buchungstrip.h"
|
||||||
#include "strips/kontierungstrip.h"
|
#include "strips/kontierungstrip.h"
|
||||||
#include "models/buchungenmodel.h"
|
#include "models/buchungenmodel.h"
|
||||||
@@ -66,14 +67,16 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, Zeiterfassung &erfassung
|
|||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->actionAboutMe, &QAction::triggered, [=](){ AboutMeDialog(userInfo, this).exec(); });
|
connect(ui->actionAboutMe, &QAction::triggered, [=](){ AboutMeDialog(userInfo, this).exec(); });
|
||||||
|
connect(ui->actionSettings, &QAction::triggered, [=](){ SettingsDialog(m_settings, this).exec(); });
|
||||||
|
|
||||||
connect(ui->actionAboutQt, &QAction::triggered, [=](){ QMessageBox::aboutQt(this); });
|
connect(ui->actionAboutQt, &QAction::triggered, [=](){ QMessageBox::aboutQt(this); });
|
||||||
|
|
||||||
ui->dateEditDate->setDate(QDate::currentDate());
|
ui->dateEditDate->setDate(QDate::currentDate());
|
||||||
connect(ui->dateEditDate, &QDateTimeEdit::dateChanged, this, &MainWindow::refresh);
|
connect(ui->dateEditDate, &QDateTimeEdit::dateChanged, this, &MainWindow::refresh);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
connect(ui->pushButtonPrev, &QAbstractButton::pressed, this, &MainWindow::pushButtonPrevPressed);
|
connect(ui->pushButtonPrev, &QAbstractButton::pressed, [=](){ ui->dateEditDate->setDate(ui->dateEditDate->date().addDays(-1)); });
|
||||||
connect(ui->pushButtonNext, &QAbstractButton::pressed, this, &MainWindow::pushButtonNextPressed);
|
connect(ui->pushButtonNext, &QAbstractButton::pressed, [=](){ ui->dateEditDate->setDate(ui->dateEditDate->date().addDays(1)); });
|
||||||
|
|
||||||
ui->timeEditTime->setTime(timeNormalise(QTime::currentTime()));
|
ui->timeEditTime->setTime(timeNormalise(QTime::currentTime()));
|
||||||
|
|
||||||
@@ -671,16 +674,6 @@ void MainWindow::contextMenuKontierung(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::pushButtonPrevPressed()
|
|
||||||
{
|
|
||||||
ui->dateEditDate->setDate(ui->dateEditDate->date().addDays(-1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::pushButtonNextPressed()
|
|
||||||
{
|
|
||||||
ui->dateEditDate->setDate(ui->dateEditDate->date().addDays(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::pushButtonStartPressed()
|
void MainWindow::pushButtonStartPressed()
|
||||||
{
|
{
|
||||||
if(m_buchungenModel->rbegin() == m_buchungenModel->rend() ||
|
if(m_buchungenModel->rbegin() == m_buchungenModel->rend() ||
|
||||||
|
@@ -34,8 +34,6 @@ private Q_SLOTS:
|
|||||||
void refreshKontierungenFinished(bool success, const QString &message);
|
void refreshKontierungenFinished(bool success, const QString &message);
|
||||||
void contextMenuBuchung(const QPoint &pos);
|
void contextMenuBuchung(const QPoint &pos);
|
||||||
void contextMenuKontierung(const QPoint &pos);
|
void contextMenuKontierung(const QPoint &pos);
|
||||||
void pushButtonPrevPressed();
|
|
||||||
void pushButtonNextPressed();
|
|
||||||
void pushButtonStartPressed();
|
void pushButtonStartPressed();
|
||||||
void pushButtonEndPressed();
|
void pushButtonEndPressed();
|
||||||
|
|
||||||
|
@@ -28,7 +28,8 @@ SOURCES += main.cpp \
|
|||||||
eventloopwithstatus.cpp \
|
eventloopwithstatus.cpp \
|
||||||
strips/buchungstrip.cpp \
|
strips/buchungstrip.cpp \
|
||||||
strips/kontierungstrip.cpp \
|
strips/kontierungstrip.cpp \
|
||||||
zeiterfassungsettings.cpp
|
zeiterfassungsettings.cpp \
|
||||||
|
dialogs/settingsdialog.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
zeiterfassung.h \
|
zeiterfassung.h \
|
||||||
@@ -42,7 +43,8 @@ HEADERS += \
|
|||||||
eventloopwithstatus.h \
|
eventloopwithstatus.h \
|
||||||
strips/buchungstrip.h \
|
strips/buchungstrip.h \
|
||||||
strips/kontierungstrip.h \
|
strips/kontierungstrip.h \
|
||||||
zeiterfassungsettings.h
|
zeiterfassungsettings.h \
|
||||||
|
dialogs/settingsdialog.h
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc
|
resources.qrc
|
||||||
@@ -54,4 +56,5 @@ FORMS += \
|
|||||||
dialogs/buchungdialog.ui \
|
dialogs/buchungdialog.ui \
|
||||||
dialogs/kontierungdialog.ui \
|
dialogs/kontierungdialog.ui \
|
||||||
strips/buchungstrip.ui \
|
strips/buchungstrip.ui \
|
||||||
strips/kontierungstrip.ui
|
strips/kontierungstrip.ui \
|
||||||
|
dialogs/settingsdialog.ui
|
||||||
|
Reference in New Issue
Block a user