45 lines
1.1 KiB
C++
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();
|
|
}
|