mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Ref T298, matching setup form added
This commit is contained in:
73
src/blackgui/editors/matchingform.cpp
Normal file
73
src/blackgui/editors/matchingform.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
/* Copyright (C) 2018
|
||||
* 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 "ui_matchingform.h"
|
||||
#include "matchingform.h"
|
||||
#include "guiutility.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
CMatchingForm::CMatchingForm(QWidget *parent) :
|
||||
CForm(parent),
|
||||
ui(new Ui::CMatchingForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CMatchingForm::~CMatchingForm()
|
||||
{ }
|
||||
|
||||
void CMatchingForm::setReadOnly(bool readonly)
|
||||
{
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_ByModelString, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_ByICAOdata, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_ByFamily, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_ByLivery, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_ByCombinedCode, readonly);
|
||||
}
|
||||
|
||||
CStatusMessageList CMatchingForm::validate(bool withNestedForms) const
|
||||
{
|
||||
Q_UNUSED(withNestedForms);
|
||||
return CStatusMessageList();
|
||||
}
|
||||
|
||||
void CMatchingForm::setValue(const CAircraftMatcherSetup &setup)
|
||||
{
|
||||
const CAircraftMatcherSetup::MatchingMode mode = setup.getMatchingMode();
|
||||
ui->cb_ByModelString->setChecked(mode.testFlag(CAircraftMatcherSetup::ByModelString));
|
||||
ui->cb_ByCombinedCode->setChecked(mode.testFlag(CAircraftMatcherSetup::ByCombinedType));
|
||||
ui->cb_ByICAOdata->setChecked(mode.testFlag(CAircraftMatcherSetup::ByIcaoData));
|
||||
ui->cb_ByLivery->setChecked(mode.testFlag(CAircraftMatcherSetup::ByLivery));
|
||||
ui->cb_ByFamily->setChecked(mode.testFlag(CAircraftMatcherSetup::ByFamily));
|
||||
}
|
||||
|
||||
CAircraftMatcherSetup CMatchingForm::value() const
|
||||
{
|
||||
CAircraftMatcherSetup setup;
|
||||
setup.setMatchingMode(matchingMode());
|
||||
return setup;
|
||||
}
|
||||
|
||||
CAircraftMatcherSetup::MatchingMode CMatchingForm::matchingMode() const
|
||||
{
|
||||
return CAircraftMatcherSetup::matchingMode(
|
||||
ui->cb_ByModelString->isChecked(), ui->cb_ByICAOdata->isChecked(),
|
||||
ui->cb_ByFamily->isChecked(), ui->cb_ByLivery->isChecked(),
|
||||
ui->cb_ByCombinedCode->isChecked()
|
||||
);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
61
src/blackgui/editors/matchingform.h
Normal file
61
src/blackgui/editors/matchingform.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Copyright (C) 2018
|
||||
* 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_MATCHINGFORM_H
|
||||
#define BLACKGUI_EDITORS_MATCHINGFORM_H
|
||||
|
||||
#include "form.h"
|
||||
#include "blackmisc/simulation/aircraftmatchersetup.h"
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CMatchingForm; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
//! Matching form
|
||||
class CMatchingForm : public CForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CMatchingForm(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CMatchingForm() override;
|
||||
|
||||
//! \name Form class implementations
|
||||
//! @{
|
||||
virtual void setReadOnly(bool readonly) override;
|
||||
virtual BlackMisc::CStatusMessageList validate(bool withNestedForms) const override;
|
||||
//! @}
|
||||
|
||||
//! Set valued
|
||||
void setValue(const BlackMisc::Simulation::CAircraftMatcherSetup &setup);
|
||||
|
||||
//! Value
|
||||
BlackMisc::Simulation::CAircraftMatcherSetup value() const;
|
||||
|
||||
//! Clear data
|
||||
void clear();
|
||||
|
||||
private:
|
||||
//! Mode
|
||||
BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode matchingMode() const;
|
||||
|
||||
QScopedPointer<Ui::CMatchingForm> ui;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
|
||||
#endif // guard
|
||||
65
src/blackgui/editors/matchingform.ui
Normal file
65
src/blackgui/editors/matchingform.ui
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CMatchingForm</class>
|
||||
<widget class="QFrame" name="CMatchingForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>287</width>
|
||||
<height>87</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_MatchingForm">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_Mode">
|
||||
<property name="title">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_Mode">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cb_ByModelString">
|
||||
<property name="text">
|
||||
<string>by model string</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="cb_ByICAOdata">
|
||||
<property name="text">
|
||||
<string>by ICAO data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_ByFamily">
|
||||
<property name="text">
|
||||
<string>by family</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="cb_ByCombinedCode">
|
||||
<property name="text">
|
||||
<string>combined code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="cb_ByLivery">
|
||||
<property name="text">
|
||||
<string>by livery</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user