mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 19:35:33 +08:00
Ref T246, first model set UI allow to change model directory
This commit is contained in:
@@ -146,7 +146,7 @@
|
|||||||
<item alignment="Qt::AlignRight">
|
<item alignment="Qt::AlignRight">
|
||||||
<widget class="QPushButton" name="pb_SkipFirstModelSet">
|
<widget class="QPushButton" name="pb_SkipFirstModelSet">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>I do this later / do not need this</string>
|
<string> I do this later / do not need this </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -274,6 +274,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CFirstModelSetComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/firstmodelsetcomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BlackGui::Components::CConfigSimulatorComponent</class>
|
<class>BlackGui::Components::CConfigSimulatorComponent</class>
|
||||||
<extends>QFrame</extends>
|
<extends>QFrame</extends>
|
||||||
@@ -322,12 +328,6 @@
|
|||||||
<header>blackgui/components/installxswiftbuscomponent.h</header>
|
<header>blackgui/components/installxswiftbuscomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>BlackGui::Components::CFirstModelSetComponent</class>
|
|
||||||
<extends>QFrame</extends>
|
|
||||||
<header>blackgui/components/firstmodelsetcomponent.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BlackGui::Components::CFirstModelSetWizardPage</class>
|
<class>BlackGui::Components::CFirstModelSetWizardPage</class>
|
||||||
<extends>QWizardPage</extends>
|
<extends>QWizardPage</extends>
|
||||||
|
|||||||
@@ -9,12 +9,16 @@
|
|||||||
|
|
||||||
#include "firstmodelsetcomponent.h"
|
#include "firstmodelsetcomponent.h"
|
||||||
#include "ui_firstmodelsetcomponent.h"
|
#include "ui_firstmodelsetcomponent.h"
|
||||||
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "dbownmodelsdialog.h"
|
#include "dbownmodelsdialog.h"
|
||||||
#include "dbownmodelscomponent.h"
|
#include "dbownmodelscomponent.h"
|
||||||
#include "dbownmodelsetdialog.h"
|
#include "dbownmodelsetdialog.h"
|
||||||
#include "dbownmodelsetcomponent.h"
|
#include "dbownmodelsetcomponent.h"
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::Simulation::Settings;
|
using namespace BlackMisc::Simulation::Settings;
|
||||||
|
|
||||||
@@ -40,6 +44,8 @@ namespace BlackGui
|
|||||||
connect(ui->pb_ModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelSetDialog);
|
connect(ui->pb_ModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelSetDialog);
|
||||||
connect(ui->pb_Models, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
connect(ui->pb_Models, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
||||||
connect(ui->pb_ModelsTriggerReload, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
connect(ui->pb_ModelsTriggerReload, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
||||||
|
connect(ui->pb_ChangeModelDir, &QPushButton::clicked, this, &CFirstModelSetComponent::changeModelDirectory);
|
||||||
|
connect(this->modelLoader(), &IAircraftModelLoader::simulatorSettingsChanged, this, &CFirstModelSetComponent::onSimulatorChanged, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFirstModelSetComponent::~CFirstModelSetComponent()
|
CFirstModelSetComponent::~CFirstModelSetComponent()
|
||||||
@@ -99,6 +105,13 @@ namespace BlackGui
|
|||||||
|
|
||||||
const CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings() const
|
const CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings() const
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(this->modelLoader());
|
||||||
|
return this->modelLoader()->multiSimulatorSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings()
|
||||||
|
{
|
||||||
|
Q_ASSERT(this->modelLoader());
|
||||||
return this->modelLoader()->multiSimulatorSettings();
|
return this->modelLoader()->multiSimulatorSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +119,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
m_modelsDialog->setSimulator(ui->comp_SimulatorSelector->getValue());
|
m_modelsDialog->setSimulator(ui->comp_SimulatorSelector->getValue());
|
||||||
m_modelsDialog->show();
|
m_modelsDialog->show();
|
||||||
bool const reload = QObject::sender() == ui->pb_ModelsTriggerReload;
|
bool const reload = (QObject::sender() == ui->pb_ModelsTriggerReload);
|
||||||
if (reload) { m_modelsDialog->requestModelsInBackground(ui->comp_SimulatorSelector->getValue(), true); }
|
if (reload) { m_modelsDialog->requestModelsInBackground(ui->comp_SimulatorSelector->getValue(), true); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +129,19 @@ namespace BlackGui
|
|||||||
m_modelSetDialog->show();
|
m_modelSetDialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFirstModelSetComponent::changeModelDirectory()
|
||||||
|
{
|
||||||
|
const CSimulatorInfo simulator = ui->comp_SimulatorSelector->getValue();
|
||||||
|
const QString dirOld = this->simulatorSettings().getFirstModelDirectoryOrDefault(simulator);
|
||||||
|
const QString newDir = QFileDialog::getExistingDirectory(this->parentWidget(), tr("Open model directory"), dirOld, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
if (newDir.isEmpty() || CDirectoryUtils::isSameExistingDirectory(dirOld, newDir)) { return; }
|
||||||
|
CStatusMessage msg = this->simulatorSettings().addModelDirectory(newDir, simulator);
|
||||||
|
if (msg.isSuccess())
|
||||||
|
{
|
||||||
|
msg = this->simulatorSettings().saveSettings(simulator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CFirstModelSetWizardPage::validatePage()
|
bool CFirstModelSetWizardPage::validatePage()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CFirstModelSetComponent> ui;
|
QScopedPointer<Ui::CFirstModelSetComponent> ui;
|
||||||
QScopedPointer<CDbOwnModelsDialog> m_modelsDialog;
|
QScopedPointer<CDbOwnModelsDialog> m_modelsDialog;
|
||||||
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
|
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
|
||||||
|
|
||||||
//! Simulator has been changed
|
//! Simulator has been changed
|
||||||
@@ -66,11 +66,17 @@ namespace BlackGui
|
|||||||
//! Simulator settings
|
//! Simulator settings
|
||||||
const BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings() const;
|
const BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings() const;
|
||||||
|
|
||||||
|
//! Simulator settings
|
||||||
|
BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings();
|
||||||
|
|
||||||
//! Open own models dialog
|
//! Open own models dialog
|
||||||
void openOwnModelsDialog();
|
void openOwnModelsDialog();
|
||||||
|
|
||||||
//! Own model set dialog
|
//! Own model set dialog
|
||||||
void openOwnModelSetDialog();
|
void openOwnModelSetDialog();
|
||||||
|
|
||||||
|
//! Change model directory
|
||||||
|
void changeModelDirectory();
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Wizard page for CFirstModelSetComponent
|
//! Wizard page for CFirstModelSetComponent
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>640</width>
|
||||||
<height>480</height>
|
<height>400</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -40,113 +40,99 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignLeft|Qt::AlignTop">
|
|
||||||
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="fr_Models">
|
<widget class="QFrame" name="gl_Models">
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<property name="leftMargin">
|
||||||
<widget class="QLabel" name="lbl_ModelDirectories">
|
<number>5</number>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Model dir.:</string>
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" colspan="4">
|
||||||
|
<widget class="BlackGui::Components::CDbDistributorComponent" name="comp_Distributors">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="2" column="3">
|
||||||
|
<widget class="QPushButton" name="pb_ModelsTriggerReload">
|
||||||
|
<property name="text">
|
||||||
|
<string> reload </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_ModelSetInfo">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>model set info</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_ModelSet">
|
||||||
|
<property name="text">
|
||||||
|
<string>Model set</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="le_ModelDirectories">
|
<widget class="QLineEdit" name="le_ModelDirectories">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>model directory from settings</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_ModelsInfo">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>model info</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="lbl_Models">
|
<widget class="QLabel" name="lbl_Models">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Models:</string>
|
<string>Models:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="0">
|
||||||
<layout class="QGridLayout" name="gl_Models">
|
<widget class="QLabel" name="lbl_ModelDirectories">
|
||||||
<item row="1" column="0">
|
<property name="text">
|
||||||
<widget class="QPushButton" name="pb_ModelSet">
|
<string>Model dir.:</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>set</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_Models">
|
|
||||||
<property name="text">
|
|
||||||
<string>models</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="pb_ModelsTriggerReload">
|
|
||||||
<property name="text">
|
|
||||||
<string>reload</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLineEdit" name="le_ModelsInfo">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLineEdit" name="le_ModelSetInfo">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QWidget" name="wi_OwnModels" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="hl_OwnModels">
|
|
||||||
<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>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QWidget" name="wi_ModelSet" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="hl_ModelSet">
|
|
||||||
<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>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
@@ -156,19 +142,37 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="BlackGui::Components::CDbDistributorComponent" name="comp_Distributors">
|
<widget class="QLabel" name="lbl_Simulator">
|
||||||
|
<property name="text">
|
||||||
|
<string>Simulator:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QPushButton" name="pb_Models">
|
||||||
|
<property name="text">
|
||||||
|
<string>display</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QPushButton" name="pb_ModelSet">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>100</width>
|
||||||
<height>125</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="text">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<string>display</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
</widget>
|
||||||
<enum>QFrame::Raised</enum>
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QPushButton" name="pb_ChangeModelDir">
|
||||||
|
<property name="text">
|
||||||
|
<string>change</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -191,6 +195,15 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>le_ModelDirectories</tabstop>
|
||||||
|
<tabstop>pb_ChangeModelDir</tabstop>
|
||||||
|
<tabstop>le_ModelsInfo</tabstop>
|
||||||
|
<tabstop>pb_Models</tabstop>
|
||||||
|
<tabstop>pb_ModelsTriggerReload</tabstop>
|
||||||
|
<tabstop>le_ModelSetInfo</tabstop>
|
||||||
|
<tabstop>pb_ModelSet</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user