These are chat archives for buddhi1980/mandelbulber2

14th
Jan 2016
Sebastian Jennen
@zebastian
Jan 14 2016 20:19
@buddhi, do you see, what i am doing wrong?
void RenderWindow::slotFractalSwap(int swapA, int swapB)
{
    cParameterContainer *swap = gParFractal->at(swapA);
    gParFractal[swapA] = gParFractal[swapB];
    gParFractal[swapB] = swap;
    gMainInterface->SynchronizeInterfaceWindow(fractalWidgets[swapA],
                                                                                         &gParFractal->at(swapA),
                                                                                         cInterface::write);
    gMainInterface->SynchronizeInterfaceWindow(fractalWidgets[swapB],
                                                                                         &gParFractal->at(swapB),
                                                                                         cInterface::write);
}
and here is the rest:
QApplication::connect(mainWindow->ui->tabWidget_fractals,
                                                SIGNAL(swapTabs(int, int)),
                                                mainWindow,
                                                SLOT(slotFractalSwap(int, int)));
Krzysztof Marczak
@buddhi1980
Jan 14 2016 20:21
what is the result?
Sebastian Jennen
@zebastian
Jan 14 2016 20:21
gcc says:
/home/sebastian/buddhi1980-mandelbulber2/mandelbulber2/src/render_window.cpp:2189: Fehler:cannot convert 'cParameterContainer' to 'cParameterContainer*' in initialization
is this even the right way, to swap the fractals?
Krzysztof Marczak
@buddhi1980
Jan 14 2016 20:23
it's good way, but there is something wrong in cParameterContainer *swap = gParFractal->at(swapA); Gime a minut to analyze it.
should be
    cParameterContainer swap = gParFractal->at(swapA);
    gParFractal[swapA] = gParFractal[swapB];
    gParFractal[swapB] = swap;
at() returns value not a pointer
Sebastian Jennen
@zebastian
Jan 14 2016 20:46
now only last line throws error:
gParFractal[swapB] = swap;
/home/sebastian/buddhi1980-mandelbulber2/mandelbulber2/src/render_window.cpp:2191: Fehler:no match for 'operator=' (operand types are 'cFractalContainer' and 'cParameterContainer')
Krzysztof Marczak
@buddhi1980
Jan 14 2016 20:49
try
gParFractal->at(swapB) = swap;
if doesn't work, you can add swap logic inside cFractalContainer class
there will be easier, because you have direct access to array
Sebastian Jennen
@zebastian
Jan 14 2016 20:57
thanks, compiles now but crashes, when function gets called.
btw, just found qswap
http://doc.qt.io/qt-4.8/qtalgorithms.html
qSwap(gParFractal[swapA], gParFractal[swapB]);
which seems to be working as well (still crashes :) )
i am not sure, what the problem is right now.
should i commit and you take a look?
Krzysztof Marczak
@buddhi1980
Jan 14 2016 20:58
yes, I will look at this
Sebastian Jennen
@zebastian
Jan 14 2016 21:01
ok, there it is: buddhi1980/mandelbulber2@d85f85c
Krzysztof Marczak
@buddhi1980
Jan 14 2016 21:01
ok
Krzysztof Marczak
@buddhi1980
Jan 14 2016 21:09
I have fixed it. Now it doesn't crash
But there is another problem. When you swap tabs then you also swap all widgets.
So if you swap 1 and 2 then you have wighets from fractal 1 on tab no. 2 (look at widgets tooltips, then you will se which parameter is connected)
I'm not sure if this will be possible, but after swap event, you can swap tab contents (all widgets) internally and then swap parameters
This is the reason why I wanted to add arrows to swap parameters between tabs. Swapping tabs by dragging makes mess in widget numbers
Sebastian Jennen
@zebastian
Jan 14 2016 21:19
yes, arrows would have been easier, but dragging really has a better user experience and is faster.
we will need to change the tabs as well, or set the objectname again for the swapped tabs,
i will continue to work on this tomorrow evening, thanks for your help!