2017-12-15 20:04:31 +01:00
|
|
|
#include "weatherplugin.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 21:34:44 +01:00
|
|
|
#include <QStatusBar>
|
|
|
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
|
|
#include "weatherwidget.h"
|
2018-03-11 14:46:34 +01:00
|
|
|
#include "weathersettingswidget.h"
|
2017-12-15 20:28:25 +01:00
|
|
|
|
|
|
|
|
WeatherPlugin::WeatherPlugin(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("weatherplugin"), QStringLiteral("_"), dir))
|
|
|
|
|
{
|
|
|
|
|
if(!QCoreApplication::installTranslator(&m_translator))
|
|
|
|
|
{
|
|
|
|
|
qWarning() << "could not install translation weatherplugin";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
qWarning() << "could not load translation weatherplugin";
|
|
|
|
|
}
|
2017-12-15 20:04:31 +01:00
|
|
|
}
|
2017-12-19 21:34:44 +01:00
|
|
|
|
|
|
|
|
void WeatherPlugin::attachTo(MainWindow &mainWindow)
|
|
|
|
|
{
|
|
|
|
|
mainWindow.statusBar()->addWidget(new WeatherWidget(mainWindow));
|
|
|
|
|
}
|
2018-03-11 13:39:38 +01:00
|
|
|
|
2018-03-11 14:32:02 +01:00
|
|
|
SettingsWidget *WeatherPlugin::settingsWidget(ZeiterfassungSettings &settings, QWidget *parent) const
|
2018-03-11 13:39:38 +01:00
|
|
|
{
|
2018-03-11 14:46:34 +01:00
|
|
|
return new WeatherSettingsWidget(settings, parent);
|
2018-03-11 13:39:38 +01:00
|
|
|
}
|