mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +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">
|
||||
<widget class="QPushButton" name="pb_SkipFirstModelSet">
|
||||
<property name="text">
|
||||
<string>I do this later / do not need this</string>
|
||||
<string> I do this later / do not need this </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -274,6 +274,12 @@
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CFirstModelSetComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/firstmodelsetcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CConfigSimulatorComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
@@ -322,12 +328,6 @@
|
||||
<header>blackgui/components/installxswiftbuscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CFirstModelSetComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/firstmodelsetcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CFirstModelSetWizardPage</class>
|
||||
<extends>QWizardPage</extends>
|
||||
|
||||
@@ -9,12 +9,16 @@
|
||||
|
||||
#include "firstmodelsetcomponent.h"
|
||||
#include "ui_firstmodelsetcomponent.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "dbownmodelsdialog.h"
|
||||
#include "dbownmodelscomponent.h"
|
||||
#include "dbownmodelsetdialog.h"
|
||||
#include "dbownmodelsetcomponent.h"
|
||||
#include <QStringList>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QFileDialog>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
|
||||
@@ -40,6 +44,8 @@ namespace BlackGui
|
||||
connect(ui->pb_ModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelSetDialog);
|
||||
connect(ui->pb_Models, &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()
|
||||
@@ -99,6 +105,13 @@ namespace BlackGui
|
||||
|
||||
const CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings() const
|
||||
{
|
||||
Q_ASSERT(this->modelLoader());
|
||||
return this->modelLoader()->multiSimulatorSettings();
|
||||
}
|
||||
|
||||
CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings()
|
||||
{
|
||||
Q_ASSERT(this->modelLoader());
|
||||
return this->modelLoader()->multiSimulatorSettings();
|
||||
}
|
||||
|
||||
@@ -106,7 +119,7 @@ namespace BlackGui
|
||||
{
|
||||
m_modelsDialog->setSimulator(ui->comp_SimulatorSelector->getValue());
|
||||
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); }
|
||||
}
|
||||
|
||||
@@ -116,6 +129,19 @@ namespace BlackGui
|
||||
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()
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CFirstModelSetComponent> ui;
|
||||
QScopedPointer<CDbOwnModelsDialog> m_modelsDialog;
|
||||
QScopedPointer<CDbOwnModelsDialog> m_modelsDialog;
|
||||
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
|
||||
|
||||
//! Simulator has been changed
|
||||
@@ -66,11 +66,17 @@ namespace BlackGui
|
||||
//! Simulator settings
|
||||
const BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings() const;
|
||||
|
||||
//! Simulator settings
|
||||
BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings();
|
||||
|
||||
//! Open own models dialog
|
||||
void openOwnModelsDialog();
|
||||
|
||||
//! Own model set dialog
|
||||
void openOwnModelSetDialog();
|
||||
|
||||
//! Change model directory
|
||||
void changeModelDirectory();
|
||||
};
|
||||
|
||||
//! Wizard page for CFirstModelSetComponent
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -40,113 +40,99 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QFrame" name="fr_Models">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_ModelDirectories">
|
||||
<property name="text">
|
||||
<string>Model dir.:</string>
|
||||
<widget class="QFrame" name="gl_Models">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<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>
|
||||
</widget>
|
||||
</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">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>model directory from settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<property name="text">
|
||||
<string>Models:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QGridLayout" name="gl_Models">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pb_ModelSet">
|
||||
<property name="text">
|
||||
<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>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_ModelDirectories">
|
||||
<property name="text">
|
||||
<string>Model dir.:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
@@ -156,19 +142,37 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="BlackGui::Components::CDbDistributorComponent" name="comp_Distributors">
|
||||
<item row="0" column="0">
|
||||
<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">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>125</height>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<property name="text">
|
||||
<string>display</string>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pb_ChangeModelDir">
|
||||
<property name="text">
|
||||
<string>change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -191,6 +195,15 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</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/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user