mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
refs #358, GUI for installed / matched models
* model / view / component classes
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include "aircraftcomponent.h"
|
#include "aircraftcomponent.h"
|
||||||
#include "cockpitcomponent.h"
|
#include "cockpitcomponent.h"
|
||||||
#include "usercomponent.h"
|
#include "usercomponent.h"
|
||||||
|
#include "mappingcomponent.h"
|
||||||
#include "textmessagecomponent.h"
|
#include "textmessagecomponent.h"
|
||||||
#include "simulatorcomponent.h"
|
#include "simulatorcomponent.h"
|
||||||
#include "flightplancomponent.h"
|
#include "flightplancomponent.h"
|
||||||
|
|||||||
@@ -467,7 +467,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="comp_Mappings">
|
<widget class="BlackGui::Components::CMappingComponent" name="comp_Mappings">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -633,6 +633,12 @@
|
|||||||
<header>blackgui/components/textmessagecomponent.h</header>
|
<header>blackgui/components/textmessagecomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CMappingComponent</class>
|
||||||
|
<extends>QTabWidget</extends>
|
||||||
|
<header>blackgui/components/mappingcomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||||
|
|||||||
97
src/blackgui/components/mappingcomponent.cpp
Normal file
97
src/blackgui/components/mappingcomponent.cpp
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/* 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 "blackcore/context_simulator.h"
|
||||||
|
#include "../views/aircraftmodelview.h"
|
||||||
|
#include "../models/aircraftmodellistmodel.h"
|
||||||
|
#include "../guiutility.h"
|
||||||
|
#include "mappingcomponent.h"
|
||||||
|
#include "ui_mappingcomponent.h"
|
||||||
|
|
||||||
|
using namespace BlackCore;
|
||||||
|
using namespace BlackGui;
|
||||||
|
using namespace BlackGui::Views;
|
||||||
|
using namespace BlackGui::Models;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
CMappingComponent::CMappingComponent(QWidget *parent) :
|
||||||
|
QTabWidget(parent), ui(new Ui::CMappingComponent)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
this->ui->tvp_CurrentMappings->setAircraftModelMode(CAircraftModelListModel::MappedModel);
|
||||||
|
this->ui->tvp_AircraftModels->setAircraftModelMode(CAircraftModelListModel::ModelOnly);
|
||||||
|
this->ui->tvp_CurrentMappings->setResizeMode(CAircraftModelView::ResizingOnce);
|
||||||
|
this->ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff);
|
||||||
|
|
||||||
|
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_aircraftModelsLoaded);
|
||||||
|
connect(this->ui->tvp_CurrentMappings, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onMappingsChanged);
|
||||||
|
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::countChanged, this, &CMappingComponent::ps_countChanged);
|
||||||
|
connect(this->ui->tvp_CurrentMappings, &CAircraftModelView::countChanged, this, &CMappingComponent::ps_countChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
CMappingComponent::~CMappingComponent()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
int CMappingComponent::countCurrentMappings() const
|
||||||
|
{
|
||||||
|
Q_ASSERT(this->ui->tvp_CurrentMappings);
|
||||||
|
return this->ui->tvp_CurrentMappings->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CMappingComponent::countAircraftModels() const
|
||||||
|
{
|
||||||
|
Q_ASSERT(this->ui->tvp_AircraftModels);
|
||||||
|
return this->ui->tvp_AircraftModels->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::runtimeHasBeenSet()
|
||||||
|
{
|
||||||
|
Q_ASSERT(getIContextSimulator());
|
||||||
|
connect(getIContextSimulator(), &IContextSimulator::installedAircraftModelsChanged, this, &CMappingComponent::ps_aircraftModelsLoaded);
|
||||||
|
connect(getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::ps_modelMatched);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::ps_aircraftModelsLoaded()
|
||||||
|
{
|
||||||
|
Q_ASSERT(getIContextSimulator());
|
||||||
|
this->ui->tvp_AircraftModels->updateContainer(getIContextSimulator()->getInstalledModels());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::ps_modelMatched(const BlackMisc::Network::CAircraftModel &model)
|
||||||
|
{
|
||||||
|
Q_UNUSED(model);
|
||||||
|
ps_onMappingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::ps_onMappingsChanged()
|
||||||
|
{
|
||||||
|
Q_ASSERT(getIContextSimulator());
|
||||||
|
this->ui->tvp_CurrentMappings->updateContainer(getIContextSimulator()->getCurrentlyMatchedModels());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::ps_countChanged(int count)
|
||||||
|
{
|
||||||
|
Q_UNUSED(count);
|
||||||
|
int am = this->indexOf(this->ui->tb_AircraftModels);
|
||||||
|
int cm = this->indexOf(this->ui->tb_CurrentMappings);
|
||||||
|
QString a = this->tabBar()->tabText(am);
|
||||||
|
QString c = this->tabBar()->tabText(cm);
|
||||||
|
a = CGuiUtility::replaceTabCountValue(a, this->countAircraftModels());
|
||||||
|
c = CGuiUtility::replaceTabCountValue(c, this->countCurrentMappings());
|
||||||
|
this->tabBar()->setTabText(am, a);
|
||||||
|
this->tabBar()->setTabText(cm, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
72
src/blackgui/components/mappingcomponent.h
Normal file
72
src/blackgui/components/mappingcomponent.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKGUI_MAPPINGCOMPONENT_H
|
||||||
|
#define BLACKGUI_MAPPINGCOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackgui/components/enableforruntime.h"
|
||||||
|
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||||
|
#include "blackmisc/nwaircraftmodel.h"
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
|
||||||
|
namespace Ui { class CMappingComponent; }
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
//! Mappings, models etc.
|
||||||
|
class CMappingComponent :
|
||||||
|
public QTabWidget,
|
||||||
|
public CEnableForDockWidgetInfoArea,
|
||||||
|
public CEnableForRuntime
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CMappingComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
~CMappingComponent();
|
||||||
|
|
||||||
|
//! Number of current mappings
|
||||||
|
int countCurrentMappings() const;
|
||||||
|
|
||||||
|
//! Numer of models
|
||||||
|
int countAircraftModels() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
|
||||||
|
void runtimeHasBeenSet() override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
//! Aircraft models available
|
||||||
|
void ps_aircraftModelsLoaded();
|
||||||
|
|
||||||
|
//! Mappings changed
|
||||||
|
void ps_onMappingsChanged();
|
||||||
|
|
||||||
|
//! Model matched
|
||||||
|
void ps_modelMatched(const BlackMisc::Network::CAircraftModel &model);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<Ui::CMappingComponent> ui;
|
||||||
|
|
||||||
|
//! Changed count
|
||||||
|
void ps_countChanged(int count);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
93
src/blackgui/components/mappingcomponent.ui
Normal file
93
src/blackgui/components/mappingcomponent.ui
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CMappingComponent</class>
|
||||||
|
<widget class="QTabWidget" name="CMappingComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>TabWidget</string>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tb_CurrentMappings">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Current mappings</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="vl_CurrentMappings">
|
||||||
|
<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="BlackGui::Views::CAircraftModelView" name="tvp_CurrentMappings">
|
||||||
|
<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_AircraftModels">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Aircraft models</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="vl_AircraftModels">
|
||||||
|
<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="BlackGui::Views::CAircraftModelView" name="tvp_AircraftModels">
|
||||||
|
<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>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Views::CAircraftModelView</class>
|
||||||
|
<extends>QTableView</extends>
|
||||||
|
<header>blackgui/views/aircraftmodelview.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
77
src/blackgui/models/aircraftmodellistmodel.cpp
Normal file
77
src/blackgui/models/aircraftmodellistmodel.cpp
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* 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 "aircraftmodellistmodel.h"
|
||||||
|
#include "blackmisc/avaircrafticao.h"
|
||||||
|
#include "blackmisc/icons.h"
|
||||||
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Network;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Models
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
CAircraftModelListModel::CAircraftModelListModel(AircraftModelMode mode, QObject *parent) : CListModelBase("CAircraftModelListModel", parent)
|
||||||
|
{
|
||||||
|
this->setAircraftModelMode(mode);
|
||||||
|
|
||||||
|
// force strings for translation in resource files
|
||||||
|
(void)QT_TRANSLATE_NOOP("CAircraftModelListModel", "callsign");
|
||||||
|
(void)QT_TRANSLATE_NOOP("CAircraftModelListModel", "combined type");
|
||||||
|
(void)QT_TRANSLATE_NOOP("CAircraftModelListModel", "model");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAircraftModelListModel::setAircraftModelMode(CAircraftModelListModel::AircraftModelMode mode)
|
||||||
|
{
|
||||||
|
if (this->m_mode == mode) return;
|
||||||
|
this->m_mode = mode;
|
||||||
|
this->m_columns.clear();
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case NotSet:
|
||||||
|
case ModelOnly:
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString}));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("description", { CAircraftModel::IndexDescription}));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("filename", { CAircraftModel::IndexFileName}));
|
||||||
|
|
||||||
|
// default sort order
|
||||||
|
this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString);
|
||||||
|
this->m_sortOrder = Qt::AscendingOrder;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MappedModel:
|
||||||
|
this->m_columns.addColumn(CColumn::standardValueObject("call", "callsign", CAircraftModel::IndexCallsign));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString}));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("ac", "aircraft ICAO", { CAircraftModel::IndexIcao, CAircraftIcao::IndexAircraftDesignator}));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("al", "airline ICAO", { CAircraftModel::IndexIcao, CAircraftIcao::IndexAirlineDesignator}));
|
||||||
|
// this->m_columns.addColumn(CColumn::standardString("ct", "combined type", { CAircraftModel::IndexIcao, CAircraftIcao::IndexCombinedAircraftType}));
|
||||||
|
this->m_columns.addColumn(CColumn("q.?", "queried", CAircraftModel::IndexHasQueriedModelString,
|
||||||
|
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "queried", "not queried")));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("description", { CAircraftModel::IndexDescription}));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("filename", { CAircraftModel::IndexFileName}));
|
||||||
|
|
||||||
|
// default sort order
|
||||||
|
this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString);
|
||||||
|
this->m_sortOrder = Qt::AscendingOrder;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
qFatal("Wrong mode");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
52
src/blackgui/models/aircraftmodellistmodel.h
Normal file
52
src/blackgui/models/aircraftmodellistmodel.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKGUI_AIRCRAFTMODELLISTMODEL_H
|
||||||
|
#define BLACKGUI_AIRCRAFTMODELLISTMODEL_H
|
||||||
|
|
||||||
|
#include "blackmisc/nwaircraftmodellist.h"
|
||||||
|
#include "blackgui/models/listmodelbase.h"
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Models
|
||||||
|
{
|
||||||
|
|
||||||
|
//! Aircraft model list model
|
||||||
|
class CAircraftModelListModel : public CListModelBase<BlackMisc::Network::CAircraftModel, BlackMisc::Network::CAircraftModelList>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! How to display
|
||||||
|
enum AircraftModelMode {
|
||||||
|
NotSet,
|
||||||
|
ModelOnly,
|
||||||
|
MappedModel
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
explicit CAircraftModelListModel(AircraftModelMode mode, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CAircraftModelListModel() {}
|
||||||
|
|
||||||
|
//! Mode
|
||||||
|
void setAircraftModelMode(CAircraftModelListModel::AircraftModelMode stationMode);
|
||||||
|
|
||||||
|
private:
|
||||||
|
AircraftModelMode m_mode = NotSet; //!< current mode
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // guard
|
||||||
@@ -32,7 +32,7 @@ namespace BlackGui
|
|||||||
this->m_columns.addColumn(CColumn("capabilities", CClient::IndexVoiceCapabilitiesIcon));
|
this->m_columns.addColumn(CColumn("capabilities", CClient::IndexVoiceCapabilitiesIcon));
|
||||||
this->m_columns.addColumn(CColumn::standardString("capabilities", CClient::IndexCapabilitiesString));
|
this->m_columns.addColumn(CColumn::standardString("capabilities", CClient::IndexCapabilitiesString));
|
||||||
this->m_columns.addColumn(CColumn::standardString("model", {CClient::IndexModel, CAircraftModel::IndexModelString}));
|
this->m_columns.addColumn(CColumn::standardString("model", {CClient::IndexModel, CAircraftModel::IndexModelString}));
|
||||||
this->m_columns.addColumn(CColumn("q.?", "queried", {CClient::IndexModel, CAircraftModel::IndexIsQueriedModelString},
|
this->m_columns.addColumn(CColumn("q.?", "queried", {CClient::IndexModel, CAircraftModel::IndexHasQueriedModelString},
|
||||||
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "queried", "not queried")));
|
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "queried", "not queried")));
|
||||||
this->m_columns.addColumn(CColumn::standardString("server", CClient::IndexServer));
|
this->m_columns.addColumn(CColumn::standardString("server", CClient::IndexServer));
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include "blackmisc/nwserverlist.h"
|
#include "blackmisc/nwserverlist.h"
|
||||||
#include "blackmisc/nwuserlist.h"
|
#include "blackmisc/nwuserlist.h"
|
||||||
#include "blackmisc/nwclientlist.h"
|
#include "blackmisc/nwclientlist.h"
|
||||||
|
#include "blackmisc/nwaircraftmodellist.h"
|
||||||
|
#include "blackmisc/nwaircraftmappinglist.h"
|
||||||
#include "blackmisc/setkeyboardhotkeylist.h"
|
#include "blackmisc/setkeyboardhotkeylist.h"
|
||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
|
||||||
@@ -202,7 +204,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (index.row() < 0 || index.row() >= this->m_container.size())
|
if (index.row() < 0 || index.row() >= this->m_container.size())
|
||||||
{
|
{
|
||||||
static const ObjectType def{}; // default object
|
static const ObjectType def {}; // default object
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -326,6 +328,8 @@ namespace BlackGui
|
|||||||
template class CListModelBase<BlackMisc::Network::CServer, BlackMisc::Network::CServerList>;
|
template class CListModelBase<BlackMisc::Network::CServer, BlackMisc::Network::CServerList>;
|
||||||
template class CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>;
|
template class CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>;
|
||||||
template class CListModelBase<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>;
|
template class CListModelBase<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>;
|
||||||
|
template class CListModelBase<BlackMisc::Network::CAircraftModel, BlackMisc::Network::CAircraftModelList>;
|
||||||
|
template class CListModelBase<BlackMisc::Network::CAircraftMapping, BlackMisc::Network::CAircraftMappingList>;
|
||||||
template class CListModelBase<BlackMisc::Settings::CSettingKeyboardHotkey, BlackMisc::Settings::CSettingKeyboardHotkeyList>;
|
template class CListModelBase<BlackMisc::Settings::CSettingKeyboardHotkey, BlackMisc::Settings::CSettingKeyboardHotkeyList>;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
32
src/blackgui/views/aircraftmodelview.cpp
Normal file
32
src/blackgui/views/aircraftmodelview.cpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* 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 "aircraftmodelview.h"
|
||||||
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackGui::Models;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Views
|
||||||
|
{
|
||||||
|
CAircraftModelView::CAircraftModelView(QWidget *parent) : CViewBase(parent)
|
||||||
|
{
|
||||||
|
this->m_withMenuItemClear = true;
|
||||||
|
this->m_withMenuItemRefresh = true;
|
||||||
|
this->standardInit(new CAircraftModelListModel(CAircraftModelListModel::ModelOnly, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAircraftModelView::setAircraftModelMode(CAircraftModelListModel::AircraftModelMode mode)
|
||||||
|
{
|
||||||
|
this->m_model->setAircraftModelMode(mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
src/blackgui/views/aircraftmodelview.h
Normal file
37
src/blackgui/views/aircraftmodelview.h
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKGUI_AIRCRAFTMODELVIEW_H
|
||||||
|
#define BLACKGUI_AIRCRAFTMODELVIEW_H
|
||||||
|
|
||||||
|
#include "viewbase.h"
|
||||||
|
#include "../models/aircraftmodellistmodel.h"
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Views
|
||||||
|
{
|
||||||
|
//! Aircrafts view
|
||||||
|
class CAircraftModelView : public CViewBase<Models::CAircraftModelListModel, BlackMisc::Network::CAircraftModelList>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
explicit CAircraftModelView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Set display mode
|
||||||
|
void setAircraftModelMode(Models::CAircraftModelListModel::AircraftModelMode mode);
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // guard
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
#include "../models/namevariantpairlistmodel.h"
|
#include "../models/namevariantpairlistmodel.h"
|
||||||
#include "../models/atcstationlistmodel.h"
|
#include "../models/atcstationlistmodel.h"
|
||||||
#include "../models/aircraftlistmodel.h"
|
#include "../models/aircraftlistmodel.h"
|
||||||
|
#include "../models/aircraftmodellistmodel.h"
|
||||||
|
#include "../models/airportlistmodel.h"
|
||||||
#include "../models/airportlistmodel.h"
|
#include "../models/airportlistmodel.h"
|
||||||
#include "../models/serverlistmodel.h"
|
#include "../models/serverlistmodel.h"
|
||||||
#include "../models/userlistmodel.h"
|
#include "../models/userlistmodel.h"
|
||||||
@@ -267,6 +269,7 @@ namespace BlackGui
|
|||||||
template class CViewBase<BlackGui::Models::CServerListModel, BlackMisc::Network::CServerList>;
|
template class CViewBase<BlackGui::Models::CServerListModel, BlackMisc::Network::CServerList>;
|
||||||
template class CViewBase<BlackGui::Models::CUserListModel, BlackMisc::Network::CUserList>;
|
template class CViewBase<BlackGui::Models::CUserListModel, BlackMisc::Network::CUserList>;
|
||||||
template class CViewBase<BlackGui::Models::CClientListModel, BlackMisc::Network::CClientList>;
|
template class CViewBase<BlackGui::Models::CClientListModel, BlackMisc::Network::CClientList>;
|
||||||
|
template class CViewBase<BlackGui::Models::CAircraftModelListModel, BlackMisc::Network::CAircraftModelList>;
|
||||||
template class CViewBase<BlackGui::Models::CKeyboardKeyListModel, BlackMisc::Settings::CSettingKeyboardHotkeyList>;
|
template class CViewBase<BlackGui::Models::CKeyboardKeyListModel, BlackMisc::Settings::CSettingKeyboardHotkeyList>;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user