diff --git a/plugins/plugins.pro b/plugins/plugins.pro index dab007d..f035e31 100644 --- a/plugins/plugins.pro +++ b/plugins/plugins.pro @@ -3,6 +3,7 @@ TEMPLATE = subdirs SUBDIRS += advancedviewplugin \ devtoolsplugin \ lunchmealplugin \ + profileplugin \ presenceplugin \ reportsplugin \ updaterplugin \ diff --git a/plugins/profileplugin/images/profile.png b/plugins/profileplugin/images/profile.png new file mode 100644 index 0000000..e6e955f Binary files /dev/null and b/plugins/profileplugin/images/profile.png differ diff --git a/plugins/profileplugin/profileplugin.cpp b/plugins/profileplugin/profileplugin.cpp new file mode 100644 index 0000000..d3719fe --- /dev/null +++ b/plugins/profileplugin/profileplugin.cpp @@ -0,0 +1,38 @@ +#include "profileplugin.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "mainwindow.h" + +ProfilePlugin::ProfilePlugin(QObject *parent) : + ZeiterfassungPlugin(parent) +{ + qDebug() << "called"; + + static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations")); + + if(m_translator.load(QLocale(), QStringLiteral("profileplugin"), QStringLiteral("_"), dir)) + { + if(!QCoreApplication::installTranslator(&m_translator)) + { + qWarning() << "could not install translation profileplugin"; + } + } + else + { + qWarning() << "could not load translation profileplugin"; + } +} + +void ProfilePlugin::attachTo(MainWindow &mainWindow) +{ + auto dialog = new QDialog(&mainWindow); + mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/profileplugin/images/profile.png")), + tr("My profile"), dialog, &QDialog::open); +} diff --git a/plugins/profileplugin/profileplugin.h b/plugins/profileplugin/profileplugin.h new file mode 100644 index 0000000..ee1f67e --- /dev/null +++ b/plugins/profileplugin/profileplugin.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include + +#include "zeiterfassungplugin.h" + +class MainWindow; + +class Q_DECL_EXPORT ProfilePlugin : public ZeiterfassungPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "dbsoftware.zeiterfassung.plugin/1.0" FILE "profileplugin.json") + Q_INTERFACES(ZeiterfassungPlugin) + +public: + explicit ProfilePlugin(QObject *parent = Q_NULLPTR); + + // ZeiterfassungPlugin interface + void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE; + +private: + QTranslator m_translator; +}; diff --git a/plugins/profileplugin/profileplugin.json b/plugins/profileplugin/profileplugin.json new file mode 100644 index 0000000..e69de29 diff --git a/plugins/profileplugin/profileplugin.pro b/plugins/profileplugin/profileplugin.pro new file mode 100644 index 0000000..215c70b --- /dev/null +++ b/plugins/profileplugin/profileplugin.pro @@ -0,0 +1,35 @@ +QT += core network gui widgets + +TARGET = profileplugin +TEMPLATE = lib + +CONFIG += shared c++14 + +DESTDIR = $${OUT_PWD}/../../bin/plugins/zeiterfassung + +LIBS += -L$$OUT_PWD/../../lib -lzeiterfassungcorelib -lzeiterfassungguilib + +INCLUDEPATH += $$PWD/../../zeiterfassungcorelib $$PWD/../../zeiterfassungguilib +DEPENDPATH += $$PWD/../../zeiterfassungcorelib $$PWD/../../zeiterfassungguilib + +DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT + +HEADERS += profileplugin.h + +SOURCES += profileplugin.cpp + +FORMS += + +RESOURCES += profileplugin_resources.qrc + +TRANSLATIONS += translations/profileplugin_en.ts \ + translations/profileplugin_de.ts + +OTHER_FILES += profileplugin.json + +include(../../lrelease.pri) + +COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/profileplugin_en.qm \ + $${OUT_PWD}/translations/profileplugin_de.qm + +include(../copy_translations.pri) diff --git a/plugins/profileplugin/profileplugin_resources.qrc b/plugins/profileplugin/profileplugin_resources.qrc new file mode 100644 index 0000000..d1346b0 --- /dev/null +++ b/plugins/profileplugin/profileplugin_resources.qrc @@ -0,0 +1,5 @@ + + + images/profile.png + + diff --git a/plugins/profileplugin/translations/profileplugin_de.ts b/plugins/profileplugin/translations/profileplugin_de.ts new file mode 100644 index 0000000..0d7005a --- /dev/null +++ b/plugins/profileplugin/translations/profileplugin_de.ts @@ -0,0 +1,12 @@ + + + + + ProfilePlugin + + + My profile + + + + diff --git a/plugins/profileplugin/translations/profileplugin_en.ts b/plugins/profileplugin/translations/profileplugin_en.ts new file mode 100644 index 0000000..d73e0c8 --- /dev/null +++ b/plugins/profileplugin/translations/profileplugin_en.ts @@ -0,0 +1,12 @@ + + + + + ProfilePlugin + + + My profile + + + +