Move documentation to cpp file.

--HG--
branch : feature
This commit is contained in:
dismine 2014-05-30 12:12:20 +03:00
parent 93f62d9ee9
commit 1b877ca978
2 changed files with 65 additions and 61 deletions

View File

@ -31,6 +31,13 @@
qreal VDrawTool::factor = 1; qreal VDrawTool::factor = 1;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VDrawTool constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param parent parent object.
*/
VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id) VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id)
:VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false), :VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false),
nameActivDraw(doc->GetNameActivDraw()), dialog(nullptr) nameActivDraw(doc->GetNameActivDraw()), dialog(nullptr)
@ -46,7 +53,15 @@ VDrawTool::~VDrawTool()
delete dialog; delete dialog;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowTool highlight tool.
* @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
Q_UNUSED(id); Q_UNUSED(id);
@ -55,6 +70,10 @@ void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace. name new active pattern peace.
*/
void VDrawTool::ChangedActivDraw(const QString &newName) void VDrawTool::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -68,6 +87,11 @@ void VDrawTool::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedNameDraw save new name active pattern peace.
* @param oldName old name.
* @param newName new name active pattern peace. new name.
*/
void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName) void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName)
{ {
if (nameActivDraw == oldName) if (nameActivDraw == oldName)
@ -77,6 +101,10 @@ void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromGui refresh tool data after change in options.
* @param result keep result working dialog.
*/
void VDrawTool::FullUpdateFromGui(int result) void VDrawTool::FullUpdateFromGui(int result)
{ {
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
@ -95,6 +123,10 @@ void VDrawTool::FullUpdateFromGui(int result)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VDrawTool::SetFactor(qreal factor) void VDrawTool::SetFactor(qreal factor)
{ {
if (factor <= 2 && factor >= 0.5) if (factor <= 2 && factor >= 0.5)
@ -104,6 +136,10 @@ void VDrawTool::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToCalculation add tool to calculation tag in pattern file.
* @param domElement tag in xml tree.
*/
void VDrawTool::AddToCalculation(const QDomElement &domElement) void VDrawTool::AddToCalculation(const QDomElement &domElement)
{ {
QDomElement calcElement; QDomElement calcElement;

View File

@ -42,83 +42,41 @@ class VDrawTool : public VAbstractTool
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VDrawTool constructor. VDrawTool(VPattern *doc, VContainer *data, quint32 id);
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param parent parent object.
*/
VDrawTool(VPattern *doc, VContainer *data, quint32 id);
virtual ~VDrawTool(); virtual ~VDrawTool();
/**
* @brief setDialog set dialog when user want change tool option. /** @brief setDialog set dialog when user want change tool option. */
*/
virtual void setDialog() {} virtual void setDialog() {}
/**
* @brief ignoreContextMenu set ignore contect menu tool. void ignoreContextMenu(bool enable);
* @param enable true - ignore.
*/
void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;}
public slots: public slots:
/**
* @brief ShowTool highlight tool.
* @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace. name new active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief ChangedNameDraw save new name active pattern peace.
* @param oldName old name.
* @param newName new name active pattern peace. new name.
*/
void ChangedNameDraw(const QString &oldName, const QString &newName); void ChangedNameDraw(const QString &oldName, const QString &newName);
/**
* @brief FullUpdateFromGui refresh tool data after change in options.
* @param result keep result working dialog.
*/
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
protected: protected:
/** /** @brief ignoreContextMenuEvent ignore or not context menu events. */
* @brief ignoreContextMenuEvent ignore or not context menu events.
*/
bool ignoreContextMenuEvent; bool ignoreContextMenuEvent;
/**
* @brief ignoreFullUpdate ignore or not full updates. /** @brief ignoreFullUpdate ignore or not full updates. */
*/
bool ignoreFullUpdate; bool ignoreFullUpdate;
/**
* @brief nameActivDraw name of tool's pattern peace. /** @brief nameActivDraw name of tool's pattern peace. */
*/
QString nameActivDraw; QString nameActivDraw;
/**
* @brief factor scene scale factor. /** @brief factor scene scale factor. */
*/
static qreal factor; static qreal factor;
/**
* @brief dialog dialog options. /** @brief dialog dialog options.*/
*/
DialogTool *dialog; DialogTool *dialog;
/**
* @brief AddToCalculation add tool to calculation tag in pattern file.
* @param domElement tag in xml tree.
*/
void AddToCalculation(const QDomElement &domElement); void AddToCalculation(const QDomElement &domElement);
/**
* @brief SaveDialog save options into file after change in dialog. /** @brief SaveDialog save options into file after change in dialog. */
*/
virtual void SaveDialog(QDomElement &domElement)=0; virtual void SaveDialog(QDomElement &domElement)=0;
template <typename Dialog, typename Tool> template <typename Dialog, typename Tool>
/** /**
* @brief ContextMenu show context menu for tool. * @brief ContextMenu show context menu for tool.
@ -203,4 +161,14 @@ private:
Q_DISABLE_COPY(VDrawTool) Q_DISABLE_COPY(VDrawTool)
}; };
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ignoreContextMenu set ignore contect menu tool.
* @param enable true - ignore.
*/
inline void VDrawTool::ignoreContextMenu(bool enable)
{
ignoreContextMenuEvent = enable;
}
#endif // VDRAWTOOL_H #endif // VDRAWTOOL_H