Ref T384, trigger (show) overlay text messages

This commit is contained in:
Klaus Basan
2018-10-03 02:09:19 +02:00
parent b3c6e22346
commit 792d2ced30
7 changed files with 73 additions and 10 deletions

View File

@@ -65,6 +65,8 @@ namespace BlackGui
connect(ui->editor_Com, &CCockpitComForm::testSelcal, this, &CCockpitComComponent::testSelcal); connect(ui->editor_Com, &CCockpitComForm::testSelcal, this, &CCockpitComComponent::testSelcal);
connect(ui->editor_Com, &CCockpitComForm::changedCockpitValues, this, &CCockpitComComponent::updateOwnCockpitInContext); connect(ui->editor_Com, &CCockpitComForm::changedCockpitValues, this, &CCockpitComComponent::updateOwnCockpitInContext);
connect(ui->editor_Com, &CCockpitComForm::changedSelcal, this, &CCockpitComComponent::updateSelcalInContext); connect(ui->editor_Com, &CCockpitComForm::changedSelcal, this, &CCockpitComComponent::updateSelcalInContext);
connect(ui->editor_Com, &CCockpitComForm::requestCom1TextMessage, this, &CCockpitComComponent::requestCom1TextMessage);
connect(ui->editor_Com, &CCockpitComForm::requestCom2TextMessage, this, &CCockpitComComponent::requestCom2TextMessage);
// Relay COM form signals // Relay COM form signals
connect(ui->editor_Com, &CCockpitComForm::transponderModeChanged, this, &CCockpitComComponent::transponderModeChanged); connect(ui->editor_Com, &CCockpitComForm::transponderModeChanged, this, &CCockpitComComponent::transponderModeChanged);

View File

@@ -59,6 +59,11 @@ namespace BlackGui
//! \copydoc BlackGui::Components::CTransponderModeSelector::transponderStateIdentEnded //! \copydoc BlackGui::Components::CTransponderModeSelector::transponderStateIdentEnded
void transponderStateIdentEnded(); void transponderStateIdentEnded();
//! Request COM text messages @{
void requestCom1TextMessage();
void requestCom2TextMessage();
//! @}
protected: protected:
//! \copydoc QWidget::paintEvent //! \copydoc QWidget::paintEvent
virtual void paintEvent(QPaintEvent *event) override; virtual void paintEvent(QPaintEvent *event) override;

View File

@@ -22,13 +22,16 @@ namespace BlackGui
namespace Components namespace Components
{ {
CCockpitComponent::CCockpitComponent(QWidget *parent) : CCockpitComponent::CCockpitComponent(QWidget *parent) :
QWidget(parent), COverlayMessagesFrame(parent),
CEnableForDockWidgetInfoArea(), CEnableForDockWidgetInfoArea(),
ui(new Ui::CCockpitComponent) ui(new Ui::CCockpitComponent)
{ {
ui->setupUi(this); ui->setupUi(this);
this->m_minHeightInfoArea = ui->comp_CockpitInfoArea->minimumHeight(); this->m_minHeightInfoArea = ui->comp_CockpitInfoArea->minimumHeight();
connect(ui->wip_CockpitComPanelShowHideBar, &BlackGui::CShowHideBar::toggleShowHide, this, &CCockpitComponent::onToggleShowHideDetails);
connect(ui->wip_CockpitComPanelShowHideBar, &CShowHideBar::toggleShowHide, this, &CCockpitComponent::onToggleShowHideDetails);
connect(ui->comp_CockpitComComponent, &CCockpitComComponent::requestCom1TextMessage, this, &CCockpitComponent::onRequestTextMessageCom1);
connect(ui->comp_CockpitComComponent, &CCockpitComComponent::requestCom2TextMessage, this, &CCockpitComponent::onRequestTextMessageCom2);
} }
CCockpitComponent::~CCockpitComponent() CCockpitComponent::~CCockpitComponent()
@@ -116,6 +119,25 @@ namespace BlackGui
} }
} }
void CCockpitComponent::mouseDoubleClickEvent(QMouseEvent *event)
{
if (event)
{
this->showOverlayInlineTextMessage(TextMessagesAll);
}
COverlayMessagesFrame::mouseDoubleClickEvent(event);
}
void CCockpitComponent::onRequestTextMessageCom1()
{
this->showOverlayInlineTextMessage(TextMessagesCom1);
}
void CCockpitComponent::onRequestTextMessageCom2()
{
this->showOverlayInlineTextMessage(TextMessagesCom2);
}
void CCockpitComponent::onToggleFloating(bool floating) void CCockpitComponent::onToggleFloating(bool floating)
{ {
ui->wip_CockpitComPanelShowHideBar->setVisible(floating); ui->wip_CockpitComPanelShowHideBar->setVisible(floating);

View File

@@ -12,12 +12,13 @@
#ifndef BLACKGUI_COMPONENTS_COCKPITCOMPONENT_H #ifndef BLACKGUI_COMPONENTS_COCKPITCOMPONENT_H
#define BLACKGUI_COMPONENTS_COCKPITCOMPONENT_H #define BLACKGUI_COMPONENTS_COCKPITCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h" #include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackgui/overlaymessagesframe.h"
#include "blackgui/blackguiexport.h"
#include <QObject> #include <QObject>
#include <QScopedPointer> #include <QScopedPointer>
#include <QSize> #include <QSize>
#include <QWidget>
namespace Ui { class CCockpitComponent; } namespace Ui { class CCockpitComponent; }
namespace BlackGui namespace BlackGui
@@ -28,7 +29,8 @@ namespace BlackGui
{ {
//! Cockpit component: COM unit, show / hide bar, voice rooms //! Cockpit component: COM unit, show / hide bar, voice rooms
class BLACKGUI_EXPORT CCockpitComponent : class BLACKGUI_EXPORT CCockpitComponent :
public QWidget, // making a widget overlay and dock widget is semi-optimal but a special case here because of text messages
public COverlayMessagesFrame,
public CEnableForDockWidgetInfoArea public CEnableForDockWidgetInfoArea
{ {
Q_OBJECT Q_OBJECT
@@ -53,6 +55,10 @@ namespace BlackGui
//! Show the audio UI //! Show the audio UI
void showAudio(); void showAudio();
protected:
//! \copydoc QWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
private: private:
//! Show or hide cockpit details //! Show or hide cockpit details
void onToggleShowHideDetails(bool show); void onToggleShowHideDetails(bool show);
@@ -60,9 +66,14 @@ namespace BlackGui
//! Toggle floating //! Toggle floating
void onToggleFloating(bool floating); void onToggleFloating(bool floating);
// toggle area on show/hide details //! Toggle area on show/hide details
void toggleShowHideDetails(bool show, bool considerCurrentSize); void toggleShowHideDetails(bool show, bool considerCurrentSize);
//! Request text message COM1 @{
void onRequestTextMessageCom1();
void onRequestTextMessageCom2();
//! @}
QScopedPointer<Ui::CCockpitComponent> ui; QScopedPointer<Ui::CCockpitComponent> ui;
QSize m_sizeFloatingShown; //! size when info area is shown QSize m_sizeFloatingShown; //! size when info area is shown
QSize m_sizeFloatingHidden; //! size when info area is hidden QSize m_sizeFloatingHidden; //! size when info area is hidden

View File

@@ -51,6 +51,8 @@ namespace BlackGui
connect(ui->sbp_ComPanelTransponder, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); connect(ui->sbp_ComPanelTransponder, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues);
connect(ui->cbp_ComPanelTransponderMode, &CTransponderModeSelector::transponderModeChanged, this, &CCockpitComForm::onGuiChangedCockpitValues); connect(ui->cbp_ComPanelTransponderMode, &CTransponderModeSelector::transponderModeChanged, this, &CCockpitComForm::onGuiChangedCockpitValues);
connect(ui->frp_ComPanelSelcalSelector, &CSelcalCodeSelector::valueChanged, this, &CCockpitComForm::onGuiChangedCockpitValues); connect(ui->frp_ComPanelSelcalSelector, &CSelcalCodeSelector::valueChanged, this, &CCockpitComForm::onGuiChangedCockpitValues);
connect(ui->tb_RequestTextMessageCom1, &QToolButton::released, this, &CCockpitComForm::requestCom1TextMessage);
connect(ui->tb_RequestTextMessageCom2, &QToolButton::released, this, &CCockpitComForm::requestCom2TextMessage);
ui->led_ComPanelCom1->setShape(CLedWidget::Rounded); ui->led_ComPanelCom1->setShape(CLedWidget::Rounded);
ui->led_ComPanelCom2->setShape(CLedWidget::Rounded); ui->led_ComPanelCom2->setShape(CLedWidget::Rounded);

View File

@@ -86,6 +86,11 @@ namespace BlackGui
//! GUI values changed //! GUI values changed
void changedCockpitValues(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); void changedCockpitValues(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
//! Request COM text messages @{
void requestCom1TextMessage();
void requestCom2TextMessage();
//! @}
private: private:
//! Init LEDs //! Init LEDs
void initLeds(); void initLeds();

View File

@@ -128,7 +128,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="3">
<widget class="QDoubleSpinBox" name="ds_ComPanelCom1Standby"> <widget class="QDoubleSpinBox" name="ds_ComPanelCom1Standby">
<property name="decimals"> <property name="decimals">
<number>3</number> <number>3</number>
@@ -147,7 +147,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="2">
<widget class="QToolButton" name="tb_ComPanelCom1Toggle"> <widget class="QToolButton" name="tb_ComPanelCom1Toggle">
<property name="toolTip"> <property name="toolTip">
<string>Toggle COM 1 standby/active</string> <string>Toggle COM 1 standby/active</string>
@@ -161,6 +161,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QToolButton" name="tb_RequestTextMessageCom1">
<property name="text">
<string>T</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -254,7 +261,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="3">
<widget class="QDoubleSpinBox" name="ds_ComPanelCom2Standby"> <widget class="QDoubleSpinBox" name="ds_ComPanelCom2Standby">
<property name="decimals"> <property name="decimals">
<number>3</number> <number>3</number>
@@ -273,7 +280,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="2">
<widget class="QToolButton" name="tb_ComPanelCom2Toggle"> <widget class="QToolButton" name="tb_ComPanelCom2Toggle">
<property name="toolTip"> <property name="toolTip">
<string>Toggle COM 2 standby/active</string> <string>Toggle COM 2 standby/active</string>
@@ -287,6 +294,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QToolButton" name="tb_RequestTextMessageCom2">
<property name="text">
<string>T</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -517,7 +531,9 @@
<tabstop>ds_ComPanelCom2Standby</tabstop> <tabstop>ds_ComPanelCom2Standby</tabstop>
<tabstop>sbp_ComPanelTransponder</tabstop> <tabstop>sbp_ComPanelTransponder</tabstop>
<tabstop>cbp_ComPanelTransponderMode</tabstop> <tabstop>cbp_ComPanelTransponderMode</tabstop>
<tabstop>tb_RequestTextMessageCom1</tabstop>
<tabstop>tb_ComPanelCom1Toggle</tabstop> <tabstop>tb_ComPanelCom1Toggle</tabstop>
<tabstop>tb_RequestTextMessageCom2</tabstop>
<tabstop>tb_ComPanelCom2Toggle</tabstop> <tabstop>tb_ComPanelCom2Toggle</tabstop>
<tabstop>tb_ComPanelSelcalTest</tabstop> <tabstop>tb_ComPanelSelcalTest</tabstop>
</tabstops> </tabstops>