Imported existing sources

This commit is contained in:
0xFEEDC0DE64
2018-09-17 19:44:16 +02:00
parent e23f87fd89
commit 30fad70d72
11 changed files with 286 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
#include "sketchplugin.h"
#include <QDebug>
#include <QDir>
#include <QCoreApplication>
#include <QLocale>
#include <QMenu>
#include <QAction>
#include "mainwindow.h"
#include "sketchmainwindow.h"
SketchPlugin::SketchPlugin(QObject *parent) :
ZeiterfassungPlugin(parent)
{
qDebug() << "called";
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
if(m_translator.load(QLocale(), QStringLiteral("sketchplugin"), QStringLiteral("_"), dir))
{
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();
}