Permalink
Browse files

Doxygen documentation

  • Loading branch information...
feragon committed Aug 17, 2016
1 parent 55fbf24 commit 35a265d48befcd39174d906da039ecde5308945c
View
@@ -40,6 +40,10 @@ class CadMdiChild : public QWidget {
void newDocument();
/**
* \brief Give function to call when window is destroyed
* \param callback Lua function
*/
void setDestroyCallback(LuaIntf::LuaRef callback);
void keyPressEvent(QKeyEvent* event);
@@ -67,13 +71,38 @@ class CadMdiChild : public QWidget {
lc::StorageManager_SPtr storageManager() const;
LCViewer::LCADViewer* viewer() const {return _viewer;}
std::shared_ptr<LCViewer::Cursor> cursor() const;
/**
* \brief Get container of temporary entities
* \return Temporary entities container
*/
LCViewer::TempEntities_SPtr tempEntities();
/**
* \brief Get selected entities
* \return Selected entities
* Return a vector of selected entities.
* This function was added for Lua which can't access EntityContainer functions
*/
std::vector<lc::entity::CADEntity_SPtr> selection();
void cancelCurrentOperations();
void import(std::string);
void exportDXF(std::string& str, DXF::version lcv);
/**
* \brief Get window ID
* \return Window ID
* This is used by Lua to distinguish the different windows.
*/
unsigned int id();
/**
* \brief Set window ID
* \param id Window ID
* This is used by Lua to distinguish the different windows.
* This function should not be used.
*/
void setId(unsigned int id);
private:
@@ -16,12 +16,26 @@
namespace Ui {
class AddLayerDialog;
}
/**
* \brief Create a dialog with all required fields to create a new layer
*/
class AddLayerDialog : public QDialog {
Q_OBJECT
public:
/**
* \brief Create empty dialog
* \param document Document which contains the DXFLinePatterns
* \param parent Parent widget
*/
AddLayerDialog(lc::Document_SPtr document, QWidget* parent = 0);
/**
* \brief Create dialog pre-filled with existing Layer informations
* \param oldLayer Layer to edit
* \param document Document which contains the DXFLinePatterns
* \param parent Parent widget
*/
AddLayerDialog(lc::Layer_CSPtr oldLayer, lc::Document_SPtr document, QWidget* parent = 0);
~AddLayerDialog();
@@ -30,6 +44,11 @@ class AddLayerDialog : public QDialog {
void editLayer(lc::Layer_CSPtr oldLayer, lc::Layer_CSPtr newLayer);
private slots:
/**
* \brief Create layer
* This function is called when "Ok" button is pressed.
* It creates the layer according to the entered informations and send it back to Layers widget.
*/
void accept();
protected:
@@ -21,20 +21,56 @@
namespace Ui {
class AddLinePatternDialog;
}
/**
* \brief Create a dialog with all required fields to create a new line pattern
*/
class AddLinePatternDialog : public QDialog {
Q_OBJECT
public:
/**
* \brief Create empty dialog
* \param document Document which contains the DXFLinePatterns
* \param parent Parent widget
*/
AddLinePatternDialog(lc::Document_SPtr document, QWidget* parent = 0);
/**
* \brief Create dialog pre-filled with existing line pattern informations.
* \param document Document which contains the DXFLinePatterns.
* \param linePattern Line pattern to edit
* \param parent Parent widget
*/
AddLinePatternDialog(lc::Document_SPtr document, lc::DxfLinePattern_CSPtr linePattern, QWidget* parent = 0);
private slots:
/**
* \brief Create a new entry for the pattern path.
*/
void on_newValueButton_pressed();
/**
* \brief Cancel
* Close the dialog.
*/
void on_cancelButton_pressed();
/**
* \brief Save
* Save the line pattern in the document and close the dialog.
*/
void on_saveButton_pressed();
/**
* \brief Edit
* Replace the original line pattern with the new one and close the dialog.
*/
void onEditButtonPressed();
/**
* \brief Generate line pattern preview
* Create a new QPixmap with a preview of the line pattern and add it in the dialog.
*/
void generatePreview();
protected:
@@ -11,21 +11,53 @@
namespace Ui {
class LinePatternManager;
}
/**
* \brief Create a new window which shows a list of line patterns
*/
class LinePatternManager : public QDialog {
Q_OBJECT
public:
/**
* \brief Create window
* \param document Document which contains the DXFLinePatterns
* \param parent Parent widget
*/
LinePatternManager(lc::Document_SPtr document, QWidget* parent = 0);
~LinePatternManager();
/**
* \brief Set a new document
* and update the list of line patterns.
* Document can be set to nullptr to clear the list.
* \param document Document or nullptr
*/
void setDocument(lc::Document_SPtr document);
private slots:
/**
* \brief Create update dialog.
* This function is called when "Edit" button is pressed.
* It create a new dialog pre-filled with the line pattern informations.
*/
void on_editButton_pressed();
/**
* \brief Create new line pattern dialog.
* It create a new dialog to create a line pattern.
* This function is called when "New" button is pressed.
*/
void on_newButton_pressed();
/**
* \brief Create update dialog.
* It create a new dialog pre-filled with the line pattern informations.
* This function is called when an element of the list is double clicked.
*/
void on_lpView_doubleClicked(const QModelIndex& index);
private:
/**
* \brief Refresh line patterns list.
*/
void updateModel();
Ui::LinePatternManager* ui;
View
@@ -12,23 +12,73 @@ extern "C"
#include "lua-intf/LuaIntf/LuaIntf.h"
#include "lua/qtbridge.h"
/**
* \brief QObject wrapper for Lua
* Allow connecting Qt signals with Lua functions
*/
class LuaQObject : public QObject {
public:
/**
* \brief Create QObject wrapper
* \param object Pointer to QObject to wrap
*/
LuaQObject(QObject* object);
~LuaQObject();
/**
* \brief Connect Qt slot to Lua function
* \param signalId Object signal ID
* \param slot Lua function
* \return true if connected, false if an error happened
*/
bool connect(int signalId, LuaIntf::LuaRef slot);
/**
* \brief Add signal parameter
* \param s Lua state
* \param type Qt QMetaType ID
* \param arg Pointer to arg
* Push a signal parameter to Lua stack
*/
void pushArg(LuaIntf::LuaState s, int const type, void const* arg);
/**
* \brief Get object name.
* \return QObject name
*/
std::string objectName();
/**
* \brief Get object name.
* \param object Pointer to QObject
* \return QObject name
*/
static std::string objectName(QObject* object);
/**
* \brief Find children by name
* \param name Children name
* \return Pointer to QObject
*/
QObject* findChild(std::string name);
/**
* \brief Find children by name
* \param object Pointer to QObject
* \param name Children name
* \return Pointer to QObject
*/
static QObject* findChild(QObject* object, std::string name);
/**
* \brief Return object validity
* \return true if QOaject still exists
*/
bool valid();
/**
* \brief Internal Qt function
* This function is called when a slot of this object is called.
* It gets the arguments and call the Lua function
*/
int qt_metacall(QMetaObject::Call c, int id, void **a);
private:
View
@@ -23,32 +23,75 @@ extern "C"
#include "cad/lualibrecadbridge.h"
#include "lua/qtbridge.h"
/**
* \brief Lua initializer
*/
class LuaInterface {
public:
/**
* \brief Create Lua instance
*/
LuaInterface();
~LuaInterface();
/**
* \brief Read and execute Lua files
*/
void initLua();
/**
* \brief Connect Qt signal with Lua function
* \param sender Pointer to sender object
* \param signalName Name of the signal with parameters
* \param slot Lua function
* \return true if connected, false if an error happened
*/
bool luaConnect(
QObject* sender,
std::string signalName,
LuaIntf::LuaRef slot
);
/**
* \brief Connect Qt signal with Qt slot
* \param sender Pointer to sender object
* \param signalName Name of the signal with parameters
* \param receiver Pointer to receiver object
* \param slotName Name of the slot with parameters
*/
bool qtConnect(QObject* sender,
std::string signalName,
QObject* receiver,
std::string slotName);
/**
* \brief Remove all connections that aren't valid anymore.
*/
void cleanInvalidQObject();
/**
* \brief Load Qt widget from .ui file
* \param fileName full path to .ui file
*/
static std::shared_ptr<QWidget> loadUiFile(const char* fileName);
/**
* \brief Return a list of plugins
* \param path Path of plugins
* \return List of strings containing the name of plugins
*/
std::vector<std::string> pluginList(const char* path);
/**
* \brief Hide the window.
* It needs to be used before initLua(), this is used in unit tests.
*/
void hideUI(bool hidden);
/**
* \brief Returns current Lua state.
* This is used for unit tests.
*/
LuaIntf::LuaState luaState();
private:
Oops, something went wrong.

0 comments on commit 35a265d

Please sign in to comment.