mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T506, partially reverted QDockWidget overlay messages
* for some reasons overlay message do not work with COverlayMessagesDockWidget when floating * so using COverlayMessagesFrame for ATC/Cockpit again * COverlayMessagesFrame does not have the issue with floating
This commit is contained in:
committed by
Mat Sutcliffe
parent
dda468b899
commit
8bb1915d97
@@ -58,7 +58,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CAtcStationComponent::CAtcStationComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
CIdentifiable(this),
|
||||
ui(new Ui::CAtcStationComponent)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ namespace BlackGui
|
||||
CUpperCaseValidator *ucv = new CUpperCaseValidator(ui->le_AtcStationsOnlineMetar);
|
||||
ui->le_AtcStationsOnlineMetar->setValidator(ucv);
|
||||
|
||||
this->deferredActivate(this);
|
||||
this->activateTextMessages(true);
|
||||
|
||||
// some icons
|
||||
ui->tb_AtcStationsAtisReload->setIcon(CIcons::atis());
|
||||
@@ -469,7 +469,7 @@ namespace BlackGui
|
||||
|
||||
void CAtcStationComponent::showOverlayInlineTextMessage()
|
||||
{
|
||||
CEnableForDockWidgetInfoArea::showOverlayInlineTextMessage(TextMessagesCom1);
|
||||
COverlayMessagesFrame::showOverlayInlineTextMessage(TextMessagesCom1);
|
||||
}
|
||||
|
||||
void CAtcStationComponent::onDetailsToggled(bool checked)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/settings/viewupdatesettings.h"
|
||||
#include "blackgui/settings/atcstationssettings.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/network.h"
|
||||
#include "blackmisc/aviation/atcstation.h"
|
||||
@@ -44,7 +45,7 @@ namespace BlackGui
|
||||
{
|
||||
//! ATC stations component
|
||||
class BLACKGUI_EXPORT CAtcStationComponent :
|
||||
public QFrame,
|
||||
public COverlayMessagesFrame,
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public BlackMisc::CIdentifiable
|
||||
{
|
||||
|
||||
@@ -22,13 +22,13 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CCockpitComponent::CCockpitComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
CEnableForDockWidgetInfoArea(),
|
||||
ui(new Ui::CCockpitComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_minHeightInfoArea = ui->comp_CockpitInfoArea->minimumHeight();
|
||||
this->deferredActivate(this);
|
||||
this->activateTextMessages(true);
|
||||
|
||||
connect(ui->wip_CockpitComPanelShowHideBar, &CShowHideBar::toggleShowHide, this, &CCockpitComponent::onToggleShowHideDetails);
|
||||
connect(ui->comp_CockpitComComponent, &CCockpitComComponent::requestCom1TextMessage, this, &CCockpitComponent::onRequestTextMessageCom1);
|
||||
@@ -123,7 +123,7 @@ namespace BlackGui
|
||||
void CCockpitComponent::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event) { this->showOverlayInlineTextMessage(TextMessagesAll); }
|
||||
QWidget::mouseDoubleClickEvent(event);
|
||||
COverlayMessagesFrame::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
void CCockpitComponent::onRequestTextMessageCom1()
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define BLACKGUI_COMPONENTS_COCKPITCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
|
||||
#include <QFrame>
|
||||
@@ -29,7 +30,7 @@ namespace BlackGui
|
||||
{
|
||||
//! Cockpit component: COM unit, show / hide bar, voice rooms
|
||||
class BLACKGUI_EXPORT CCockpitComponent :
|
||||
public QFrame,
|
||||
public COverlayMessagesFrame,
|
||||
public CEnableForDockWidgetInfoArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -34,36 +34,6 @@ namespace BlackGui
|
||||
m_parentDockableInfoArea = parentInfoArea;
|
||||
}
|
||||
|
||||
void CEnableForDockWidgetInfoArea::deferredActivate(QObject *relatedObject, int delayMs)
|
||||
{
|
||||
if (!relatedObject) { return; }
|
||||
QPointer<QObject> myself(relatedObject);
|
||||
QTimer::singleShot(delayMs, relatedObject, [ = ]
|
||||
{
|
||||
if (myself) { this->activateTextMessages(true); }
|
||||
});
|
||||
}
|
||||
|
||||
void CEnableForDockWidgetInfoArea::initOverlayMessages(QSize inner)
|
||||
{
|
||||
if (m_parentDockableInfoArea) { m_parentDockableInfoArea->initOverlayMessages(inner); }
|
||||
}
|
||||
|
||||
void CEnableForDockWidgetInfoArea::activateTextMessages(bool activate)
|
||||
{
|
||||
if (m_parentDockableInfoArea) { m_parentDockableInfoArea->activateTextMessages(activate); }
|
||||
}
|
||||
|
||||
void CEnableForDockWidgetInfoArea::showOverlayInlineTextMessage(TextMessageTab tab)
|
||||
{
|
||||
if (m_parentDockableInfoArea) { m_parentDockableInfoArea->showOverlayInlineTextMessage(tab); }
|
||||
}
|
||||
|
||||
void CEnableForDockWidgetInfoArea::showOverlayInlineTextMessage(const CCallsign &callsign)
|
||||
{
|
||||
if (m_parentDockableInfoArea) { m_parentDockableInfoArea->showOverlayInlineTextMessage(callsign); }
|
||||
}
|
||||
|
||||
bool CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
||||
{
|
||||
// sanity check
|
||||
|
||||
@@ -68,21 +68,6 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
virtual ~CEnableForDockWidgetInfoArea() {}
|
||||
|
||||
//! Deferred activation, as dockwidget is not directly initalized
|
||||
void deferredActivate(QObject *relatedObject, int delayMs = 2500);
|
||||
|
||||
//! \copydoc BlackGui::COverlayMessages::initOverlayMessages
|
||||
void initOverlayMessages(QSize inner = {});
|
||||
|
||||
//! \copydoc BlackGui::COverlayMessages::showKillButton
|
||||
void activateTextMessages(bool activate);
|
||||
|
||||
//! \copydoc BlackGui::COverlayMessages::showOverlayImage
|
||||
void showOverlayInlineTextMessage(Components::TextMessageTab tab);
|
||||
|
||||
//! \copydoc BlackGui::COverlayMessages::showOverlayImage
|
||||
void showOverlayInlineTextMessage(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
private:
|
||||
CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget
|
||||
BlackMisc::CConnectionGuard m_connections;
|
||||
|
||||
Reference in New Issue
Block a user