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.
*/
#include "infobarstatus.h"
#include "ui_infobarstatus.h"
#include "infobarstatuscomponent.h"
#include "ui_infobarstatuscomponent.h"
#include "blackmisc/icons.h"
#include <QPoint>
@@ -23,22 +23,22 @@ namespace BlackGui
{
namespace Components
{
CInfoBarStatus::CInfoBarStatus(QWidget *parent) :
QFrame(parent), ui(new Ui::CInfoBarStatus)
CInfoBarStatusComponent::CInfoBarStatusComponent(QWidget *parent) :
QFrame(parent), ui(new Ui::CInfoBarStatusComponent)
{
ui->setupUi(this);
this->initLeds();
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;
}
void CInfoBarStatus::initLeds()
void CInfoBarStatusComponent::initLeds()
{
CLed::LedShapes shape = CLed::Circle;
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);
}
void CInfoBarStatus::setDBusStatus(bool dbus)
void CInfoBarStatusComponent::setDBusStatus(bool 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);
}
void CInfoBarStatus::setVolume(int volume)
void CInfoBarStatusComponent::setVolume(int volume)
{
if (volume < 1)
{
@@ -72,7 +72,7 @@ namespace BlackGui
}
}
void CInfoBarStatus::runtimeHasBeenSet()
void CInfoBarStatusComponent::runtimeHasBeenSet()
{
Q_ASSERT(getIContextSimulator());
Q_ASSERT(getIContextAudio());
@@ -80,12 +80,12 @@ namespace BlackGui
if (this->getIContextSimulator())
{
connect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &CInfoBarStatus::ps_simulatorConnectionChanged);
connect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &CInfoBarStatusComponent::ps_simulatorConnectionChanged);
}
if (this->getIContextNetwork())
{
connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CInfoBarStatus::ps_networkConnectionChanged);
connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CInfoBarStatusComponent::ps_networkConnectionChanged);
}
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);
}
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 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());
Q_ASSERT(sender);

View File

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

View File

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

View File

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

View File

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