Files
DbZeiterfassung-sketchplugin/sketchplugin.cpp
T

45 lines
1.1 KiB
C++
Raw Normal View History

2018-09-17 19:44:16 +02:00
#include "sketchplugin.h"
#include <QDebug>
#include <QDir>
#include <QCoreApplication>
#include <QLocale>
#include <QMenu>
#include <QAction>
2018-10-14 15:35:29 +02:00
#include "utils/fileutils.h"
2018-09-17 19:44:16 +02:00
#include "mainwindow.h"
#include "sketchmainwindow.h"
SketchPlugin::SketchPlugin(QObject *parent) :
ZeiterfassungPlugin(parent)
{
qDebug() << "called";
2018-10-14 15:35:29 +02:00
if(m_translator.load(QLocale(), QStringLiteral("sketchplugin"), QStringLiteral("_"), translationsDir()))
2018-09-17 19:44:16 +02:00
{
if(!QCoreApplication::installTranslator(&m_translator))
{
qWarning() << "could not install translation sketchplugin";
}
}
else
{
qWarning() << "could not load translation sketchplugin";
}
}
void SketchPlugin::attachTo(MainWindow &mainWindow)
{
mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/sketchplugin/images/sketch.png")), tr("Open Sketch viewer"),
this, &SketchPlugin::openWindow);
}
void SketchPlugin::openWindow()
{
auto window = new SketchMainWindow;
window->setAttribute(Qt::WA_DeleteOnClose);
window->show();
}