mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #445, data entry GUI
* component for main info area * component for data mapping * new subproject
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a2527e69e3
commit
d7bd20dd26
75
src/blackgui/components/datamaininfoareacomponent.cpp
Normal file
75
src/blackgui/components/datamaininfoareacomponent.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
/* 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/datamappingcomponent.h"
|
||||
#include "blackgui/components/datamaininfoareacomponent.h"
|
||||
#include "ui_datamaininfoareacomponent.h"
|
||||
#include "blackmisc/icons.h"
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
CDataMainInfoAreaComponent::~CDataMainInfoAreaComponent()
|
||||
{ }
|
||||
|
||||
CLogComponent *CDataMainInfoAreaComponent::getLogComponent() const
|
||||
{
|
||||
return this->ui->comp_Log;
|
||||
}
|
||||
|
||||
CDataMappingComponent *CDataMainInfoAreaComponent::getMappingComponent() const
|
||||
{
|
||||
return this->ui->comp_Mapping;
|
||||
}
|
||||
|
||||
QSize CDataMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const
|
||||
{
|
||||
InfoArea area = static_cast<InfoArea>(areaIndex);
|
||||
switch (area)
|
||||
{
|
||||
case InfoAreaMapping:
|
||||
case InfoAreaSettings:
|
||||
case InfoAreaLog:
|
||||
default:
|
||||
return QSize(800, 600);
|
||||
}
|
||||
}
|
||||
|
||||
const QPixmap &CDataMainInfoAreaComponent::indexToPixmap(int areaIndex) const
|
||||
{
|
||||
InfoArea area = static_cast<InfoArea>(areaIndex);
|
||||
switch (area)
|
||||
{
|
||||
case InfoAreaMapping:
|
||||
return CIcons::appMappings16();
|
||||
case InfoAreaSettings:
|
||||
return CIcons::appSettings16();
|
||||
case InfoAreaLog:
|
||||
return CIcons::appLog16();
|
||||
default:
|
||||
return CIcons::empty();
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
73
src/blackgui/components/datamaininfoareacomponent.h
Normal file
73
src/blackgui/components/datamaininfoareacomponent.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* 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_DATAMAININFOAREACOMPONENT_H
|
||||
#define BLACKGUI_DATAMAININFOAREACOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/infoarea.h"
|
||||
#include <QMainWindow>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CDataMainInfoAreaComponent; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
class CLogComponent;
|
||||
class CDataMappingComponent;
|
||||
|
||||
/**
|
||||
* Main info area for data entry tool
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDataMainInfoAreaComponent : public BlackGui::CInfoArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Info areas
|
||||
enum InfoArea
|
||||
{
|
||||
// index must match tab index!
|
||||
InfoAreaMapping = 0,
|
||||
InfoAreaLog = 1,
|
||||
InfoAreaSettings = 2,
|
||||
InfoAreaNone = -1
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
explicit CDataMainInfoAreaComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CDataMainInfoAreaComponent();
|
||||
|
||||
//! Log component
|
||||
BlackGui::Components::CLogComponent *getLogComponent() const;
|
||||
|
||||
//! Model component
|
||||
BlackGui::Components::CDataMappingComponent *getMappingComponent() const;
|
||||
|
||||
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::CDataMainInfoAreaComponent> ui;
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
178
src/blackgui/components/datamaininfoareacomponent.ui
Normal file
178
src/blackgui/components/datamaininfoareacomponent.ui
Normal file
@@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CDataMainInfoAreaComponent</class>
|
||||
<widget class="QMainWindow" name="CDataMainInfoAreaComponent">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>500</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_centralEmptyWidget"/>
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_Mapping">
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::TopDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Models</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>4</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="qw_MappingOuter">
|
||||
<layout class="QVBoxLayout" name="vl_MissingModelsOuter">
|
||||
<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="QFrame" name="fr_MappingInner">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_MissingModelsInner">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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::Components::CDataMappingComponent" name="comp_Mapping">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_Log">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::TopDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Logging</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>4</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="qw_LogOuter">
|
||||
<layout class="QVBoxLayout" name="vl_LogOuter">
|
||||
<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="QFrame" name="fr_LogInner">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_LogInner">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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::Components::CLogComponent" name="comp_Log">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::CDockWidgetInfoArea</class>
|
||||
<extends>QDockWidget</extends>
|
||||
<header>blackgui/dockwidgetinfoarea.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CLogComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/logcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CDataMappingComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/datamappingcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
87
src/blackgui/components/datamappingcomponent.cpp
Normal file
87
src/blackgui/components/datamappingcomponent.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/* 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
|
||||
68
src/blackgui/components/datamappingcomponent.h
Normal file
68
src/blackgui/components/datamappingcomponent.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* 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
|
||||
159
src/blackgui/components/datamappingcomponent.ui
Normal file
159
src/blackgui/components/datamappingcomponent.ui
Normal file
@@ -0,0 +1,159 @@
|
||||
<?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>
|
||||
37
src/swiftdata/main.cpp
Normal file
37
src/swiftdata/main.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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 "swiftdata.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/worker.h"
|
||||
#include "blackmisc/networkutils.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/filelogger.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackGui;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
CGuiUtility::initSwiftGuiApplication(a, "swiftdata", CIcons::swiftDatabase24());
|
||||
|
||||
CSwiftData w;
|
||||
w.show();
|
||||
int r = a.exec();
|
||||
return r;
|
||||
}
|
||||
91
src/swiftdata/swiftdata.cpp
Normal file
91
src/swiftdata/swiftdata.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/* 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 "swiftdata.h"
|
||||
#include "ui_swiftdata.h"
|
||||
#include "blackgui/components/logcomponent.h"
|
||||
#include "blackgui/components/datamaininfoareacomponent.h"
|
||||
#include "blackgui/components/datamappingcomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackcore/web_datareader.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Components;
|
||||
|
||||
CSwiftData::CSwiftData(QWidget *parent) :
|
||||
QMainWindow(parent), CIdentifiable(this), ui(new Ui::CSwiftData),
|
||||
m_webDataReader(new CWebDataReader(CWebDataReader::AllSwiftDbReaders))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->init();
|
||||
}
|
||||
|
||||
void CSwiftData::initStyleSheet()
|
||||
{
|
||||
const QString s = CStyleSheetUtility::instance().styles(
|
||||
{
|
||||
CStyleSheetUtility::fileNameFonts(),
|
||||
CStyleSheetUtility::fileNameStandardWidget(),
|
||||
CStyleSheetUtility::fileNameSwiftData()
|
||||
}
|
||||
);
|
||||
this->setStyleSheet(s);
|
||||
}
|
||||
|
||||
CSwiftData::~CSwiftData()
|
||||
{ }
|
||||
|
||||
void CSwiftData::ps_appendLogMessage(const CStatusMessage &message)
|
||||
{
|
||||
ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(message);
|
||||
}
|
||||
|
||||
void CSwiftData::ps_onStyleSheetsChanged()
|
||||
{
|
||||
this->initStyleSheet();
|
||||
}
|
||||
|
||||
void CSwiftData::init()
|
||||
{
|
||||
this->setWindowIcon(CIcons::swiftDatabase24());
|
||||
this->setWindowTitle(QString("swiftdata %1").arg(CProject::version()));
|
||||
this->setObjectName("CSwiftData");
|
||||
this->initStyleSheet();
|
||||
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CSwiftData::ps_onStyleSheetsChanged);
|
||||
this->initReaders();
|
||||
}
|
||||
|
||||
void CSwiftData::initLogDisplay()
|
||||
{
|
||||
CLogHandler::instance()->install(true);
|
||||
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
||||
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
||||
CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)
|
||||
);
|
||||
logHandler->subscribe(this, &CSwiftData::ps_appendLogMessage);
|
||||
}
|
||||
|
||||
|
||||
void CSwiftData::initReaders()
|
||||
{
|
||||
CDataMappingComponent *mc = this->ui->comp_MainInfoArea->getMappingComponent();
|
||||
Q_ASSERT_X(mc, Q_FUNC_INFO, "Missing mapping component");
|
||||
Q_ASSERT_X(this->m_webDataReader, Q_FUNC_INFO, "Missing reader");
|
||||
mc->readersInitialized(this->m_webDataReader);
|
||||
this->m_webDataReader->readAllInBackground(1000); // kick of readers
|
||||
}
|
||||
58
src/swiftdata/swiftdata.h
Normal file
58
src/swiftdata/swiftdata.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFTDATA_H
|
||||
#define SWIFTDATA_H
|
||||
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackgui/systemtraywindow.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackgui/managedstatusbar.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CSwiftData; }
|
||||
namespace BlackCore { class CWebDataReader; }
|
||||
|
||||
//! swift data entry control
|
||||
class CSwiftData :
|
||||
public QMainWindow,
|
||||
public BlackMisc::CIdentifiable,
|
||||
public BlackGui::Components::CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CSwiftData(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CSwiftData();
|
||||
|
||||
private slots:
|
||||
//! Append log message
|
||||
void ps_appendLogMessage(const BlackMisc::CStatusMessage &message);
|
||||
|
||||
//! Style sheet has changed
|
||||
void ps_onStyleSheetsChanged();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void initLogDisplay();
|
||||
void initStyleSheet();
|
||||
void initReaders();
|
||||
QScopedPointer<Ui::CSwiftData> ui;
|
||||
BlackGui::CManagedStatusBar m_statusBar;
|
||||
BlackCore::CWebDataReader *m_webDataReader = nullptr;
|
||||
};
|
||||
|
||||
#endif // guard
|
||||
BIN
src/swiftdata/swiftdata.ico
Normal file
BIN
src/swiftdata/swiftdata.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
28
src/swiftdata/swiftdata.pro
Normal file
28
src/swiftdata/swiftdata.pro
Normal file
@@ -0,0 +1,28 @@
|
||||
include ($$SourceRoot/config.pri)
|
||||
include ($$SourceRoot/build.pri)
|
||||
|
||||
QT += core dbus network xml multimedia gui svg
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = swiftdata
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += *.cpp
|
||||
HEADERS += *.h
|
||||
FORMS += *.ui
|
||||
CONFIG += blackmisc blacksound blackinput blackcore blackgui
|
||||
|
||||
DEPENDPATH += . $$SourceRoot/src/blackmisc \
|
||||
$$SourceRoot/src/blacksound \
|
||||
$$SourceRoot/src/blackcore \
|
||||
$$SourceRoot/src/blackgui \
|
||||
$$SourceRoot/src/blackinput
|
||||
|
||||
INCLUDEPATH += . $$SourceRoot/src
|
||||
DESTDIR = $$BuildRoot/bin
|
||||
OTHER_FILES += *.qss *.ico *.rc
|
||||
RC_FILE = swiftdata.rc
|
||||
DISTFILES += swiftdata.rc
|
||||
|
||||
include ($$SourceRoot/libraries.pri)
|
||||
1
src/swiftdata/swiftdata.rc
Normal file
1
src/swiftdata/swiftdata.rc
Normal file
@@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "swiftdata.ico"
|
||||
93
src/swiftdata/swiftdata.ui
Normal file
93
src/swiftdata/swiftdata.ui
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CSwiftData</class>
|
||||
<widget class="QMainWindow" name="CSwiftData">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>swiftdata</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_CentralWidget">
|
||||
<layout class="QVBoxLayout" name="vl_CentralWidget">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="sw_CentralWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pq_MainInfoArea">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CDataMainInfoAreaComponent" name="comp_MainInfoArea" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="mb_SwiftData">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="sb_SwiftData"/>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CDataMainInfoAreaComponent</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>blackgui/components/datamaininfoareacomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user