Each ModelEdit window now has its own FirmwareInterface (it means that

we could open 2 ModelEdit windows on different firmwares)
This commit is contained in:
bsongis
2014-04-18 16:55:53 +02:00
parent c5ac19a054
commit 50a73a3af5
30 changed files with 253 additions and 245 deletions
+10 -10
View File
@@ -92,8 +92,8 @@ float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax
return y;
}
Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Curves),
currentCurve(0)
{
@@ -101,7 +101,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
lock = true;
if (!GetCurrentFirmware()->getCapability(HasCvNames)) {
if (!firmware->getCapability(HasCvNames)) {
ui->curveName->hide();
ui->curveNameLabel->hide();
}
@@ -110,7 +110,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
ui->curvePreview->setScene(scene);
for (int i=0; i<GetCurrentFirmware()->getCapability(NumCurves); i++) {
for (int i=0; i<firmware->getCapability(NumCurves); i++) {
visibleCurves[i] = false;
// The reset curve button
@@ -164,7 +164,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
ui->pointsLayout->addWidget(spnx[i], i, 1, 1, 1);
bool insert;
if (GetCurrentFirmware()->getCapability(EnhancedCurves)) {
if (firmware->getCapability(EnhancedCurves)) {
insert = (i >= 1);
}
else {
@@ -220,7 +220,7 @@ void Curves::update()
{
lock = true;
if (GetCurrentFirmware()->getCapability(HasCvNames)) {
if (firmware->getCapability(HasCvNames)) {
ui->curveName->setText(model.curves[currentCurve].name);
}
@@ -242,7 +242,7 @@ void Curves::updateCurveType()
int index = 0;
if (GetCurrentFirmware()->getCapability(EnhancedCurves)) {
if (firmware->getCapability(EnhancedCurves)) {
index = model.curves[currentCurve].count - 2;
}
else {
@@ -288,7 +288,7 @@ void Curves::updateCurve()
pen.setWidth(1);
pen.setStyle(Qt::SolidLine);
int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
int numcurves = firmware->getCapability(NumCurves);
for (int k=0; k<numcurves; k++) {
pen.setColor(colors[k]);
if (currentCurve!=k && visibleCurves[k]) {
@@ -406,7 +406,7 @@ void Curves::onNodeUnfocus()
bool Curves::allowCurveType(int points, CurveData::CurveType type)
{
int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
int numcurves = firmware->getCapability(NumCurves);
int totalpoints = 0;
for (int i=0; i<numcurves; i++) {
@@ -415,7 +415,7 @@ bool Curves::allowCurveType(int points, CurveData::CurveType type)
totalpoints += cvPoints + (cvType==CurveData::CURVE_TYPE_CUSTOM ? cvPoints-2 : 0);
}
int fwpoints = GetCurrentFirmware()->getCapability(NumCurvePoints);
int fwpoints = firmware->getCapability(NumCurvePoints);
if (totalpoints > fwpoints) {
QMessageBox::warning(this, "companion", tr("Not enough free points in EEPROM to store the curve."));
return false;