Absence plugin #54
@@ -1,11 +1,21 @@
|
|||||||
#include "absencedialog.h"
|
#include "absencedialog.h"
|
||||||
#include "ui_absencedialog.h"
|
#include "ui_absencedialog.h"
|
||||||
|
|
||||||
AbsenceDialog::AbsenceDialog(QWidget *parent) :
|
#include <QDate>
|
||||||
|
|
||||||
|
AbsenceDialog::AbsenceDialog(const QDate &date, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AbsenceDialog)
|
ui(new Ui::AbsenceDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
|
||||||
|
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||||
|
#else
|
||||||
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ui->labelTitle->setText(tr("Absences for %0").arg(date.toString(tr("dd.MM.yyyy"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
AbsenceDialog::~AbsenceDialog()
|
AbsenceDialog::~AbsenceDialog()
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
class QDate;
|
||||||
|
|
||||||
namespace Ui { class AbsenceDialog; }
|
namespace Ui { class AbsenceDialog; }
|
||||||
|
|
||||||
class AbsenceDialog : public QDialog
|
class AbsenceDialog : public QDialog
|
||||||
@@ -9,7 +11,7 @@ class AbsenceDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AbsenceDialog(QWidget *parent = 0);
|
explicit AbsenceDialog(const QDate &date, QWidget *parent = 0);
|
||||||
~AbsenceDialog();
|
~AbsenceDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<author/>
|
|
||||||
<comment/>
|
|
||||||
<exportmacro/>
|
|
||||||
<class>AbsenceDialog</class>
|
<class>AbsenceDialog</class>
|
||||||
<widget class="QDialog" name="AbsenceDialog">
|
<widget class="QDialog" name="AbsenceDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@@ -13,26 +11,36 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Absences</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QLabel" name="labelTitle">
|
||||||
<x>30</x>
|
<property name="font">
|
||||||
<y>240</y>
|
<font>
|
||||||
<width>341</width>
|
<pointsize>16</pointsize>
|
||||||
<height>32</height>
|
</font>
|
||||||
</rect>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="orientation">
|
<string notr="true">Absences for</string>
|
||||||
<enum>Qt::Horizontal</enum>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="standardButtons">
|
</item>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<item>
|
||||||
</property>
|
<widget class="QTreeView" name="treeView"/>
|
||||||
</widget>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<pixmapfunction/>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@@ -34,5 +34,5 @@ AbsencePlugin::AbsencePlugin(QObject *parent) :
|
|||||||
void AbsencePlugin::attachTo(MainWindow &mainWindow)
|
void AbsencePlugin::attachTo(MainWindow &mainWindow)
|
||||||
{
|
{
|
||||||
for(auto stripsWidget : mainWindow.stripsWidgets())
|
for(auto stripsWidget : mainWindow.stripsWidgets())
|
||||||
stripsWidget->headerLayout()->addWidget(new AbsenceWidget(stripsWidget));
|
stripsWidget->headerLayout()->addWidget(new AbsenceWidget(*stripsWidget));
|
||||||
}
|
}
|
||||||
|
@@ -16,22 +16,20 @@ DEPENDPATH += $$PWD/$${PROJECT_ROOT}/zeiterfassungcorelib $$PWD/$${PROJECT_ROOT}
|
|||||||
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT
|
DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += absencedialog.h \
|
||||||
absenceplugin.h \
|
absenceplugin.h \
|
||||||
absencewidget.h \
|
absencewidget.h
|
||||||
absencedialog.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += absencedialog.cpp \
|
||||||
absenceplugin.cpp \
|
absenceplugin.cpp \
|
||||||
absencewidget.cpp \
|
absencewidget.cpp
|
||||||
absencedialog.cpp
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += absencedialog.ui
|
||||||
absencedialog.ui
|
|
||||||
|
|
||||||
RESOURCES += absenceplugin_resources.qrc
|
RESOURCES += absenceplugin_resources.qrc
|
||||||
|
|
||||||
TRANSLATIONS +=
|
TRANSLATIONS += translations/absenceplugin_en.ts \
|
||||||
|
translations/absenceplugin_de.ts
|
||||||
|
|
||||||
OTHER_FILES += absenceplugin.json
|
OTHER_FILES += absenceplugin.json
|
||||||
|
|
||||||
|
@@ -1,9 +1,12 @@
|
|||||||
#include "absencewidget.h"
|
#include "absencewidget.h"
|
||||||
|
|
||||||
|
#include "stripswidget.h"
|
||||||
|
|
||||||
#include "absencedialog.h"
|
#include "absencedialog.h"
|
||||||
|
|
||||||
AbsenceWidget::AbsenceWidget(QWidget *parent) :
|
AbsenceWidget::AbsenceWidget(StripsWidget &stripsWidget) :
|
||||||
QToolButton(parent)
|
QToolButton(&stripsWidget),
|
||||||
|
m_stripsWidget(stripsWidget)
|
||||||
{
|
{
|
||||||
setIcon(QIcon(QStringLiteral(":/zeiterfassung/plugins/absenceplugin/images/absence.png")));
|
setIcon(QIcon(QStringLiteral(":/zeiterfassung/plugins/absenceplugin/images/absence.png")));
|
||||||
setText(tr("Absence"));
|
setText(tr("Absence"));
|
||||||
@@ -13,6 +16,6 @@ AbsenceWidget::AbsenceWidget(QWidget *parent) :
|
|||||||
|
|
||||||
void AbsenceWidget::pressedSlot()
|
void AbsenceWidget::pressedSlot()
|
||||||
{
|
{
|
||||||
AbsenceDialog dialog(this);
|
AbsenceDialog dialog(m_stripsWidget.date(), this);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
@@ -2,13 +2,18 @@
|
|||||||
|
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
|
class StripsWidget;
|
||||||
|
|
||||||
class AbsenceWidget : public QToolButton
|
class AbsenceWidget : public QToolButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AbsenceWidget(QWidget *parent = Q_NULLPTR);
|
explicit AbsenceWidget(StripsWidget &stripsWidget);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void pressedSlot();
|
void pressedSlot();
|
||||||
|
|
||||||
|
private:
|
||||||
|
StripsWidget &m_stripsWidget;
|
||||||
};
|
};
|
||||||
|
30
plugins/absenceplugin/translations/absenceplugin_de.ts
Normal file
30
plugins/absenceplugin/translations/absenceplugin_de.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="de_DE">
|
||||||
|
<context>
|
||||||
|
<name>AbsenceDialog</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencedialog.ui" line="14"/>
|
||||||
|
<source>Absences</source>
|
||||||
|
<translation>Abwesenheiten</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencedialog.cpp" line="18"/>
|
||||||
|
<source>Absences for %0</source>
|
||||||
|
<translation>Abwesenheiten für %0</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencedialog.cpp" line="18"/>
|
||||||
|
<source>dd.MM.yyyy</source>
|
||||||
|
<translation>dd.MM.yyyy</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>AbsenceWidget</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencewidget.cpp" line="12"/>
|
||||||
|
<source>Absence</source>
|
||||||
|
<translation>Abwesenheit</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
30
plugins/absenceplugin/translations/absenceplugin_en.ts
Normal file
30
plugins/absenceplugin/translations/absenceplugin_en.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="en_US">
|
||||||
|
<context>
|
||||||
|
<name>AbsenceDialog</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencedialog.ui" line="14"/>
|
||||||
|
<source>Absences</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencedialog.cpp" line="18"/>
|
||||||
|
<source>Absences for %0</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencedialog.cpp" line="18"/>
|
||||||
|
<source>dd.MM.yyyy</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>AbsenceWidget</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../absencewidget.cpp" line="12"/>
|
||||||
|
<source>Absence</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
Reference in New Issue
Block a user