mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #618, GUI dialog to create own model set
* new tab in model mapping component * form + dialog to select appropriate models
This commit is contained in:
67
src/blackgui/editors/ownmodelsetform.cpp
Normal file
67
src/blackgui/editors/ownmodelsetform.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/* Copyright (C) 2016
|
||||
* 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 "ownmodelsetform.h"
|
||||
#include "ui_ownmodelsetform.h"
|
||||
#include "blackgui/models/distributorlistmodel.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
COwnModelSetForm::COwnModelSetForm(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::COwnModelSetForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->tvp_Distributors->setDistributorMode(CDistributorListModel::Minimal);
|
||||
}
|
||||
|
||||
COwnModelSetForm::~COwnModelSetForm()
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
void COwnModelSetForm::reloadData()
|
||||
{
|
||||
Q_ASSERT_X(sGui && sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
|
||||
const CDistributorList distributors(sGui->getWebDataServices()->getDistributors());
|
||||
if (!distributors.isEmpty())
|
||||
{
|
||||
this->ui->tvp_Distributors->updateContainerMaybeAsync(distributors);
|
||||
}
|
||||
}
|
||||
|
||||
bool COwnModelSetForm::selectedDistributors() const
|
||||
{
|
||||
return this->ui->rb_SelectedDistributors->isChecked();
|
||||
}
|
||||
|
||||
bool COwnModelSetForm::dbDataOnly() const
|
||||
{
|
||||
return this->ui->rb_DbDataOnly->isChecked();
|
||||
}
|
||||
|
||||
bool COwnModelSetForm::dbIcaoCodesOnly() const
|
||||
{
|
||||
return this->ui->rb_DbIcaoCodesOnly->isChecked();
|
||||
}
|
||||
|
||||
CDistributorList COwnModelSetForm::getSelectedDistributors() const
|
||||
{
|
||||
return ui->tvp_Distributors->selectedObjects();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
60
src/blackgui/editors/ownmodelsetform.h
Normal file
60
src/blackgui/editors/ownmodelsetform.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Copyright (C) 2016
|
||||
* 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_EDITORS_OWNMODELSETFORM_H
|
||||
#define BLACKGUI_EDITORS_OWNMODELSETFORM_H
|
||||
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class COwnModelSetForm; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
/*!
|
||||
* Selection for own model set
|
||||
*/
|
||||
class COwnModelSetForm : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit COwnModelSetForm(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~COwnModelSetForm();
|
||||
|
||||
//! Reload data
|
||||
void reloadData();
|
||||
|
||||
//! Selected providers?
|
||||
bool selectedDistributors() const;
|
||||
|
||||
//! Get selected providers
|
||||
BlackMisc::Simulation::CDistributorList getSelectedDistributors() const;
|
||||
|
||||
//! Only DB data
|
||||
bool dbDataOnly() const;
|
||||
|
||||
//! DB ICAO codes
|
||||
bool dbIcaoCodesOnly() const;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::COwnModelSetForm> ui;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
152
src/blackgui/editors/ownmodelsetform.ui
Normal file
152
src/blackgui/editors/ownmodelsetform.ui
Normal file
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>COwnModelSetForm</class>
|
||||
<widget class="QFrame" name="COwnModelSetForm">
|
||||
<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_OwnModelSetForm">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gq_OwnModelSetForm">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="rb_DbIcaoCodesOnly">
|
||||
<property name="toolTip">
|
||||
<string>Model has ICAO code known in DB</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DB ICAO data</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_SourceSet</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Providers">
|
||||
<property name="text">
|
||||
<string>Distributors:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QRadioButton" name="rb_WithIcaoData">
|
||||
<property name="toolTip">
|
||||
<string>Model has ICAO code</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> ICAO data</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_SourceSet</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_SelectSourceSet">
|
||||
<property name="text">
|
||||
<string>Source set:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rb_SelectedDistributors">
|
||||
<property name="text">
|
||||
<string>selected</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_Distributors</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rb_DbDataOnly">
|
||||
<property name="toolTip">
|
||||
<string>Own models for which DB data are available</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DB data only</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_SourceSet</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="rb_DefaultDistributors">
|
||||
<property name="text">
|
||||
<string>default</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_Distributors</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CDistributorView" name="tvp_Distributors">
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CDistributorView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/distributorview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="bg_Distributors"/>
|
||||
<buttongroup name="bg_SourceSet"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user