Renamed infobarstatus to infobarstatuscomponent (CInfoBarStatusComponent)

This commit is contained in:
Klaus Basan
2014-08-03 18:14:48 +02:00
parent a78422bf3e
commit b93b95fd73
5 changed files with 33 additions and 32 deletions

View File

@@ -7,8 +7,8 @@
* contained in the LICENSE file. * contained in the LICENSE file.
*/ */
#include "infobarstatus.h" #include "infobarstatuscomponent.h"
#include "ui_infobarstatus.h" #include "ui_infobarstatuscomponent.h"
#include "blackmisc/icons.h" #include "blackmisc/icons.h"
#include <QPoint> #include <QPoint>
@@ -23,22 +23,22 @@ namespace BlackGui
{ {
namespace Components namespace Components
{ {
CInfoBarStatus::CInfoBarStatus(QWidget *parent) : CInfoBarStatusComponent::CInfoBarStatusComponent(QWidget *parent) :
QFrame(parent), ui(new Ui::CInfoBarStatus) QFrame(parent), ui(new Ui::CInfoBarStatusComponent)
{ {
ui->setupUi(this); ui->setupUi(this);
this->initLeds(); this->initLeds();
this->ui->lbl_Audio->setContextMenuPolicy(Qt::CustomContextMenu); this->ui->lbl_Audio->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this->ui->lbl_Audio, &QLabel::customContextMenuRequested, this, &CInfoBarStatus::ps_customAudioContextMenuRequested); connect(this->ui->lbl_Audio, &QLabel::customContextMenuRequested, this, &CInfoBarStatusComponent::ps_customAudioContextMenuRequested);
} }
CInfoBarStatus::~CInfoBarStatus() CInfoBarStatusComponent::~CInfoBarStatusComponent()
{ {
delete ui; delete ui;
} }
void CInfoBarStatus::initLeds() void CInfoBarStatusComponent::initLeds()
{ {
CLed::LedShapes shape = CLed::Circle; CLed::LedShapes shape = CLed::Circle;
this->ui->led_DBus->setValues(CLed::Yellow, CLed::Black, shape, "DBus connected", "DBus disconnected", 14); this->ui->led_DBus->setValues(CLed::Yellow, CLed::Black, shape, "DBus connected", "DBus disconnected", 14);
@@ -50,17 +50,17 @@ namespace BlackGui
this->ui->led_Audio->setValues(CLed::Yellow, CLed::Red, shape, "On", "Muted", 18); this->ui->led_Audio->setValues(CLed::Yellow, CLed::Red, shape, "On", "Muted", 18);
} }
void CInfoBarStatus::setDBusStatus(bool dbus) void CInfoBarStatusComponent::setDBusStatus(bool dbus)
{ {
this->ui->led_DBus->setValue(dbus); this->ui->led_DBus->setValue(dbus);
} }
void CInfoBarStatus::setDBusTooltip(const QString &tooltip) void CInfoBarStatusComponent::setDBusTooltip(const QString &tooltip)
{ {
this->ui->led_DBus->setOnToolTip(tooltip); this->ui->led_DBus->setOnToolTip(tooltip);
} }
void CInfoBarStatus::setVolume(int volume) void CInfoBarStatusComponent::setVolume(int volume)
{ {
if (volume < 1) if (volume < 1)
{ {
@@ -72,7 +72,7 @@ namespace BlackGui
} }
} }
void CInfoBarStatus::runtimeHasBeenSet() void CInfoBarStatusComponent::runtimeHasBeenSet()
{ {
Q_ASSERT(getIContextSimulator()); Q_ASSERT(getIContextSimulator());
Q_ASSERT(getIContextAudio()); Q_ASSERT(getIContextAudio());
@@ -80,12 +80,12 @@ namespace BlackGui
if (this->getIContextSimulator()) if (this->getIContextSimulator())
{ {
connect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &CInfoBarStatus::ps_simulatorConnectionChanged); connect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &CInfoBarStatusComponent::ps_simulatorConnectionChanged);
} }
if (this->getIContextNetwork()) if (this->getIContextNetwork())
{ {
connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CInfoBarStatus::ps_networkConnectionChanged); connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CInfoBarStatusComponent::ps_networkConnectionChanged);
} }
if (this->getIContextApplication()) if (this->getIContextApplication())
@@ -101,12 +101,12 @@ namespace BlackGui
} }
} }
void CInfoBarStatus::ps_simulatorConnectionChanged(bool connected) void CInfoBarStatusComponent::ps_simulatorConnectionChanged(bool connected)
{ {
this->ui->led_Simulator->setValue(connected); this->ui->led_Simulator->setValue(connected);
} }
void CInfoBarStatus::ps_networkConnectionChanged(uint from, uint to, const QString &message) void CInfoBarStatusComponent::ps_networkConnectionChanged(uint from, uint to, const QString &message)
{ {
INetwork::ConnectionStatus fromStatus = static_cast<INetwork::ConnectionStatus>(from); INetwork::ConnectionStatus fromStatus = static_cast<INetwork::ConnectionStatus>(from);
INetwork::ConnectionStatus toStatus = static_cast<INetwork::ConnectionStatus>(to); INetwork::ConnectionStatus toStatus = static_cast<INetwork::ConnectionStatus>(to);
@@ -133,7 +133,7 @@ namespace BlackGui
} }
} }
void CInfoBarStatus::ps_customAudioContextMenuRequested(const QPoint &position) void CInfoBarStatusComponent::ps_customAudioContextMenuRequested(const QPoint &position)
{ {
QWidget *sender = qobject_cast<QWidget *>(QWidget::sender()); QWidget *sender = qobject_cast<QWidget *>(QWidget::sender());
Q_ASSERT(sender); Q_ASSERT(sender);

View File

@@ -9,29 +9,29 @@
//! \file //! \file
#ifndef BLACKGUI_INFOBARSTATUS_H #ifndef BLACKGUI_INFOBARSTATUSCOMPONENT_H
#define BLACKGUI_INFOBARSTATUS_H #define BLACKGUI_INFOBARSTATUSCOMPONENT_H
#include "runtimebasedcomponent.h" #include "runtimebasedcomponent.h"
#include "../led.h" #include "../led.h"
#include <QFrame> #include <QFrame>
namespace Ui { class CInfoBarStatus; } namespace Ui { class CInfoBarStatusComponent; }
namespace BlackGui namespace BlackGui
{ {
namespace Components namespace Components
{ {
//! Info bar displaying status (Network, Simulator, DBus) //! Info bar displaying status (Network, Simulator, DBus)
class CInfoBarStatus : public QFrame, public CRuntimeBasedComponent class CInfoBarStatusComponent : public QFrame, public CRuntimeBasedComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
//! Constructor //! Constructor
explicit CInfoBarStatus(QWidget *parent = nullptr); explicit CInfoBarStatusComponent(QWidget *parent = nullptr);
//!Constructor //!Constructor
~CInfoBarStatus(); ~CInfoBarStatusComponent();
//! Init the LEDs //! Init the LEDs
void initLeds(); void initLeds();
@@ -50,7 +50,7 @@ namespace BlackGui
virtual void runtimeHasBeenSet() override; virtual void runtimeHasBeenSet() override;
private: private:
Ui::CInfoBarStatus *ui; Ui::CInfoBarStatusComponent *ui;
private slots: private slots:
//! Simulator connection has been changed //! Simulator connection has been changed

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>CInfoBarStatus</class> <class>CInfoBarStatusComponent</class>
<widget class="QFrame" name="CInfoBarStatus"> <widget class="QFrame" name="CInfoBarStatusComponent">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -21,6 +21,7 @@ namespace BlackGui
{ {
CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(parent) CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(parent)
{ {
this->setAutoAdjustWhenFloating(false);
this->setMarginsWhenDocked(0, 0, 0, -1); this->setMarginsWhenDocked(0, 0, 0, -1);
this->setWindowTitle("Info bar"); this->setWindowTitle("Info bar");
this->setWindowIcon(CIcons::swift24()); this->setWindowIcon(CIcons::swift24());

View File

@@ -610,7 +610,7 @@
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>4</number> <number>4</number>
</attribute> </attribute>
<widget class="BlackGui::Components::CInfoBarStatus" name="comp_InfoBarStatus"/> <widget class="BlackGui::Components::CInfoBarStatusComponent" name="comp_InfoBarStatus"/>
</widget> </widget>
<action name="menu_TestLocationsEDDF"> <action name="menu_TestLocationsEDDF">
<property name="text"> <property name="text">
@@ -677,18 +677,18 @@
<header>blackgui/components/maininfoareacomponent.h</header> <header>blackgui/components/maininfoareacomponent.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>BlackGui::Components::CInfoBarStatus</class>
<extends>QWidget</extends>
<header>blackgui/components/infobarstatus.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>BlackGui::CDockWidgetInfoBar</class> <class>BlackGui::CDockWidgetInfoBar</class>
<extends>QDockWidget</extends> <extends>QDockWidget</extends>
<header>blackgui/dockwidgetinfobar.h</header> <header>blackgui/dockwidgetinfobar.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>BlackGui::Components::CInfoBarStatusComponent</class>
<extends>QWidget</extends>
<header>blackgui/components/infobarstatuscomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>le_CommandLineInput</tabstop> <tabstop>le_CommandLineInput</tabstop>