Skip to content

Commit

Permalink
Corrected swapping of fractal tabs in Navi
Browse files Browse the repository at this point in the history
  • Loading branch information
buddhi1980 committed Sep 29, 2024
1 parent ce39ac6 commit 442433f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions mandelbulber2/qt/dock_fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ void cDockFractal::InitializeFractalUi() const
}
fractalTabs[i]->AssignParameterContainers(params, fractalParams);
fractalTabs[i]->Init(i == 0, i);
fractalTabs[i]->AssignParentDockFractal(this);
}

static_cast<MyTabBar *>(ui->tabWidget_fractals->tabBar())->setupMoveButtons();

//}
WriteLog("cInterface::InitializeFractalUi(QString &uiFileName) finished", 2);
}
Expand All @@ -227,7 +229,7 @@ void cDockFractal::slotFractalSwap(int swapA, int swapB) const
// qDebug() << "swapping " << swapA << " with " << swapB;

// read all data from ui
gMainInterface->SynchronizeInterface(params, fractalParams, qInterface::read);
SynchronizeInterfaceFractals(params, fractalParams, qInterface::read);

// swap formula specific fields in gPar
QStringList gParFormulaSpecificFields({"formula", "formula_iterations", "formula_weight",
Expand Down Expand Up @@ -264,7 +266,7 @@ void cDockFractal::slotFractalSwap(int swapA, int swapB) const
fractalTabs[swapB]->SynchronizeFractal(fractalParams->at(swapA), qInterface::read);

// write swapped changes to ui
gMainInterface->SynchronizeInterface(params, fractalParams, qInterface::write);
SynchronizeInterfaceFractals(params, fractalParams, qInterface::write);
}

void cDockFractal::slotChangedCheckBoxBooleanOperators(bool state) const
Expand Down
5 changes: 2 additions & 3 deletions mandelbulber2/qt/tab_fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ void cTabFractal::slotChangedComboFractal(int indexInComboBox)
};

fractal::enumCPixelAddition cPixelAddition = newFractalList[index]->getCpixelAddition();
bool booleanState =
gMainInterface->mainWindow->GetWidgetDockFractal()->AreBooleanFractalsEnabled();
bool booleanState = parentDockFractal->AreBooleanFractalsEnabled();

if (cPixelAddition == fractal::cpixelAlreadyHas)
CConstantAdditionSetVisible(false);
Expand Down Expand Up @@ -277,7 +276,7 @@ void cTabFractal::slotChangedComboFractal(int indexInComboBox)
fractalWidget.reset();
}

gMainInterface->mainWindow->GetWidgetDockFractal()->SetTabText(
parentDockFractal->SetTabText(
tabIndex, QString("#%1: %2").arg(tabIndex + 1).arg(fullFormulaName));
}

Expand Down
7 changes: 7 additions & 0 deletions mandelbulber2/qt/tab_fractal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
class cAutomatedWidgets;
class cParameterContainer;
class cFractalContainer;
class cDockFractal;

namespace Ui
{
Expand All @@ -63,6 +64,10 @@ class cTabFractal : public QWidget, public cMyWidgetWithParams
explicit cTabFractal(QWidget *parent = nullptr);
~cTabFractal() override;

void AssignParentDockFractal(const cDockFractal *dockFractal)
{
parentDockFractal = dockFractal;
};
void InitWidgetNames() const;
void Init(bool firstTab, int _tabIndex);
void FormulaTransformSetVisible(bool visible) const;
Expand Down Expand Up @@ -99,6 +104,8 @@ private slots:
std::unique_ptr<QWidget> fractalWidget;

cAutomatedWidgets *automatedWidgets;

const cDockFractal *parentDockFractal = nullptr;
};

#endif /* MANDELBULBER2_QT_TAB_FRACTAL_H_ */

0 comments on commit 442433f

Please sign in to comment.