From: vsr Date: Sat, 29 Dec 2012 07:18:29 +0000 (+0000) Subject: Merge from BR_DDS_IMP 29/12/2012 X-Git-Tag: V6_main_FINAL~63 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0dc8248943da1f8fd4549a5594fa5d7da3e1d35b;p=modules%2Fgui.git Merge from BR_DDS_IMP 29/12/2012 --- diff --git a/src/DDS/DDS_DicGroup.cxx b/src/DDS/DDS_DicGroup.cxx index ea2c65593..5a492d658 100644 --- a/src/DDS/DDS_DicGroup.cxx +++ b/src/DDS/DDS_DicGroup.cxx @@ -182,12 +182,12 @@ void DDS_DicGroup::FillDataMap( const LDOM_Element& theComponentData, const LDOM // 1. Attributes (id,label,units?,format?,required?) TCollection_AsciiString anID = aQuantity.getAttribute( DDS_Dictionary::KeyWord( "DATUM_ID" ) ); - Handle(DDS_DicItem) aDicItem = new DDS_DicItem(); + Handle(DDS_DicItem) aDicItem = CreateItem(); aDicItem->myComponent = this; aDicItem->FillDataMap( anID, aQuantity, theComponentData, theDocElement, unitSystems ); myDataMap.Add( anID, aDicItem ); - + bool exist = false; for( int i=1, n=myKeys.Length(); i<=n && !exist; i++ ) if( myKeys.Value( i )==anID ) @@ -226,3 +226,67 @@ void DDS_DicGroup::GetKeys( TColStd_SequenceOfAsciiString& seq ) const { seq = myKeys; } + +/*! + \brief Instantiate new dictionary item, used for customization of + data dictionary items. + \return New dictionary item instance. +*/ +Handle(DDS_DicItem) DDS_DicGroup::CreateItem() const +{ + return new DDS_DicItem(); +} + +/*! + \brief Bind dictionary item to ID + \return Standard_True if the item has been succesfully bound. + Standard_False if there is an item with same id. +*/ +Standard_Boolean DDS_DicGroup::AddDicItem( const TCollection_AsciiString& theID, + const Handle(DDS_DicItem)& theDicItem ) +{ + if ( myDataMap.Contains( theID ) ) + return Standard_False; + + myDataMap.Add( theID, theDicItem ); + myKeys.Append( theID ); + + return Standard_True; +} + +/*! + \brief Check if there is item bounded by id. + \return Standard_True if there is an item bound in map with given id. +*/ +Standard_Boolean DDS_DicGroup::HasDicItem( const TCollection_AsciiString& theID ) const +{ + return myDataMap.Contains( theID ); +} + +/*! + \brief Clear dictionary items map +*/ +void DDS_DicGroup::RemoveAllDicItems() +{ + myDataMap.Clear(); + myKeys.Clear(); +} + +/*! + \brief Returns a reference to a map. Can be used to iterate through + dictionary items. +*/ +const DDS_IndexedDataMapOfDicItems& DDS_DicGroup::GetItemMap() const +{ + return myDataMap; +} + +/*! + \brief Add new unit system and bind its label name. + \return Standard_False if there is other system bound by this key. +*/ +Standard_Boolean DDS_DicGroup::AddUnitSystem( const TCollection_AsciiString& theSystemKey, + const TCollection_ExtendedString& theSystemLabel ) +{ + return myUnitSystem.Bind( theSystemKey, theSystemLabel ); +} diff --git a/src/DDS/DDS_DicGroup.h b/src/DDS/DDS_DicGroup.h index 5b7d2f6c8..ac53bd409 100644 --- a/src/DDS/DDS_DicGroup.h +++ b/src/DDS/DDS_DicGroup.h @@ -38,27 +38,44 @@ DEFINE_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared) class DDS_DicGroup : public MMgt_TShared { public: - DDS_DicGroup( const TCollection_AsciiString& ); + Standard_EXPORT DDS_DicGroup( const TCollection_AsciiString& ); - TCollection_AsciiString GetName() const; - Standard_EXPORT void GetKeys( TColStd_SequenceOfAsciiString& ) const; + Standard_EXPORT TCollection_AsciiString GetName() const; + Standard_EXPORT void GetKeys( TColStd_SequenceOfAsciiString& ) const; - Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; + Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; - Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; - Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; + Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; + Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; - Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem() const; - Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString& ); + Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem() const; + Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString& ); -private: - DDS_DicGroup( const DDS_DicGroup& ); + virtual Standard_EXPORT Handle(DDS_DicItem) CreateItem() const; + +protected: - void operator=( const DDS_DicGroup& ); + Standard_EXPORT DDS_DicGroup( const DDS_DicGroup& ); - void FillDataMap( const LDOM_Element&, const LDOM_Element& ); + Standard_EXPORT void operator=( const DDS_DicGroup& ); + + Standard_EXPORT virtual void FillDataMap( const LDOM_Element&, const LDOM_Element& ); + + Standard_EXPORT Standard_Boolean AddDicItem( const TCollection_AsciiString&, + const Handle(DDS_DicItem)& ); + + Standard_EXPORT Standard_Boolean HasDicItem( const TCollection_AsciiString& ) const; + + Standard_EXPORT void RemoveAllDicItems(); + + Standard_EXPORT const + DDS_IndexedDataMapOfDicItems& GetItemMap() const; + + Standard_EXPORT Standard_Boolean AddUnitSystem( const TCollection_AsciiString&, + const TCollection_ExtendedString& ); + +protected: -private: typedef NCollection_DataMap UnitSystemMap; diff --git a/src/DDS/DDS_DicItem.cxx b/src/DDS/DDS_DicItem.cxx index 4ec5f83a4..1e6daef4c 100644 --- a/src/DDS/DDS_DicItem.cxx +++ b/src/DDS/DDS_DicItem.cxx @@ -1291,3 +1291,188 @@ DDS_DicItem::UnitSystem DDS_DicItem::GetActiveUnitSystem() const aSystem = aComponent->GetActiveUnitSystem(); return aSystem; } + +/*! + \brief Set item's identify string. + \param theId identify string. +*/ +void DDS_DicItem::SetId( const TCollection_AsciiString& theId ) +{ + myId = theId; +} + +/*! + \brief Set item's component pointer. + \param theComponent component pointer. +*/ +void DDS_DicItem::SetComponent( const Handle(Standard_Transient)& theComponent ) +{ + myComponent = theComponent; +} + +/*! + \brief Set item's label string. + \param theLabel label string. +*/ +void DDS_DicItem::SetLabel( const TCollection_AsciiString& theLabel ) +{ + myLabel = theLabel; +} + +/*! + \brief Set item's filter string. + \param theFilter filter string. +*/ +void DDS_DicItem::SetFilter( const TCollection_AsciiString& theFilter ) +{ + myFilter = theFilter; +} + +/*! + \brief Set item's required value. + \param theRequired required value string. +*/ +void DDS_DicItem::SetRequired( const TCollection_AsciiString& theRequired ) +{ + myRequired = theRequired; +} + +/*! + \brief Set item's warning level value. + \param theWarningLevel warning level value. +*/ +void DDS_DicItem::SetWarningLevel( const Standard_Integer& theWarningLevel ) +{ + myWarnLevel = theWarningLevel; +} + +/*! + \brief Set item's minimum zoom value. + \param theMinZoom minimum zoom value. +*/ +void DDS_DicItem::SetMinZoom( const Standard_Real& theMinZoom ) +{ + myMinZoom = theMinZoom; +} + +/*! + \brief Set item's maximum zoom value. + \param theMaxZoom maximum zoom value. +*/ +void DDS_DicItem::SetMaxZoom( const Standard_Real& theMaxZoom ) +{ + myMaxZoom = theMaxZoom; +} + +/*! + \brief Set item's zoom order value. + \param theZoomOrder zoom order value. +*/ +void DDS_DicItem::SetZoomOrder( const Standard_Real& theZoomOrder ) +{ + myZoomOrder = theZoomOrder; +} + +/*! + \brief Set item's short description. + \param theShortDescr short description string. +*/ +void DDS_DicItem::SetShortDescription( const TCollection_ExtendedString& theShortDescr ) +{ + myShortDescr = theShortDescr; +} + +/*! + \brief Set item's long description. + \param theLongDescr long description string. +*/ +void DDS_DicItem::SetLongDescription( const TCollection_ExtendedString& theLongDescr ) +{ + myLongDescr = theLongDescr; +} + +/*! + \brief Add item's option. + \param theOptionName option name string. + \param theOptionValue option value string. +*/ +bool DDS_DicItem::SetOption( const TCollection_AsciiString& theOptionName, + const TCollection_AsciiString& theOptionValue ) +{ + return myOptions.Bind( theOptionName, theOptionValue ); +} + +/*! + \brief Set item's type value. + \param theType item value type. +*/ +void DDS_DicItem::SetType( const DDS_DicItem::Type& theType ) +{ + myType = theType; +} + +/*! + \brief Set item's minimum value. + \param theMinVal minimum possible value. +*/ +void DDS_DicItem::SetMin( const Standard_Real& theMinVal ) +{ + myData |= MinValue; + myMin = theMinVal; +} + +/*! + \brief Set item's maximum value. + \param theMaxVal maximum possible value. +*/ +void DDS_DicItem::SetMax( const Standard_Real& theMaxVal ) +{ + myData |= MaxValue; + myMax = theMaxVal; +} + +/*! + \brief Set item's default value as a real number. + \param theDefVal default value. +*/ +void DDS_DicItem::SetDefaultValue( const Standard_Real& theDefVal ) +{ + myData |= DefaultValue; + myDefValue = theDefVal; +} + +/*! + \brief Set item's default value as a string. + \param theDefStr default value. +*/ +void DDS_DicItem::SetDefaultValue( const TCollection_AsciiString& theDefStr ) +{ + myDefString = theDefStr; +} + +/*! + \brief Set item's value list. + \param theStrings list of value strings. + \param theIntegers list of integer values associated with string item. +*/ +void DDS_DicItem::SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)& theStrings, + const Handle(TColStd_HArray1OfInteger)& theIntegers ) +{ + myListRef = theStrings; + myListRefID = theIntegers; +} + +/*! + \brief Set item's value list and icons. + \param theStrings list of value strings. + \param theIntegers list of integer values associated with string item. + \param theIcons list of icons associated with string item. +*/ +void DDS_DicItem::SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)& theStrings, + const Handle(TColStd_HArray1OfInteger)& theIntegers, + const Handle(TColStd_HArray1OfExtendedString)& theIcons ) +{ + myListRef = theStrings; + myListRefID = theIntegers; + myListRefIcons = theIcons; +} diff --git a/src/DDS/DDS_DicItem.h b/src/DDS/DDS_DicItem.h index 96efab7fa..814ac28e2 100644 --- a/src/DDS/DDS_DicItem.h +++ b/src/DDS/DDS_DicItem.h @@ -82,90 +82,132 @@ public: typedef TCollection_AsciiString UnitSystem; public: - DDS_DicItem(); + Standard_EXPORT DDS_DicItem(); - Standard_EXPORT TCollection_AsciiString GetId() const; - Standard_EXPORT DDS_DicItem::Type GetType() const; - Standard_EXPORT TCollection_ExtendedString GetLabel() const; - Standard_EXPORT TCollection_ExtendedString GetFilter() const; - Standard_EXPORT TCollection_ExtendedString GetRequired() const; - Standard_EXPORT DDS_MsgType GetWarningLevel() const; - Standard_EXPORT TCollection_ExtendedString GetLongDescription() const; - Standard_EXPORT TCollection_ExtendedString GetShortDescription() const; - Standard_EXPORT TCollection_AsciiString GetComponent() const; + Standard_EXPORT TCollection_AsciiString GetId() const; + Standard_EXPORT DDS_DicItem::Type GetType() const; + Standard_EXPORT TCollection_ExtendedString GetLabel() const; + Standard_EXPORT TCollection_ExtendedString GetFilter() const; + Standard_EXPORT TCollection_ExtendedString GetRequired() const; + Standard_EXPORT DDS_MsgType GetWarningLevel() const; + Standard_EXPORT TCollection_ExtendedString GetLongDescription() const; + Standard_EXPORT TCollection_ExtendedString GetShortDescription() const; + Standard_EXPORT TCollection_AsciiString GetComponent() const; - Standard_EXPORT TCollection_AsciiString GetUnits() const; - Standard_EXPORT TCollection_AsciiString GetUnits( const UnitSystem& ) const; + Standard_EXPORT virtual TCollection_AsciiString GetUnits() const; + Standard_EXPORT virtual TCollection_AsciiString GetUnits( const UnitSystem& ) const; - Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const; - Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const; + Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const; + Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const; - Standard_EXPORT Standard_Real GetMinValue() const; - Standard_EXPORT Standard_Real GetMinValue( const UnitSystem& ) const; + Standard_EXPORT Standard_Real GetMinValue() const; + Standard_EXPORT Standard_Real GetMinValue( const UnitSystem& ) const; - Standard_EXPORT Standard_Real GetMaxValue() const; - Standard_EXPORT Standard_Real GetMaxValue( const UnitSystem& ) const; + Standard_EXPORT Standard_Real GetMaxValue() const; + Standard_EXPORT Standard_Real GetMaxValue( const UnitSystem& ) const; - Standard_EXPORT Standard_Integer GetPrecision() const; - Standard_EXPORT Standard_Integer GetPrecision( const UnitSystem& ) const; + Standard_EXPORT virtual Standard_Integer GetPrecision() const; + Standard_EXPORT virtual Standard_Integer GetPrecision( const UnitSystem& ) const; - Standard_EXPORT TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const; - Standard_EXPORT TCollection_AsciiString GetFormat( const UnitSystem&, - const Standard_Boolean = Standard_True ) const; - Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const; - Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, - Handle(TColStd_HArray1OfInteger)& ) const; - Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, - Handle(TColStd_HArray1OfInteger)&, - Handle(TColStd_HArray1OfExtendedString)& ) const; - Standard_EXPORT Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const; + Standard_EXPORT virtual TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const; + Standard_EXPORT virtual TCollection_AsciiString GetFormat( const UnitSystem&, + const Standard_Boolean = Standard_True ) const; + Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const; + Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, + Handle(TColStd_HArray1OfInteger)& ) const; + Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, + Handle(TColStd_HArray1OfInteger)&, + Handle(TColStd_HArray1OfExtendedString)& ) const; + Standard_EXPORT Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const; - Standard_EXPORT Standard_Real GetMinZoom() const; - Standard_EXPORT Standard_Real GetMaxZoom() const; - Standard_EXPORT Standard_Real GetZoomOrder() const; + Standard_EXPORT Standard_Real GetMinZoom() const; + Standard_EXPORT Standard_Real GetMaxZoom() const; + Standard_EXPORT Standard_Real GetZoomOrder() const; - Standard_EXPORT Standard_Real ToSI( const Standard_Real ) const; - Standard_EXPORT Standard_Real FromSI( const Standard_Real ) const; + Standard_EXPORT virtual Standard_Real ToSI( const Standard_Real ) const; + Standard_EXPORT virtual Standard_Real FromSI( const Standard_Real ) const; - Standard_EXPORT Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const; - Standard_EXPORT Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const; + Standard_EXPORT virtual Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const; + Standard_EXPORT virtual Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const; - Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const; + Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const; - Standard_EXPORT TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const; - Standard_EXPORT Standard_Boolean GetOptionNames( TColStd_SequenceOfAsciiString& ) const; + Standard_EXPORT TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const; + Standard_EXPORT Standard_Boolean GetOptionNames( TColStd_SequenceOfAsciiString& ) const; + +protected: + + Standard_EXPORT void SetId( const TCollection_AsciiString& ); + + Standard_EXPORT void SetComponent( const Handle(Standard_Transient)& ); + + Standard_EXPORT void SetLabel( const TCollection_AsciiString& ); + + Standard_EXPORT void SetFilter( const TCollection_AsciiString& ); + + Standard_EXPORT void SetRequired( const TCollection_AsciiString& ); + + Standard_EXPORT void SetWarningLevel( const Standard_Integer& ); + + Standard_EXPORT void SetMinZoom( const Standard_Real& ); + Standard_EXPORT void SetMaxZoom( const Standard_Real& ); + Standard_EXPORT void SetZoomOrder( const Standard_Real& ); + + Standard_EXPORT void SetShortDescription( const TCollection_ExtendedString& ); + Standard_EXPORT void SetLongDescription( const TCollection_ExtendedString& ); + + Standard_EXPORT bool SetOption( const TCollection_AsciiString&, const TCollection_AsciiString& ); + Standard_EXPORT void SetType( const DDS_DicItem::Type& ); + + Standard_EXPORT void SetMin( const Standard_Real& ); + Standard_EXPORT void SetMax( const Standard_Real& ); + + Standard_EXPORT void SetDefaultValue( const Standard_Real& ); + Standard_EXPORT void SetDefaultValue( const TCollection_AsciiString& ); + + Standard_EXPORT void SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&, + const Handle(TColStd_HArray1OfInteger)& ); + Standard_EXPORT void SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&, + const Handle(TColStd_HArray1OfInteger)&, + const Handle(TColStd_HArray1OfExtendedString)& ); + +protected: + + Standard_EXPORT DDS_DicItem( const DDS_DicItem& ); + + Standard_EXPORT void operator=( const DDS_DicItem& ); + + Standard_EXPORT virtual void FillDataMap( TCollection_AsciiString, const LDOM_Element&, + const LDOM_Element&, const LDOM_Element&, + const TColStd_SequenceOfAsciiString& ); private: - DDS_DicItem( const DDS_DicItem& ); - void operator=( const DDS_DicItem& ); - void FillDataMap( TCollection_AsciiString, const LDOM_Element&, - const LDOM_Element&, const LDOM_Element&, - const TColStd_SequenceOfAsciiString& ); - void PrepareFormats( const TCollection_AsciiString& ); - void GetDefaultFormat(); - UnitSystem GetActiveUnitSystem() const; - - void GetStringFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - TCollection_AsciiString& ); - void GetIntegerFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const Standard_Character, - TCollection_AsciiString& ); - void GetFloatFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const Standard_Character, - TCollection_AsciiString& ); - void Split( const TCollection_AsciiString&, - Handle(TColStd_HArray1OfExtendedString)& ); - - UnitData* GetUnitData( const UnitSystem& ) const; + + Standard_EXPORT void PrepareFormats( const TCollection_AsciiString& ); + Standard_EXPORT void GetDefaultFormat(); + Standard_EXPORT UnitSystem GetActiveUnitSystem() const; + + Standard_EXPORT void GetStringFormat( const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + TCollection_AsciiString& ); + Standard_EXPORT void GetIntegerFormat( const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const Standard_Character, + TCollection_AsciiString& ); + Standard_EXPORT void GetFloatFormat( const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const Standard_Character, + TCollection_AsciiString& ); + Standard_EXPORT void Split( const TCollection_AsciiString&, + Handle(TColStd_HArray1OfExtendedString)& ); + + Standard_EXPORT UnitData* GetUnitData( const UnitSystem& ) const; private: typedef NCollection_DataMap OptionsMap; diff --git a/src/DDS/DDS_Dictionary.cxx b/src/DDS/DDS_Dictionary.cxx index 28c309574..4cb46aaf9 100644 --- a/src/DDS/DDS_Dictionary.cxx +++ b/src/DDS/DDS_Dictionary.cxx @@ -43,6 +43,8 @@ IMPLEMENT_STANDARD_HANDLE(DDS_Dictionary, MMgt_TShared) IMPLEMENT_STANDARD_RTTIEXT(DDS_Dictionary, MMgt_TShared) +Handle(DDS_Dictionary) DDS_Dictionary::myDictionary = Handle(DDS_Dictionary)(); + /*! \class DDS_Dictionary \brief This class provides an information about used datums, @@ -425,12 +427,10 @@ void DDS_Dictionary::SetActiveUnitSystem( const TCollection_AsciiString& theSyst */ Handle_DDS_Dictionary DDS_Dictionary::Get() { - static Handle(DDS_Dictionary) sDictionary; - - if ( sDictionary.IsNull() ) - sDictionary = new DDS_Dictionary(); + if ( myDictionary.IsNull() ) + myDictionary = new DDS_Dictionary(); - return sDictionary; + return myDictionary; } /*! @@ -456,9 +456,8 @@ Standard_Boolean DDS_Dictionary::Load( const TCollection_AsciiString theFileName LDOM_Document aDoc = aParser.getDocument(); LDOM_Element aDocElement = aDoc.getDocumentElement(); - for ( LDOM_Element aComponentElem = aDocElement.GetChildByTagName( KeyWord( "COMPONENT" ) ); - !aComponentElem.isNull(); aComponentElem = aComponentElem.GetSiblingByTagName() ) - aDic->FillDataMap( aComponentElem, aDocElement ); + if ( !aDocElement.isNull() ) + aDic->FillDataMap( aDocElement ); _LoadMap.Add( theFileName ); @@ -527,17 +526,20 @@ Handle_DDS_DicItem DDS_Dictionary::GetDicItem( const TCollection_AsciiString& th /*! \brief Fill the internal data structures from the XML node. - \param theComponentData component XML node \param theDocElement document XML node */ -void DDS_Dictionary::FillDataMap( const LDOM_Element& theComponentData, const LDOM_Element& theDocElement ) +void DDS_Dictionary::FillDataMap( const LDOM_Element& theDocElement ) { - TCollection_AsciiString aCompName = theComponentData.getAttribute( KeyWord( "COMPONENT_NAME" ) ); - if ( !myGroupMap.Contains( aCompName ) ) - myGroupMap.Add( aCompName, new DDS_DicGroup( aCompName ) ); - Handle(DDS_DicGroup) aDicGroup = myGroupMap.FindFromKey( aCompName ); - aDicGroup->FillDataMap( theComponentData, theDocElement ); - myGroupMap.Add( aCompName, aDicGroup ); + for ( LDOM_Element aComponentElem = theDocElement.GetChildByTagName( KeyWord( "COMPONENT" ) ); + !aComponentElem.isNull(); aComponentElem = aComponentElem.GetSiblingByTagName() ) + { + TCollection_AsciiString aCompName = aComponentElem.getAttribute( KeyWord( "COMPONENT_NAME" ) ); + if ( !myGroupMap.Contains( aCompName ) ) + myGroupMap.Add( aCompName, CreateGroup( aCompName ) ); + Handle(DDS_DicGroup) aDicGroup = myGroupMap.FindFromKey( aCompName ); + aDicGroup->FillDataMap( aComponentElem, theDocElement ); + myGroupMap.Add( aCompName, aDicGroup ); + } } /*! @@ -608,3 +610,25 @@ void DDS_Dictionary::GetKeys( const TCollection_AsciiString& theComponent, TColS if( !aDicGroup.IsNull() ) aDicGroup->GetKeys( seq ); } + +/*! + \brief Create instance of a dictionary group. This method can + be used for customization data dictionary by specific + groups design. + \return New dictionary group instance. +*/ +Handle(DDS_DicGroup) DDS_Dictionary::CreateGroup( const TCollection_AsciiString& theCompName ) const +{ + return new DDS_DicGroup( theCompName ); +} + +/*! + \brief Set instance of dictionary. This method might be used in descendant classes to initialize + custom dictionary and replace the default implementation. + This method overrides static handle on dictionary that is available + through Get() method +*/ +void DDS_Dictionary::SetDictionary( const Handle(DDS_Dictionary)& theDict ) +{ + myDictionary = theDict; +} diff --git a/src/DDS/DDS_Dictionary.h b/src/DDS/DDS_Dictionary.h index a091f8b8a..beb9733bb 100644 --- a/src/DDS/DDS_Dictionary.h +++ b/src/DDS/DDS_Dictionary.h @@ -67,17 +67,30 @@ public: static Standard_EXPORT LDOMString KeyWord( const TCollection_AsciiString& ); -private: - DDS_Dictionary(); - DDS_Dictionary( const DDS_Dictionary& ); +protected: - void operator=( const DDS_Dictionary& ); + Standard_EXPORT virtual Handle(DDS_DicGroup) CreateGroup( const TCollection_AsciiString& ) const; - void FillDataMap( const LDOM_Element&, const LDOM_Element& ); +protected: + + Standard_EXPORT DDS_Dictionary(); + + Standard_EXPORT DDS_Dictionary( const DDS_Dictionary& ); + + Standard_EXPORT void operator=( const DDS_Dictionary& ); + + Standard_EXPORT virtual void FillDataMap( const LDOM_Element& ); + + Standard_EXPORT static void SetDictionary(const Handle(DDS_Dictionary)& theDict); + +protected: -private: DDS_IndexedDataMapOfDicGroups myGroupMap; +private: + + static Handle(DDS_Dictionary) myDictionary; + public: DEFINE_STANDARD_RTTI(DDS_Dictionary) }; diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx index 85edfbe70..03bb8c8fa 100644 --- a/src/PyConsole/PyConsole_Console.cxx +++ b/src/PyConsole/PyConsole_Console.cxx @@ -41,8 +41,6 @@ #include #include -#include - /*! \brief Constructor. @@ -69,7 +67,6 @@ PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp char* synchronous = getenv("PYTHON_CONSOLE_SYNC"); if (synchronous && atoi(synchronous)) { - MESSAGE("Python console is synchronous"); myEditor->setIsSync(true); } myEditor->viewport()->installEventFilter( this ); diff --git a/src/QDS/QDS_CheckBox.h b/src/QDS/QDS_CheckBox.h index 0d950ae8a..6b79e017b 100644 --- a/src/QDS/QDS_CheckBox.h +++ b/src/QDS/QDS_CheckBox.h @@ -38,6 +38,8 @@ public: bool isChecked() const; void setChecked( const bool ); + virtual QString getString() const; + virtual void clear(); signals: @@ -51,7 +53,6 @@ protected: QCheckBox* checkBox() const; virtual QWidget* createControl( QWidget* ); - virtual QString getString() const; virtual void setString( const QString& ); }; diff --git a/src/QDS/QDS_ComboBox.cxx b/src/QDS/QDS_ComboBox.cxx index b58bee9b7..02f67868f 100644 --- a/src/QDS/QDS_ComboBox.cxx +++ b/src/QDS/QDS_ComboBox.cxx @@ -443,7 +443,7 @@ QWidget* QDS_ComboBox::createControl( QWidget* parent ) { QtxComboBox* cb = new QtxComboBox( parent ); cb->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); - connect( cb, SIGNAL( textChanged( const QString& ) ), this, + connect( cb, SIGNAL( editTextChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); connect( cb, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) ); return cb; diff --git a/src/QDS/QDS_ComboBox.h b/src/QDS/QDS_ComboBox.h index 31a45aee6..e704b2e3d 100644 --- a/src/QDS/QDS_ComboBox.h +++ b/src/QDS/QDS_ComboBox.h @@ -62,6 +62,8 @@ public: void setValues( const QList&, const QStringList& ); void setValues( const QStringList& ); + virtual QString getString() const; + virtual void reset(); int stringToValue( const QString& ) const; @@ -79,7 +81,6 @@ protected: QtxComboBox* comboBox() const; virtual QWidget* createControl( QWidget* ); - virtual QString getString() const; virtual void setString( const QString& ); virtual void unitSystemChanged( const QString& ); diff --git a/src/QDS/QDS_Datum.cxx b/src/QDS/QDS_Datum.cxx index 9b7cae69d..e7dde3292 100644 --- a/src/QDS/QDS_Datum.cxx +++ b/src/QDS/QDS_Datum.cxx @@ -551,8 +551,29 @@ int QDS_Datum::optionInteger( const QString& name ) const QVariant QDS_Datum::value() const { QVariant val; - if ( !isEmpty() ) - val = stringValue(); + // trying to return QVariant containing value of correct data type + if ( dicItem().IsNull() ) + { + if ( !isEmpty() ) + val = stringValue(); + } + else + { + switch( type() ) + { + case DDS_DicItem::Float: + val = doubleValue(); + break; + case DDS_DicItem::Integer: + case DDS_DicItem::List: + val = integerValue(); + break; + case DDS_DicItem::String: + case DDS_DicItem::Unknown: + val = stringValue(); + break; + } + } return val; } @@ -698,6 +719,39 @@ void QDS_Datum::clear() */ void QDS_Datum::setValue( const QVariant& val ) { + // trying to extract data of correct type from QVariant + if ( !dicItem().IsNull() ) + { + bool isOk = false; + switch( type() ) + { + case DDS_DicItem::Float: + { + double aDblVal = val.toDouble( &isOk ); + if ( isOk ) + { + setDoubleValue( aDblVal ); + return; + } + break; + } + case DDS_DicItem::Integer: + case DDS_DicItem::List: + { + int anIntVal = val.toInt( &isOk ); + if ( isOk ) + { + setIntegerValue( anIntVal ); + return; + } + break; + } + case DDS_DicItem::String: + case DDS_DicItem::Unknown: + break; + } + } + if ( val.isValid() && val.canConvert( QVariant::String ) ) setStringValue( val.toString() ); else @@ -1033,7 +1087,7 @@ void QDS_Datum::addTo( QHBoxLayout* l ) if ( wrapper( Control ) ) l->addWidget( wrapper( Control ) ); if ( wrapper( Units ) ) - l->addWidget( unitsWidget() ); + l->addWidget( wrapper( Units ) ); } /*! diff --git a/src/QDS/QDS_Datum.h b/src/QDS/QDS_Datum.h index 0217602e3..ce5e0920a 100644 --- a/src/QDS/QDS_Datum.h +++ b/src/QDS/QDS_Datum.h @@ -114,6 +114,8 @@ public: static QString format( const double, const QString&, const bool = false ); static QString units( const QString& ); + virtual QString getString() const = 0; + virtual bool eventFilter( QObject*, QEvent* ); operator QWidget*() const; @@ -151,7 +153,6 @@ protected: virtual QLabel* createUnits( QWidget* ); virtual QWidget* createControl( QWidget* ) = 0; - virtual QString getString() const = 0; virtual void setString( const QString& ) = 0; virtual bool validate( const QString& ) const; diff --git a/src/QDS/QDS_LineEdit.h b/src/QDS/QDS_LineEdit.h index f5ddfb0cf..f89605106 100644 --- a/src/QDS/QDS_LineEdit.h +++ b/src/QDS/QDS_LineEdit.h @@ -47,6 +47,8 @@ public: bool hasSelection() const; void setSelection( const bool ); + virtual QString getString() const; + signals: void returnPressed(); @@ -60,7 +62,6 @@ protected: virtual QWidget* createControl( QWidget* ); QLineEdit* lineEdit() const; - virtual QString getString() const; virtual void setString( const QString& ); virtual void unitSystemChanged( const QString& ); diff --git a/src/QDS/QDS_RadioBox.h b/src/QDS/QDS_RadioBox.h index 56b280dcb..b76fd168e 100644 --- a/src/QDS/QDS_RadioBox.h +++ b/src/QDS/QDS_RadioBox.h @@ -58,6 +58,8 @@ public: void setValues( const QList&, const QStringList& ); void setValues( const QStringList& ); + virtual QString getString() const; + signals: void activated( int ); @@ -70,7 +72,6 @@ protected: virtual QWidget* createControl( QWidget* ); void buttons( QList& ) const; - virtual QString getString() const; virtual void setString( const QString& ); virtual void unitSystemChanged( const QString& ); diff --git a/src/QDS/QDS_SpinBox.h b/src/QDS/QDS_SpinBox.h index d9030397a..30cb133d1 100644 --- a/src/QDS/QDS_SpinBox.h +++ b/src/QDS/QDS_SpinBox.h @@ -38,6 +38,8 @@ public: int step() const; void setStep( const int ); + virtual QString getString() const; + private slots: void onValueChanged( int ); @@ -46,7 +48,6 @@ protected: virtual QWidget* createControl( QWidget* ); - virtual QString getString() const; virtual void setString( const QString& ); virtual void unitSystemChanged( const QString& ); diff --git a/src/QDS/QDS_SpinBoxDbl.h b/src/QDS/QDS_SpinBoxDbl.h index 47b7a0bfa..9ed90e8b0 100644 --- a/src/QDS/QDS_SpinBoxDbl.h +++ b/src/QDS/QDS_SpinBoxDbl.h @@ -38,6 +38,8 @@ public: double step() const; void setStep( const double ); + virtual QString getString() const; + private slots: void onValueChanged( double ); @@ -45,7 +47,6 @@ protected: QtxDoubleSpinBox* spinBox() const; virtual QWidget* createControl( QWidget* ); - virtual QString getString() const; virtual void setString( const QString& ); virtual void unitSystemChanged( const QString& ); diff --git a/src/QDS/QDS_TextEdit.h b/src/QDS/QDS_TextEdit.h index 7f792c2a9..34d811423 100644 --- a/src/QDS/QDS_TextEdit.h +++ b/src/QDS/QDS_TextEdit.h @@ -35,6 +35,8 @@ public: QDS_TextEdit( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_TextEdit(); + virtual QString getString() const; + signals: void returnPressed(); @@ -45,7 +47,6 @@ protected: QTextEdit* textEdit() const; virtual QWidget* createControl( QWidget* ); - virtual QString getString() const; virtual void setString( const QString& ); }; diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 6607e2f1e..74aefc055 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -1104,7 +1104,7 @@ void QtxWorkstackArea::onChildCaptionChanged( QtxWorkstackChild* c ) */ void QtxWorkstackArea::updateCurrent() { - QWidget* cur = child( widget( myBar->tabId( myBar->currentIndex() ) ) ); + QWidget* cur = child( myBar->tabId( myBar->currentIndex() ) ); if ( cur ) myStack->setCurrentWidget( cur ); } diff --git a/src/Qtx/QtxWorkstack.h b/src/Qtx/QtxWorkstack.h index 09babe484..9c48b4beb 100644 --- a/src/Qtx/QtxWorkstack.h +++ b/src/Qtx/QtxWorkstack.h @@ -200,7 +200,7 @@ public: bool restoreState( QDataStream&, QMap& ); }; -class QtxWorkstackArea : public QFrame +class QTX_EXPORT QtxWorkstackArea : public QFrame { Q_OBJECT diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index e4eb217cd..65e06a1fd 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -219,7 +219,8 @@ void STD_Application::createActions() // Create menus int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, MenuFileId, 0 ); - int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, MenuEditId, 10 ); + // Let the application developers insert some menus between Edit and View + int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, MenuEditId, 5 ); int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, MenuViewId, 10 ); int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, MenuHelpId, 1000 ); diff --git a/src/SUIT/SUIT_DataBrowser.cxx b/src/SUIT/SUIT_DataBrowser.cxx index 99adcc0cd..d346cfe1c 100644 --- a/src/SUIT/SUIT_DataBrowser.cxx +++ b/src/SUIT/SUIT_DataBrowser.cxx @@ -176,7 +176,7 @@ int SUIT_DataBrowser::shortcutKey(const int id) const */ void SUIT_DataBrowser::setShortcutKey( const int id, const int key ) { - ShortcutMap::iterator it = myShortcutMap.find( key ); + ShortcutMap::iterator it = myShortcutMap.find( id ); if( it != myShortcutMap.end() ) (*it)->setKey(key); } diff --git a/src/SUIT/SUIT_DataObject.cxx b/src/SUIT/SUIT_DataObject.cxx index a16944201..8c8b3e78a 100755 --- a/src/SUIT/SUIT_DataObject.cxx +++ b/src/SUIT/SUIT_DataObject.cxx @@ -399,6 +399,24 @@ void SUIT_DataObject::assignParent( SUIT_DataObject* p ) myParent = p; } +/*! + \brief Sets modification state of the object. + + When the object has been modified (modified is set to true) + a signal is emitted to notify the tree model and eventually redraw the data object. + + \param modified modified state +*/ +void SUIT_DataObject::setModified(bool modified) +{ + if ( _modified == modified ) + return; + + _modified = modified; + if ( _modified ) + signal()->emitModified( this ); +} + /*! \brief Get data object name. @@ -928,6 +946,15 @@ void SUIT_DataObject::Signal::emitRemoved( SUIT_DataObject* object, SUIT_DataObj emit( removed( object, parent ) ); } +/*! + \brief Emit a signal to notify that the data object has been modified. + \param object data object that has been modified +*/ +void SUIT_DataObject::Signal::emitModified( SUIT_DataObject* object ) +{ + emit( modified( object ) ); +} + /*! \brief Schedule data object for the late deleting. \param object data object to be deleted later diff --git a/src/SUIT/SUIT_DataObject.h b/src/SUIT/SUIT_DataObject.h index 3358c0131..e17ab3951 100755 --- a/src/SUIT/SUIT_DataObject.h +++ b/src/SUIT/SUIT_DataObject.h @@ -101,7 +101,7 @@ public: virtual void assignParent( SUIT_DataObject* ); void insertChildAtPos( SUIT_DataObject* obj, int position ); bool modified(){return _modified;}; - void setModified(bool modified){_modified = modified;}; + virtual void setModified(bool modified); virtual QString name() const; virtual QString text( const int = NameId ) const; @@ -173,6 +173,7 @@ private: void emitDestroyed( SUIT_DataObject* ); void emitInserted( SUIT_DataObject*, SUIT_DataObject* ); void emitRemoved( SUIT_DataObject*, SUIT_DataObject* ); + void emitModified( SUIT_DataObject* ); void deleteLater( SUIT_DataObject* ); @@ -181,6 +182,7 @@ signals: void destroyed( SUIT_DataObject* ); void inserted( SUIT_DataObject*, SUIT_DataObject* ); void removed( SUIT_DataObject*, SUIT_DataObject* ); + void modified( SUIT_DataObject* ); friend class SUIT_DataObject; diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 4b3c8a776..321173da3 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -483,6 +483,8 @@ SUIT_TreeModel::~SUIT_TreeModel() this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) ); SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); + SUIT_DataObject::disconnect( SIGNAL( modifed( SUIT_DataObject* ) ), + this, SLOT( onModified( SUIT_DataObject* ) ) ); delete myRoot; } @@ -669,8 +671,10 @@ Qtx::HeaderViewFlags SUIT_TreeModel::headerFlags( const QString& name ) const \param id - column name \param state - visible state + \param emitChanged - if set to false, blocks dataChanged() signal, this can be used to + prevent emitting dataChanged() several times for the same data object */ -void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState state ) +void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState state, bool emitChanged ) { VisibilityMap::const_iterator it = myVisibilityMap.find( id ); if ( it != myVisibilityMap.end() && it.value() == state ) @@ -684,7 +688,7 @@ void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState else { needSignal = myVisibilityMap.remove( id ) > 0; } - if ( needSignal ) { + if ( emitChanged && needSignal ) { QModelIndexList lst; if ( searcher() ) { SUIT_DataObject* o = searcher()->findObject( id ); @@ -703,7 +707,6 @@ void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState /*! \brief Set visibility state for all objects. - \param id - column name \param state - visible state */ void SUIT_TreeModel::setVisibilityStateForAll( Qtx::VisibilityState state ) @@ -775,7 +778,15 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r ) this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) ); SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); + SUIT_DataObject::disconnect( SIGNAL( modified( SUIT_DataObject* ) ), + this, SLOT( onModified( SUIT_DataObject* ) ) ); delete myRoot; + + if ( myRootItem ) { + QList items = myRootItem->children(); + for ( QList::iterator anIt = items.begin(); anIt != items.end(); anIt++ ) + delete *anIt; + } } myRoot = r; @@ -1212,6 +1223,8 @@ void SUIT_TreeModel::setAutoUpdate( const bool on ) this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) ); SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); + SUIT_DataObject::disconnect( SIGNAL( modified( SUIT_DataObject* ) ), + this, SLOT( onModified( SUIT_DataObject* ) ) ); myAutoUpdate = on; if ( myAutoUpdate ) { @@ -1219,6 +1232,8 @@ void SUIT_TreeModel::setAutoUpdate( const bool on ) this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) ); SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); + SUIT_DataObject::connect( SIGNAL( modified( SUIT_DataObject* ) ), + this, SLOT( onModified( SUIT_DataObject* ) ) ); updateTree(); } @@ -1412,11 +1427,15 @@ void SUIT_TreeModel::initialize() this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) ); SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); + SUIT_DataObject::disconnect( SIGNAL( modified( SUIT_DataObject* ) ), + this, SLOT( onModified( SUIT_DataObject* ) ) ); if ( autoUpdate() ) { SUIT_DataObject::connect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) ); SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); + SUIT_DataObject::connect( SIGNAL( modified( SUIT_DataObject* ) ), + this, SLOT( onModified( SUIT_DataObject* ) ) ); } myItems.clear(); // ????? is it really necessary @@ -1597,7 +1616,7 @@ void SUIT_TreeModel::updateItem( SUIT_TreeModel::TreeItem* item, bool emitLayout QModelIndex lastIdx = index( obj, columnCount() - 1 ); emit dataChanged( firstIdx, lastIdx ); obj->setModified(false); - if( emitLayoutChanged ) + if ( emitLayoutChanged ) emit layoutChanged(); } @@ -1664,6 +1683,22 @@ void SUIT_TreeModel::onRemoved( SUIT_DataObject* /*object*/, SUIT_DataObject* pa updateTree( parent ); } +/*! + \brief Called when the data object is modified. TreeSync is not used here for maximum efficiency. + It is assumed that it is up to the application to decide when its data objects are modified. + \param obj data object that has been modified +*/ +void SUIT_TreeModel::onModified( SUIT_DataObject* obj ) +{ + if ( autoUpdate() ) + { + QModelIndex firstIdx = index( obj, 0 ); + QModelIndex lastIdx = index( obj, columnCount() - 1 ); + emit dataChanged( firstIdx, lastIdx ); + obj->setModified(false); + } +} + /*! \brief Drag and Drop support. */ @@ -2171,11 +2206,12 @@ Qtx::HeaderViewFlags SUIT_ProxyModel::headerFlags( const QString& name ) const \param id - column name \param state - visible state + \param emitChanged - if set to false, blocks dataChanged() signal, this can be used to + prevent emitting dataChanged() several times for the same data object */ -void SUIT_ProxyModel::setVisibilityState(const QString& id, Qtx::VisibilityState state) -{ +void SUIT_ProxyModel::setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged ) { if(treeModel()) - treeModel()->setVisibilityState(id,state); + treeModel()->setVisibilityState(id,state,emitChanged); } /*! diff --git a/src/SUIT/SUIT_TreeModel.h b/src/SUIT/SUIT_TreeModel.h index f06ffb32f..c016b79fb 100755 --- a/src/SUIT/SUIT_TreeModel.h +++ b/src/SUIT/SUIT_TreeModel.h @@ -83,7 +83,7 @@ public: virtual QPixmap columnIcon( const QString& name ) const = 0; virtual void setAppropriate( const QString& name, const Qtx::Appropriate appr ) = 0; virtual Qtx::Appropriate appropriate( const QString& name ) const = 0; - virtual void setVisibilityState(const QString& id, Qtx::VisibilityState state) = 0; + virtual void setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged = true) = 0; virtual void setVisibilityStateForAll(Qtx::VisibilityState state) = 0; virtual Qtx::VisibilityState visibilityState(const QString& id) const = 0; virtual void setHeaderFlags( const QString& name, const Qtx::HeaderViewFlags flags ) = 0; @@ -152,7 +152,7 @@ public: virtual QPixmap columnIcon( const QString& name ) const; virtual void setAppropriate( const QString& name, const Qtx::Appropriate appr ); virtual Qtx::Appropriate appropriate( const QString& name ) const; - virtual void setVisibilityState(const QString& id, Qtx::VisibilityState state); + virtual void setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged = true); virtual void setVisibilityStateForAll(Qtx::VisibilityState state); virtual Qtx::VisibilityState visibilityState(const QString& id) const; virtual void setHeaderFlags( const QString& name, const Qtx::HeaderViewFlags flags ); @@ -212,6 +212,7 @@ private: private slots: void onInserted( SUIT_DataObject*, SUIT_DataObject* ); void onRemoved( SUIT_DataObject*, SUIT_DataObject* ); + void onModified( SUIT_DataObject* ); private: typedef QMap ItemMap; @@ -275,7 +276,7 @@ public: virtual QPixmap columnIcon( const QString& name ) const; virtual void setAppropriate( const QString& name, const Qtx::Appropriate appr ); virtual Qtx::Appropriate appropriate( const QString& name ) const; - virtual void setVisibilityState(const QString& id, Qtx::VisibilityState state); + virtual void setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged = true); virtual void setVisibilityStateForAll(Qtx::VisibilityState state); virtual Qtx::VisibilityState visibilityState(const QString& id) const; virtual void setHeaderFlags( const QString& name, const Qtx::HeaderViewFlags flags );