Web radio plugin #48
@@ -10,9 +10,39 @@ WebRadioDialog::WebRadioDialog(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_player->setMedia(QMediaContent(QUrl(QStringLiteral("http://stream.drumandbass.fm:9002"))));
|
||||
for(const auto &url : 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")
|
||||
})
|
||||
{
|
||||
ui->comboBox->addItem(url);
|
||||
}
|
||||
|
||||
connect(ui->pushButton, &QAbstractButton::pressed, m_player, &QMediaPlayer::play);
|
||||
connect(ui->comboBox, &QComboBox::currentTextChanged, this, [=](const QString &url){ m_player->setMedia(QMediaContent(QUrl(url))); });
|
||||
|
||||
Q_EMIT ui->comboBox->currentTextChanged(ui->comboBox->currentText());
|
||||
|
||||
connect(ui->pushButtonPlay, &QAbstractButton::pressed, m_player, &QMediaPlayer::play);
|
||||
connect(ui->pushButtonPause, &QAbstractButton::pressed, m_player, &QMediaPlayer::pause);
|
||||
connect(ui->pushButtonStop, &QAbstractButton::pressed, m_player, &QMediaPlayer::stop);
|
||||
connect(ui->horizontalSlider, &QAbstractSlider::valueChanged, m_player, &QMediaPlayer::setVolume);
|
||||
|
||||
connect(m_player, &QMediaPlayer::stateChanged, [](QMediaPlayer::State newState){ qDebug() << newState; });
|
||||
connect(m_player, &QMediaPlayer::mediaStatusChanged, [](QMediaPlayer::MediaStatus status){ qDebug() << status; });
|
||||
connect(m_player, static_cast<void(QMediaPlayer::*)(QMediaPlayer::Error)>(&QMediaPlayer::error),
|
||||
[](QMediaPlayer::Error error){ qDebug() << error; });
|
||||
connect(m_player, SIGNAL(volumeChanged(int)), ui->horizontalSlider, SLOT(setValue(int)));
|
||||
|
||||
Q_EMIT m_player->volumeChanged(m_player->volume());
|
||||
}
|
||||
|
||||
WebRadioDialog::~WebRadioDialog()
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>433</width>
|
||||
<width>539</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -29,17 +29,79 @@
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="pushButtonPlay">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>191</width>
|
||||
<width>131</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string>play()</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>160</y>
|
||||
<width>351</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonPause">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>60</y>
|
||||
<width>131</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>pause()</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonStop">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>60</y>
|
||||
<width>131</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>stop()</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>130</y>
|
||||
<width>160</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>20</y>
|
||||
<width>271</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@@ -14,14 +14,13 @@ DEPENDPATH += $$PWD/../../zeiterfassungcorelib $$PWD/../../zeiterfassungguilib
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT
|
||||
|
||||
HEADERS += webradioplugin.h \
|
||||
webradiodialog.h
|
||||
HEADERS += webradiodialog.h \
|
||||
webradioplugin.h
|
||||
|
||||
SOURCES += webradioplugin.cpp \
|
||||
webradiodialog.cpp
|
||||
SOURCES += webradiodialog.cpp \
|
||||
webradioplugin.cpp
|
||||
|
||||
FORMS += \
|
||||
webradiodialog.ui
|
||||
FORMS += webradiodialog.ui
|
||||
|
||||
RESOURCES += webradioplugin_resources.qrc
|
||||
|
||||
|
Reference in New Issue
Block a user