Initial commit
This commit is contained in:
38
CMakeLists.txt
Normal file
38
CMakeLists.txt
Normal file
@@ -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)
|
17
exportdialog.cpp
Normal file
17
exportdialog.cpp
Normal file
@@ -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;
|
||||||
|
}
|
20
exportdialog.h
Normal file
20
exportdialog.h
Normal file
@@ -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;
|
||||||
|
};
|
22
exportdialog.ui
Normal file
22
exportdialog.ui
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ExportDialog</class>
|
||||||
|
<widget class="QDialog" name="ExportDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1024</width>
|
||||||
|
<height>480</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Export</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
38
exportplugin.cpp
Normal file
38
exportplugin.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#include "exportplugin.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QLocale>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
24
exportplugin.h
Normal file
24
exportplugin.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTranslator>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
};
|
0
exportplugin.json
Normal file
0
exportplugin.json
Normal file
22
exportplugin.pro
Normal file
22
exportplugin.pro
Normal file
@@ -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)
|
5
exportplugin_resources.qrc
Normal file
5
exportplugin_resources.qrc
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/zeiterfassung/plugins/exportplugin">
|
||||||
|
<file>images/export-plugin.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
BIN
images/export-plugin.png
Executable file
BIN
images/export-plugin.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
18
translations/exportplugin_de.ts
Normal file
18
translations/exportplugin_de.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="de_DE">
|
||||||
|
<context>
|
||||||
|
<name>ExportDialog</name>
|
||||||
|
<message>
|
||||||
|
<source>Export</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>ExportPlugin</name>
|
||||||
|
<message>
|
||||||
|
<source>Export</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
18
translations/exportplugin_en.ts
Normal file
18
translations/exportplugin_en.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="en_US">
|
||||||
|
<context>
|
||||||
|
<name>ExportDialog</name>
|
||||||
|
<message>
|
||||||
|
<source>Export</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>ExportPlugin</name>
|
||||||
|
<message>
|
||||||
|
<source>Export</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
Reference in New Issue
Block a user