Skip to content

Commit

Permalink
Use fileName() instead of setFilename() for filename accessor
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9135 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Aug 23, 2008
1 parent 841699b commit 9576836
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsproject.sip
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public:
void setFilename( const QString & name );

/** returns file name */
QString setFilename() const;
QString fileName() const;
//@}


Expand Down
18 changes: 9 additions & 9 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ static void setTitleBarText_( QWidget & qgisApp )

if ( QgsProject::instance()->title().isEmpty() )
{
if ( QgsProject::instance()->setFilename().isEmpty() )
if ( QgsProject::instance()->fileName().isEmpty() )
{
// no project title nor file name, so just leave caption with
// application name and version
}
else
{
QFileInfo projectFileInfo( QgsProject::instance()->setFilename() );
QFileInfo projectFileInfo( QgsProject::instance()->fileName() );
caption += projectFileInfo.baseName();
}
}
Expand Down Expand Up @@ -2882,7 +2882,7 @@ bool QgisApp::fileSave()
// the current project file name is empty
bool isNewProject = false;

if ( QgsProject::instance()->setFilename().isNull() )
if ( QgsProject::instance()->fileName().isNull() )
{
isNewProject = true;

Expand Down Expand Up @@ -2925,7 +2925,7 @@ bool QgisApp::fileSave()
if ( QgsProject::instance()->write() )
{
setTitleBarText_(*this); // update title bar
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->setFilename() );
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->fileName() );

if (isNewProject)
{
Expand All @@ -2938,13 +2938,13 @@ bool QgisApp::fileSave()
{
QMessageBox::critical(this,
tr("Unable to save project"),
tr("Unable to save project to ") + QgsProject::instance()->setFilename() );
tr("Unable to save project to ") + QgsProject::instance()->fileName() );
}
}
catch ( std::exception & e )
{
QMessageBox::critical( this,
tr("Unable to save project ") + QgsProject::instance()->setFilename(),
tr("Unable to save project ") + QgsProject::instance()->fileName(),
QString::fromLocal8Bit( e.what() ) );
}
return true;
Expand Down Expand Up @@ -3008,21 +3008,21 @@ void QgisApp::fileSaveAs()
if ( QgsProject::instance()->write() )
{
setTitleBarText_(*this); // update title bar
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->setFilename() );
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->fileName() );
// add this to the list of recently used project files
saveRecentProjectPath(fullPath.filePath(), settings);
}
else
{
QMessageBox::critical(this,
tr("Unable to save project"),
tr("Unable to save project to ") + QgsProject::instance()->setFilename() );
tr("Unable to save project to ") + QgsProject::instance()->fileName() );
}
}
catch ( std::exception & e )
{
QMessageBox::critical( 0x0,
tr("Unable to save project ") + QgsProject::instance()->setFilename(),
tr("Unable to save project ") + QgsProject::instance()->fileName(),
QString::fromLocal8Bit( e.what() ),
QMessageBox::Ok,
Qt::NoButton );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ QString QgsMapLayer::loadNamedStyle ( const QString theURI, bool &theResultFlag)
}
else
{
QFileInfo project( QgsProject::instance()->setFilename() );
QFileInfo project( QgsProject::instance()->fileName() );
QgsDebugMsg( QString("project filename: %1").arg( project.absoluteFilePath() ) );

QString qml;
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ QgsProject * QgsProject::theProject_;



QString QgsProject::setFilename() const
QString QgsProject::fileName() const
{
return imp_->file.fileName();
} // QString QgsProject::setFilename() const
} // QString QgsProject::fileName() const



Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class CORE_EXPORT QgsProject : public QObject
void setFilename( QString const & name );

/** returns file name */
QString setFilename() const;
QString fileName() const;
//@}


Expand Down
2 changes: 1 addition & 1 deletion tests/algorithms/qgsproject/projecttest.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ProjectTest : public CppUnit::TestFixture
QgsProject::instance()->dirty( false );
QgsProject::instance()->setFilename( mFile );

CPPUNIT_ASSERT( mFile == QgsProject::instance()->setFilename() );
CPPUNIT_ASSERT( mFile == QgsProject::instance()->fileName() );
CPPUNIT_ASSERT( QgsProject::instance()->isDirty() );
} // testFileName

Expand Down

0 comments on commit 9576836

Please sign in to comment.