mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
refs #335, changed info areas
* remove unused methods * changed ui, preferred size and such * changed ctor for CEnableForDockWidgetInfoArea and made setParentDockWidgetInfoArea virtual * adjusted derived classes ctor * added enum and area methods for cockpitinfoarea
This commit is contained in:
committed by
Roland Winklmeier
parent
594df164a2
commit
e6a5e2960f
@@ -24,7 +24,7 @@ namespace BlackGui
|
||||
|
||||
CAircraftComponent::CAircraftComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForDockWidgetInfoArea(),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CAircraftComponent), m_updateTimer(nullptr)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackGui
|
||||
{
|
||||
CAtcStationComponent::CAtcStationComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForDockWidgetInfoArea(),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CAtcStationComponent), m_updateTimer(nullptr)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace BlackGui
|
||||
{
|
||||
CCockpitComComponent::CCockpitComComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForDockWidgetInfoArea(),
|
||||
ui(new Ui::CCockpitMainComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>363</width>
|
||||
<height>99</height>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -17,7 +17,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
<string>Cockpit COM</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -568,40 +568,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="wi_CockpitComPanelBottomSpacer" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_CockpitComPanelBottomSpacer">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="vs_CockpitComPanelBottomSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -24,20 +24,12 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initInfoArea();
|
||||
if (this->statusBar())
|
||||
{
|
||||
this->statusBar()->hide();
|
||||
}
|
||||
this->ps_setTabBarPosition(QTabWidget::North);
|
||||
}
|
||||
|
||||
CCockpitInfoAreaComponent::~CCockpitInfoAreaComponent()
|
||||
{ }
|
||||
|
||||
void CCockpitInfoAreaComponent::toggleFloating()
|
||||
{
|
||||
CInfoArea::toggleFloating();
|
||||
}
|
||||
|
||||
QSize CCockpitInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const
|
||||
{
|
||||
Q_UNUSED(areaIndex);
|
||||
@@ -46,8 +38,16 @@ namespace BlackGui
|
||||
|
||||
const QPixmap &CCockpitInfoAreaComponent::indexToPixmap(int areaIndex) const
|
||||
{
|
||||
Q_UNUSED(areaIndex);
|
||||
return CIcons::empty16();
|
||||
InfoArea area = static_cast<InfoArea>(areaIndex);
|
||||
switch (area)
|
||||
{
|
||||
case InfoAreaAudio:
|
||||
return CIcons::appAudio16();
|
||||
case InfoAreaVoiceRooms:
|
||||
return CIcons::appVoiceRooms16();
|
||||
default:
|
||||
return CIcons::empty();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BlackGui
|
||||
{
|
||||
//! The cockpit itself is part of the main info area, but itself also an info area.
|
||||
//! hence windows can be docked in the cockpit too.
|
||||
class CCockpitInfoAreaComponent : public CInfoArea
|
||||
class CCockpitInfoAreaComponent : public BlackGui::CInfoArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -34,9 +34,21 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
~CCockpitInfoAreaComponent();
|
||||
|
||||
//! Info areas
|
||||
enum InfoArea
|
||||
{
|
||||
// index must match tab index!
|
||||
InfoAreaVoiceRooms = 0,
|
||||
InfoAreaAudio = 1,
|
||||
InfoAreaNone = -1
|
||||
};
|
||||
|
||||
public slots:
|
||||
//! CInfoArea::toggleFloating
|
||||
virtual void toggleFloating() override;
|
||||
//! Toggle floating of given area
|
||||
void toggleFloating(InfoArea infoArea) { CInfoArea::toggleFloating(static_cast<int>(infoArea)); }
|
||||
|
||||
//! Select area
|
||||
void selectArea(InfoArea infoArea) { CInfoArea::selectArea(static_cast<int>(infoArea)); }
|
||||
|
||||
protected:
|
||||
//! \copydoc CInfoArea::getPreferredSizeWhenFloating
|
||||
|
||||
@@ -6,46 +6,45 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>80</width>
|
||||
<height>75</height>
|
||||
<width>161</width>
|
||||
<height>67</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>Cockpit info area</string>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="documentMode">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_CockpitInfoAreaComComponent">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CCockpitComComponent" name="comp_CockpitComComponent">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="sb_CockpitInfoAreaStatusBar"/>
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dw_CockpitVoiceRooms">
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::TopDockWidgetArea</set>
|
||||
<set>Qt::BottomDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Voice rooms</string>
|
||||
@@ -83,6 +82,37 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dw_Audio">
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::BottomDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="qw_Audio">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CAudioComponent" name="comp_Audio">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
@@ -91,18 +121,18 @@
|
||||
<header>blackgui/dockwidgetinfoarea.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CCockpitComComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/cockpitcomcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CVoiceRoomsComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/voiceroomscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CAudioComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/audiocomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -14,15 +14,11 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
|
||||
CEnableForDockWidgetInfoArea::CEnableForDockWidgetInfoArea(QWidget *parent)
|
||||
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
|
||||
CDockWidgetInfoArea *ia = dynamic_cast<CDockWidgetInfoArea *>(parent);
|
||||
if (ia)
|
||||
{
|
||||
this->m_parentDockableInfoArea = ia;
|
||||
}
|
||||
this->m_parentDockableInfoArea = parentInfoArea;
|
||||
}
|
||||
|
||||
bool CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace BlackGui
|
||||
|
||||
//! Corresponding dockable widget in info area
|
||||
//! \remarks Usually set from CDockWidgetInfoArea when it is fully initialized
|
||||
bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget);
|
||||
virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget);
|
||||
|
||||
//! The parent info area
|
||||
const CInfoArea *getParentInfoArea() const;
|
||||
@@ -50,7 +50,8 @@ namespace BlackGui
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CEnableForDockWidgetInfoArea(QWidget *parent);
|
||||
//! \remarks Normally the infoa area will be provided later \sa setParentDockWidgetInfoArea
|
||||
CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea = nullptr);
|
||||
|
||||
private:
|
||||
BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace BlackGui
|
||||
CTextMessageComponent *getTextMessageComponent();
|
||||
|
||||
//! Selected area of non floating areas
|
||||
InfoArea getSelectedInfoArea() const { return static_cast<InfoArea>(getSelectedTabBarIndex()); }
|
||||
// InfoArea getSelectedInfoArea() const { return static_cast<InfoArea>(getSelectedTabBarIndex()); }
|
||||
|
||||
public slots:
|
||||
//! Toggle floating of given area
|
||||
|
||||
@@ -27,16 +27,16 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="documentMode">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dockNestingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_centralWidgetEmpty"/>
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dw_Cockpit">
|
||||
@@ -67,7 +67,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CCockpitInfoAreaComponent" name="comp_CockpitInfoArea" native="true"/>
|
||||
<widget class="BlackGui::Components::CCockpitComponent" name="comp_CockpitInfoArea" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -573,12 +573,6 @@
|
||||
<header>blackgui/dockwidgetinfoarea.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CCockpitInfoAreaComponent</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>blackgui/components/cockpitinfoareacomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CAtcStationComponent</class>
|
||||
<extends>QTabWidget</extends>
|
||||
@@ -627,6 +621,12 @@
|
||||
<header>blackgui/components/simulatorcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CCockpitComponent</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>blackgui/components/cockpitcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace BlackGui
|
||||
{
|
||||
CSimulatorComponent::CSimulatorComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForDockWidgetInfoArea(),
|
||||
ui(new Ui::CSimulatorComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BlackGui
|
||||
{
|
||||
CUserComponent::CUserComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForDockWidgetInfoArea(),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CUserComponent), m_updateTimer(nullptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user