Web radio plugin #48
@@ -6,4 +6,5 @@ SUBDIRS += advancedviewplugin \
|
||||
presenceplugin \
|
||||
reportsplugin \
|
||||
updaterplugin \
|
||||
weatherplugin
|
||||
weatherplugin \
|
||||
webradioplugin
|
||||
|
BIN
plugins/webradioplugin/images/web-radio.png
Normal file
BIN
plugins/webradioplugin/images/web-radio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
101
plugins/webradioplugin/translations/webradioplugin_de.ts
Normal file
101
plugins/webradioplugin/translations/webradioplugin_de.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="de_DE">
|
||||
<context>
|
||||
<name>WebRadioDialog</name>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="14"/>
|
||||
<source>Radio</source>
|
||||
<translation>Radio</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="31"/>
|
||||
<source>Play</source>
|
||||
<translation>Abspielen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="44"/>
|
||||
<source>Pause</source>
|
||||
<translation>Pause</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="57"/>
|
||||
<source>Stop</source>
|
||||
<translation>Stop</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="69"/>
|
||||
<source>Stopped</source>
|
||||
<translation>Gestoppt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="70"/>
|
||||
<source>Playing</source>
|
||||
<translation>Wird abgespielt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="71"/>
|
||||
<source>Paused</source>
|
||||
<translation>Pausiert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="74"/>
|
||||
<location filename="../webradiodialog.cpp" line="93"/>
|
||||
<source>Unknown</source>
|
||||
<translation>Unbekannt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="82"/>
|
||||
<source>Unknown media</source>
|
||||
<translation>Unbekanntes Medium</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="83"/>
|
||||
<source>No media</source>
|
||||
<translation>Kein Medium</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="84"/>
|
||||
<source>Loading media...</source>
|
||||
<translation>Lade Medium...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="85"/>
|
||||
<source>Loaded media</source>
|
||||
<translation>Medium geladen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="86"/>
|
||||
<source>Stalled media</source>
|
||||
<translation>Medium angehalten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="87"/>
|
||||
<source>Buffering media</source>
|
||||
<translation>Puffere Medium</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="88"/>
|
||||
<source>Buffered media</source>
|
||||
<translation>Medium gepuffert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="89"/>
|
||||
<source>End of media</source>
|
||||
<translation>Ende des Mediums</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="90"/>
|
||||
<source>Invalid media</source>
|
||||
<translation>Ungültiges Medium</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WebRadioPlugin</name>
|
||||
<message>
|
||||
<location filename="../webradioplugin.cpp" line="38"/>
|
||||
<source>Play webradio</source>
|
||||
<translation>Webradio spielen</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
101
plugins/webradioplugin/translations/webradioplugin_en.ts
Normal file
101
plugins/webradioplugin/translations/webradioplugin_en.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>WebRadioDialog</name>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="14"/>
|
||||
<source>Radio</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="31"/>
|
||||
<source>Play</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="44"/>
|
||||
<source>Pause</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.ui" line="57"/>
|
||||
<source>Stop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="69"/>
|
||||
<source>Stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="70"/>
|
||||
<source>Playing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="71"/>
|
||||
<source>Paused</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="74"/>
|
||||
<location filename="../webradiodialog.cpp" line="93"/>
|
||||
<source>Unknown</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="82"/>
|
||||
<source>Unknown media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="83"/>
|
||||
<source>No media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="84"/>
|
||||
<source>Loading media...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="85"/>
|
||||
<source>Loaded media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="86"/>
|
||||
<source>Stalled media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="87"/>
|
||||
<source>Buffering media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="88"/>
|
||||
<source>Buffered media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="89"/>
|
||||
<source>End of media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../webradiodialog.cpp" line="90"/>
|
||||
<source>Invalid media</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WebRadioPlugin</name>
|
||||
<message>
|
||||
<location filename="../webradioplugin.cpp" line="38"/>
|
||||
<source>Play webradio</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
134
plugins/webradioplugin/webradiodialog.cpp
Normal file
134
plugins/webradioplugin/webradiodialog.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "webradiodialog.h"
|
||||
#include "ui_webradiodialog.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "zeiterfassungsettings.h"
|
||||
|
||||
WebRadioDialog::WebRadioDialog(MainWindow &mainWindow) :
|
||||
QDialog(&mainWindow),
|
||||
ui(new Ui::WebRadioDialog),
|
||||
m_mainWindow(mainWindow),
|
||||
m_player(new QMediaPlayer(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(m_player, &QMediaPlayer::stateChanged, this, &WebRadioDialog::stateChanged);
|
||||
connect(m_player, &QMediaPlayer::stateChanged, this, &WebRadioDialog::updateWidgets);
|
||||
connect(m_player, &QMediaPlayer::mediaStatusChanged, this, &WebRadioDialog::mediaStatusChanged);
|
||||
connect(m_player, &QMediaPlayer::mediaStatusChanged, this, &WebRadioDialog::updateWidgets);
|
||||
connect(m_player, static_cast<void(QMediaPlayer::*)(QMediaPlayer::Error)>(&QMediaPlayer::error), this, &WebRadioDialog::error);
|
||||
|
||||
for(const auto &url : m_mainWindow.settings().value(QStringLiteral("WebRadioPlugin/urls"), QStringList {
|
||||
QStringLiteral("http://stream.drumandbass.fm:9002"),
|
||||
QStringLiteral("http://stream.trap.fm:6002"),
|
||||
QStringLiteral("http://stream.dubbase.fm:7002"),
|
||||
QStringLiteral("http://lw1.mp3.tb-group.fm/hb.mp3"),
|
||||
QStringLiteral("http://lw1.mp3.tb-group.fm/tb.mp3"),
|
||||
QStringLiteral("http://lw1.mp3.tb-group.fm/tt.mp3"),
|
||||
QStringLiteral("http://lw1.mp3.tb-group.fm/ht.mp3"),
|
||||
QStringLiteral("http://lw1.mp3.tb-group.fm/trb.mp3"),
|
||||
QStringLiteral("http://lw1.mp3.tb-group.fm/ct.mp3"),
|
||||
QStringLiteral("http://lw1.mp3.tb-group.fm/clt.mp3"),
|
||||
QStringLiteral("https://live.helsinki.at:8088/live160.ogg")
|
||||
}).toStringList())
|
||||
{
|
||||
ui->comboBox->addItem(url, url);
|
||||
}
|
||||
|
||||
ui->comboBox->setCurrentIndex(ui->comboBox->findData(m_mainWindow.settings().value(QStringLiteral("WebRadioPlugin/lastUrl")).toString()));
|
||||
|
||||
connect(ui->comboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &WebRadioDialog::currentIndexChanged);
|
||||
|
||||
connect(ui->comboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &WebRadioDialog::updateWidgets);
|
||||
|
||||
connect(ui->pushButtonPlay, &QAbstractButton::pressed, this, &WebRadioDialog::play);
|
||||
connect(ui->pushButtonPause, &QAbstractButton::pressed, m_player, &QMediaPlayer::pause);
|
||||
connect(ui->pushButtonStop, &QAbstractButton::pressed, m_player, &QMediaPlayer::stop);
|
||||
|
||||
m_player->setVolume(m_mainWindow.settings().value(QStringLiteral("WebRadioPlugin/volume"), 100).toInt());
|
||||
ui->horizontalSlider->setValue(m_player->volume());
|
||||
connect(ui->horizontalSlider, &QAbstractSlider::valueChanged, this, &WebRadioDialog::volumeChanged);
|
||||
|
||||
stateChanged(m_player->state());
|
||||
mediaStatusChanged(m_player->mediaStatus());
|
||||
currentIndexChanged(ui->comboBox->currentIndex());
|
||||
updateWidgets();
|
||||
}
|
||||
|
||||
WebRadioDialog::~WebRadioDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void WebRadioDialog::stateChanged(QMediaPlayer::State newState)
|
||||
{
|
||||
switch(newState)
|
||||
{
|
||||
case QMediaPlayer::StoppedState: ui->labelState->setText(tr("Stopped")); break;
|
||||
case QMediaPlayer::PlayingState: ui->labelState->setText(tr("Playing")); break;
|
||||
case QMediaPlayer::PausedState: ui->labelState->setText(tr("Paused")); break;
|
||||
default:
|
||||
qWarning() << "unknown state" << newState;
|
||||
ui->labelState->setText(tr("Unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
void WebRadioDialog::mediaStatusChanged(QMediaPlayer::MediaStatus status)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
case QMediaPlayer::UnknownMediaStatus: ui->labelMediaStatus->setText(tr("Unknown media")); break;
|
||||
case QMediaPlayer::NoMedia: ui->labelMediaStatus->setText(tr("No media")); break;
|
||||
case QMediaPlayer::LoadingMedia: ui->labelMediaStatus->setText(tr("Loading media...")); break;
|
||||
case QMediaPlayer::LoadedMedia: ui->labelMediaStatus->setText(tr("Loaded media")); break;
|
||||
case QMediaPlayer::StalledMedia: ui->labelMediaStatus->setText(tr("Stalled media")); break;
|
||||
case QMediaPlayer::BufferingMedia: ui->labelMediaStatus->setText(tr("Buffering media")); break;
|
||||
case QMediaPlayer::BufferedMedia: ui->labelMediaStatus->setText(tr("Buffered media")); break;
|
||||
case QMediaPlayer::EndOfMedia: ui->labelMediaStatus->setText(tr("End of media")); break;
|
||||
case QMediaPlayer::InvalidMedia: ui->labelMediaStatus->setText(tr("Invalid media")); break;
|
||||
default:
|
||||
qWarning() << "unknown mediaStatus" << status;
|
||||
ui->labelMediaStatus->setText(tr("Unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
void WebRadioDialog::error(QMediaPlayer::Error error)
|
||||
{
|
||||
qWarning() << error;
|
||||
}
|
||||
|
||||
void WebRadioDialog::currentIndexChanged(int index)
|
||||
{
|
||||
if(index == -1)
|
||||
m_player->setMedia(QMediaContent());
|
||||
else
|
||||
m_player->setMedia(QMediaContent(QUrl(ui->comboBox->currentData().toString())));
|
||||
}
|
||||
|
||||
void WebRadioDialog::play()
|
||||
{
|
||||
if(ui->comboBox->currentIndex() == -1)
|
||||
return;
|
||||
|
||||
m_mainWindow.settings().setValue(QStringLiteral("WebRadioPlugin/lastUrl"), ui->comboBox->currentData().toString());
|
||||
|
||||
m_player->play();
|
||||
}
|
||||
|
||||
void WebRadioDialog::updateWidgets()
|
||||
{
|
||||
ui->comboBox->setEnabled(m_player->state() != QMediaPlayer::PlayingState);
|
||||
ui->pushButtonPlay->setEnabled(ui->comboBox->currentIndex() > -1 &&
|
||||
(m_player->state() == QMediaPlayer::StoppedState || m_player->state() == QMediaPlayer::PausedState) &&
|
||||
(m_player->mediaStatus() == QMediaPlayer::LoadedMedia || m_player->mediaStatus() == QMediaPlayer::BufferedMedia));
|
||||
ui->pushButtonPause->setEnabled(m_player->state() == QMediaPlayer::PlayingState || m_player->state() == QMediaPlayer::PausedState);
|
||||
ui->pushButtonStop->setEnabled(m_player->state() == QMediaPlayer::PlayingState || m_player->state() == QMediaPlayer::PausedState);
|
||||
}
|
||||
|
||||
void WebRadioDialog::volumeChanged(int volume)
|
||||
{
|
||||
m_mainWindow.settings().setValue(QStringLiteral("WebRadioPlugin/volume"), volume);
|
||||
m_player->setVolume(volume);
|
||||
}
|
36
plugins/webradioplugin/webradiodialog.h
Normal file
36
plugins/webradioplugin/webradiodialog.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef WEBRADIODIALOG_H
|
||||
#define WEBRADIODIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMediaPlayer>
|
||||
|
||||
class MainWindow;
|
||||
|
||||
namespace Ui { class WebRadioDialog; }
|
||||
|
||||
class WebRadioDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WebRadioDialog(MainWindow &mainWindow);
|
||||
~WebRadioDialog();
|
||||
|
||||
private Q_SLOTS:
|
||||
void stateChanged(QMediaPlayer::State newState);
|
||||
void mediaStatusChanged(QMediaPlayer::MediaStatus status);
|
||||
void error(QMediaPlayer::Error error);
|
||||
void currentIndexChanged(int index);
|
||||
void volumeChanged(int volume);
|
||||
void play();
|
||||
|
||||
private:
|
||||
void updateWidgets();
|
||||
|
||||
Ui::WebRadioDialog *ui;
|
||||
|
||||
MainWindow &m_mainWindow;
|
||||
QMediaPlayer *m_player;
|
||||
};
|
||||
|
||||
#endif // WEBRADIODIALOG_H
|
135
plugins/webradioplugin/webradiodialog.ui
Normal file
135
plugins/webradioplugin/webradiodialog.ui
Normal file
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WebRadioDialog</class>
|
||||
<widget class="QDialog" name="WebRadioDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>494</width>
|
||||
<height>155</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Radio</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonPlay">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Play</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonPause">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pause</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonStop">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelState">
|
||||
<property name="text">
|
||||
<string notr="true">state</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelMediaStatus">
|
||||
<property name="text">
|
||||
<string notr="true">mediaStatus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>WebRadioDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>WebRadioDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
39
plugins/webradioplugin/webradioplugin.cpp
Normal file
39
plugins/webradioplugin/webradioplugin.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "webradioplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "webradiodialog.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 WebRadioDialog(mainWindow);
|
||||
mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/webradioplugin/images/web-radio.png")),
|
||||
tr("Play webradio"), dialog, &QWidget::show);
|
||||
}
|
22
plugins/webradioplugin/webradioplugin.h
Normal file
22
plugins/webradioplugin/webradioplugin.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#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;
|
||||
};
|
0
plugins/webradioplugin/webradioplugin.json
Normal file
0
plugins/webradioplugin/webradioplugin.json
Normal file
37
plugins/webradioplugin/webradioplugin.pro
Normal file
37
plugins/webradioplugin/webradioplugin.pro
Normal file
@@ -0,0 +1,37 @@
|
||||
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 += webradiodialog.h \
|
||||
webradioplugin.h
|
||||
|
||||
SOURCES += webradiodialog.cpp \
|
||||
webradioplugin.cpp
|
||||
|
||||
FORMS += webradiodialog.ui
|
||||
|
||||
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)
|
5
plugins/webradioplugin/webradioplugin_resources.qrc
Normal file
5
plugins/webradioplugin/webradioplugin_resources.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/zeiterfassung/plugins/webradioplugin">
|
||||
<file>images/web-radio.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Reference in New Issue
Block a user