Commit aafd0c3e authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Management of proxy UIData improved.

parent d48de63b
......@@ -21,7 +21,8 @@ GenericUIData::GenericUIData( const QString &typeString, const QString &filename
m_DisplayOptions( NULL ),
m_Parent( NULL ),
m_Project( NULL ),
m_IsCollapsed( false )
m_IsCollapsed( false ),
m_IsProxy( false )
{
Rename(filename);
}
......
......@@ -42,7 +42,10 @@ protected:
bool m_IsCollapsed;
bool m_IsProxy;
void Rename( const QString& filename );
inline void SetProxy( bool isProxy ) { m_IsProxy = isProxy; }
public:
GenericUIData( const QString &typeString, const QString &filename );
......@@ -85,6 +88,8 @@ public:
inline bool IsExpanded() const { return !m_IsCollapsed; }
inline void SetCollapsed( bool collapsed = true ) { m_IsCollapsed = collapsed; }
inline void SetExpanded( bool expanded = true ) { m_IsCollapsed = !expanded; }
inline bool IsProxy() const { return m_IsProxy; }
};
......@@ -126,8 +131,10 @@ public:
inline UIData( T* content, const QString& filename ) :
GenericUIData( s_ClassTypeString, filename ),
m_Content( content )
{}
virtual ~UIData() {}
{
SetProxy( false );
}
inline ~UIData() { if( !IsProxy() ) delete m_Content; }
inline void SetContent( T* content ) { m_Content = content; }
......@@ -141,11 +148,10 @@ public:
template <typename T>
class UIDataNoProxy : public UIData<T>
class UIDataProxy : public UIData<T>
{
public:
inline UIDataNoProxy( T* content, const QString& filename ) : UIData<T>( content, filename ) {}
virtual ~UIDataNoProxy() { delete UIData<T>::m_Content; }
inline UIDataProxy( T* content, const QString& filename ) : UIData<T>( content, filename ) { SetProxy( true ); }
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment