2017-12-15 20:04:31 +01:00
|
|
|
#include "lunchmealplugin.h"
|
|
|
|
|
|
2017-12-15 20:28:25 +01:00
|
|
|
#include <QDebug>
|
2017-12-19 23:54:58 +01:00
|
|
|
#include <QDir>
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QLocale>
|
2017-12-19 18:52:48 +01:00
|
|
|
#include <QBoxLayout>
|
|
|
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "stripswidget.h"
|
|
|
|
|
|
|
|
|
|
#include "lunchmealwidget.h"
|
2018-03-11 15:35:29 +01:00
|
|
|
#include "lunchmealsettingswidget.h"
|
2017-12-15 20:28:25 +01:00
|
|
|
|
|
|
|
|
LunchMealPlugin::LunchMealPlugin(QObject *parent) :
|
|
|
|
|
ZeiterfassungPlugin(parent)
|
2017-12-15 20:04:31 +01:00
|
|
|
{
|
2017-12-18 22:18:24 +01:00
|
|
|
qDebug() << "called";
|
2017-12-19 23:54:58 +01:00
|
|
|
|
|
|
|
|
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
|
|
|
|
|
|
|
|
|
if(m_translator.load(QLocale(), QStringLiteral("lunchmealplugin"), QStringLiteral("_"), dir))
|
|
|
|
|
{
|
|
|
|
|
if(!QCoreApplication::installTranslator(&m_translator))
|
|
|
|
|
{
|
|
|
|
|
qWarning() << "could not install translation lunchmealplugin";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
qWarning() << "could not load translation lunchmealplugin";
|
|
|
|
|
}
|
2017-12-15 20:04:31 +01:00
|
|
|
}
|
2017-12-19 18:52:48 +01:00
|
|
|
|
|
|
|
|
void LunchMealPlugin::attachTo(MainWindow &mainWindow)
|
|
|
|
|
{
|
|
|
|
|
for(auto stripsWidget : mainWindow.stripsWidgets())
|
|
|
|
|
stripsWidget->headerLayout()->addWidget(new LunchMealWidget(*stripsWidget));
|
|
|
|
|
}
|
2018-03-11 15:35:29 +01:00
|
|
|
|
|
|
|
|
SettingsWidget *LunchMealPlugin::settingsWidget(ZeiterfassungSettings &settings, QWidget *parent) const
|
|
|
|
|
{
|
|
|
|
|
return new LunchMealSettingsWidget(settings, parent);
|
|
|
|
|
}
|