diff --git a/plugins/plugins.pro b/plugins/plugins.pro index dab007d..5a6d1f5 100644 --- a/plugins/plugins.pro +++ b/plugins/plugins.pro @@ -6,4 +6,5 @@ SUBDIRS += advancedviewplugin \ presenceplugin \ reportsplugin \ updaterplugin \ - weatherplugin + weatherplugin \ + webradioplugin diff --git a/plugins/webradioplugin/images/web-radio.png b/plugins/webradioplugin/images/web-radio.png new file mode 100644 index 0000000..c68d7c1 Binary files /dev/null and b/plugins/webradioplugin/images/web-radio.png differ diff --git a/plugins/webradioplugin/translations/webradioplugin_de.ts b/plugins/webradioplugin/translations/webradioplugin_de.ts new file mode 100644 index 0000000..3e2f9c2 --- /dev/null +++ b/plugins/webradioplugin/translations/webradioplugin_de.ts @@ -0,0 +1,12 @@ + + + + + WebRadioPlugin + + + Play webradio + + + + diff --git a/plugins/webradioplugin/translations/webradioplugin_en.ts b/plugins/webradioplugin/translations/webradioplugin_en.ts new file mode 100644 index 0000000..9db9347 --- /dev/null +++ b/plugins/webradioplugin/translations/webradioplugin_en.ts @@ -0,0 +1,12 @@ + + + + + WebRadioPlugin + + + Play webradio + + + + diff --git a/plugins/webradioplugin/webradioplugin.cpp b/plugins/webradioplugin/webradioplugin.cpp new file mode 100644 index 0000000..98a0b99 --- /dev/null +++ b/plugins/webradioplugin/webradioplugin.cpp @@ -0,0 +1,40 @@ +#include "webradioplugin.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "mainwindow.h" + +WebRadioPlugin::WebRadioPlugin(QObject *parent) : + ZeiterfassungPlugin(parent) +{ + qDebug() << "called"; + + static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations")); + + if(m_translator.load(QLocale(), QStringLiteral("webradioplugin"), QStringLiteral("_"), dir)) + { + if(!QCoreApplication::installTranslator(&m_translator)) + { + qWarning() << "could not install translation webradioplugin"; + } + } + else + { + qWarning() << "could not load translation webradioplugin"; + } +} + +void WebRadioPlugin::attachTo(MainWindow &mainWindow) +{ + auto dialog = new QDialog(&mainWindow); + dialog->setWindowFlag(Qt::WindowCloseButtonHint, true); + dialog->setWindowFlag(Qt::WindowContextHelpButtonHint, false); + mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/webradioplugin/images/web-radio.png")), + tr("Play webradio"), dialog, &QWidget::show); +} diff --git a/plugins/webradioplugin/webradioplugin.h b/plugins/webradioplugin/webradioplugin.h new file mode 100644 index 0000000..e11932d --- /dev/null +++ b/plugins/webradioplugin/webradioplugin.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +#include "zeiterfassungplugin.h" + +class Q_DECL_EXPORT WebRadioPlugin : public ZeiterfassungPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "dbsoftware.zeiterfassung.plugin/1.0" FILE "webradioplugin.json") + Q_INTERFACES(ZeiterfassungPlugin) + +public: + explicit WebRadioPlugin(QObject *parent = Q_NULLPTR); + + // ZeiterfassungPlugin interface + void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE; + +private: + QTranslator m_translator; +}; diff --git a/plugins/webradioplugin/webradioplugin.json b/plugins/webradioplugin/webradioplugin.json new file mode 100644 index 0000000..e69de29 diff --git a/plugins/webradioplugin/webradioplugin.pro b/plugins/webradioplugin/webradioplugin.pro new file mode 100644 index 0000000..d56f0d6 --- /dev/null +++ b/plugins/webradioplugin/webradioplugin.pro @@ -0,0 +1,35 @@ +QT += core network gui widgets multimedia + +TARGET = webradioplugin +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 += webradioplugin.h + +SOURCES += webradioplugin.cpp + +FORMS += + +RESOURCES += webradioplugin_resources.qrc + +TRANSLATIONS += translations/webradioplugin_en.ts \ + translations/webradioplugin_de.ts + +OTHER_FILES += webradioplugin.json + +include(../../lrelease.pri) + +COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/webradioplugin_en.qm \ + $${OUT_PWD}/translations/webradioplugin_de.qm + +include(../copy_translations.pri) diff --git a/plugins/webradioplugin/webradioplugin_resources.qrc b/plugins/webradioplugin/webradioplugin_resources.qrc new file mode 100644 index 0000000..f7b12b5 --- /dev/null +++ b/plugins/webradioplugin/webradioplugin_resources.qrc @@ -0,0 +1,5 @@ + + + images/web-radio.png + +