Added profileplugin
This commit is contained in:
@@ -3,6 +3,7 @@ TEMPLATE = subdirs
|
||||
SUBDIRS += advancedviewplugin \
|
||||
devtoolsplugin \
|
||||
lunchmealplugin \
|
||||
profileplugin \
|
||||
presenceplugin \
|
||||
reportsplugin \
|
||||
updaterplugin \
|
||||
|
BIN
plugins/profileplugin/images/profile.png
Normal file
BIN
plugins/profileplugin/images/profile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
38
plugins/profileplugin/profileplugin.cpp
Normal file
38
plugins/profileplugin/profileplugin.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "profileplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
#include <QDialog>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
#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);
|
||||
}
|
24
plugins/profileplugin/profileplugin.h
Normal file
24
plugins/profileplugin/profileplugin.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#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;
|
||||
};
|
0
plugins/profileplugin/profileplugin.json
Normal file
0
plugins/profileplugin/profileplugin.json
Normal file
35
plugins/profileplugin/profileplugin.pro
Normal file
35
plugins/profileplugin/profileplugin.pro
Normal file
@@ -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)
|
5
plugins/profileplugin/profileplugin_resources.qrc
Normal file
5
plugins/profileplugin/profileplugin_resources.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/zeiterfassung/plugins/profileplugin">
|
||||
<file>images/profile.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
12
plugins/profileplugin/translations/profileplugin_de.ts
Normal file
12
plugins/profileplugin/translations/profileplugin_de.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="de_DE">
|
||||
<context>
|
||||
<name>ProfilePlugin</name>
|
||||
<message>
|
||||
<location filename="../profileplugin.cpp" line="35"/>
|
||||
<source>My profile</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
12
plugins/profileplugin/translations/profileplugin_en.ts
Normal file
12
plugins/profileplugin/translations/profileplugin_en.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>ProfilePlugin</name>
|
||||
<message>
|
||||
<location filename="../profileplugin.cpp" line="35"/>
|
||||
<source>My profile</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
Reference in New Issue
Block a user