2017-12-28 11:49:42 +01:00
|
|
|
#include "absenceplugin.h"
|
|
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QLocale>
|
2017-12-28 14:31:41 +01:00
|
|
|
#include <QBoxLayout>
|
|
|
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "stripswidget.h"
|
|
|
|
|
|
|
|
|
|
#include "absencewidget.h"
|
2017-12-28 11:49:42 +01:00
|
|
|
|
|
|
|
|
AbsencePlugin::AbsencePlugin(QObject *parent) :
|
|
|
|
|
ZeiterfassungPlugin(parent)
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "called";
|
|
|
|
|
|
|
|
|
|
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
|
|
|
|
|
|
|
|
|
if(m_translator.load(QLocale(), QStringLiteral("absenceplugin"), QStringLiteral("_"), dir))
|
|
|
|
|
{
|
|
|
|
|
if(!QCoreApplication::installTranslator(&m_translator))
|
|
|
|
|
{
|
|
|
|
|
qWarning() << "could not install translation absenceplugin";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
qWarning() << "could not load translation absenceplugin";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AbsencePlugin::attachTo(MainWindow &mainWindow)
|
|
|
|
|
{
|
2017-12-28 14:31:41 +01:00
|
|
|
for(auto stripsWidget : mainWindow.stripsWidgets())
|
2017-12-28 17:38:36 +01:00
|
|
|
stripsWidget->headerLayout()->addWidget(new AbsenceWidget(*stripsWidget));
|
2017-12-28 11:49:42 +01:00
|
|
|
}
|