Added view to AbsenceDialog and added translations
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
#include "absencedialog.h"
|
||||
#include "ui_absencedialog.h"
|
||||
|
||||
AbsenceDialog::AbsenceDialog(QWidget *parent) :
|
||||
#include <QDate>
|
||||
|
||||
AbsenceDialog::AbsenceDialog(const QDate &date, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AbsenceDialog)
|
||||
{
|
||||
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()
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QDate;
|
||||
|
||||
namespace Ui { class AbsenceDialog; }
|
||||
|
||||
class AbsenceDialog : public QDialog
|
||||
@@ -9,7 +11,7 @@ class AbsenceDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AbsenceDialog(QWidget *parent = 0);
|
||||
explicit AbsenceDialog(const QDate &date, QWidget *parent = 0);
|
||||
~AbsenceDialog();
|
||||
|
||||
private:
|
||||
|
@@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>AbsenceDialog</class>
|
||||
<widget class="QDialog" name="AbsenceDialog">
|
||||
<property name="geometry">
|
||||
@@ -13,26 +11,36 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Absences</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelTitle">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Absences for</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@@ -34,5 +34,5 @@ AbsencePlugin::AbsencePlugin(QObject *parent) :
|
||||
void AbsencePlugin::attachTo(MainWindow &mainWindow)
|
||||
{
|
||||
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
|
||||
|
||||
HEADERS += \
|
||||
HEADERS += absencedialog.h \
|
||||
absenceplugin.h \
|
||||
absencewidget.h \
|
||||
absencedialog.h
|
||||
absencewidget.h
|
||||
|
||||
SOURCES += \
|
||||
SOURCES += absencedialog.cpp \
|
||||
absenceplugin.cpp \
|
||||
absencewidget.cpp \
|
||||
absencedialog.cpp
|
||||
absencewidget.cpp
|
||||
|
||||
FORMS += \
|
||||
absencedialog.ui
|
||||
FORMS += absencedialog.ui
|
||||
|
||||
RESOURCES += absenceplugin_resources.qrc
|
||||
|
||||
TRANSLATIONS +=
|
||||
TRANSLATIONS += translations/absenceplugin_en.ts \
|
||||
translations/absenceplugin_de.ts
|
||||
|
||||
OTHER_FILES += absenceplugin.json
|
||||
|
||||
|
@@ -1,9 +1,12 @@
|
||||
#include "absencewidget.h"
|
||||
|
||||
#include "stripswidget.h"
|
||||
|
||||
#include "absencedialog.h"
|
||||
|
||||
AbsenceWidget::AbsenceWidget(QWidget *parent) :
|
||||
QToolButton(parent)
|
||||
AbsenceWidget::AbsenceWidget(StripsWidget &stripsWidget) :
|
||||
QToolButton(&stripsWidget),
|
||||
m_stripsWidget(stripsWidget)
|
||||
{
|
||||
setIcon(QIcon(QStringLiteral(":/zeiterfassung/plugins/absenceplugin/images/absence.png")));
|
||||
setText(tr("Absence"));
|
||||
@@ -13,6 +16,6 @@ AbsenceWidget::AbsenceWidget(QWidget *parent) :
|
||||
|
||||
void AbsenceWidget::pressedSlot()
|
||||
{
|
||||
AbsenceDialog dialog(this);
|
||||
AbsenceDialog dialog(m_stripsWidget.date(), this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
@@ -2,13 +2,18 @@
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
class StripsWidget;
|
||||
|
||||
class AbsenceWidget : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AbsenceWidget(QWidget *parent = Q_NULLPTR);
|
||||
explicit AbsenceWidget(StripsWidget &stripsWidget);
|
||||
|
||||
private Q_SLOTS:
|
||||
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