[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();
|
int row = getCurrentModel();
|
||||||
checkAndInitModel(row);
|
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();
|
wizard->exec();
|
||||||
if (wizard->mix.complete /*TODO rather test the exec() result?*/) {
|
if (wizard->mix.complete /*TODO rather test the exec() result?*/) {
|
||||||
radioData.models[row] = wizard->mix;
|
radioData.models[row] = wizard->mix;
|
||||||
|
|||||||
@@ -37,10 +37,11 @@ void Channel::clear()
|
|||||||
weight2 = 0;
|
weight2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WizMix::WizMix(const GeneralSettings & settings, unsigned int modelId):
|
WizMix::WizMix(const GeneralSettings & settings, unsigned int modelId, const ModelData & modelData):
|
||||||
complete(false),
|
complete(false),
|
||||||
modelId(modelId),
|
modelId(modelId),
|
||||||
settings(settings),
|
settings(settings),
|
||||||
|
originalModelData(modelData),
|
||||||
vehicle(NOVEHICLE)
|
vehicle(NOVEHICLE)
|
||||||
{
|
{
|
||||||
strcpy(name, " ");
|
strcpy(name, " ");
|
||||||
@@ -90,6 +91,8 @@ WizMix::operator ModelData()
|
|||||||
int throttleChannel = -1;
|
int throttleChannel = -1;
|
||||||
|
|
||||||
ModelData model;
|
ModelData model;
|
||||||
|
//ModelData model(originalModelData);
|
||||||
|
model.category = originalModelData.category;
|
||||||
model.used = true;
|
model.used = true;
|
||||||
model.moduleData[0].modelId = modelId;
|
model.moduleData[0].modelId = modelId;
|
||||||
model.setDefaultInputs(settings);
|
model.setDefaultInputs(settings);
|
||||||
|
|||||||
@@ -97,11 +97,12 @@ class WizMix
|
|||||||
char name[WIZ_MODEL_NAME_LENGTH + 1];
|
char name[WIZ_MODEL_NAME_LENGTH + 1];
|
||||||
unsigned int modelId;
|
unsigned int modelId;
|
||||||
const GeneralSettings & settings;
|
const GeneralSettings & settings;
|
||||||
|
const ModelData & originalModelData;
|
||||||
Vehicle vehicle;
|
Vehicle vehicle;
|
||||||
Channel channel[WIZ_MAX_CHANNELS];
|
Channel channel[WIZ_MAX_CHANNELS];
|
||||||
bool options[WIZ_MAX_OPTIONS];
|
bool options[WIZ_MAX_OPTIONS];
|
||||||
|
|
||||||
WizMix(const GeneralSettings & settings, unsigned int modelId);
|
WizMix(const GeneralSettings & settings, unsigned int modelId, const ModelData & modelData);
|
||||||
operator ModelData();
|
operator ModelData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
#include "wizarddata.h"
|
#include "wizarddata.h"
|
||||||
#include "helpers.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),
|
QWizard(parent),
|
||||||
mix(settings, modelId),
|
mix(settings, modelId, modelData),
|
||||||
settings(settings)
|
settings(settings)
|
||||||
{
|
{
|
||||||
setWindowIcon(CompanionIcon("wizard.png"));
|
setWindowIcon(CompanionIcon("wizard.png"));
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class WizardDialog : public QWizard
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
WizMix mix;
|
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;
|
const GeneralSettings & settings;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
Reference in New Issue
Block a user