HyperspaceExplorer 0.7.1
|
A Dialog to enter a function from in polar coordinates. More...
#include <PolarDialogImpl.h>
Public Member Functions | |
PolarDialogImpl (QWidget *parent=0, Qt::WFlags f=0) | |
Private Slots | |
virtual bool | checkValidity () |
virtual bool | loadFunction () |
Private Member Functions | |
virtual bool | functionPresent (const QString &) |
virtual void | writeSource () |
A Dialog to enter a function from in polar coordinates.
The function is evaluated as .
The function will then be compiled into a dynamic library and loaded to be displayed on screen
UI::Dialogs::PolarDialogImpl::PolarDialogImpl | ( | QWidget * | parent = 0 , |
Qt::WFlags | f = 0 |
||
) |
PolarDialogImpl c'tor taking parameters for the parent ComplexDialog, which in turn inherited them from QDialog displays the dialog
parent | parent widget (NULL) |
f | window flags |
References checkValidity(), and loadFunction().
bool UI::Dialogs::PolarDialogImpl::checkValidity | ( | ) | [private, virtual, slot] |
this function is called when the user clicks the OK button in the Function Dialog. checks whether all fields are filled in, whether the given function is valid C++ syntax, ie. whether it compiles, and whether the compiled code links into a dynamic library. as a side effect, it generates this library. finally, it checks whether the library can be loaded. if so, it accepts the input. also, this function creates a directory structure "plugins/real" under the resource directory and changes the CWD to that folder for the duration of checkValidity (). the name for this function is chosen rather unfortunately, i guess.
Referenced by PolarDialogImpl().
bool UI::Dialogs::PolarDialogImpl::functionPresent | ( | const QString & | libName | ) | [private, virtual] |
loads the dynamic library given by libName, if it exists and can be loaded. then it checks whether a function named f () is present. if so, returns true. else borks with an error message.
libName | filename for the selected DLL |
Implements UI::Dialogs::PluginCreator.
bool UI::Dialogs::PolarDialogImpl::loadFunction | ( | ) | [private, virtual, slot] |
display and load the selected DLL into current address space loads a dynamic library, which can be selected by the user on a QFileDialog. calls loadFunction () below. see there.
Implements UI::Dialogs::PluginCreator.
Referenced by PolarDialogImpl().
void UI::Dialogs::PolarDialogImpl::writeSource | ( | ) | [private, virtual] |
write a C++ source file, containing the given function and some framework to make it compilable by g++ (there is currently no support for other compilers). the resulting file "<function-name>.C" defines the function f () and the function symbolic (), which returns the function in symbolic terms, not in C++ syntax.
Implements UI::Dialogs::PluginCreator.