From 777e3701c682c7288baf7d0ca6fe6132e47dd720 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 24 Sep 2015 00:54:36 +0200 Subject: [PATCH] refs #452 the info area for the DB components --- .../components/datainfoareacomponent.cpp | 115 +++++ .../components/datainfoareacomponent.h | 99 ++++ .../components/datainfoareacomponent.ui | 485 ++++++++++++++++++ 3 files changed, 699 insertions(+) create mode 100644 src/blackgui/components/datainfoareacomponent.cpp create mode 100644 src/blackgui/components/datainfoareacomponent.h create mode 100644 src/blackgui/components/datainfoareacomponent.ui diff --git a/src/blackgui/components/datainfoareacomponent.cpp b/src/blackgui/components/datainfoareacomponent.cpp new file mode 100644 index 000000000..2da41c16d --- /dev/null +++ b/src/blackgui/components/datainfoareacomponent.cpp @@ -0,0 +1,115 @@ +/* Copyright (C) 2015 + * 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/logcomponent.h" +#include "blackgui/components/datainfoareacomponent.h" +#include "blackcore/webdataservices.h" +#include "ui_datainfoareacomponent.h" +#include "blackmisc/icons.h" + +using namespace BlackMisc; +using namespace BlackGui; +using namespace BlackGui::Components; + +namespace BlackGui +{ + namespace Components + { + CDataInfoAreaComponent::CDataInfoAreaComponent(QWidget *parent) : + CInfoArea(parent), + ui(new Ui::CDataInfoAreaComponent) + { + ui->setupUi(this); + initInfoArea(); // init base class + this->setWindowIcon(CIcons::swiftDatabase24()); + this->ps_setTabBarPosition(QTabWidget::North); + } + + CDataInfoAreaComponent::~CDataInfoAreaComponent() + { } + + CDbModelComponent *CDataInfoAreaComponent::getModelComponent() const + { + return this->ui->comp_DbModels; + } + + CDbLiveryComponent *CDataInfoAreaComponent::getLiveryComponent() const + { + return this->ui->comp_DbLiveries; + } + + CDbDistributorComponent *CDataInfoAreaComponent::getDistributorComponent() const + { + return this->ui->comp_DbDistributors; + } + + CDbAircraftIcaoComponent *CDataInfoAreaComponent::getAircraftComponent() const + { + return this->ui->comp_AircraftIcao; + } + + CDbAirlineIcaoComponent *CDataInfoAreaComponent::getAirlineComponent() const + { + return this->ui->comp_AirlineIcao; + } + + CDbCountryComponent *CDataInfoAreaComponent::getCountryComponent() const + { + return this->ui->comp_Countries; + } + + void CDataInfoAreaComponent::setProvider(BlackMisc::Network::IWebDataServicesProvider *provider) + { + Q_ASSERT_X(provider, Q_FUNC_INFO, "Missing provider"); + this->ui->comp_AircraftIcao->setProvider(provider); + this->ui->comp_AirlineIcao->setProvider(provider); + this->ui->comp_DbDistributors->setProvider(provider); + this->ui->comp_DbLiveries->setProvider(provider); + this->ui->comp_DbModels->setProvider(provider); + this->ui->comp_Countries->setProvider(provider); + } + + QSize CDataInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const + { + InfoArea area = static_cast(areaIndex); + switch (area) + { + case InfoAreaAircraftIcao: + case InfoAreaAirlineIcao: + case InfoAreaLiveries: + case InfoAreaModels: + case InfoAreaCountries: + default: + return QSize(800, 600); + } + } + + const QPixmap &CDataInfoAreaComponent::indexToPixmap(int areaIndex) const + { + InfoArea area = static_cast(areaIndex); + switch (area) + { + case InfoAreaAircraftIcao: + return CIcons::appAircraftIcao16(); + case InfoAreaAirlineIcao: + return CIcons::appAirlineIcao16(); + case InfoAreaLiveries: + return CIcons::appLiveries16(); + case InfoAreaDistributors: + return CIcons::appDistributors16(); + case InfoAreaModels: + return CIcons::appModels16(); + case InfoAreaCountries: + return CIcons::appCountries16(); + default: + return CIcons::empty(); + } + } + } // ns +} // ns diff --git a/src/blackgui/components/datainfoareacomponent.h b/src/blackgui/components/datainfoareacomponent.h new file mode 100644 index 000000000..e8f1ff786 --- /dev/null +++ b/src/blackgui/components/datainfoareacomponent.h @@ -0,0 +1,99 @@ +/* Copyright (C) 2014 + * 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_DATAINFOAREACOMPONENT_H +#define BLACKGUI_DATAINFOAREACOMPONENT_H + +#include "blackgui/blackguiexport.h" +#include "blackgui/infoarea.h" +#include "blackmisc/network/webdataservicesprovider.h" +#include +#include + +namespace Ui { class CDataInfoAreaComponent; } + +namespace BlackGui +{ + namespace Components + { + class CDataMappingComponent; + class CDbAircraftIcaoComponent; + class CDbAirlineIcaoComponent; + class CDbModelComponent; + class CDbDistributorComponent; + class CDbLiveryComponent; + class CDbCountryComponent; + + /** + * Main info area for data entry tool + */ + class BLACKGUI_EXPORT CDataInfoAreaComponent : + public BlackGui::CInfoArea, + public BlackMisc::Network::CWebDataServicesAware + { + Q_OBJECT + + public: + //! Info areas + enum InfoArea + { + // index must match tab index! + InfoAreaModels = 0, + InfoAreaLiveries = 1, + InfoAreaDistributors = 2, + InfoAreaAircraftIcao = 3, + InfoAreaAirlineIcao = 4, + InfoAreaCountries = 5, + InfoAreaNone = -1 + }; + + //! Constructor + explicit CDataInfoAreaComponent(QWidget *parent = nullptr); + + //! Destructor + ~CDataInfoAreaComponent(); + + //! DB model component + CDbModelComponent *getModelComponent() const; + + //! DB livery component + CDbLiveryComponent *getLiveryComponent() const; + + //! DB distributor component + CDbDistributorComponent *getDistributorComponent() const; + + //! DB aircraft ICAO component + CDbAircraftIcaoComponent *getAircraftComponent() const; + + //! DB airline ICAO component + CDbAirlineIcaoComponent *getAirlineComponent() const; + + //! DB country component + CDbCountryComponent *getCountryComponent() const; + + //! Set data reader + virtual void setProvider(BlackMisc::Network::IWebDataServicesProvider *webDataReader) override; + + protected: + //! \copydoc CInfoArea::getPreferredSizeWhenFloating + virtual QSize getPreferredSizeWhenFloating(int areaIndex) const override; + + //! \copydoc CInfoArea::indexToPixmap + virtual const QPixmap &indexToPixmap(int areaIndex) const override; + + private: + QScopedPointer ui; + }; + + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/datainfoareacomponent.ui b/src/blackgui/components/datainfoareacomponent.ui new file mode 100644 index 000000000..c9557d3ec --- /dev/null +++ b/src/blackgui/components/datainfoareacomponent.ui @@ -0,0 +1,485 @@ + + + CDataInfoAreaComponent + + + + 0 + 0 + 485 + 55 + + + + MainWindow + + + + + 0 + 3 + + + + + + Qt::TopDockWidgetArea + + + Aircraft models + + + 4 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + Qt::TopDockWidgetArea + + + Liveries + + + 4 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + Qt::TopDockWidgetArea + + + Distributors + + + 4 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + Qt::TopDockWidgetArea + + + Aircraft ICAO + + + 4 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + Qt::TopDockWidgetArea + + + Airline ICAO + + + 4 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + Qt::TopDockWidgetArea + + + Countries + + + 4 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + + BlackGui::CDockWidgetInfoArea + QDockWidget +
blackgui/dockwidgetinfoarea.h
+ 1 +
+ + BlackGui::Components::CDbModelComponent + QFrame +
blackgui/components/dbmodelcomponent.h
+ 1 +
+ + BlackGui::Components::CDbLiveryComponent + QFrame +
blackgui/components/dbliverycomponent.h
+ 1 +
+ + BlackGui::Components::CDbDistributorComponent + QFrame +
blackgui/components/dbdistributorcomponent.h
+ 1 +
+ + BlackGui::Components::CDbAircraftIcaoComponent + QFrame +
blackgui/components/dbaircrafticaocomponent.h
+ 1 +
+ + BlackGui::Components::CDbAirlineIcaoComponent + QFrame +
blackgui/components/dbairlineicaocomponent.h
+ 1 +
+ + BlackGui::Components::CDbCountryComponent + QFrame +
blackgui/components/dbcountrycomponent.h
+ 1 +
+
+ + +