mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
Moved CEnableForDockWidgetInfoArea to ns BlackGui, was in BlackGui::Components for some reason
Discovered during T536
This commit is contained in:
committed by
Mat Sutcliffe
parent
8957d1d767
commit
22ae03bd3b
@@ -9,13 +9,13 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_AIRCRAFTCOMPONENT_H
|
||||
#define BLACKGUI_AIRCRAFTCOMPONENT_H
|
||||
#ifndef BLACKGUI_COMPONENTS_AIRCRAFTCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_AIRCRAFTCOMPONENT_H
|
||||
|
||||
#include "blackcore/network.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/settings/viewupdatesettings.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/network.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_ATCSTATIONCOMPONENT_H
|
||||
#define BLACKGUI_ATCSTATIONCOMPONENT_H
|
||||
#ifndef BLACKGUI_COMPONENTS_ATCSTATIONCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_ATCSTATIONCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/settings/viewupdatesettings.h"
|
||||
#include "blackgui/settings/atcstationssettings.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/network.h"
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||
#define BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||
#ifndef BLACKGUI_COMPONENTS_COCKPITCOMCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_COCKPITCOMCOMPONENT_H
|
||||
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
|
||||
#include "blackmisc/audio/voiceroomlist.h"
|
||||
#include "blackmisc/aviation/selcal.h"
|
||||
#include "blackmisc/aviation/transponder.h"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_COCKPITCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_COCKPITCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBAIRCRAFTCATEGORYCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBAIRCRAFTCATEGORYCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBAIRCRAFTICAOCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBAIRCRAFTICAOCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBAIRLINEICAOCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBAIRLINEICAOCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBCOUNTRYCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBCOUNTRYCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBDISTRIBUTORCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBDISTRIBUTORCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include <QFrame>
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBLIVERYCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBLIVERYCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/menus/menudelegate.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define BLACKUI_COMPONENTS_DBMODELCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/dbmappingcomponentaware.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBSTASHCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBSTASHCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/dbmappingcomponentaware.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
#include "blackmisc/propertyindexvariantmap.h"
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/dockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforframelesswindow.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/infoarea.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QMetaObject>
|
||||
#include <QObject>
|
||||
#include <QtGlobal>
|
||||
#include <QTimer>
|
||||
#include <QPointer>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackGui;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CEnableForDockWidgetInfoArea::CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea)
|
||||
{
|
||||
// it the parent is already an info area at this time, we keep it
|
||||
// otherwise we expect the info area to set it later
|
||||
m_parentDockableInfoArea = parentInfoArea;
|
||||
}
|
||||
|
||||
bool CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
||||
{
|
||||
// sanity check
|
||||
if (m_parentDockableInfoArea)
|
||||
{
|
||||
// we already have a value
|
||||
// changes should not happen
|
||||
Q_ASSERT_X(m_parentDockableInfoArea == parentDockableWidget, Q_FUNC_INFO, "Reassigned parent dock widget area");
|
||||
return m_parentDockableInfoArea == parentDockableWidget;
|
||||
}
|
||||
|
||||
m_parentDockableInfoArea = parentDockableWidget;
|
||||
QMetaObject::Connection con = QDockWidget::connect(parentDockableWidget, &QDockWidget::destroyed, [this]
|
||||
{
|
||||
// break dependency to dockable widget
|
||||
m_parentDockableInfoArea = nullptr;
|
||||
});
|
||||
Q_ASSERT_X(con, Q_FUNC_INFO, "Connection failed");
|
||||
m_connections.append(con);
|
||||
return true;
|
||||
}
|
||||
|
||||
CInfoArea *CEnableForDockWidgetInfoArea::getParentInfoArea() const
|
||||
{
|
||||
Q_ASSERT(m_parentDockableInfoArea);
|
||||
if (!m_parentDockableInfoArea) return nullptr;
|
||||
return m_parentDockableInfoArea->getParentInfoArea();
|
||||
}
|
||||
|
||||
bool CEnableForDockWidgetInfoArea::isParentDockWidgetFloating() const
|
||||
{
|
||||
Q_ASSERT(m_parentDockableInfoArea);
|
||||
if (!m_parentDockableInfoArea) { return false; }
|
||||
return m_parentDockableInfoArea->isFloating();
|
||||
}
|
||||
|
||||
bool CEnableForDockWidgetInfoArea::isVisibleWidget() const
|
||||
{
|
||||
if (!m_parentDockableInfoArea) { return false; } // can happen function is used while dock widget not yet fully initialized
|
||||
return m_parentDockableInfoArea->isVisibleWidget();
|
||||
}
|
||||
|
||||
CEnableForFramelessWindow *CEnableForDockWidgetInfoArea::mainApplicationWindow() const
|
||||
{
|
||||
CEnableForFramelessWindow *mw = CGuiUtility::mainFramelessEnabledWindow();
|
||||
return mw;
|
||||
}
|
||||
|
||||
QWidget *CEnableForDockWidgetInfoArea::mainApplicationWindowWidget() const
|
||||
{
|
||||
CEnableForFramelessWindow *mw = this->mainApplicationWindow();
|
||||
return mw ? mw->getWidget() : nullptr;
|
||||
}
|
||||
|
||||
void CEnableForDockWidgetInfoArea::displayMyself()
|
||||
{
|
||||
// if we are already visible, we are done
|
||||
if (this->isVisibleWidget()) { return; }
|
||||
|
||||
// select myself
|
||||
if (this->getParentInfoArea())
|
||||
{
|
||||
this->getParentInfoArea()->selectArea(this->getDockWidgetInfoArea());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -1,78 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_ENABLEFORDOCKWIDGETINFOAREA_H
|
||||
#define BLACKGUI_ENABLEFORDOCKWIDGETINFOAREA_H
|
||||
|
||||
#include "blackgui/components/textmessagecomponenttab.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/connectionguard.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
class CDockWidgetInfoArea;
|
||||
class CEnableForFramelessWindow;
|
||||
class CInfoArea;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
//! Helper class: If a component is residing in an dockable widget.
|
||||
//! This class provides access to its info area and dockable widget.
|
||||
class BLACKGUI_EXPORT CEnableForDockWidgetInfoArea
|
||||
{
|
||||
public:
|
||||
//! Corresponding dockable widget in info area
|
||||
CDockWidgetInfoArea *getDockWidgetInfoArea() const { return m_parentDockableInfoArea; }
|
||||
|
||||
//! Has dock area?
|
||||
bool hasDockWidgetArea() const { return m_parentDockableInfoArea; }
|
||||
|
||||
//! Corresponding dockable widget in info area
|
||||
//! \remarks Usually set from CDockWidgetInfoArea when it is fully initialized
|
||||
virtual bool setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget);
|
||||
|
||||
//! The parent info area
|
||||
CInfoArea *getParentInfoArea() const;
|
||||
|
||||
//! Is the parent dockable widget floating?
|
||||
bool isParentDockWidgetFloating() const;
|
||||
|
||||
//! \copydoc CDockWidgetInfoArea::isVisibleWidget
|
||||
bool isVisibleWidget() const;
|
||||
|
||||
//! Main application window if any
|
||||
CEnableForFramelessWindow *mainApplicationWindow() const;
|
||||
|
||||
//! Main application window widget if any
|
||||
QWidget *mainApplicationWindowWidget() const;
|
||||
|
||||
//! Display myself
|
||||
void displayMyself();
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
//! \remarks Normally the info area will be provided later \sa setParentDockWidgetInfoArea
|
||||
CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CEnableForDockWidgetInfoArea() {}
|
||||
|
||||
private:
|
||||
CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget
|
||||
BlackMisc::CConnectionGuard m_connections;
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
@@ -12,11 +12,11 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_MAPPINGCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_MAPPINGCOMPONENT_H
|
||||
|
||||
#include "blackcore/network.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/settings/viewupdatesettings.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/network.h"
|
||||
#include "blackmisc/tokenbucket.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_RADARCOMPONENT_H
|
||||
#define BLACKGUI_RADARCOMPONENT_H
|
||||
#ifndef BLACKGUI_COMPONENTS_RADARCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_RADARCOMPONENT_H
|
||||
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItemGroup>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_SIMULATORCOMPONENT_H
|
||||
#define BLACKGUI_SIMULATORCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "textmessagecomponenttab.h"
|
||||
#include "blackgui/settings/textmessagesettings.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/aviation/atcstation.h"
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
#ifndef BLACKGUI_USERCOMPONENT_H
|
||||
#define BLACKGUI_USERCOMPONENT_H
|
||||
|
||||
#include "blackcore/network.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/settings/viewupdatesettings.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackcore/network.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
@@ -69,6 +69,6 @@ namespace BlackGui
|
||||
QTimer m_updateTimer;
|
||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settings { this, &CUserComponent::onSettingsChanged };
|
||||
};
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user