From 81ba2dbcffdc5e01c8afdaf0967dc50a4dcab623 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 12 Aug 2012 03:11:28 +0200 Subject: [PATCH] CHANGED: #1471 CDBViewQuantity fields can now be serialized. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/dbview_quantity.h | 1 + code/nel/src/gui/dbview_quantity.cpp | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/code/nel/include/nel/gui/dbview_quantity.h b/code/nel/include/nel/gui/dbview_quantity.h index 8e6c7e5a8..4522b9b9e 100644 --- a/code/nel/include/nel/gui/dbview_quantity.h +++ b/code/nel/include/nel/gui/dbview_quantity.h @@ -41,6 +41,7 @@ namespace NLGUI std::string getProperty( const std::string &name ) const; void setProperty( const std::string &name, const std::string &value ); + xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual void draw (); diff --git a/code/nel/src/gui/dbview_quantity.cpp b/code/nel/src/gui/dbview_quantity.cpp index e0515ea41..eae75d354 100644 --- a/code/nel/src/gui/dbview_quantity.cpp +++ b/code/nel/src/gui/dbview_quantity.cpp @@ -86,6 +86,30 @@ namespace NLGUI CViewText::setProperty( name, value ); } + + xmlNodePtr CDBViewQuantity::serialize( xmlNodePtr parentNode, const char *type ) const + { + xmlNodePtr node = CViewText::serialize( parentNode, type ); + if( node == NULL ) + return NULL; + + xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_quantity" ); + + if( _Number.getNodePtr() != NULL ) + xmlSetProp( node, BAD_CAST "value", BAD_CAST _Number.getNodePtr()->getFullName().c_str() ); + else + xmlSetProp( node, BAD_CAST "value", BAD_CAST "" ); + + if( _NumberMax.getNodePtr() != NULL ) + xmlSetProp( node, BAD_CAST "valuemax", BAD_CAST _NumberMax.getNodePtr()->getFullName().c_str() ); + else + xmlSetProp( node, BAD_CAST "valuemax", BAD_CAST "" ); + + xmlSetProp( node, BAD_CAST "emptytext", BAD_CAST _EmptyText.toString().c_str() ); + + return node; + } + // *************************************************************************** bool CDBViewQuantity::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) {