Files
QtZeiterfassung/plugins/weatherplugin/weatherplugin.cpp
T

37 lines
894 B
C++
Raw Permalink Normal View History

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"
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));
}