/* 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/datainfoareacomponent.h" #include "blackgui/components/datamaininfoareacomponent.h" #include "blackgui/components/dbaircrafticaocomponent.h" #include "blackgui/components/dbliverycomponent.h" #include "blackgui/components/dbmappingcomponent.h" #include "blackgui/components/dbmodelcomponent.h" #include "blackgui/components/logcomponent.h" #include "blackmisc/icons.h" #include "ui_datamaininfoareacomponent.h" #include using namespace BlackMisc; using namespace BlackGui; using namespace BlackGui::Components; namespace BlackGui { namespace Components { CDataMainInfoAreaComponent::CDataMainInfoAreaComponent(QWidget *parent) : CInfoArea(parent), ui(new Ui::CDataMainInfoAreaComponent) { ui->setupUi(this); initInfoArea(); // init base class this->setWindowIcon(CIcons::swiftDatabase24()); connect(ui->comp_Mapping, &CDbMappingComponent::filterByLivery, ui->comp_DataInfoArea->getLiveryComponent(), &CDbLiveryComponent::filter); connect(ui->comp_Mapping, &CDbMappingComponent::filterByAircraftIcao, ui->comp_DataInfoArea->getAircraftComponent(), &CDbAircraftIcaoComponent::filter); connect(ui->comp_Mapping, &CDbMappingComponent::requestUpdatedData, ui->comp_DataInfoArea, &CDataInfoAreaComponent::requestUpdatedData); connect(ui->comp_DataInfoArea->getModelComponent(), &CDbModelComponent::requestStash, ui->comp_Mapping, &CDbMappingComponent::stashModels); connect(ui->comp_Log, &CLogComponent::requestAttention, this, &CDataMainInfoAreaComponent::selectLog); } CDataMainInfoAreaComponent::~CDataMainInfoAreaComponent() { } CLogComponent *CDataMainInfoAreaComponent::getLogComponent() const { return this->ui->comp_Log; } CDbMappingComponent *CDataMainInfoAreaComponent::getMappingComponent() const { return this->ui->comp_Mapping; } CDataInfoAreaComponent *CDataMainInfoAreaComponent::getDataInfoAreaComponent() const { return this->ui->comp_DataInfoArea; } void CDataMainInfoAreaComponent::displayLog() { this->selectArea(InfoAreaLog); this->getLogComponent()->displayLog(); } void CDataMainInfoAreaComponent::displayConsole() { this->selectArea(InfoAreaLog); this->getLogComponent()->displayConsole(); } void CDataMainInfoAreaComponent::selectLog() { this->selectArea(InfoAreaLog); } QSize CDataMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const { InfoArea area = static_cast(areaIndex); switch (area) { case InfoAreaData: case InfoAreaMapping: case InfoAreaSettings: case InfoAreaLog: default: return QSize(800, 600); } } const QPixmap &CDataMainInfoAreaComponent::indexToPixmap(int areaIndex) const { InfoArea area = static_cast(areaIndex); switch (area) { case InfoAreaData: return CIcons::appDatabase16(); case InfoAreaMapping: return CIcons::appMappings16(); case InfoAreaSettings: return CIcons::appSettings16(); case InfoAreaLog: return CIcons::appLog16(); default: return CIcons::empty(); } } } // ns } // ns