Ref T573, status bar can resize text and added XPDR mode display

This commit is contained in:
Klaus Basan
2019-03-19 05:39:36 +01:00
committed by Mat Sutcliffe
parent 6adfc6b93f
commit 19ac6d9285
3 changed files with 53 additions and 18 deletions

View File

@@ -9,14 +9,15 @@
#include "blackgui/components/infobarstatuscomponent.h"
#include "blackgui/guiapplication.h"
#include "blackgui/led.h"
#include "blackgui/guiutility.h"
#include "blackcore/context/contextapplication.h"
#include "blackcore/context/contextaudio.h"
#include "blackcore/context/contextnetwork.h"
#include "blackcore/context/contextsimulator.h"
#include "blackcore/simulator.h"
#include "blackmisc/audio/audioutils.h"
#include "blackmisc/network/server.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include "blackmisc/network/server.h"
#include "blackmisc/audio/audioutils.h"
#include "blackconfig/buildconfig.h"
#include "ui_infobarstatuscomponent.h"
@@ -45,6 +46,7 @@ namespace BlackGui
{
ui->setupUi(this);
this->initLeds();
this->adjustTextSize();
ui->lbl_Audio->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->lbl_Audio, &QLabel::customContextMenuRequested, this, &CInfoBarStatusComponent::onCustomAudioContextMenuRequested);
@@ -103,6 +105,22 @@ namespace BlackGui
this->onInternetAccessibleChanged(sGui->isInternetAccessible());
}
void CInfoBarStatusComponent::adjustTextSize()
{
CGuiUtility::setElidedText(ui->lbl_Audio, QStringLiteral("audio"), Qt::ElideRight);
CGuiUtility::setElidedText(ui->lbl_Network, QStringLiteral("network"), Qt::ElideRight);
CGuiUtility::setElidedText(ui->lbl_DBus, QStringLiteral("DBus"), {}, Qt::ElideRight);
CGuiUtility::setElidedText(ui->lbl_MapperReady, QStringLiteral("mapper ready"), Qt::ElideRight);
CGuiUtility::setElidedText(ui->lbl_Ptt, QStringLiteral("PTT"), Qt::ElideRight);
CGuiUtility::setElidedText(ui->lbl_Simulator, QStringLiteral("simulator"), Qt::ElideRight);
// CGuiUtility::setElidedText(ui->lbl_Audio, QStringLiteral("au"), QStringLiteral("audio"), Qt::ElideRight);
// CGuiUtility::setElidedText(ui->lbl_DBus, QStringLiteral("DBus"), {}, Qt::ElideRight);
// CGuiUtility::setElidedText(ui->lbl_MapperReady, QStringLiteral("map"), QStringLiteral("mapper ready"), Qt::ElideRight);
// CGuiUtility::setElidedText(ui->lbl_Ptt, QStringLiteral("PTT"), QStringLiteral("push to talk"), Qt::ElideRight);
// CGuiUtility::setElidedText(ui->lbl_Simulator, QStringLiteral("sim"), QStringLiteral("simulator"), Qt::ElideRight);
}
void CInfoBarStatusComponent::setDBusStatus(bool dbus)
{
ui->led_DBus->setOn(dbus);
@@ -121,6 +139,12 @@ namespace BlackGui
}
}
void CInfoBarStatusComponent::resizeEvent(QResizeEvent *event)
{
QFrame::resizeEvent(event);
m_dsResize.inputSignal();
}
void CInfoBarStatusComponent::onSimulatorStatusChanged(int status)
{
const ISimulator::SimulatorStatus simStatus = static_cast<ISimulator::SimulatorStatus>(status);

View File

@@ -48,13 +48,21 @@ namespace BlackGui
//! Set the spacing
void setSpacing(int spacing);
protected:
//! \copydoc QWidget::resizeEvent
virtual void resizeEvent(QResizeEvent *event) override;
private:
QScopedPointer<Ui::CInfoBarStatusComponent> ui;
BlackCore::CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CInfoBarStatusComponent::onPttChanged };
BlackMisc::CDigestSignal m_dsResize { this, &CInfoBarStatusComponent::adjustTextSize, 1000, 25 };
//! Init the LEDs
void initLeds();
//! Init labels
void adjustTextSize();
//! Simulator connection has been changed
void onSimulatorStatusChanged(int status);
@@ -84,4 +92,5 @@ namespace BlackGui
};
} // ns
} // ns
#endif // guard

View File

@@ -2,14 +2,6 @@
<ui version="4.0">
<class>CInfoBarStatusComponent</class>
<widget class="QFrame" name="CInfoBarStatusComponent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>250</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -35,6 +27,16 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Components::CTransponderModeComponent" name="comp_XpdrMode">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Network">
<property name="toolTip">
@@ -78,7 +80,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="lb_MapperReady">
<widget class="QLabel" name="lbl_MapperReady">
<property name="toolTip">
<string>Mappings ready</string>
</property>
@@ -95,12 +97,6 @@
</item>
<item>
<widget class="QLabel" name="lbl_DBus">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>DBus</string>
</property>
@@ -164,7 +160,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>40</width>
<height>20</height>
</size>
</property>
@@ -179,6 +175,12 @@
<header>blackgui/led.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CTransponderModeComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/transpondermodecomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>