Imported existing sources

This commit is contained in:
0xFEEDC0DE64
2018-09-17 19:43:21 +02:00
parent 6cac15ff54
commit c1f1b884ff
11 changed files with 718 additions and 0 deletions

BIN
images/profile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

32
profiledialog.cpp Normal file
View File

@@ -0,0 +1,32 @@
#include "profiledialog.h"
#include "ui_profiledialog.h"
ProfileDialog::ProfileDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent) :
ZeiterfassungDialog(parent),
ui(new Ui::ProfileDialog)
{
ui->setupUi(this);
ui->spinBoxUserId->setValue(userInfo.userId);
ui->lineEditEmail->setText(userInfo.email);
ui->lineEditLongUsername->setText(userInfo.longUsername);
ui->lineEditText->setText(userInfo.text);
ui->lineEditUsername->setText(userInfo.username);
ui->lineEditStreet->setText(userInfo.street);
ui->lineEditCity->setText(userInfo.city);
ui->dateEditEmployedSince->setDate(userInfo.employedSince);
ui->dateEditEmployedTill->setDate(userInfo.employedTill);
ui->lineEditPlaceOfBirth->setText(userInfo.placeOfBirth);
ui->lineEditZipcode->setText(userInfo.zipcode);
ui->lineEditReligion->setText(userInfo.religion);
ui->lineEditDepartment->setText(userInfo.department);
ui->lineEditVerwendgr->setText(userInfo.verwendgr);
ui->lineEditTaetig->setText(userInfo.taetig);
ui->lineEditArbverh->setText(userInfo.arbverh);
ui->lineEditBetriebsnr->setText(userInfo.betriebsnr);
}
ProfileDialog::~ProfileDialog()
{
delete ui;
}

18
profiledialog.h Normal file
View File

@@ -0,0 +1,18 @@
#pragma once
#include "zeiterfassungdialog.h"
#include "replies/getuserinforeply.h"
namespace Ui { class ProfileDialog; }
class ProfileDialog : public ZeiterfassungDialog
{
Q_OBJECT
public:
explicit ProfileDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent = Q_NULLPTR);
~ProfileDialog();
private:
Ui::ProfileDialog *ui;
};

356
profiledialog.ui Normal file
View File

@@ -0,0 +1,356 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProfileDialog</class>
<widget class="QDialog" name="ProfileDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>454</width>
<height>281</height>
</rect>
</property>
<property name="windowTitle">
<string>Profile</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>610</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelUserId">
<property name="text">
<string>User-ID:</string>
</property>
<property name="buddy">
<cstring>spinBoxUserId</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelEmail">
<property name="text">
<string>E-Mail:</string>
</property>
<property name="buddy">
<cstring>lineEditEmail</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelLongUsername">
<property name="text">
<string>Long username:</string>
</property>
<property name="buddy">
<cstring>lineEditLongUsername</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelText">
<property name="text">
<string>Text:</string>
</property>
<property name="buddy">
<cstring>lineEditText</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelUsername">
<property name="text">
<string>Username:</string>
</property>
<property name="buddy">
<cstring>lineEditUsername</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBoxUserId">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="maximum">
<number>16777215</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditEmail">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditLongUsername">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditText">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEditUsername">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelStreet">
<property name="text">
<string>Street:</string>
</property>
<property name="buddy">
<cstring>lineEditStreet</cstring>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelCity">
<property name="text">
<string>City:</string>
</property>
<property name="buddy">
<cstring>lineEditCity</cstring>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelEmployedSince">
<property name="text">
<string>Employed since:</string>
</property>
<property name="buddy">
<cstring>dateEditEmployedSince</cstring>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="labelEmployedTill">
<property name="text">
<string>Employed till:</string>
</property>
<property name="buddy">
<cstring>dateEditEmployedTill</cstring>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="labelPlaceOfBirth">
<property name="text">
<string>Place of birth:</string>
</property>
<property name="buddy">
<cstring>lineEditPlaceOfBirth</cstring>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="labelZipcode">
<property name="text">
<string>Zipcode:</string>
</property>
<property name="buddy">
<cstring>lineEditZipcode</cstring>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="labelReligion">
<property name="text">
<string>Religion:</string>
</property>
<property name="buddy">
<cstring>lineEditReligion</cstring>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="labelDepartment">
<property name="text">
<string>Department:</string>
</property>
<property name="buddy">
<cstring>lineEditDepartment</cstring>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="labelVerwendgr">
<property name="text">
<string>Verwendgr:</string>
</property>
<property name="buddy">
<cstring>lineEditVerwendgr</cstring>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="labelTaetig">
<property name="text">
<string>Taetig:</string>
</property>
<property name="buddy">
<cstring>lineEditTaetig</cstring>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="labelArbverh">
<property name="text">
<string>Arbverh:</string>
</property>
<property name="buddy">
<cstring>lineEditArbverh</cstring>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="labelBetriebsnr">
<property name="text">
<string>Betriebsnr:</string>
</property>
<property name="buddy">
<cstring>lineEditBetriebsnr</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditStreet">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEditCity">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="lineEditPlaceOfBirth">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="lineEditZipcode">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="lineEditReligion">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLineEdit" name="lineEditDepartment">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLineEdit" name="lineEditVerwendgr">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLineEdit" name="lineEditTaetig">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QLineEdit" name="lineEditArbverh">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="16" column="1">
<widget class="QLineEdit" name="lineEditBetriebsnr">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QDateEdit" name="dateEditEmployedSince">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QDateEdit" name="dateEditEmployedTill">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ProfileDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>226</x>
<y>5</y>
</hint>
<hint type="destinationlabel">
<x>226</x>
<y>0</y>
</hint>
</hints>
</connection>
</connections>
</ui>

39
profileplugin.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include "profileplugin.h"
#include <QDebug>
#include <QDir>
#include <QCoreApplication>
#include <QLocale>
#include <QMenu>
#include <QAction>
#include "mainwindow.h"
#include "profiledialog.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 ProfileDialog(mainWindow.userInfo(), &mainWindow);
mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/profileplugin/images/profile.png")),
tr("My profile"), dialog, &QDialog::open);
}

24
profileplugin.h Normal file
View 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
profileplugin.json Normal file
View File

22
profileplugin.pro Normal file
View File

@@ -0,0 +1,22 @@
QT += core network gui widgets
DBLIBS += zeiterfassungcore zeiterfassunggui
TARGET = profileplugin
HEADERS += profiledialog.h \
profileplugin.h
SOURCES += profiledialog.cpp \
profileplugin.cpp
FORMS += profiledialog.ui
RESOURCES += profileplugin_resources.qrc
TRANSLATIONS += translations/profileplugin_en.ts \
translations/profileplugin_de.ts
OTHER_FILES += profileplugin.json
include(../plugin.pri)

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/zeiterfassung/plugins/profileplugin">
<file>images/profile.png</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
<name>ProfileDialog</name>
<message>
<location filename="../profiledialog.ui" line="14"/>
<source>Profile</source>
<translation>Profil</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="35"/>
<source>User-ID:</source>
<translation>Benutzer-ID:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="45"/>
<source>E-Mail:</source>
<translation>E-Mail:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="55"/>
<source>Long username:</source>
<translation>Langer Benutzername:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="65"/>
<source>Text:</source>
<translation>Text:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="75"/>
<source>Username:</source>
<translation>Benutzername:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="123"/>
<source>Street:</source>
<translation>Straße:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="130"/>
<source>City:</source>
<translation>Stadt:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="137"/>
<source>Employed since:</source>
<translation>Angestellt seit:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="144"/>
<source>Employed till:</source>
<translation>Angestellt bis:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="151"/>
<source>Place of birth:</source>
<translation>Geburtsort:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="158"/>
<source>Zipcode:</source>
<translation>Postleitzahl:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="165"/>
<source>Religion:</source>
<translation>Religion:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="172"/>
<source>Department:</source>
<translation>Abteilung:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="179"/>
<source>Verwendgr:</source>
<translation>Verwendgr:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="186"/>
<source>Taetig:</source>
<translation>Taetig:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="193"/>
<source>Arbverh:</source>
<translation>Arbverh:</translation>
</message>
<message>
<location filename="../profiledialog.ui" line="200"/>
<source>Betriebsnr:</source>
<translation>Betriebsnr:</translation>
</message>
<message>
<location filename="../profiledialog.cpp" line="17"/>
<location filename="../profiledialog.cpp" line="18"/>
<source>dd.MM.yyyy</source>
<translation>dd.MM.yyyy</translation>
</message>
</context>
<context>
<name>ProfilePlugin</name>
<message>
<location filename="../profileplugin.cpp" line="38"/>
<source>My profile</source>
<translation>Mein Profil</translation>
</message>
</context>
</TS>

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>ProfileDialog</name>
<message>
<location filename="../profiledialog.ui" line="14"/>
<source>Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="35"/>
<source>User-ID:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="45"/>
<source>E-Mail:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="55"/>
<source>Long username:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="65"/>
<source>Text:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="75"/>
<source>Username:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="123"/>
<source>Street:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="130"/>
<source>City:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="137"/>
<source>Employed since:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="144"/>
<source>Employed till:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="151"/>
<source>Place of birth:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="158"/>
<source>Zipcode:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="165"/>
<source>Religion:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="172"/>
<source>Department:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="179"/>
<source>Verwendgr:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="186"/>
<source>Taetig:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="193"/>
<source>Arbverh:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.ui" line="200"/>
<source>Betriebsnr:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../profiledialog.cpp" line="17"/>
<location filename="../profiledialog.cpp" line="18"/>
<source>dd.MM.yyyy</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProfilePlugin</name>
<message>
<location filename="../profileplugin.cpp" line="38"/>
<source>My profile</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>