mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 17:26:16 +00:00
Merged default
This commit is contained in:
parent
2c021b0018
commit
59a4f6e677
12 changed files with 526 additions and 515 deletions
|
@ -364,6 +364,10 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
|
|||
#include <malloc.h>
|
||||
inline void *aligned_malloc(size_t size, size_t alignment) { return _aligned_malloc(size, alignment); }
|
||||
inline void aligned_free(void *ptr) { _aligned_free(ptr); }
|
||||
#elif defined(NL_OS_MAC)
|
||||
// under Mac OS X, malloc is already aligned for SSE and Altivec (16 bytes alignment)
|
||||
inline void *aligned_malloc(size_t size, size_t alignment) { return malloc(size); }
|
||||
inline void aligned_free(void *ptr) { free(ptr); }
|
||||
#else
|
||||
#include <malloc.h>
|
||||
inline void *aligned_malloc(size_t size, size_t alignment) { return memalign(alignment, size); }
|
||||
|
|
|
@ -450,14 +450,14 @@ PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
|
|||
PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
|
||||
|
||||
// ARB_occlusion_query
|
||||
PFNGLGENQUERIESPROC nglGenQueriesARB;
|
||||
PFNGLDELETEQUERIESPROC nglDeleteQueriesARB;
|
||||
PFNGLISQUERYPROC nglIsQueryARB;
|
||||
PFNGLBEGINQUERYPROC nglBeginQueryARB;
|
||||
PFNGLENDQUERYPROC nglEndQueryARB;
|
||||
PFNGLGETQUERYIVPROC nglGetQueryivARB;
|
||||
PFNGLGETQUERYOBJECTIVPROC nglGetQueryObjectivARB;
|
||||
PFNGLGETQUERYOBJECTUIVPROC nglGetQueryObjectuivARB;
|
||||
PFNGLGENQUERIESARBPROC nglGenQueriesARB;
|
||||
PFNGLDELETEQUERIESARBPROC nglDeleteQueriesARB;
|
||||
PFNGLISQUERYARBPROC nglIsQueryARB;
|
||||
PFNGLBEGINQUERYARBPROC nglBeginQueryARB;
|
||||
PFNGLENDQUERYARBPROC nglEndQueryARB;
|
||||
PFNGLGETQUERYIVARBPROC nglGetQueryivARB;
|
||||
PFNGLGETQUERYOBJECTIVARBPROC nglGetQueryObjectivARB;
|
||||
PFNGLGETQUERYOBJECTUIVARBPROC nglGetQueryObjectuivARB;
|
||||
|
||||
// GL_EXT_framebuffer_object
|
||||
PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
|
||||
|
@ -1397,14 +1397,14 @@ static bool setupARBOcclusionQuery(const char *glext)
|
|||
CHECK_EXT("ARB_occlusion_query");
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
CHECK_ADDRESS(PFNGLGENQUERIESPROC, glGenQueriesARB);
|
||||
CHECK_ADDRESS(PFNGLDELETEQUERIESPROC, glDeleteQueriesARB);
|
||||
CHECK_ADDRESS(PFNGLISQUERYPROC, glIsQueryARB);
|
||||
CHECK_ADDRESS(PFNGLBEGINQUERYPROC, glBeginQueryARB);
|
||||
CHECK_ADDRESS(PFNGLENDQUERYPROC, glEndQueryARB);
|
||||
CHECK_ADDRESS(PFNGLGETQUERYIVPROC, glGetQueryivARB);
|
||||
CHECK_ADDRESS(PFNGLGETQUERYOBJECTIVPROC, glGetQueryObjectivARB);
|
||||
CHECK_ADDRESS(PFNGLGETQUERYOBJECTUIVPROC, glGetQueryObjectuivARB);
|
||||
CHECK_ADDRESS(PFNGLGENQUERIESARBPROC, glGenQueriesARB);
|
||||
CHECK_ADDRESS(PFNGLDELETEQUERIESARBPROC, glDeleteQueriesARB);
|
||||
CHECK_ADDRESS(PFNGLISQUERYARBPROC, glIsQueryARB);
|
||||
CHECK_ADDRESS(PFNGLBEGINQUERYARBPROC, glBeginQueryARB);
|
||||
CHECK_ADDRESS(PFNGLENDQUERYARBPROC, glEndQueryARB);
|
||||
CHECK_ADDRESS(PFNGLGETQUERYIVARBPROC, glGetQueryivARB);
|
||||
CHECK_ADDRESS(PFNGLGETQUERYOBJECTIVARBPROC, glGetQueryObjectivARB);
|
||||
CHECK_ADDRESS(PFNGLGETQUERYOBJECTUIVARBPROC, glGetQueryObjectuivARB);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
|
@ -744,14 +744,14 @@ extern PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
|
|||
|
||||
// ARB_occlusion_query
|
||||
//==================================
|
||||
extern PFNGLGENQUERIESPROC nglGenQueriesARB;
|
||||
extern PFNGLDELETEQUERIESPROC nglDeleteQueriesARB;
|
||||
extern PFNGLISQUERYPROC nglIsQueryARB;
|
||||
extern PFNGLBEGINQUERYPROC nglBeginQueryARB;
|
||||
extern PFNGLENDQUERYPROC nglEndQueryARB;
|
||||
extern PFNGLGETQUERYIVPROC nglGetQueryivARB;
|
||||
extern PFNGLGETQUERYOBJECTIVPROC nglGetQueryObjectivARB;
|
||||
extern PFNGLGETQUERYOBJECTUIVPROC nglGetQueryObjectuivARB;
|
||||
extern PFNGLGENQUERIESARBPROC nglGenQueriesARB;
|
||||
extern PFNGLDELETEQUERIESARBPROC nglDeleteQueriesARB;
|
||||
extern PFNGLISQUERYARBPROC nglIsQueryARB;
|
||||
extern PFNGLBEGINQUERYARBPROC nglBeginQueryARB;
|
||||
extern PFNGLENDQUERYARBPROC nglEndQueryARB;
|
||||
extern PFNGLGETQUERYIVARBPROC nglGetQueryivARB;
|
||||
extern PFNGLGETQUERYOBJECTIVARBPROC nglGetQueryObjectivARB;
|
||||
extern PFNGLGETQUERYOBJECTUIVARBPROC nglGetQueryObjectuivARB;
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ NLMISC_REGISTER_OBJECT(CViewBase, CInterfaceGroupWheel, std::string, "group_whee
|
|||
namespace NLGUI
|
||||
{
|
||||
|
||||
void force_link_group_wheel_cpp() { }
|
||||
|
||||
// *****************************************************************************************************************
|
||||
CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam ¶m) : CInterfaceGroup(param)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace NLGUI
|
|||
void ifexprufct_forcelink();
|
||||
void force_link_dbgroup_select_number_cpp();
|
||||
void force_link_dbgroup_combo_box_cpp();
|
||||
void force_link_group_wheel_cpp();
|
||||
|
||||
/// Necessary so the linker doesn't drop the code of these classes from the library
|
||||
void LinkHack()
|
||||
|
@ -37,5 +38,6 @@ namespace NLGUI
|
|||
ifexprufct_forcelink();
|
||||
force_link_dbgroup_select_number_cpp();
|
||||
force_link_dbgroup_combo_box_cpp();
|
||||
force_link_group_wheel_cpp();
|
||||
}
|
||||
}
|
|
@ -68,12 +68,12 @@ IF(APPLE)
|
|||
SET_TARGET_PROPERTIES(ryzom_client PROPERTIES OUTPUT_NAME ${MACOSX_BUNDLE_BUNDLE_NAME})
|
||||
SET_TARGET_PROPERTIES(ryzom_client PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${MAC_RESOURCES_DIR}/Info.plist)
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client PRE_BUILD COMMAND mkdir -p ${RYZOM_RESOURCES_DIR})
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR})
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR})
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR})
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR})
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR})
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR})
|
||||
|
||||
IF(RYZOM_DATA_DIR)
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -R ARGS ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
|
||||
ENDIF(RYZOM_DATA_DIR)
|
||||
ENDIF(APPLE)
|
||||
|
||||
|
|
|
@ -2747,8 +2747,8 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory
|
|||
impulse.serial( slotIndex, CInventoryCategoryTemplate::SlotBitSize );
|
||||
|
||||
// Access the database leaf
|
||||
CCDBNodeBranch *slotNode = static_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)slotIndex ));
|
||||
ICDBNode *leafNode = slotNode->find( INVENTORIES::InfoVersionStr );
|
||||
CCDBNodeBranch *slotNode = safe_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)slotIndex ));
|
||||
CCDBNodeLeaf *leafNode = type_cast<CCDBNodeLeaf*>(slotNode->find( INVENTORIES::InfoVersionStr ));
|
||||
BOMB_IF( !leafNode, "Inventory slot property missing in database", continue );
|
||||
|
||||
// Apply or increment Info Version in database
|
||||
|
@ -2756,13 +2756,13 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory
|
|||
{
|
||||
uint32 infoVersion;
|
||||
impulse.serial( infoVersion, INVENTORIES::InfoVersionBitSize );
|
||||
((CCDBNodeLeaf*)leafNode)->setPropCheckGC( serverTick, infoVersion );
|
||||
leafNode->setPropCheckGC( serverTick, infoVersion );
|
||||
}
|
||||
else
|
||||
{
|
||||
// NB: don't need to check GC on a info version upgrade, since this is always a delta of +1
|
||||
// the order of received of this impulse is not important
|
||||
((CCDBNodeLeaf*)leafNode)->setValue64( ((CCDBNodeLeaf*)leafNode)->getValue64() + 1 );
|
||||
leafNode->setValue64( leafNode->getValue64() + 1 );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2777,10 +2777,10 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory
|
|||
//nldebug( "Inv %s Update %u", CInventoryCategoryTemplate::InventoryStr[invId], itemSlot.getSlotIndex() );
|
||||
|
||||
// Apply all properties to database
|
||||
CCDBNodeBranch *slotNode = static_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)itemSlot.getSlotIndex() ));
|
||||
CCDBNodeBranch *slotNode = safe_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)itemSlot.getSlotIndex() ));
|
||||
for ( uint i=0; i!=INVENTORIES::NbItemPropId; ++i )
|
||||
{
|
||||
CCDBNodeLeaf *leafNode = static_cast<CCDBNodeLeaf*>(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[i]) ));
|
||||
CCDBNodeLeaf *leafNode = type_cast<CCDBNodeLeaf*>(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[i]) ));
|
||||
SKIP_IF( !leafNode, "Inventory slot property missing in database", continue );
|
||||
leafNode->setPropCheckGC( serverTick, (sint64)itemSlot.getItemProp( ( INVENTORIES::TItemPropId)i ) );
|
||||
}
|
||||
|
@ -2796,8 +2796,8 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory
|
|||
//nldebug( "Inv %s Prop %u %s", CInventoryCategoryTemplate::InventoryStr[invId], itemSlot.getSlotIndex(), INVENTORIES::CItemSlot::ItemPropStr[itemSlot.getOneProp().ItemPropId] );
|
||||
|
||||
// Apply property to database
|
||||
CCDBNodeBranch *slotNode = static_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)itemSlot.getSlotIndex() ));
|
||||
CCDBNodeLeaf *leafNode = safe_cast<CCDBNodeLeaf*>(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[itemSlot.getOneProp().ItemPropId]) ));
|
||||
CCDBNodeBranch *slotNode = safe_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)itemSlot.getSlotIndex() ));
|
||||
CCDBNodeLeaf *leafNode = type_cast<CCDBNodeLeaf*>(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[itemSlot.getOneProp().ItemPropId]) ));
|
||||
SKIP_IF( !leafNode, "Inventory slot property missing in database", continue );
|
||||
leafNode->setPropCheckGC( serverTick, (sint64)itemSlot.getOneProp().ItemPropValue );
|
||||
|
||||
|
@ -2809,13 +2809,14 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory
|
|||
//nldebug( "Inv %s Reset %u", CInventoryCategoryTemplate::InventoryStr[invId], slotIndex );
|
||||
|
||||
// Reset all properties in database
|
||||
CCDBNodeBranch *slotNode = static_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)slotIndex ));
|
||||
CCDBNodeBranch *slotNode = safe_cast<CCDBNodeBranch*>(inventoryNode->getNode( (uint16)slotIndex ));
|
||||
for ( uint i=0; i!=INVENTORIES::NbItemPropId; ++i )
|
||||
{
|
||||
// Instead of clearing all leaves (by index), we must find and clear only the
|
||||
// properties in TItemPropId, because the actual database leaves may have
|
||||
// less properties, and because we must not clear the leaf INFO_VERSION.
|
||||
CCDBNodeLeaf *leafNode = safe_cast<CCDBNodeLeaf*>(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[i]) ));
|
||||
// NOTE: For example, only player BAG inventory has WORNED leaf.
|
||||
CCDBNodeLeaf *leafNode = type_cast<CCDBNodeLeaf*>(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[i]) ));
|
||||
SKIP_IF( !leafNode, "Inventory slot property missing in database", continue );
|
||||
leafNode->setPropCheckGC( serverTick, 0 );
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <nel/georges/u_form.h>
|
||||
#include <nel/georges/u_type.h>
|
||||
|
||||
namespace GeorgesQt
|
||||
namespace GeorgesQt
|
||||
{
|
||||
|
||||
CUndoFormArrayRenameCommand::CUndoFormArrayRenameCommand(CGeorgesFormModel *model, CFormItem *item, const QVariant &value, QUndoCommand *parent)
|
||||
|
@ -41,63 +41,63 @@ namespace GeorgesQt
|
|||
}
|
||||
|
||||
void CUndoFormArrayRenameCommand::redo()
|
||||
{
|
||||
{
|
||||
update(true);
|
||||
}
|
||||
|
||||
void CUndoFormArrayRenameCommand::undo()
|
||||
{
|
||||
{
|
||||
update(false);
|
||||
}
|
||||
|
||||
void CUndoFormArrayRenameCommand::update(bool redo)
|
||||
{
|
||||
// Get the parent node
|
||||
const NLGEORGES::CFormDfn *parentDfn;
|
||||
uint indexDfn;
|
||||
const NLGEORGES::CFormDfn *nodeDfn;
|
||||
const NLGEORGES::CType *nodeType;
|
||||
NLGEORGES::CFormElm *node;
|
||||
NLGEORGES::UFormDfn::TEntryType type;
|
||||
bool isArray;
|
||||
bool vdfnArray;
|
||||
NLGEORGES::CForm *form=static_cast<NLGEORGES::CForm*>(m_item->form());
|
||||
NLGEORGES::CFormElm *elm = static_cast<NLGEORGES::CFormElm*>(&form->Elements);
|
||||
|
||||
nlverify ( elm->getNodeByName (m_item->formName().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, isArray, vdfnArray, true, NLGEORGES_FIRST_ROUND) );
|
||||
if (node)
|
||||
{
|
||||
std::string tmpName;
|
||||
node->getFormName(tmpName);
|
||||
|
||||
NLGEORGES::CFormElmArray* array = static_cast<NLGEORGES::CFormElmArray*> (node->getParent ());
|
||||
|
||||
// In the redo stage save the old value, just in case.
|
||||
if(redo)
|
||||
{
|
||||
// If the name of the element is empty then give it a nice default.
|
||||
if(array->Elements[m_item->structId()].Name.empty())
|
||||
{
|
||||
m_oldValue.append("#");
|
||||
m_oldValue.append(QString("%1").arg(m_item->structId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oldValue = QString(array->Elements[m_item->structId()].Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
QString value;
|
||||
if(redo)
|
||||
value = m_newValue;
|
||||
else
|
||||
value = m_oldValue;
|
||||
|
||||
|
||||
array->Elements[m_item->structId()].Name = value.toAscii().data();
|
||||
m_item->setName(value.toAscii().data());
|
||||
|
||||
m_model->emitDataChanged(m_model->index(m_item->row(), 0, m_item));
|
||||
{
|
||||
// Get the parent node
|
||||
const NLGEORGES::CFormDfn *parentDfn;
|
||||
uint indexDfn;
|
||||
const NLGEORGES::CFormDfn *nodeDfn;
|
||||
const NLGEORGES::CType *nodeType;
|
||||
NLGEORGES::CFormElm *node;
|
||||
NLGEORGES::UFormDfn::TEntryType type;
|
||||
bool isArray;
|
||||
bool vdfnArray;
|
||||
NLGEORGES::CForm *form=static_cast<NLGEORGES::CForm*>(m_item->form());
|
||||
NLGEORGES::CFormElm *elm = static_cast<NLGEORGES::CFormElm*>(&form->Elements);
|
||||
|
||||
nlverify ( elm->getNodeByName (m_item->formName().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, isArray, vdfnArray, true, NLGEORGES_FIRST_ROUND) );
|
||||
if (node)
|
||||
{
|
||||
std::string tmpName;
|
||||
node->getFormName(tmpName);
|
||||
|
||||
NLGEORGES::CFormElmArray* array = static_cast<NLGEORGES::CFormElmArray*> (node->getParent ());
|
||||
|
||||
// In the redo stage save the old value, just in case.
|
||||
if(redo)
|
||||
{
|
||||
// If the name of the element is empty then give it a nice default.
|
||||
if(array->Elements[m_item->structId()].Name.empty())
|
||||
{
|
||||
m_oldValue.append("#");
|
||||
m_oldValue.append(QString("%1").arg(m_item->structId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oldValue = QString(array->Elements[m_item->structId()].Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
QString value;
|
||||
if(redo)
|
||||
value = m_newValue;
|
||||
else
|
||||
value = m_oldValue;
|
||||
|
||||
|
||||
array->Elements[m_item->structId()].Name = value.toAscii().data();
|
||||
m_item->setName(value.toAscii().data());
|
||||
|
||||
m_model->emitDataChanged(m_model->index(m_item->row(), 0, m_item));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,77 +1,77 @@
|
|||
#include "browser_ctrl.h"
|
||||
#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h"
|
||||
#include "3rdparty/qtpropertybrowser/qtvariantproperty.h"
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "nel/georges/form.h"
|
||||
|
||||
#include "formitem.h"
|
||||
|
||||
#include "browser_ctrl_pvt.h"
|
||||
|
||||
BrowserCtrl::BrowserCtrl( QtTreePropertyBrowser *browser ) :
|
||||
QObject( browser )
|
||||
{
|
||||
m_pvt = new BrowserCtrlPvt();
|
||||
m_pvt->setBrowser( browser );
|
||||
|
||||
connect( m_pvt, SIGNAL( arrayResized( const QString&, int ) ), this, SLOT( onArrayResized( const QString&, int ) ) );
|
||||
connect( m_pvt, SIGNAL( modified() ), this, SLOT( onModified() ) );
|
||||
connect( m_pvt, SIGNAL( valueChanged( const QString&, const QString& ) ), this, SLOT( onValueChanged( const QString&, const QString& ) ) );
|
||||
}
|
||||
|
||||
BrowserCtrl::~BrowserCtrl()
|
||||
{
|
||||
delete m_pvt;
|
||||
m_pvt = NULL;
|
||||
}
|
||||
|
||||
void BrowserCtrl::clicked( const QModelIndex &idx )
|
||||
#include "browser_ctrl.h"
|
||||
#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h"
|
||||
#include "3rdparty/qtpropertybrowser/qtvariantproperty.h"
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "nel/georges/form.h"
|
||||
|
||||
#include "formitem.h"
|
||||
|
||||
#include "browser_ctrl_pvt.h"
|
||||
|
||||
BrowserCtrl::BrowserCtrl( QtTreePropertyBrowser *browser ) :
|
||||
QObject( browser )
|
||||
{
|
||||
m_pvt = new BrowserCtrlPvt();
|
||||
m_pvt->setBrowser( browser );
|
||||
|
||||
connect( m_pvt, SIGNAL( arrayResized( const QString&, int ) ), this, SLOT( onArrayResized( const QString&, int ) ) );
|
||||
connect( m_pvt, SIGNAL( modified() ), this, SLOT( onModified() ) );
|
||||
connect( m_pvt, SIGNAL( valueChanged( const QString&, const QString& ) ), this, SLOT( onValueChanged( const QString&, const QString& ) ) );
|
||||
}
|
||||
|
||||
BrowserCtrl::~BrowserCtrl()
|
||||
{
|
||||
delete m_pvt;
|
||||
m_pvt = NULL;
|
||||
}
|
||||
|
||||
void BrowserCtrl::clicked( const QModelIndex &idx )
|
||||
{
|
||||
disableMgrConnections();
|
||||
m_pvt->clear();
|
||||
|
||||
GeorgesQt::CFormItem *item = static_cast< GeorgesQt::CFormItem* >( idx.internalPointer() );
|
||||
|
||||
m_pvt->setupNode( item );
|
||||
|
||||
enableMgrConnections();
|
||||
|
||||
}
|
||||
|
||||
void BrowserCtrl::onValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
m_pvt->onValueChanged( p, value );
|
||||
}
|
||||
|
||||
void BrowserCtrl::onValueChanged( const QString &key, const QString &value )
|
||||
{
|
||||
Q_EMIT valueChanged( key, value );
|
||||
}
|
||||
|
||||
void BrowserCtrl::onArrayResized( const QString &name, int size )
|
||||
{
|
||||
Q_EMIT arrayResized( name, size );
|
||||
}
|
||||
|
||||
void BrowserCtrl::onModified()
|
||||
{
|
||||
Q_EMIT modified();
|
||||
}
|
||||
|
||||
void BrowserCtrl::enableMgrConnections()
|
||||
{
|
||||
QtVariantPropertyManager *mgr = m_pvt->manager();
|
||||
|
||||
connect( mgr, SIGNAL( valueChanged( QtProperty*, const QVariant & ) ),
|
||||
this, SLOT( onValueChanged( QtProperty*, const QVariant & ) ) );
|
||||
}
|
||||
|
||||
void BrowserCtrl::disableMgrConnections()
|
||||
{
|
||||
QtVariantPropertyManager *mgr = m_pvt->manager();
|
||||
|
||||
disconnect( mgr, SIGNAL( valueChanged( QtProperty*, const QVariant & ) ),
|
||||
this, SLOT( onValueChanged( QtProperty*, const QVariant & ) ) );
|
||||
}
|
||||
|
||||
m_pvt->setupNode( item );
|
||||
|
||||
enableMgrConnections();
|
||||
|
||||
}
|
||||
|
||||
void BrowserCtrl::onValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
m_pvt->onValueChanged( p, value );
|
||||
}
|
||||
|
||||
void BrowserCtrl::onValueChanged( const QString &key, const QString &value )
|
||||
{
|
||||
Q_EMIT valueChanged( key, value );
|
||||
}
|
||||
|
||||
void BrowserCtrl::onArrayResized( const QString &name, int size )
|
||||
{
|
||||
Q_EMIT arrayResized( name, size );
|
||||
}
|
||||
|
||||
void BrowserCtrl::onModified()
|
||||
{
|
||||
Q_EMIT modified();
|
||||
}
|
||||
|
||||
void BrowserCtrl::enableMgrConnections()
|
||||
{
|
||||
QtVariantPropertyManager *mgr = m_pvt->manager();
|
||||
|
||||
connect( mgr, SIGNAL( valueChanged( QtProperty*, const QVariant & ) ),
|
||||
this, SLOT( onValueChanged( QtProperty*, const QVariant & ) ) );
|
||||
}
|
||||
|
||||
void BrowserCtrl::disableMgrConnections()
|
||||
{
|
||||
QtVariantPropertyManager *mgr = m_pvt->manager();
|
||||
|
||||
disconnect( mgr, SIGNAL( valueChanged( QtProperty*, const QVariant & ) ),
|
||||
this, SLOT( onValueChanged( QtProperty*, const QVariant & ) ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,284 +1,284 @@
|
|||
#include "browser_ctrl_pvt.h"
|
||||
#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h"
|
||||
#include "3rdparty/qtpropertybrowser/qtvariantproperty.h"
|
||||
#include <QVariant>
|
||||
#include "formitem.h"
|
||||
|
||||
#include "nel/georges/form.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
QVariant::Type getValueType( const NLGEORGES::UType *typ )
|
||||
{
|
||||
QVariant::Type t = QVariant::String;
|
||||
|
||||
NLGEORGES::UType::TType ttyp = NLGEORGES::UType::String;
|
||||
if( typ != NULL )
|
||||
ttyp = typ->getType();
|
||||
|
||||
switch( ttyp )
|
||||
{
|
||||
case NLGEORGES::UType::UnsignedInt: t = QVariant::UInt; break;
|
||||
case NLGEORGES::UType::SignedInt: t = QVariant::Int; break;
|
||||
case NLGEORGES::UType::Double: t = QVariant::Double; break;
|
||||
case NLGEORGES::UType::Color: t = QVariant::Color; break;
|
||||
case NLGEORGES::UType::String: t = QVariant::String; break;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
NLGEORGES::UFormElm* getGeorgesNode( GeorgesQt::CFormItem *item )
|
||||
{
|
||||
NLGEORGES::UFormElm *n = NULL;
|
||||
item->form()->getRootNode().getNodeByName( &n, item->formName().c_str() );
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BrowserCtrlPvt::BrowserCtrlPvt( QObject *parent ) :
|
||||
QObject( parent )
|
||||
{
|
||||
mgr = new QtVariantPropertyManager();
|
||||
factory = new QtVariantEditorFactory();
|
||||
m_rootNode = NULL;
|
||||
}
|
||||
|
||||
BrowserCtrlPvt::~BrowserCtrlPvt()
|
||||
{
|
||||
delete mgr;
|
||||
mgr = NULL;
|
||||
delete factory;
|
||||
factory = NULL;
|
||||
m_browser = NULL;
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupAtom( NLGEORGES::CFormElmStruct::CFormElmStructElm &elm )
|
||||
{
|
||||
#include "browser_ctrl_pvt.h"
|
||||
#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h"
|
||||
#include "3rdparty/qtpropertybrowser/qtvariantproperty.h"
|
||||
#include <QVariant>
|
||||
#include "formitem.h"
|
||||
|
||||
#include "nel/georges/form.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
QVariant::Type getValueType( const NLGEORGES::UType *typ )
|
||||
{
|
||||
QVariant::Type t = QVariant::String;
|
||||
|
||||
NLGEORGES::UType::TType ttyp = NLGEORGES::UType::String;
|
||||
if( typ != NULL )
|
||||
ttyp = typ->getType();
|
||||
|
||||
switch( ttyp )
|
||||
{
|
||||
case NLGEORGES::UType::UnsignedInt: t = QVariant::UInt; break;
|
||||
case NLGEORGES::UType::SignedInt: t = QVariant::Int; break;
|
||||
case NLGEORGES::UType::Double: t = QVariant::Double; break;
|
||||
case NLGEORGES::UType::Color: t = QVariant::Color; break;
|
||||
case NLGEORGES::UType::String: t = QVariant::String; break;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
NLGEORGES::UFormElm* getGeorgesNode( GeorgesQt::CFormItem *item )
|
||||
{
|
||||
NLGEORGES::UFormElm *n = NULL;
|
||||
item->form()->getRootNode().getNodeByName( &n, item->formName().c_str() );
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BrowserCtrlPvt::BrowserCtrlPvt( QObject *parent ) :
|
||||
QObject( parent )
|
||||
{
|
||||
mgr = new QtVariantPropertyManager();
|
||||
factory = new QtVariantEditorFactory();
|
||||
m_rootNode = NULL;
|
||||
}
|
||||
|
||||
BrowserCtrlPvt::~BrowserCtrlPvt()
|
||||
{
|
||||
delete mgr;
|
||||
mgr = NULL;
|
||||
delete factory;
|
||||
factory = NULL;
|
||||
m_browser = NULL;
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupAtom( NLGEORGES::CFormElmStruct::CFormElmStructElm &elm )
|
||||
{
|
||||
QString key = elm.Name.c_str();
|
||||
QString value = "";
|
||||
QVariant::Type t = QVariant::String;
|
||||
|
||||
if( elm.Element != NULL )
|
||||
{
|
||||
t = getValueType( elm.Element->getType() );
|
||||
|
||||
std::string formName;
|
||||
elm.Element->getFormName( formName, NULL );
|
||||
|
||||
std::string v;
|
||||
m_rootNode->getValueByName( v, formName.c_str(), NLGEORGES::UFormElm::NoEval, NULL, 0 );
|
||||
value = v.c_str();
|
||||
}
|
||||
|
||||
QtVariantProperty *p = mgr->addProperty( t, key );
|
||||
p->setValue( value );
|
||||
m_browser->addProperty( p );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupStruct( NLGEORGES::UFormElm *node )
|
||||
{
|
||||
NLGEORGES::CFormElmStruct *st = static_cast< NLGEORGES::CFormElmStruct* >( node );
|
||||
|
||||
t = getValueType( elm.Element->getType() );
|
||||
|
||||
std::string formName;
|
||||
elm.Element->getFormName( formName, NULL );
|
||||
|
||||
std::string v;
|
||||
m_rootNode->getValueByName( v, formName.c_str(), NLGEORGES::UFormElm::NoEval, NULL, 0 );
|
||||
value = v.c_str();
|
||||
}
|
||||
|
||||
QtVariantProperty *p = mgr->addProperty( t, key );
|
||||
p->setValue( value );
|
||||
m_browser->addProperty( p );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupStruct( NLGEORGES::UFormElm *node )
|
||||
{
|
||||
NLGEORGES::CFormElmStruct *st = static_cast< NLGEORGES::CFormElmStruct* >( node );
|
||||
|
||||
for( int i = 0; i < st->Elements.size(); i++ )
|
||||
{
|
||||
NLGEORGES::CFormElmStruct::CFormElmStructElm &elm = st->Elements[ i ];
|
||||
if( ( elm.Element != NULL ) && !elm.Element->isAtom() )
|
||||
continue;
|
||||
|
||||
if( elm.Element == NULL )
|
||||
{
|
||||
NLGEORGES::CFormDfn::CEntry &entry = st->FormDfn->getEntry( i );
|
||||
if( entry.getArrayFlag() )
|
||||
continue;
|
||||
}
|
||||
|
||||
setupAtom( elm );
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupStruct( GeorgesQt::CFormItem *node )
|
||||
{
|
||||
NLGEORGES::UFormElm *n = getGeorgesNode( node );
|
||||
if( n == NULL )
|
||||
return;
|
||||
|
||||
m_currentNode.p = n;
|
||||
|
||||
setupStruct( n );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupArray( GeorgesQt::CFormItem *node )
|
||||
{
|
||||
NLGEORGES::UFormElm *n = getGeorgesNode( node );
|
||||
uint size = 0;
|
||||
|
||||
if( n != NULL )
|
||||
{
|
||||
NLGEORGES::CFormElmArray *arr = static_cast< NLGEORGES::CFormElmArray* >( n );
|
||||
arr->getArraySize( size );
|
||||
m_currentNode.p = n;
|
||||
}
|
||||
|
||||
QString key = QObject::tr( "Array size" );
|
||||
QtVariantProperty *p = mgr->addProperty( QVariant::Int, key );
|
||||
p->setValue( size );
|
||||
m_browser->addProperty( p );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupNode( GeorgesQt::CFormItem *node )
|
||||
{
|
||||
m_currentNode.clear();
|
||||
m_currentNode.name = node->formName().c_str();
|
||||
|
||||
m_rootNode = dynamic_cast< NLGEORGES::CFormElm* >( &(node->form()->getRootNode()) );
|
||||
|
||||
if( node->isArray() )
|
||||
setupArray( node );
|
||||
else
|
||||
setupStruct( node );
|
||||
|
||||
m_browser->setFactoryForManager( mgr, factory );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::clear()
|
||||
{
|
||||
m_browser->clear();
|
||||
m_currentNode.clear();
|
||||
}
|
||||
|
||||
|
||||
void BrowserCtrlPvt::onStructValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
std::string k = p->propertyName().toUtf8().constData();
|
||||
std::string v = value.toString().toUtf8().constData();
|
||||
|
||||
bool created = false;
|
||||
m_currentNode.p->setValueByName( v.c_str(), k.c_str(), &created );
|
||||
|
||||
QString key = m_currentNode.name + "." + p->propertyName();
|
||||
|
||||
Q_EMIT modified();
|
||||
Q_EMIT valueChanged( key, value.toString() );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::createArray()
|
||||
{
|
||||
const NLGEORGES::CFormDfn *parentDfn;
|
||||
const NLGEORGES::CFormDfn *nodeDfn;
|
||||
uint indexDfn;
|
||||
const NLGEORGES::CType *type;
|
||||
NLGEORGES::UFormDfn::TEntryType entryType;
|
||||
NLGEORGES::CFormElm *node;
|
||||
bool created;
|
||||
bool isArray;
|
||||
|
||||
m_rootNode->createNodeByName( m_currentNode.name.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created );
|
||||
|
||||
if( !created )
|
||||
return;
|
||||
|
||||
m_currentNode.p = node;
|
||||
|
||||
NLGEORGES::CFormElmArray *arr = dynamic_cast< NLGEORGES::CFormElmArray* >( node );
|
||||
QString idx = "[0]";
|
||||
arr->createNodeByName( idx.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created );
|
||||
|
||||
std::string formName;
|
||||
arr->getFormName( formName, NULL );
|
||||
|
||||
Q_EMIT arrayResized( formName.c_str(), 1 );
|
||||
Q_EMIT modified();
|
||||
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
// Newsize checks hacked in, because setting unsigned value type in QVariant crashes the property browser!
|
||||
int newSize = value.toInt();
|
||||
if( newSize < 0 )
|
||||
return;
|
||||
|
||||
if( m_currentNode.p == NULL )
|
||||
{
|
||||
if( newSize != 1 )
|
||||
return;
|
||||
createArray();
|
||||
return;
|
||||
}
|
||||
|
||||
NLGEORGES::CFormElmArray *arr = static_cast< NLGEORGES::CFormElmArray* >( m_currentNode.p );
|
||||
std::string formName;
|
||||
arr->getFormName( formName, NULL );
|
||||
|
||||
int oldSize = arr->Elements.size();
|
||||
|
||||
if( newSize == oldSize )
|
||||
return;
|
||||
|
||||
if( newSize < oldSize )
|
||||
{
|
||||
for( int i = newSize; i < oldSize; i++ )
|
||||
{
|
||||
delete arr->Elements[ i ].Element;
|
||||
}
|
||||
|
||||
arr->Elements.resize( newSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
arr->Elements.resize( newSize );
|
||||
|
||||
|
||||
const NLGEORGES::CFormDfn *parentDfn;
|
||||
const NLGEORGES::CFormDfn *nodeDfn;
|
||||
uint indexDfn;
|
||||
const NLGEORGES::CType *type;
|
||||
NLGEORGES::UFormDfn::TEntryType entryType;
|
||||
NLGEORGES::CFormElm *node;
|
||||
bool created;
|
||||
bool isArray;
|
||||
|
||||
QString idx;
|
||||
|
||||
for( int i = oldSize; i < newSize; i++ )
|
||||
{
|
||||
idx.clear();
|
||||
idx += "[";
|
||||
idx += QString::number( i );
|
||||
idx += "]";
|
||||
|
||||
bool b;
|
||||
b = arr->createNodeByName( idx.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created );
|
||||
}
|
||||
}
|
||||
|
||||
QString name = formName.c_str();
|
||||
Q_EMIT arrayResized( name, newSize );
|
||||
Q_EMIT modified();
|
||||
|
||||
if( newSize == 0 )
|
||||
m_currentNode.p = NULL;
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
if( m_currentNode.p == NULL )
|
||||
{
|
||||
if( m_currentNode.name.isEmpty() )
|
||||
return;
|
||||
|
||||
onArrayValueChanged( p, value );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_currentNode.p->isStruct() )
|
||||
onStructValueChanged( p, value );
|
||||
else
|
||||
if( m_currentNode.p->isArray() )
|
||||
onArrayValueChanged( p, value );
|
||||
}
|
||||
|
||||
|
||||
NLGEORGES::CFormElmStruct::CFormElmStructElm &elm = st->Elements[ i ];
|
||||
if( ( elm.Element != NULL ) && !elm.Element->isAtom() )
|
||||
continue;
|
||||
|
||||
if( elm.Element == NULL )
|
||||
{
|
||||
NLGEORGES::CFormDfn::CEntry &entry = st->FormDfn->getEntry( i );
|
||||
if( entry.getArrayFlag() )
|
||||
continue;
|
||||
}
|
||||
|
||||
setupAtom( elm );
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupStruct( GeorgesQt::CFormItem *node )
|
||||
{
|
||||
NLGEORGES::UFormElm *n = getGeorgesNode( node );
|
||||
if( n == NULL )
|
||||
return;
|
||||
|
||||
m_currentNode.p = n;
|
||||
|
||||
setupStruct( n );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupArray( GeorgesQt::CFormItem *node )
|
||||
{
|
||||
NLGEORGES::UFormElm *n = getGeorgesNode( node );
|
||||
uint size = 0;
|
||||
|
||||
if( n != NULL )
|
||||
{
|
||||
NLGEORGES::CFormElmArray *arr = static_cast< NLGEORGES::CFormElmArray* >( n );
|
||||
arr->getArraySize( size );
|
||||
m_currentNode.p = n;
|
||||
}
|
||||
|
||||
QString key = QObject::tr( "Array size" );
|
||||
QtVariantProperty *p = mgr->addProperty( QVariant::Int, key );
|
||||
p->setValue( size );
|
||||
m_browser->addProperty( p );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::setupNode( GeorgesQt::CFormItem *node )
|
||||
{
|
||||
m_currentNode.clear();
|
||||
m_currentNode.name = node->formName().c_str();
|
||||
|
||||
m_rootNode = dynamic_cast< NLGEORGES::CFormElm* >( &(node->form()->getRootNode()) );
|
||||
|
||||
if( node->isArray() )
|
||||
setupArray( node );
|
||||
else
|
||||
setupStruct( node );
|
||||
|
||||
m_browser->setFactoryForManager( mgr, factory );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::clear()
|
||||
{
|
||||
m_browser->clear();
|
||||
m_currentNode.clear();
|
||||
}
|
||||
|
||||
|
||||
void BrowserCtrlPvt::onStructValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
std::string k = p->propertyName().toUtf8().constData();
|
||||
std::string v = value.toString().toUtf8().constData();
|
||||
|
||||
bool created = false;
|
||||
m_currentNode.p->setValueByName( v.c_str(), k.c_str(), &created );
|
||||
|
||||
QString key = m_currentNode.name + "." + p->propertyName();
|
||||
|
||||
Q_EMIT modified();
|
||||
Q_EMIT valueChanged( key, value.toString() );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::createArray()
|
||||
{
|
||||
const NLGEORGES::CFormDfn *parentDfn;
|
||||
const NLGEORGES::CFormDfn *nodeDfn;
|
||||
uint indexDfn;
|
||||
const NLGEORGES::CType *type;
|
||||
NLGEORGES::UFormDfn::TEntryType entryType;
|
||||
NLGEORGES::CFormElm *node;
|
||||
bool created;
|
||||
bool isArray;
|
||||
|
||||
m_rootNode->createNodeByName( m_currentNode.name.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created );
|
||||
|
||||
if( !created )
|
||||
return;
|
||||
|
||||
m_currentNode.p = node;
|
||||
|
||||
NLGEORGES::CFormElmArray *arr = dynamic_cast< NLGEORGES::CFormElmArray* >( node );
|
||||
QString idx = "[0]";
|
||||
arr->createNodeByName( idx.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created );
|
||||
|
||||
std::string formName;
|
||||
arr->getFormName( formName, NULL );
|
||||
|
||||
Q_EMIT arrayResized( formName.c_str(), 1 );
|
||||
Q_EMIT modified();
|
||||
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
// Newsize checks hacked in, because setting unsigned value type in QVariant crashes the property browser!
|
||||
int newSize = value.toInt();
|
||||
if( newSize < 0 )
|
||||
return;
|
||||
|
||||
if( m_currentNode.p == NULL )
|
||||
{
|
||||
if( newSize != 1 )
|
||||
return;
|
||||
createArray();
|
||||
return;
|
||||
}
|
||||
|
||||
NLGEORGES::CFormElmArray *arr = static_cast< NLGEORGES::CFormElmArray* >( m_currentNode.p );
|
||||
std::string formName;
|
||||
arr->getFormName( formName, NULL );
|
||||
|
||||
int oldSize = arr->Elements.size();
|
||||
|
||||
if( newSize == oldSize )
|
||||
return;
|
||||
|
||||
if( newSize < oldSize )
|
||||
{
|
||||
for( int i = newSize; i < oldSize; i++ )
|
||||
{
|
||||
delete arr->Elements[ i ].Element;
|
||||
}
|
||||
|
||||
arr->Elements.resize( newSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
arr->Elements.resize( newSize );
|
||||
|
||||
|
||||
const NLGEORGES::CFormDfn *parentDfn;
|
||||
const NLGEORGES::CFormDfn *nodeDfn;
|
||||
uint indexDfn;
|
||||
const NLGEORGES::CType *type;
|
||||
NLGEORGES::UFormDfn::TEntryType entryType;
|
||||
NLGEORGES::CFormElm *node;
|
||||
bool created;
|
||||
bool isArray;
|
||||
|
||||
QString idx;
|
||||
|
||||
for( int i = oldSize; i < newSize; i++ )
|
||||
{
|
||||
idx.clear();
|
||||
idx += "[";
|
||||
idx += QString::number( i );
|
||||
idx += "]";
|
||||
|
||||
bool b;
|
||||
b = arr->createNodeByName( idx.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created );
|
||||
}
|
||||
}
|
||||
|
||||
QString name = formName.c_str();
|
||||
Q_EMIT arrayResized( name, newSize );
|
||||
Q_EMIT modified();
|
||||
|
||||
if( newSize == 0 )
|
||||
m_currentNode.p = NULL;
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value )
|
||||
{
|
||||
if( m_currentNode.p == NULL )
|
||||
{
|
||||
if( m_currentNode.name.isEmpty() )
|
||||
return;
|
||||
|
||||
onArrayValueChanged( p, value );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_currentNode.p->isStruct() )
|
||||
onStructValueChanged( p, value );
|
||||
else
|
||||
if( m_currentNode.p->isArray() )
|
||||
onArrayValueChanged( p, value );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ namespace GeorgesQt
|
|||
CFormItem *addArray(CFormItem *parent, NLGEORGES::CFormElmArray *array, NLGEORGES::CFormDfn *rootDfn,
|
||||
const char *name, uint structId, const char *formName, uint slot);
|
||||
|
||||
void emitDataChanged(const QModelIndex &index)
|
||||
{
|
||||
Q_EMIT dataChanged(index, index);
|
||||
void emitDataChanged(const QModelIndex &index)
|
||||
{
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
|
||||
void arrayResized( const QString &name, int size );
|
||||
|
@ -103,3 +103,5 @@ namespace GeorgesQt
|
|||
} /* namespace GeorgesQt */
|
||||
|
||||
#endif // GEORGESFORM_MODEL_H
|
||||
|
||||
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Project includes
|
||||
#include "tile_editor_plugin.h"
|
||||
#include "tile_editor_main_window.h"
|
||||
#include "../core/icore.h"
|
||||
#include "../core/menu_manager.h"
|
||||
#include "../core/core_constants.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
using namespace TileEditorPluginQt;
|
||||
|
||||
TileEditorPlugin::~TileEditorPlugin()
|
||||
{
|
||||
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
|
||||
{
|
||||
m_plugMan->removeObject(obj);
|
||||
}
|
||||
qDeleteAll(m_autoReleaseObjects);
|
||||
m_autoReleaseObjects.clear();
|
||||
|
||||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Project includes
|
||||
#include "tile_editor_plugin.h"
|
||||
#include "tile_editor_main_window.h"
|
||||
#include "../core/icore.h"
|
||||
#include "../core/menu_manager.h"
|
||||
#include "../core/core_constants.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
using namespace TileEditorPluginQt;
|
||||
|
||||
TileEditorPlugin::~TileEditorPlugin()
|
||||
{
|
||||
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
|
||||
{
|
||||
m_plugMan->removeObject(obj);
|
||||
}
|
||||
qDeleteAll(m_autoReleaseObjects);
|
||||
m_autoReleaseObjects.clear();
|
||||
|
||||
delete m_LibContext;
|
||||
m_LibContext = NULL;
|
||||
}
|
||||
|
||||
bool TileEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
m_plugMan = pluginManager;
|
||||
addAutoReleasedObject(new TileEditorContext());
|
||||
return true;
|
||||
}
|
||||
|
||||
void TileEditorPlugin::extensionsInitialized()
|
||||
{
|
||||
}
|
||||
|
||||
void TileEditorPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
// Ensure that a context doesn't exist yet.
|
||||
// This only applies to platforms without PIC, e.g. Windows.
|
||||
nlassert(!NLMISC::INelContext::isContextInitialised());
|
||||
#endif // NL_OS_WINDOWS
|
||||
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
|
||||
}
|
||||
|
||||
void TileEditorPlugin::addAutoReleasedObject(QObject *obj)
|
||||
{
|
||||
m_plugMan->addObject(obj);
|
||||
m_autoReleaseObjects.prepend(obj);
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(TileEditorPlugin)
|
||||
m_LibContext = NULL;
|
||||
}
|
||||
|
||||
bool TileEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
m_plugMan = pluginManager;
|
||||
addAutoReleasedObject(new TileEditorContext());
|
||||
return true;
|
||||
}
|
||||
|
||||
void TileEditorPlugin::extensionsInitialized()
|
||||
{
|
||||
}
|
||||
|
||||
void TileEditorPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
// Ensure that a context doesn't exist yet.
|
||||
// This only applies to platforms without PIC, e.g. Windows.
|
||||
nlassert(!NLMISC::INelContext::isContextInitialised());
|
||||
#endif // NL_OS_WINDOWS
|
||||
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
|
||||
}
|
||||
|
||||
void TileEditorPlugin::addAutoReleasedObject(QObject *obj)
|
||||
{
|
||||
m_plugMan->addObject(obj);
|
||||
m_autoReleaseObjects.prepend(obj);
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(TileEditorPlugin)
|
||||
|
|
Loading…
Reference in a new issue