[Companion] Fix model being moved to wrong category after wizard run (closes #4482)
This commit is contained in:
@@ -538,7 +538,7 @@ void MdiChild::wizardEdit()
|
||||
{
|
||||
int row = getCurrentModel();
|
||||
checkAndInitModel(row);
|
||||
WizardDialog * wizard = new WizardDialog(radioData.generalSettings, row+1, this);
|
||||
WizardDialog * wizard = new WizardDialog(radioData.generalSettings, row+1, radioData.models[row], this);
|
||||
wizard->exec();
|
||||
if (wizard->mix.complete /*TODO rather test the exec() result?*/) {
|
||||
radioData.models[row] = wizard->mix;
|
||||
|
||||
@@ -37,10 +37,11 @@ void Channel::clear()
|
||||
weight2 = 0;
|
||||
}
|
||||
|
||||
WizMix::WizMix(const GeneralSettings & settings, unsigned int modelId):
|
||||
WizMix::WizMix(const GeneralSettings & settings, unsigned int modelId, const ModelData & modelData):
|
||||
complete(false),
|
||||
modelId(modelId),
|
||||
settings(settings),
|
||||
originalModelData(modelData),
|
||||
vehicle(NOVEHICLE)
|
||||
{
|
||||
strcpy(name, " ");
|
||||
@@ -90,6 +91,8 @@ WizMix::operator ModelData()
|
||||
int throttleChannel = -1;
|
||||
|
||||
ModelData model;
|
||||
//ModelData model(originalModelData);
|
||||
model.category = originalModelData.category;
|
||||
model.used = true;
|
||||
model.moduleData[0].modelId = modelId;
|
||||
model.setDefaultInputs(settings);
|
||||
|
||||
@@ -80,7 +80,7 @@ class Channel
|
||||
{
|
||||
public:
|
||||
WizardPage page; // Originating dialog, only of interest for producer
|
||||
bool prebooked; // Temporary lock variable
|
||||
bool prebooked; // Temporary lock variable
|
||||
Input input1;
|
||||
Input input2;
|
||||
int weight1;
|
||||
@@ -97,11 +97,12 @@ class WizMix
|
||||
char name[WIZ_MODEL_NAME_LENGTH + 1];
|
||||
unsigned int modelId;
|
||||
const GeneralSettings & settings;
|
||||
const ModelData & originalModelData;
|
||||
Vehicle vehicle;
|
||||
Channel channel[WIZ_MAX_CHANNELS];
|
||||
bool options[WIZ_MAX_OPTIONS];
|
||||
|
||||
WizMix(const GeneralSettings & settings, unsigned int modelId);
|
||||
WizMix(const GeneralSettings & settings, unsigned int modelId, const ModelData & modelData);
|
||||
operator ModelData();
|
||||
|
||||
private:
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#include "wizarddata.h"
|
||||
#include "helpers.h"
|
||||
|
||||
WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelId, QWidget *parent):
|
||||
WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelId, const ModelData & modelData, QWidget *parent):
|
||||
QWizard(parent),
|
||||
mix(settings, modelId),
|
||||
mix(settings, modelId, modelData),
|
||||
settings(settings)
|
||||
{
|
||||
setWindowIcon(CompanionIcon("wizard.png"));
|
||||
|
||||
@@ -30,7 +30,7 @@ class WizardDialog : public QWizard
|
||||
|
||||
public:
|
||||
WizMix mix;
|
||||
WizardDialog(const GeneralSettings & settings, const unsigned int modelId, QWidget *parent = 0);
|
||||
WizardDialog(const GeneralSettings & settings, const unsigned int modelId, const ModelData & modelData, QWidget *parent = 0);
|
||||
const GeneralSettings & settings;
|
||||
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user