Changeset 2230

Show
Ignore:
Timestamp:
08/26/08 23:07:17 (3 months ago)
Author:
hlamer
Message:

Fixed crash in the XUPItem

Location:
v2/branches/dev
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • v2/branches/dev/config.pri

    r2211 r2230  
    4848QMAKE_TARGET_COPYRIGHT  = "Copyright (C) 2005 - 2008 Filipe AZEVEDO" 
    4949PACKAGE_DOMAIN  = "www.monkeystudio.org" 
    50 PACKAGE_VERSION = 1.8.2.2svn 
     50PACKAGE_VERSION = 1.8.2.2svn_debug 
    5151 
    5252# define variable for source code 
  • v2/branches/dev/monkey/src/xupmanager/FilteredProjectItemModel.h

    r2227 r2230  
    99#include "XUPItem.h" 
    1010#include "XUPProjectItem.h" 
     11 
     12#include <QDebug> 
    1113 
    1214class ProjectItemModel; 
  • v2/branches/dev/monkey/src/xupmanager/XUPItem.cpp

    r2229 r2230  
    288288QString XUPItem::valueName( const QString& s ) const 
    289289{ 
    290         if ( project()->textTypes().contains( s ) ) //FIXME Do it's right? 
     290        if ( project() && project()->textTypes().contains( s ) ) //FIXME Do it's right? 
    291291                return "text"; 
    292292        return "name"; 
     
    338338void XUPItem::setModified( bool b, bool e ) 
    339339{ 
    340         if ( isProject() && b && !modified() ) 
    341         { 
    342                 mModified = true; 
    343                 if ( e ) 
    344                         emit modifiedChanged( this, true ); 
    345         } 
    346         else if ( isProject() && !b && modified() ) 
    347         { 
    348                 foreach ( XUPItem* it, children( true, true ) ) 
    349                         if ( it->modified() ) 
    350                                 it->setModified( false, false ); 
    351                 mModified = false; 
    352                 if ( e ) 
    353                         emit modifiedChanged( this, false ); 
    354         } 
    355         else if ( mModified != b ) 
     340        if ( mModified != b ) 
    356341        { 
    357342                mModified = b; 
  • v2/branches/dev/monkey/src/xupmanager/XUPProjectItem.cpp

    r2229 r2230  
    99XUPItemInfos XUPProjectItem::mXUPItemInfos; 
    1010 
    11 XUPProjectItem::XUPProjectItem( const QDomElement e, const QString& s, bool b ) 
     11XUPProjectItem::XUPProjectItem( const QDomElement e, const QString& s) 
    1212{ 
    1313#if 0 
     
    1717        setDomElement( e ); 
    1818        loadProject( s ); 
    19         setModified( b ); 
    2019} 
    2120 
     
    9190void XUPProjectItem::registerVariableSuffixes( const QString& n, const QStringList& s ) 
    9291{ mXUPItemInfos.VariableSuffixes[n] = s; } 
     92 
     93XUPProjectItem* XUPProjectItem::project() 
     94{ 
     95        return this; 
     96} 
     97 
     98void XUPProjectItem::setModified( bool b, bool e ) 
     99{ 
     100        if (b && !modified() ) 
     101        { 
     102                mModified = true; 
     103                if ( e ) 
     104                        emit modifiedChanged( this, true ); 
     105        } 
     106        else if (!b && modified() ) 
     107        { 
     108                foreach ( XUPItem* it, children( true, true ) ) 
     109                        if ( it->modified() ) 
     110                                it->setModified( false, false ); 
     111                mModified = false; 
     112                if ( e ) 
     113                        emit modifiedChanged( this, false ); 
     114        } 
     115} 
    93116 
    94117QStringList XUPProjectItem::projectSettingsValues( const QString& variable, const QStringList& defaultValues ) const 
  • v2/branches/dev/monkey/src/xupmanager/XUPProjectItem.h

    r2229 r2230  
    1212        static QString mProjectSettingsScope; 
    1313 
    14         XUPProjectItem( const QDomElement = QDomDocument().toElement(), const QString& = QString(), bool = false ); 
     14        XUPProjectItem( const QDomElement = QDomDocument().toElement(), const QString& = QString()); 
    1515         
    1616        // register item specific infos 
     
    5757        // return copy of this item 
    5858        virtual XUPProjectItem* clone( bool = true ) const = 0; 
     59 
     60        // return the project item of this item (this!!!). Implemented for overloading of XUPItem's function 
     61        virtual XUPProjectItem* project(); 
     62         
     63        // set item modified state and emit modified signal according to second parameter 
     64        virtual void setModified( bool, bool = true ); 
    5965         
    6066        // return a project settings value