mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
refs #768, model form as combined form of livery/distributor and aircraft ICAO
This commit is contained in:
120
src/blackgui/editors/aircraftmodelform.cpp
Normal file
120
src/blackgui/editors/aircraftmodelform.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
/* 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 "aircraftmodelform.h"
|
||||
#include "ui_aircraftmodelform.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
CAircraftModelForm::CAircraftModelForm(QWidget *parent) :
|
||||
CForm(parent),
|
||||
ui(new Ui::CAircraftModelForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setFocusProxy(ui->editor_AircraftIcao);
|
||||
}
|
||||
|
||||
CAircraftModelForm::~CAircraftModelForm()
|
||||
{ }
|
||||
|
||||
void CAircraftModelForm::setReadOnly(bool readOnly)
|
||||
{
|
||||
ui->editor_AircraftIcao->setReadOnly(readOnly);
|
||||
ui->editor_Distributor->setReadOnly(readOnly);
|
||||
ui->editor_Livery->setReadOnly(readOnly);
|
||||
}
|
||||
|
||||
CStatusMessageList CAircraftModelForm::validate(bool withNestedForms) const
|
||||
{
|
||||
CStatusMessageList msgs;
|
||||
msgs.push_back(ui->editor_AircraftIcao->validate(withNestedForms));
|
||||
msgs.push_back(ui->editor_Distributor->validate(withNestedForms));
|
||||
msgs.push_back(ui->editor_Livery->validate(withNestedForms));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
CStatusMessageList CAircraftModelForm::validateLivery(bool withNestedForms) const
|
||||
{
|
||||
return ui->editor_Livery->validate(withNestedForms);
|
||||
}
|
||||
|
||||
CStatusMessageList CAircraftModelForm::validateAircraftIcao(bool withNestedForms) const
|
||||
{
|
||||
return ui->editor_AircraftIcao->validate(withNestedForms);
|
||||
}
|
||||
|
||||
CStatusMessageList CAircraftModelForm::validateDistributor(bool withNestedForms) const
|
||||
{
|
||||
return ui->editor_Distributor->validate(withNestedForms);
|
||||
}
|
||||
|
||||
Aviation::CLivery CAircraftModelForm::getLivery() const
|
||||
{
|
||||
return ui->editor_Livery->getValue();
|
||||
}
|
||||
|
||||
Aviation::CAircraftIcaoCode CAircraftModelForm::getAircraftIcao() const
|
||||
{
|
||||
return ui->editor_AircraftIcao->getValue();
|
||||
}
|
||||
|
||||
Simulation::CDistributor CAircraftModelForm::getDistributor() const
|
||||
{
|
||||
return ui->editor_Distributor->getValue();
|
||||
}
|
||||
|
||||
void CAircraftModelForm::allowDrop(bool allowDrop)
|
||||
{
|
||||
ui->editor_AircraftIcao->allowDrop(allowDrop);
|
||||
ui->editor_Distributor->allowDrop(allowDrop);
|
||||
ui->editor_Livery->allowDrop(allowDrop);
|
||||
}
|
||||
|
||||
bool CAircraftModelForm::setLivery(const BlackMisc::Aviation::CLivery &livery)
|
||||
{
|
||||
return ui->editor_Livery->setValue(livery);
|
||||
}
|
||||
|
||||
bool CAircraftModelForm::setAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &icao)
|
||||
{
|
||||
return ui->editor_AircraftIcao->setValue(icao);
|
||||
}
|
||||
|
||||
bool CAircraftModelForm::setDistributor(const BlackMisc::Simulation::CDistributor &distributor)
|
||||
{
|
||||
return ui->editor_Distributor->setValue(distributor);
|
||||
}
|
||||
|
||||
void CAircraftModelForm::clear()
|
||||
{
|
||||
this->clearLivery();
|
||||
this->clearAircraftIcao();
|
||||
this->clearDistributor();
|
||||
}
|
||||
|
||||
void CAircraftModelForm::clearLivery()
|
||||
{
|
||||
ui->editor_Livery->clear();
|
||||
}
|
||||
|
||||
void CAircraftModelForm::clearAircraftIcao()
|
||||
{
|
||||
ui->editor_AircraftIcao->clear();
|
||||
}
|
||||
|
||||
void CAircraftModelForm::clearDistributor()
|
||||
{
|
||||
ui->editor_Distributor->clear();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
91
src/blackgui/editors/aircraftmodelform.h
Normal file
91
src/blackgui/editors/aircraftmodelform.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* 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_AIRCRAFTMODELFORM_H
|
||||
#define BLACKGUI_EDITORS_AIRCRAFTMODELFORM_H
|
||||
|
||||
#include "form.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CAircraftModelForm; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
/**
|
||||
* Combined form of Livery, ICAOs, distributor
|
||||
*/
|
||||
class CAircraftModelForm : public CForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAircraftModelForm(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CAircraftModelForm();
|
||||
|
||||
//! Allow to drop data
|
||||
void allowDrop(bool allowDrop);
|
||||
|
||||
//! Set as read only
|
||||
virtual void setReadOnly(bool readOnly) override;
|
||||
|
||||
//! \copydoc BlackGui::Editors::CForm::validate
|
||||
virtual BlackMisc::CStatusMessageList validate(bool withNestedForms = true) const override;
|
||||
|
||||
//! \copydoc BlackGui::Editors::CForm::validate
|
||||
virtual BlackMisc::CStatusMessageList validateLivery(bool withNestedForms = true) const;
|
||||
|
||||
//! \copydoc BlackGui::Editors::CForm::validate
|
||||
virtual BlackMisc::CStatusMessageList validateAircraftIcao(bool withNestedForms = true) const;
|
||||
|
||||
//! \copydoc BlackGui::Editors::CForm::validate
|
||||
virtual BlackMisc::CStatusMessageList validateDistributor(bool withNestedForms = true) const;
|
||||
|
||||
//! Livery
|
||||
BlackMisc::Aviation::CLivery getLivery() const;
|
||||
|
||||
//! Aircraft ICAO
|
||||
BlackMisc::Aviation::CAircraftIcaoCode getAircraftIcao() const;
|
||||
|
||||
//! Distributor
|
||||
BlackMisc::Simulation::CDistributor getDistributor() const;
|
||||
|
||||
//! Livery
|
||||
bool setLivery(const BlackMisc::Aviation::CLivery &livery);
|
||||
|
||||
//! Aircraft
|
||||
bool setAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
|
||||
//! Distributor
|
||||
bool setDistributor(const BlackMisc::Simulation::CDistributor &distributor);
|
||||
|
||||
//! Clear entire form
|
||||
void clear();
|
||||
|
||||
//! \copydoc BlackGui::Editors::CLiveryForm::clear
|
||||
void clearLivery();
|
||||
|
||||
//! \copydoc BlackGui::Editors::CAircraftIcaoForm::clear
|
||||
void clearAircraftIcao();
|
||||
|
||||
//! \copydoc BlackGui::Editors::CDistributorForm::clear
|
||||
void clearDistributor();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftModelForm> ui;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
163
src/blackgui/editors/aircraftmodelform.ui
Normal file
163
src/blackgui/editors/aircraftmodelform.ui
Normal file
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAircraftModelForm</class>
|
||||
<widget class="QFrame" name="CAircraftModelForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="vl_AircraftModelForm">
|
||||
<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_AircraftModelLeft">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AircraftModelFormLeft">
|
||||
<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::Editors::CDistributorForm" name="editor_Distributor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Editors::CAircraftIcaoForm" name="editor_AircraftIcao">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_LeftEmpty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_AircraftModelRight">
|
||||
<layout class="QVBoxLayout" name="vl_AircraftModelFormRight">
|
||||
<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::Editors::CLiveryForm" name="editor_Livery">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_RightEmpty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CAircraftIcaoForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/aircrafticaoform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CLiveryForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/liveryform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CDistributorForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/distributorform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user