diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..54dbaee --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,38 @@ +set(HEADERS + exportdialog.h + exportplugin.h +) + +set(SOURCES + exportdialog.cpp + exportplugin.cpp +) + +set(FORMS + exportdialog.ui +) + +set(RESOURCES + exportplugin_resources.qrc +) + +set(OTHER_FILES + exportplugin.json +) + +set(TRANSLATIONS + translations/exportplugin_en.ts + translations/exportplugin_de.ts +) + +set_source_files_properties(${TRANSLATIONS} PROPERTIES OUTPUT_LOCATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations) +QT5_CREATE_TRANSLATION(TRANSLATIONS_C ${TRANSLATIONS} ${HEADERS} ${SOURCES} ${FORMS} OPTIONS -no-obsolete) +#QT5_ADD_TRANSLATION(TRANSLATIONS_C ${TRANSLATIONS}) + +add_library(zeiterfassung-plugins-exportplugin SHARED ${HEADERS} ${SOURCES} ${FORMS} ${RESOURCES} ${OTHER_FILES} ${TRANSLATIONS_C}) + +set_target_properties(zeiterfassung-plugins-exportplugin PROPERTIES OUTPUT_NAME exportplugin PREFIX "") + +target_link_libraries(zeiterfassung-plugins-exportplugin Qt5::Core Qt5::Gui Qt5::Widgets zeiterfassungguilib zeiterfassungnetworklib) + +add_dependencies(zeiterfassung-plugins zeiterfassung-plugins-exportplugin) diff --git a/exportdialog.cpp b/exportdialog.cpp new file mode 100644 index 0000000..70c2315 --- /dev/null +++ b/exportdialog.cpp @@ -0,0 +1,17 @@ +#include "exportdialog.h" +#include "ui_exportdialog.h" + +#include "mainwindow.h" + +ExportDialog::ExportDialog(MainWindow &mainWindow, QWidget *parent) : + ZeiterfassungDialog(parent), + ui(new Ui::ExportDialog), + m_mainWindow(mainWindow) +{ + ui->setupUi(this); +} + +ExportDialog::~ExportDialog() +{ + delete ui; +} diff --git a/exportdialog.h b/exportdialog.h new file mode 100644 index 0000000..07ca957 --- /dev/null +++ b/exportdialog.h @@ -0,0 +1,20 @@ +#pragma once + +#include "zeiterfassungdialog.h" + +namespace Ui { class ExportDialog; } +class MainWindow; + +class ExportDialog : public ZeiterfassungDialog +{ + Q_OBJECT + +public: + explicit ExportDialog(MainWindow &mainWindow, QWidget *parent = Q_NULLPTR); + ~ExportDialog(); + +private: + Ui::ExportDialog *ui; + + MainWindow &m_mainWindow; +}; diff --git a/exportdialog.ui b/exportdialog.ui new file mode 100644 index 0000000..d8ae0b2 --- /dev/null +++ b/exportdialog.ui @@ -0,0 +1,22 @@ + + + ExportDialog + + + + 0 + 0 + 1024 + 480 + + + + Export + + + + + + + + diff --git a/exportplugin.cpp b/exportplugin.cpp new file mode 100644 index 0000000..fa7bc9d --- /dev/null +++ b/exportplugin.cpp @@ -0,0 +1,38 @@ +#include "exportplugin.h" + +#include +#include +#include +#include +#include + +#include "utils/fileutils.h" + +#include "mainwindow.h" + +#include "exportdialog.h" + +ExportPlugin::ExportPlugin(QObject *parent) : + ZeiterfassungPlugin(parent) +{ + qDebug() << "called"; + + if(m_translator.load(QLocale(), QStringLiteral("exportplugin"), QStringLiteral("_"), translationsDir())) + { + if(!QCoreApplication::installTranslator(&m_translator)) + { + qWarning() << "could not install translation exportplugin"; + } + } + else + { + qWarning() << "could not load translation exportplugin"; + } +} + +void ExportPlugin::attachTo(MainWindow &mainWindow) +{ + auto dialog = new ExportDialog(mainWindow); + mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/exportplugin/images/export-plugin.png")), + tr("Export"), dialog, &QDialog::open); +} diff --git a/exportplugin.h b/exportplugin.h new file mode 100644 index 0000000..f70df24 --- /dev/null +++ b/exportplugin.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include + +#include "zeiterfassungplugin.h" + +class MainWindow; + +class Q_DECL_EXPORT ExportPlugin : public ZeiterfassungPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "dbsoftware.zeiterfassung.plugin/1.0" FILE "exportplugin.json") + Q_INTERFACES(ZeiterfassungPlugin) + +public: + explicit ExportPlugin(QObject *parent = Q_NULLPTR); + + // ZeiterfassungPlugin interface + void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE; + +private: + QTranslator m_translator; +}; diff --git a/exportplugin.json b/exportplugin.json new file mode 100644 index 0000000..e69de29 diff --git a/exportplugin.pro b/exportplugin.pro new file mode 100644 index 0000000..886857b --- /dev/null +++ b/exportplugin.pro @@ -0,0 +1,22 @@ +QT += core network gui widgets + +DBLIBS += dbcore zeiterfassungcore zeiterfassunggui zeiterfassungnetwork + +TARGET = exportplugin + +HEADERS += exportdialog.h \ + exportplugin.h + +SOURCES += exportdialog.cpp \ + exportplugin.cpp + +FORMS += exportdialog.ui + +RESOURCES += exportplugin_resources.qrc + +TRANSLATIONS += translations/exportplugin_en.ts \ + translations/exportplugin_de.ts + +OTHER_FILES += exportplugin.json + +include(../plugin.pri) diff --git a/exportplugin_resources.qrc b/exportplugin_resources.qrc new file mode 100644 index 0000000..3afdec1 --- /dev/null +++ b/exportplugin_resources.qrc @@ -0,0 +1,5 @@ + + + images/export-plugin.png + + diff --git a/images/export-plugin.png b/images/export-plugin.png new file mode 100755 index 0000000..3d35ba1 Binary files /dev/null and b/images/export-plugin.png differ diff --git a/translations/exportplugin_de.ts b/translations/exportplugin_de.ts new file mode 100644 index 0000000..270d267 --- /dev/null +++ b/translations/exportplugin_de.ts @@ -0,0 +1,18 @@ + + + + + ExportDialog + + Export + + + + + ExportPlugin + + Export + + + + diff --git a/translations/exportplugin_en.ts b/translations/exportplugin_en.ts new file mode 100644 index 0000000..2620668 --- /dev/null +++ b/translations/exportplugin_en.ts @@ -0,0 +1,18 @@ + + + + + ExportDialog + + Export + + + + + ExportPlugin + + Export + + + +