Commit 49a5d892 authored by Jonathan Marten's avatar Jonathan Marten

Use a KMessageWidget for the "Nothing is playing..." and similar messages

parent 138b59a8
......@@ -45,10 +45,10 @@
// KDE
#include <klocalizedstring.h>
#include <kmessagewidget.h>
// Qt
#include <QPushButton>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
......@@ -145,9 +145,6 @@ void ViewSliders::initLayout()
{
resetMdws();
delete m_emptyStreamHint;
m_emptyStreamHint = nullptr;
// Our m_layoutSliders now should only contain spacer widgets from the addSpacing() calls in add() above.
// We need to trash those too otherwise all sliders gradually migrate away from the edge :p
if (m_layoutSliders!=nullptr)
......@@ -201,14 +198,11 @@ void ViewSliders::initLayout()
else if (viewId.contains(".Capture_Devices.")) emptyStreamText = i18n("There are no capture devices.");
else if (viewId.contains(".Playback_Devices.")) emptyStreamText = i18n("There are no playback devices.");
// TODO: does this need to be a member?
m_emptyStreamHint = new QLabel(emptyStreamText);
QFont f = m_emptyStreamHint->font();
f.setBold(true);
m_emptyStreamHint->setFont(f);
m_emptyStreamHint->setAlignment(Qt::AlignCenter);
m_emptyStreamHint->setWordWrap(true);
m_emptyStreamHint->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
delete m_emptyStreamHint;
m_emptyStreamHint = new KMessageWidget(emptyStreamText, this);
m_emptyStreamHint->setIcon(QIcon::fromTheme("dialog-information"));
m_emptyStreamHint->setMessageType(KMessageWidget::Information);
m_emptyStreamHint->setCloseButtonVisible(false);
m_layoutSliders->addWidget(m_emptyStreamHint);
if (GlobalConfig::instance().data.getToplevelOrientation()==Qt::Horizontal)
......
......@@ -25,8 +25,8 @@
class QBoxLayout;
class QGridLayout;
class QLabel;
class QPushButton;
class KMessageWidget;
class Mixer;
......@@ -59,7 +59,7 @@ private:
QBoxLayout *m_layoutSliders;
QBoxLayout *m_layoutSwitches;
QPushButton *m_configureViewButton;
QLabel *m_emptyStreamHint;
KMessageWidget *m_emptyStreamHint;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment