mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #452 removed old data mapping component
This commit is contained in:
committed by
Mathew Sutcliffe
parent
777e3701c6
commit
18c12db710
@@ -1,87 +0,0 @@
|
||||
/* 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 "datamappingcomponent.h"
|
||||
#include "ui_datamappingcomponent.h"
|
||||
#include "blackcore/web_datareader.h"
|
||||
|
||||
using namespace BlackGui::Views;
|
||||
using namespace BlackCore;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CDataMappingComponent::CDataMappingComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CDataMappingComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(this->ui->tvp_Distributors, &CDistributorView::requestUpdate, this, &CDataMappingComponent::ps_requestModelDataUpdate);
|
||||
connect(this->ui->tvp_Liveries, &CLiveryView::requestUpdate, this, &CDataMappingComponent::ps_requestModelDataUpdate);
|
||||
connect(this->ui->tvp_Models, &CLiveryView::requestUpdate, this, &CDataMappingComponent::ps_requestModelDataUpdate);
|
||||
}
|
||||
|
||||
CDataMappingComponent::~CDataMappingComponent()
|
||||
{ }
|
||||
|
||||
void CDataMappingComponent::readersInitialized(CWebDataReader *webReaders)
|
||||
{
|
||||
Q_ASSERT_X(webReaders, Q_FUNC_INFO, "Missing readers");
|
||||
if (this->m_webDataReader) { return; }
|
||||
if (!this->m_webReaderSignalConnections.isEmpty()) { return; }
|
||||
this->m_webDataReader = webReaders;
|
||||
this->m_webReaderSignalConnections = this->m_webDataReader->connectSwiftDatabaseSignals(
|
||||
this, // the object here must be the same as in the bind
|
||||
std::bind(&CDataMappingComponent::ps_aircraftIcaoCodeRead, this, std::placeholders::_1),
|
||||
std::bind(&CDataMappingComponent::ps_airlineIcaoCodeRead, this, std::placeholders::_1),
|
||||
std::bind(&CDataMappingComponent::ps_liveriesRead, this, std::placeholders::_1),
|
||||
std::bind(&CDataMappingComponent::ps_distributorsRead, this, std::placeholders::_1),
|
||||
std::bind(&CDataMappingComponent::ps_modelsRead, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
void CDataMappingComponent::ps_aircraftIcaoCodeRead(int number)
|
||||
{
|
||||
Q_UNUSED(number);
|
||||
}
|
||||
|
||||
void CDataMappingComponent::ps_airlineIcaoCodeRead(int number)
|
||||
{
|
||||
Q_UNUSED(number);
|
||||
}
|
||||
|
||||
void CDataMappingComponent::ps_liveriesRead(int number)
|
||||
{
|
||||
Q_ASSERT_X(this->m_webDataReader, Q_FUNC_INFO, "Missing reader");
|
||||
Q_UNUSED(number);
|
||||
this->ui->tvp_Liveries->updateContainerMaybeAsync(this->m_webDataReader->getLiveries());
|
||||
}
|
||||
|
||||
void CDataMappingComponent::ps_distributorsRead(int number)
|
||||
{
|
||||
Q_ASSERT_X(this->m_webDataReader, Q_FUNC_INFO, "Missing reader");
|
||||
Q_UNUSED(number);
|
||||
this->ui->tvp_Distributors->updateContainerMaybeAsync(this->m_webDataReader->getDistributors());
|
||||
}
|
||||
|
||||
void CDataMappingComponent::ps_modelsRead(int number)
|
||||
{
|
||||
Q_ASSERT_X(this->m_webDataReader, Q_FUNC_INFO, "Missing reader");
|
||||
Q_UNUSED(number);
|
||||
this->ui->tvp_Models->updateContainerMaybeAsync(this->m_webDataReader->getModels());
|
||||
}
|
||||
|
||||
void CDataMappingComponent::ps_requestModelDataUpdate()
|
||||
{
|
||||
Q_ASSERT_X(this->m_webDataReader, Q_FUNC_INFO, "Missing reader");
|
||||
this->m_webDataReader->readModelDataInBackground();
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
@@ -1,68 +0,0 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#ifndef BLACKGUI_DATAMAPPINGCOMPONENT_H
|
||||
#define BLACKGUI_DATAMAPPINGCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CDataMappingComponent; }
|
||||
namespace BlackCore { class CWebDataReader; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
/**
|
||||
* Mappings from/for the database
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDataMappingComponent : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Contructor
|
||||
explicit CDataMappingComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CDataMappingComponent();
|
||||
|
||||
//! Readers have been initialized
|
||||
void readersInitialized(BlackCore::CWebDataReader *webReaders);
|
||||
|
||||
private slots:
|
||||
//! Aircraft ICAO codes read
|
||||
void ps_aircraftIcaoCodeRead(int number);
|
||||
|
||||
//! Airline ICAO codes read
|
||||
void ps_airlineIcaoCodeRead(int number);
|
||||
|
||||
//! Liveries read
|
||||
void ps_liveriesRead(int number);
|
||||
|
||||
//! Distributors read
|
||||
void ps_distributorsRead(int number);
|
||||
|
||||
//! Models read
|
||||
void ps_modelsRead(int number);
|
||||
|
||||
//! Request distributor update
|
||||
void ps_requestModelDataUpdate();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDataMappingComponent> ui;
|
||||
BlackCore::CWebDataReader *m_webDataReader = nullptr;
|
||||
QList<QMetaObject::Connection> m_webReaderSignalConnections;
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -1,159 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CDataMappingComponent</class>
|
||||
<widget class="QFrame" name="CDataMappingComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_DataMappingComponent">
|
||||
<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="QTabWidget" name="tw_DataMappingComponent">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tb_Models">
|
||||
<attribute name="title">
|
||||
<string>Models</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_TabModels">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CAircraftModelView" name="tvp_Models">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_Liveries">
|
||||
<attribute name="title">
|
||||
<string>Liveries</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_TabLiveries">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CLiveryView" name="tvp_Liveries">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_Distributors">
|
||||
<attribute name="title">
|
||||
<string>Distributors</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_TabDistributors">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CDistributorView" name="tvp_Distributors">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAircraftModelView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/aircraftmodelview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CDistributorView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/distributorview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CLiveryView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/liveryview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user