mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T246, allow to copy model set or create 1st model set as dialog from mapping tool
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/* 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 "copymodelsfromotherswiftversionsdialog.h"
|
||||
#include "ui_copymodelsfromotherswiftversionsdialog.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CCopyModelsFromOtherSwiftVersionsDialog::CCopyModelsFromOtherSwiftVersionsDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CCopyModelsFromOtherSwiftVersionsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
CCopyModelsFromOtherSwiftVersionsDialog::~CCopyModelsFromOtherSwiftVersionsDialog()
|
||||
{ }
|
||||
} // ns
|
||||
} // ns
|
||||
@@ -0,0 +1,43 @@
|
||||
/* 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_COMPONENTS_COPYMODELSFROMOTHERSWIFTVERSIONSDIALOG_H
|
||||
#define BLACKGUI_COMPONENTS_COPYMODELSFROMOTHERSWIFTVERSIONSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CCopyModelsFromOtherSwiftVersionsDialog; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
/**
|
||||
* Copy models from other swift versions as dialog
|
||||
*/
|
||||
class CCopyModelsFromOtherSwiftVersionsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CCopyModelsFromOtherSwiftVersionsDialog(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CCopyModelsFromOtherSwiftVersionsDialog();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CCopyModelsFromOtherSwiftVersionsDialog> ui;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CCopyModelsFromOtherSwiftVersionsDialog</class>
|
||||
<widget class="QDialog" name="CCopyModelsFromOtherSwiftVersionsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Copy models from another swift version</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_CopyFromAnotherSwiftDialog">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CCopyModelsFromOtherSwiftVersionsComponent" name="comp_CopyComponent"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="bb_CopyDialog">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CCopyModelsFromOtherSwiftVersionsComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/copymodelsfromotherswiftversionscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -11,19 +11,21 @@
|
||||
#include "blackgui/components/dbmappingcomponent.h"
|
||||
#include "blackgui/components/dbownmodelsetcomponent.h"
|
||||
#include "blackgui/components/dbownmodelsetformdialog.h"
|
||||
#include "blackgui/components/firstmodelsetdialog.h"
|
||||
#include "blackgui/components/copymodelsfromotherswiftversionsdialog.h"
|
||||
#include "blackgui/menus/aircraftmodelmenus.h"
|
||||
#include "blackgui/menus/menuaction.h"
|
||||
#include "blackgui/models/aircraftmodellistmodel.h"
|
||||
#include "blackgui/views/aircraftmodelview.h"
|
||||
#include "blackgui/views/viewbase.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/orderable.h"
|
||||
#include "blackmisc/simulation/aircraftmodelutils.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/simulation/distributorlistpreferences.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/orderable.h"
|
||||
#include "ui_dbownmodelsetcomponent.h"
|
||||
|
||||
#include <QAction>
|
||||
@@ -76,6 +78,8 @@ namespace BlackGui
|
||||
connect(ui->pb_LoadExistingSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
|
||||
connect(ui->pb_SaveAsSetForSimulator, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
|
||||
connect(ui->pb_ShowMatrix, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
|
||||
connect(ui->pb_CopyFromAnotherSwift, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
|
||||
connect(ui->pb_FirstSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelSetComponent::setSimulator, Qt::QueuedConnection);
|
||||
connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CDbOwnModelSetComponent::changeSimulator, Qt::QueuedConnection);
|
||||
connect(ui->tvp_OwnModelSet, &CAircraftModelView::modelDataChanged, this, &CDbOwnModelSetComponent::onRowCountChanged);
|
||||
@@ -216,12 +220,16 @@ namespace BlackGui
|
||||
if (sender == ui->pb_CreateNewSet)
|
||||
{
|
||||
this->createNewSet();
|
||||
return;
|
||||
}
|
||||
else if (sender == ui->pb_LoadExistingSet)
|
||||
|
||||
if (sender == ui->pb_LoadExistingSet)
|
||||
{
|
||||
ui->tvp_OwnModelSet->showFileLoadDialog();
|
||||
return;
|
||||
}
|
||||
else if (sender == ui->pb_SaveAsSetForSimulator)
|
||||
|
||||
if (sender == ui->pb_SaveAsSetForSimulator)
|
||||
{
|
||||
const CAircraftModelList ml(ui->tvp_OwnModelSet->container());
|
||||
if (!ml.isEmpty())
|
||||
@@ -229,10 +237,25 @@ namespace BlackGui
|
||||
const CStatusMessage m = m_modelSetLoader.setCachedModels(ml);
|
||||
CLogMessage::preformatted(m);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (sender == ui->pb_ShowMatrix)
|
||||
|
||||
if (sender == ui->pb_ShowMatrix)
|
||||
{
|
||||
this->showAirlineAircraftMatrix();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender == ui->pb_FirstSet)
|
||||
{
|
||||
this->firstSet();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender == ui->pb_CopyFromAnotherSwift)
|
||||
{
|
||||
this->copyFromAnotherSwift();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,11 +340,29 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
static const CStatusMessage m = CStatusMessage(this).error("No model data for %1") << simulator.toQString(true);
|
||||
const CStatusMessage m = CStatusMessage(this).error("No model data for %1") << simulator.toQString(true);
|
||||
if (mc) { mc->showOverlayMessage(m); }
|
||||
}
|
||||
}
|
||||
|
||||
void CDbOwnModelSetComponent::firstSet()
|
||||
{
|
||||
if (!m_firstModelSet)
|
||||
{
|
||||
m_firstModelSet.reset(new CFirstModelSetDialog(this));
|
||||
}
|
||||
m_firstModelSet->show();
|
||||
}
|
||||
|
||||
void CDbOwnModelSetComponent::copyFromAnotherSwift()
|
||||
{
|
||||
if (!m_copyFromAnotherSwift)
|
||||
{
|
||||
m_copyFromAnotherSwift.reset(new CCopyModelsFromOtherSwiftVersionsDialog(this));
|
||||
}
|
||||
m_copyFromAnotherSwift->show();
|
||||
}
|
||||
|
||||
void CDbOwnModelSetComponent::changeSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
m_modelSetLoader.setSimulator(simulator);
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace BlackGui
|
||||
{
|
||||
class CDbMappingComponent;
|
||||
class CDbOwnModelSetFormDialog;
|
||||
class CCopyModelsFromOtherSwiftVersionsDialog;
|
||||
class CFirstModelSetDialog;
|
||||
|
||||
/*!
|
||||
* Handling of the own model set
|
||||
@@ -143,6 +145,12 @@ namespace BlackGui
|
||||
//! Create new set
|
||||
void createNewSet();
|
||||
|
||||
//! First set wizard
|
||||
void firstSet();
|
||||
|
||||
//! Copy from another swift version
|
||||
void copyFromAnotherSwift();
|
||||
|
||||
//! Unchecked version of setSimulator
|
||||
void changeSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
@@ -152,8 +160,10 @@ namespace BlackGui
|
||||
//! Update distributor order
|
||||
void updateDistributorOrder(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
|
||||
QScopedPointer<CDbOwnModelSetFormDialog> m_modelSetFormDialog;
|
||||
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
|
||||
QScopedPointer<CDbOwnModelSetFormDialog> m_modelSetFormDialog;
|
||||
QScopedPointer<CFirstModelSetDialog> m_firstModelSet;
|
||||
QScopedPointer<CCopyModelsFromOtherSwiftVersionsDialog> m_copyFromAnotherSwift;
|
||||
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { this };
|
||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TDistributorListPreferences> m_distributorPreferences { this, &CDbOwnModelSetComponent::distributorPreferencesChanged }; //!< distributor preferences
|
||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TModel> m_modelSettings { this }; //!< settings for models
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>796</width>
|
||||
<height>224</height>
|
||||
<width>1019</width>
|
||||
<height>223</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -132,6 +132,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_FirstSet">
|
||||
<property name="text">
|
||||
<string>first set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_CopyFromAnotherSwift">
|
||||
<property name="text">
|
||||
<string>copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_LoadExistingSet">
|
||||
<property name="minimumSize">
|
||||
@@ -170,17 +184,17 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAircraftModelView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/aircraftmodelview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSimulatorSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/simulatorselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAircraftModelView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/aircraftmodelview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -16,8 +16,15 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QFrame" name="fr_Info">
|
||||
<layout class="QGridLayout" name="gl_Info" columnstretch="1,5">
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="hl_Info" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_SwiftIcon">
|
||||
<property name="text">
|
||||
<string><html><img src=":/own/icons/own/swift3D/sw3DOrange-32.png"></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Explaination">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:9pt; font-weight:600; color:#ff0000;">WORK IN PROGRESS (experimental) </span><span style=" font-size:9pt;">The model set defines which aircraft you will use in the simulator. From all models you have installed on your disk you can select a subset actually being used.</span></p></body></html></string>
|
||||
@@ -30,13 +37,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_SwiftIcon">
|
||||
<property name="text">
|
||||
<string><html><img src=":/own/icons/own/swift3D/sw3DOrange-32.png"></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
28
src/blackgui/components/firstmodelsetdialog.cpp
Normal file
28
src/blackgui/components/firstmodelsetdialog.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/* 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 "firstmodelsetdialog.h"
|
||||
#include "ui_firstmodelsetdialog.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CFirstModelSetDialog::CFirstModelSetDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CFirstModelSetDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
CFirstModelSetDialog::~CFirstModelSetDialog()
|
||||
{ }
|
||||
} // ns
|
||||
} // ns
|
||||
42
src/blackgui/components/firstmodelsetdialog.h
Normal file
42
src/blackgui/components/firstmodelsetdialog.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* 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_COMPONENTS_FIRSTMODELSETDIALOG_H
|
||||
#define BLACKGUI_COMPONENTS_FIRSTMODELSETDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CFirstModelSetDialog; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
/**
|
||||
* First model set dialog
|
||||
*/
|
||||
class CFirstModelSetDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CFirstModelSetDialog(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CFirstModelSetDialog();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CFirstModelSetDialog> ui;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
82
src/blackgui/components/firstmodelsetdialog.ui
Normal file
82
src/blackgui/components/firstmodelsetdialog.ui
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CFirstModelSetDialog</class>
|
||||
<widget class="QDialog" name="CFirstModelSetDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>First model set</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_FirstModelSet">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CFirstModelSetComponent" name="comp_FirstModelSet">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="bb_FirstModelSetDialog">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CFirstModelSetComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/firstmodelsetcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>bb_FirstModelSetDialog</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CFirstModelSetDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>bb_FirstModelSetDialog</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CFirstModelSetDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user