Files
DbZeiterfassung-sketchplugin/sketchplugin.cpp
2018-10-14 15:35:29 +02:00

45 lines
1.1 KiB
C++

#include "sketchplugin.h"
#include <QDebug>
#include <QDir>
#include <QCoreApplication>
#include <QLocale>
#include <QMenu>
#include <QAction>
#include "utils/fileutils.h"
#include "mainwindow.h"
#include "sketchmainwindow.h"
SketchPlugin::SketchPlugin(QObject *parent) :
ZeiterfassungPlugin(parent)
{
qDebug() << "called";
if(m_translator.load(QLocale(), QStringLiteral("sketchplugin"), QStringLiteral("_"), translationsDir()))
{
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();
}