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/zeiterfassungguilib/dialogs/aboutmedialog.cpp b/plugins/profileplugin/profiledialog.cpp similarity index 85% rename from zeiterfassungguilib/dialogs/aboutmedialog.cpp rename to plugins/profileplugin/profiledialog.cpp index 473c1ac..1a52589 100644 --- a/zeiterfassungguilib/dialogs/aboutmedialog.cpp +++ b/plugins/profileplugin/profiledialog.cpp @@ -1,9 +1,9 @@ -#include "aboutmedialog.h" -#include "ui_aboutmedialog.h" +#include "profiledialog.h" +#include "ui_profiledialog.h" -AboutMeDialog::AboutMeDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent) : +ProfileDialog::ProfileDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent) : QDialog(parent), - ui(new Ui::AboutMeDialog) + ui(new Ui::ProfileDialog) { ui->setupUi(this); @@ -26,7 +26,7 @@ AboutMeDialog::AboutMeDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget ui->lineEditBetriebsnr->setText(userInfo.betriebsnr); } -AboutMeDialog::~AboutMeDialog() +ProfileDialog::~ProfileDialog() { delete ui; } diff --git a/plugins/profileplugin/profiledialog.h b/plugins/profileplugin/profiledialog.h new file mode 100644 index 0000000..b2abd1c --- /dev/null +++ b/plugins/profileplugin/profiledialog.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +#include "zeiterfassungguilib_global.h" +#include "replies/getuserinforeply.h" + +namespace Ui { class ProfileDialog; } + +class ZEITERFASSUNGGUILIBSHARED_EXPORT ProfileDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ProfileDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent = Q_NULLPTR); + ~ProfileDialog(); + +private: + Ui::ProfileDialog *ui; +}; diff --git a/zeiterfassungguilib/dialogs/aboutmedialog.ui b/plugins/profileplugin/profiledialog.ui similarity index 95% rename from zeiterfassungguilib/dialogs/aboutmedialog.ui rename to plugins/profileplugin/profiledialog.ui index d6f99d9..3ce9181 100644 --- a/zeiterfassungguilib/dialogs/aboutmedialog.ui +++ b/plugins/profileplugin/profiledialog.ui @@ -1,7 +1,7 @@ - AboutMeDialog - + ProfileDialog + 0 @@ -11,21 +11,9 @@ - About me + Profile - - - - - 20 - - - - About me - - - @@ -315,7 +303,7 @@ buttonBox rejected() - AboutMeDialog + ProfileDialog close() diff --git a/plugins/profileplugin/profileplugin.cpp b/plugins/profileplugin/profileplugin.cpp new file mode 100644 index 0000000..1dc949d --- /dev/null +++ b/plugins/profileplugin/profileplugin.cpp @@ -0,0 +1,39 @@ +#include "profileplugin.h" + +#include +#include +#include +#include +#include +#include + +#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); +} 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..d299e48 --- /dev/null +++ b/plugins/profileplugin/profileplugin.pro @@ -0,0 +1,37 @@ +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 += 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(../../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..e8cb231 --- /dev/null +++ b/plugins/profileplugin/translations/profileplugin_de.ts @@ -0,0 +1,111 @@ + + + + + ProfileDialog + + + Profile + Profil + + + + User-ID: + Benutzer-ID: + + + + E-Mail: + E-Mail: + + + + Long username: + Langer Benutzername: + + + + Text: + Text: + + + + Username: + Benutzername: + + + + Street: + Straße: + + + + City: + Stadt: + + + + Employed since: + Angestellt seit: + + + + Employed till: + Angestellt bis: + + + + Place of birth: + Geburtsort: + + + + Zipcode: + Postleitzahl: + + + + Religion: + Religion: + + + + Department: + Abteilung: + + + + Verwendgr: + Verwendgr: + + + + Taetig: + Taetig: + + + + Arbverh: + Arbverh: + + + + Betriebsnr: + Betriebsnr: + + + + + dd.MM.yyyy + dd.MM.yyyy + + + + ProfilePlugin + + + My profile + Mein Profil + + + diff --git a/plugins/profileplugin/translations/profileplugin_en.ts b/plugins/profileplugin/translations/profileplugin_en.ts new file mode 100644 index 0000000..d6f19e1 --- /dev/null +++ b/plugins/profileplugin/translations/profileplugin_en.ts @@ -0,0 +1,111 @@ + + + + + ProfileDialog + + + Profile + + + + + User-ID: + + + + + E-Mail: + + + + + Long username: + + + + + Text: + + + + + Username: + + + + + Street: + + + + + City: + + + + + Employed since: + + + + + Employed till: + + + + + Place of birth: + + + + + Zipcode: + + + + + Religion: + + + + + Department: + + + + + Verwendgr: + + + + + Taetig: + + + + + Arbverh: + + + + + Betriebsnr: + + + + + + dd.MM.yyyy + + + + + ProfilePlugin + + + My profile + + + + diff --git a/zeiterfassungguilib/dialogs/aboutmedialog.h b/zeiterfassungguilib/dialogs/aboutmedialog.h deleted file mode 100644 index 769226b..0000000 --- a/zeiterfassungguilib/dialogs/aboutmedialog.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -#include "zeiterfassungguilib_global.h" -#include "replies/getuserinforeply.h" - -namespace Ui { class AboutMeDialog; } - -class ZEITERFASSUNGGUILIBSHARED_EXPORT AboutMeDialog : public QDialog -{ - Q_OBJECT - -public: - explicit AboutMeDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent = Q_NULLPTR); - ~AboutMeDialog(); - -private: - Ui::AboutMeDialog *ui; -}; diff --git a/zeiterfassungguilib/mainwindow.cpp b/zeiterfassungguilib/mainwindow.cpp index 2a35266..845ea44 100644 --- a/zeiterfassungguilib/mainwindow.cpp +++ b/zeiterfassungguilib/mainwindow.cpp @@ -19,7 +19,6 @@ #include "zeiterfassungsettings.h" #include "stripfactory.h" #include "stripswidget.h" -#include "dialogs/aboutmedialog.h" #include "dialogs/settingsdialog.h" #include "replies/getprojectsreply.h" #include "replies/createbookingreply.h" @@ -47,7 +46,6 @@ MainWindow::MainWindow(ZeiterfassungSettings &settings, ZeiterfassungApi &erfass ui->actionRefresh->setShortcut(QKeySequence::Refresh); connect(ui->actionRefresh, &QAction::triggered, this, &MainWindow::refreshEverything); - connect(ui->actionAboutMe, &QAction::triggered, [=](){ AboutMeDialog(userInfo, this).exec(); }); connect(ui->actionSettings, &QAction::triggered, [=](){ SettingsDialog(m_settings, this).exec(); }); ui->actionHelp->setShortcut(QKeySequence::HelpContents); diff --git a/zeiterfassungguilib/mainwindow.ui b/zeiterfassungguilib/mainwindow.ui index 5735f18..c96c07d 100644 --- a/zeiterfassungguilib/mainwindow.ui +++ b/zeiterfassungguilib/mainwindow.ui @@ -211,7 +211,6 @@ &About - diff --git a/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts b/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts index d66d22a..626b154 100644 --- a/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts +++ b/zeiterfassungguilib/translations/zeiterfassungguilib_de.ts @@ -1,106 +1,6 @@ - - AboutMeDialog - - - - About me - Über mich - - - - User-ID: - Benutzer-ID: - - - - E-Mail: - E-Mail: - - - - Long username: - Langer Benutzername: - - - - Text: - Text: - - - - Username: - Benutzername: - - - - Street: - Straße: - - - - City: - Stadt: - - - - Employed since: - Angestellt seit: - - - - Employed till: - Angestellt bis: - - - - Place of birth: - Geburtsort: - - - - Zipcode: - Postleitzahl: - - - - Religion: - Religion: - - - - Department: - Abteilung: - - - - Verwendgr: - Verwendgr: - - - - Taetig: - Taetig: - - - - Arbverh: - Arbverh: - - - - Betriebsnr: - Betriebsnr: - - - - - dd.MM.yyyy - dd.MM.yyyy - - AuthenticationDialog @@ -168,8 +68,8 @@ - - + + Start Kommen @@ -189,107 +89,107 @@ &Über - + &View &Ansicht - + &Tools &Werkzeuge - + &Quit &Beenden - + About &Me Über &mich - + About &zeiterfassung Über &zeiterfassung - + About &Qt Über &Qt - + &Today &Heute - + &Refresh everything Alles &neu laden - + &Settings &Einstellungen - + Help Hilfe - + Zeiterfassung - %0 (%1) Zeiterfassung - %0 (%1) - + Subproject Subprojekt - + Workpackage Arbeitspaket - + Text Text - - + + Could not load bookings! Konnte Buchungen nicht laden! - - + + Could not create booking! Konnte Buchung nicht erstellen! - - + + Could not edit time assignment! Konnte Kontierung nicht bearbeiten! - - + + %0 (%1) %0 (%1) - + Could not create time assignment! Konnte Kontierung nicht erstellen! - - + + Switch Wechseln diff --git a/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts b/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts index 8c38655..b96835a 100644 --- a/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts +++ b/zeiterfassungguilib/translations/zeiterfassungguilib_en.ts @@ -1,106 +1,6 @@ - - AboutMeDialog - - - - About me - - - - - User-ID: - - - - - E-Mail: - - - - - Long username: - - - - - Text: - - - - - Username: - - - - - Street: - - - - - City: - - - - - Employed since: - - - - - Employed till: - - - - - Place of birth: - - - - - Zipcode: - - - - - Religion: - - - - - Department: - - - - - Verwendgr: - - - - - Taetig: - - - - - Arbverh: - - - - - Betriebsnr: - - - - - - dd.MM.yyyy - - - AuthenticationDialog @@ -168,8 +68,8 @@ - - + + Start @@ -189,107 +89,107 @@ - + &View - + &Tools - + &Quit - + About &Me - + About &zeiterfassung - + About &Qt - + &Today - + &Refresh everything - + &Settings - + Help - + Zeiterfassung - %0 (%1) - + Subproject - + Workpackage - + Text - - + + Could not load bookings! - - + + Could not create booking! - + Could not create time assignment! - - + + Could not edit time assignment! - - + + Switch - - + + %0 (%1) diff --git a/zeiterfassungguilib/zeiterfassungguilib.pro b/zeiterfassungguilib/zeiterfassungguilib.pro index 0f252db..2936ed3 100644 --- a/zeiterfassungguilib/zeiterfassungguilib.pro +++ b/zeiterfassungguilib/zeiterfassungguilib.pro @@ -19,7 +19,6 @@ SOURCES += mainwindow.cpp \ stripfactory.cpp \ stripswidget.cpp \ zeiterfassungplugin.cpp \ - dialogs/aboutmedialog.cpp \ dialogs/authenticationdialog.cpp \ dialogs/languageselectiondialog.cpp \ dialogs/settingsdialog.cpp @@ -29,7 +28,6 @@ HEADERS += mainwindow.h \ stripswidget.h \ zeiterfassungguilib_global.h \ zeiterfassungplugin.h \ - dialogs/aboutmedialog.h \ dialogs/authenticationdialog.h \ dialogs/languageselectiondialog.h \ dialogs/settingsdialog.h @@ -37,8 +35,7 @@ HEADERS += mainwindow.h \ FORMS += mainwindow.ui \ dialogs/settingsdialog.ui \ dialogs/languageselectiondialog.ui \ - dialogs/authenticationdialog.ui \ - dialogs/aboutmedialog.ui + dialogs/authenticationdialog.ui RESOURCES += zeiterfassungguilib_resources.qrc