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::changedCockpitValues, this, &CCockpitComComponent::updateOwnCockpitInContext);
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
connect(ui->editor_Com, &CCockpitComForm::transponderModeChanged, this, &CCockpitComComponent::transponderModeChanged);

View File

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

View File

@@ -22,13 +22,16 @@ namespace BlackGui
namespace Components
{
CCockpitComponent::CCockpitComponent(QWidget *parent) :
QWidget(parent),
COverlayMessagesFrame(parent),
CEnableForDockWidgetInfoArea(),
ui(new Ui::CCockpitComponent)
{
ui->setupUi(this);
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()
@@ -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)
{
ui->wip_CockpitComPanelShowHideBar->setVisible(floating);

View File

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