From e6a5e2960f2880005946c5051cc6657848dfc6c2 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 16 Oct 2014 03:06:08 +0200 Subject: [PATCH] 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 --- src/blackgui/components/aircraftcomponent.cpp | 2 +- .../components/atcstationcomponent.cpp | 2 +- .../components/cockpitcomcomponent.cpp | 2 +- .../components/cockpitcomcomponent.ui | 38 +------ .../components/cockpitinfoareacomponent.cpp | 22 ++-- .../components/cockpitinfoareacomponent.h | 18 ++- .../components/cockpitinfoareacomponent.ui | 106 +++++++++++------- .../enablefordockwidgetinfoarea.cpp | 8 +- .../components/enablefordockwidgetinfoarea.h | 5 +- .../components/maininfoareacomponent.h | 2 +- .../components/maininfoareacomponent.ui | 20 ++-- .../components/simulatorcomponent.cpp | 2 +- src/blackgui/components/usercomponent.cpp | 2 +- 13 files changed, 117 insertions(+), 112 deletions(-) diff --git a/src/blackgui/components/aircraftcomponent.cpp b/src/blackgui/components/aircraftcomponent.cpp index 715e4dfaf..60e3cdeec 100644 --- a/src/blackgui/components/aircraftcomponent.cpp +++ b/src/blackgui/components/aircraftcomponent.cpp @@ -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) { diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp index f9e7fe46f..c0a3bca5f 100644 --- a/src/blackgui/components/atcstationcomponent.cpp +++ b/src/blackgui/components/atcstationcomponent.cpp @@ -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) { diff --git a/src/blackgui/components/cockpitcomcomponent.cpp b/src/blackgui/components/cockpitcomcomponent.cpp index dd2a1c736..8815ef8aa 100644 --- a/src/blackgui/components/cockpitcomcomponent.cpp +++ b/src/blackgui/components/cockpitcomcomponent.cpp @@ -19,7 +19,7 @@ namespace BlackGui { CCockpitComComponent::CCockpitComComponent(QWidget *parent) : QFrame(parent), - CEnableForDockWidgetInfoArea(this), + CEnableForDockWidgetInfoArea(), ui(new Ui::CCockpitMainComponent) { ui->setupUi(this); diff --git a/src/blackgui/components/cockpitcomcomponent.ui b/src/blackgui/components/cockpitcomcomponent.ui index 97cd4d969..232d1ee39 100644 --- a/src/blackgui/components/cockpitcomcomponent.ui +++ b/src/blackgui/components/cockpitcomcomponent.ui @@ -7,7 +7,7 @@ 0 0 363 - 99 + 101 @@ -17,7 +17,7 @@ - Frame + Cockpit COM QFrame::StyledPanel @@ -568,40 +568,6 @@ - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - diff --git a/src/blackgui/components/cockpitinfoareacomponent.cpp b/src/blackgui/components/cockpitinfoareacomponent.cpp index 6e71a4c0f..02adb2329 100644 --- a/src/blackgui/components/cockpitinfoareacomponent.cpp +++ b/src/blackgui/components/cockpitinfoareacomponent.cpp @@ -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(areaIndex); + switch (area) + { + case InfoAreaAudio: + return CIcons::appAudio16(); + case InfoAreaVoiceRooms: + return CIcons::appVoiceRooms16(); + default: + return CIcons::empty(); + } } } // namespace diff --git a/src/blackgui/components/cockpitinfoareacomponent.h b/src/blackgui/components/cockpitinfoareacomponent.h index a75865436..a48dfc6a6 100644 --- a/src/blackgui/components/cockpitinfoareacomponent.h +++ b/src/blackgui/components/cockpitinfoareacomponent.h @@ -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(infoArea)); } + + //! Select area + void selectArea(InfoArea infoArea) { CInfoArea::selectArea(static_cast(infoArea)); } protected: //! \copydoc CInfoArea::getPreferredSizeWhenFloating diff --git a/src/blackgui/components/cockpitinfoareacomponent.ui b/src/blackgui/components/cockpitinfoareacomponent.ui index f2a1a8104..2ea2a6661 100644 --- a/src/blackgui/components/cockpitinfoareacomponent.ui +++ b/src/blackgui/components/cockpitinfoareacomponent.ui @@ -6,46 +6,45 @@ 0 0 - 80 - 75 + 161 + 67 + + + 0 + 0 + + - MainWindow + Cockpit info area + + + false + + + false + + + QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - + + + 0 + 0 + + - + + false + + + QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable + - Qt::TopDockWidgetArea + Qt::BottomDockWidgetArea Voice rooms @@ -83,6 +82,37 @@ + + + false + + + QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable + + + Qt::BottomDockWidgetArea + + + Audio + + + 8 + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + @@ -91,18 +121,18 @@
blackgui/dockwidgetinfoarea.h
1
- - BlackGui::Components::CCockpitComComponent - QFrame -
blackgui/components/cockpitcomcomponent.h
- 1 -
BlackGui::Components::CVoiceRoomsComponent QFrame
blackgui/components/voiceroomscomponent.h
1
+ + BlackGui::Components::CAudioComponent + QFrame +
blackgui/components/audiocomponent.h
+ 1 +
diff --git a/src/blackgui/components/enablefordockwidgetinfoarea.cpp b/src/blackgui/components/enablefordockwidgetinfoarea.cpp index 46820ae42..a9f5dd947 100644 --- a/src/blackgui/components/enablefordockwidgetinfoarea.cpp +++ b/src/blackgui/components/enablefordockwidgetinfoarea.cpp @@ -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(parent); - if (ia) - { - this->m_parentDockableInfoArea = ia; - } + this->m_parentDockableInfoArea = parentInfoArea; } bool CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget) diff --git a/src/blackgui/components/enablefordockwidgetinfoarea.h b/src/blackgui/components/enablefordockwidgetinfoarea.h index 9e81dc2aa..705b42935 100644 --- a/src/blackgui/components/enablefordockwidgetinfoarea.h +++ b/src/blackgui/components/enablefordockwidgetinfoarea.h @@ -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 diff --git a/src/blackgui/components/maininfoareacomponent.h b/src/blackgui/components/maininfoareacomponent.h index 690050d0d..0feddd01f 100644 --- a/src/blackgui/components/maininfoareacomponent.h +++ b/src/blackgui/components/maininfoareacomponent.h @@ -86,7 +86,7 @@ namespace BlackGui CTextMessageComponent *getTextMessageComponent(); //! Selected area of non floating areas - InfoArea getSelectedInfoArea() const { return static_cast(getSelectedTabBarIndex()); } +// InfoArea getSelectedInfoArea() const { return static_cast(getSelectedTabBarIndex()); } public slots: //! Toggle floating of given area diff --git a/src/blackgui/components/maininfoareacomponent.ui b/src/blackgui/components/maininfoareacomponent.ui index b116e5ca0..85fd73e46 100644 --- a/src/blackgui/components/maininfoareacomponent.ui +++ b/src/blackgui/components/maininfoareacomponent.ui @@ -27,16 +27,16 @@ - true + false - true + false false - QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::ForceTabbedDocks + QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks @@ -67,7 +67,7 @@ 0 - + @@ -573,12 +573,6 @@
blackgui/dockwidgetinfoarea.h
1 - - BlackGui::Components::CCockpitInfoAreaComponent - QWidget -
blackgui/components/cockpitinfoareacomponent.h
- 1 -
BlackGui::Components::CAtcStationComponent QTabWidget @@ -627,6 +621,12 @@
blackgui/components/simulatorcomponent.h
1
+ + BlackGui::Components::CCockpitComponent + QWidget +
blackgui/components/cockpitcomponent.h
+ 1 +
diff --git a/src/blackgui/components/simulatorcomponent.cpp b/src/blackgui/components/simulatorcomponent.cpp index 2126ce868..caf15ca4a 100644 --- a/src/blackgui/components/simulatorcomponent.cpp +++ b/src/blackgui/components/simulatorcomponent.cpp @@ -17,7 +17,7 @@ namespace BlackGui { CSimulatorComponent::CSimulatorComponent(QWidget *parent) : QTabWidget(parent), - CEnableForDockWidgetInfoArea(this), + CEnableForDockWidgetInfoArea(), ui(new Ui::CSimulatorComponent) { ui->setupUi(this); diff --git a/src/blackgui/components/usercomponent.cpp b/src/blackgui/components/usercomponent.cpp index 3651563f7..86630459f 100644 --- a/src/blackgui/components/usercomponent.cpp +++ b/src/blackgui/components/usercomponent.cpp @@ -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) {