Skip to content
Permalink
Browse files

Astyle

  • Loading branch information
nyalldawson committed Jan 17, 2020
1 parent bc1f21a commit 10e07ea5efe19b8202fefb7dbd8386e6445ff04c
Showing with 45 additions and 45 deletions.
  1. +34 −34 src/core/qgsproject.cpp
  2. +11 −11 src/core/qgsproject.h
@@ -473,14 +473,14 @@ QString QgsProject::title() const
return mMetadata.title();
}

QString QgsProject::saveUser() const
{
return mSaveUser;
}

QString QgsProject::saveUserFullname() const
{
return mSaveUserFull;
QString QgsProject::saveUser() const
{
return mSaveUser;
}

QString QgsProject::saveUserFullname() const
{
return mSaveUserFull;
}

bool QgsProject::isDirty() const
@@ -735,7 +735,7 @@ void QgsProject::clear()
mProjectScope.reset();
mFile.setFileName( QString() );
mProperties.clearKeys();
mSaveUser.clear();
mSaveUser.clear();
mSaveUserFull.clear();
mHomePath.clear();
mCachedHomePath.clear();
@@ -912,22 +912,22 @@ static void _getTitle( const QDomDocument &doc, QString &title )

}

static void getProjectMetadata(const QDomDocument &doc, QString &lastUser, QString &lastUserFull)
{
QDomNodeList nl = doc.elementsByTagName(QStringLiteral("qgis"));

if (!nl.count())
{
QgsDebugMsg("unable to find qgis element");
return;
}

QDomNode qgisNode = nl.item(0); // there should only be one, so zeroth element OK

QDomElement qgisElement = qgisNode.toElement(); // qgis node should be element
lastUser = qgisElement.attribute(QStringLiteral("save-user"), QString());
lastUserFull = qgisElement.attribute(QStringLiteral("save-user-full"), QString());
}
static void getProjectMetadata( const QDomDocument &doc, QString &lastUser, QString &lastUserFull )
{
QDomNodeList nl = doc.elementsByTagName( QStringLiteral( "qgis" ) );

if ( !nl.count() )
{
QgsDebugMsg( "unable to find qgis element" );
return;
}

QDomNode qgisNode = nl.item( 0 ); // there should only be one, so zeroth element OK

QDomElement qgisElement = qgisNode.toElement(); // qgis node should be element
lastUser = qgisElement.attribute( QStringLiteral( "save-user" ), QString() );
lastUserFull = qgisElement.attribute( QStringLiteral( "save-user-full" ), QString() );
}


QgsProjectVersion getVersion( const QDomDocument &doc )
@@ -1265,7 +1265,7 @@ bool QgsProject::readProjectFile( const QString &filename, QgsProject::ReadFlags
QString oldTitle;
_getTitle( *doc, oldTitle );

getProjectMetadata(*doc, mSaveUser, mSaveUserFull);
getProjectMetadata( *doc, mSaveUser, mSaveUserFull );

QDomNodeList homePathNl = doc->elementsByTagName( QStringLiteral( "homePath" ) );
if ( homePathNl.count() > 0 )
@@ -1557,9 +1557,9 @@ bool QgsProject::readProjectFile( const QString &filename, QgsProject::ReadFlags
// if all went well, we're allegedly in pristine state
if ( clean )
setDirty( false );

QgsDebugMsg(QString("Project save user: %1").arg(mSaveUser));
QgsDebugMsg(QString("Project save user: %1").arg(mSaveUserFull));

QgsDebugMsg( QString( "Project save user: %1" ).arg( mSaveUser ) );
QgsDebugMsg( QString( "Project save user: %1" ).arg( mSaveUserFull ) );

Q_NOWARN_DEPRECATED_PUSH
emit nonIdentifiableLayersChanged( nonIdentifiableLayers() );
@@ -1986,10 +1986,10 @@ bool QgsProject::writeProjectFile( const QString &filename )
QDomElement qgisNode = doc->createElement( QStringLiteral( "qgis" ) );
qgisNode.setAttribute( QStringLiteral( "projectname" ), title() );
qgisNode.setAttribute( QStringLiteral( "version" ), QStringLiteral( "%1" ).arg( Qgis::version() ) );
QString newSaveUser = QgsApplication::userLoginName();
QString newSaveUserFull = QgsApplication::userFullName();
qgisNode.setAttribute(QStringLiteral("save-user"), newSaveUser);
qgisNode.setAttribute(QStringLiteral("save-user-full"), newSaveUserFull);
QString newSaveUser = QgsApplication::userLoginName();
QString newSaveUserFull = QgsApplication::userFullName();
qgisNode.setAttribute( QStringLiteral( "save-user" ), newSaveUser );
qgisNode.setAttribute( QStringLiteral( "save-user-full" ), newSaveUserFull );
doc->appendChild( qgisNode );

QDomElement homePathNode = doc->createElement( QStringLiteral( "homePath" ) );
@@ -2229,7 +2229,7 @@ bool QgsProject::writeProjectFile( const QString &filename )
setDirty( false ); // reset to pristine state

emit projectSaved();
mSaveUser = newSaveUser;
mSaveUser = newSaveUser;
mSaveUserFull = newSaveUserFull;
return true;
}
@@ -160,15 +160,15 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
*/
QString title() const;

/**
* Returns the user name that did the last save.
*/
QString saveUser() const;

/**
* Returns the full user name that did the last save.
*/
QString saveUserFullname() const;
/**
* Returns the user name that did the last save.
*/
QString saveUser() const;

/**
* Returns the full user name that did the last save.
*/
QString saveUserFullname() const;

/**
* Returns TRUE if the project has been modified since the last write()
@@ -1803,8 +1803,8 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera

QFile mFile; // current physical project file

QString mSaveUser; // last saved user.
QString mSaveUserFull; // last saved user full name.
QString mSaveUser; // last saved user.
QString mSaveUserFull; // last saved user full name.

/**
* Manual override for project home path - if empty, home path is automatically

0 comments on commit 10e07ea

Please sign in to comment.
You can’t perform that action at this time.