mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Use fileName() instead of setFilename() for filename accessor
git-svn-id: http://svn.osgeo.org/qgis/trunk@9135 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
c6fb52f15d
commit
0636f412b2
@ -62,7 +62,7 @@ public:
|
|||||||
void setFilename( const QString & name );
|
void setFilename( const QString & name );
|
||||||
|
|
||||||
/** returns file name */
|
/** returns file name */
|
||||||
QString setFilename() const;
|
QString fileName() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,14 +224,14 @@ static void setTitleBarText_( QWidget & qgisApp )
|
|||||||
|
|
||||||
if ( QgsProject::instance()->title().isEmpty() )
|
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
|
// no project title nor file name, so just leave caption with
|
||||||
// application name and version
|
// application name and version
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QFileInfo projectFileInfo( QgsProject::instance()->setFilename() );
|
QFileInfo projectFileInfo( QgsProject::instance()->fileName() );
|
||||||
caption += projectFileInfo.baseName();
|
caption += projectFileInfo.baseName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2882,7 +2882,7 @@ bool QgisApp::fileSave()
|
|||||||
// the current project file name is empty
|
// the current project file name is empty
|
||||||
bool isNewProject = false;
|
bool isNewProject = false;
|
||||||
|
|
||||||
if ( QgsProject::instance()->setFilename().isNull() )
|
if ( QgsProject::instance()->fileName().isNull() )
|
||||||
{
|
{
|
||||||
isNewProject = true;
|
isNewProject = true;
|
||||||
|
|
||||||
@ -2925,7 +2925,7 @@ bool QgisApp::fileSave()
|
|||||||
if ( QgsProject::instance()->write() )
|
if ( QgsProject::instance()->write() )
|
||||||
{
|
{
|
||||||
setTitleBarText_(*this); // update title bar
|
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)
|
if (isNewProject)
|
||||||
{
|
{
|
||||||
@ -2938,13 +2938,13 @@ bool QgisApp::fileSave()
|
|||||||
{
|
{
|
||||||
QMessageBox::critical(this,
|
QMessageBox::critical(this,
|
||||||
tr("Unable to save project"),
|
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 )
|
catch ( std::exception & e )
|
||||||
{
|
{
|
||||||
QMessageBox::critical( this,
|
QMessageBox::critical( this,
|
||||||
tr("Unable to save project ") + QgsProject::instance()->setFilename(),
|
tr("Unable to save project ") + QgsProject::instance()->fileName(),
|
||||||
QString::fromLocal8Bit( e.what() ) );
|
QString::fromLocal8Bit( e.what() ) );
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -3008,7 +3008,7 @@ void QgisApp::fileSaveAs()
|
|||||||
if ( QgsProject::instance()->write() )
|
if ( QgsProject::instance()->write() )
|
||||||
{
|
{
|
||||||
setTitleBarText_(*this); // update title bar
|
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
|
// add this to the list of recently used project files
|
||||||
saveRecentProjectPath(fullPath.filePath(), settings);
|
saveRecentProjectPath(fullPath.filePath(), settings);
|
||||||
}
|
}
|
||||||
@ -3016,13 +3016,13 @@ void QgisApp::fileSaveAs()
|
|||||||
{
|
{
|
||||||
QMessageBox::critical(this,
|
QMessageBox::critical(this,
|
||||||
tr("Unable to save project"),
|
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 )
|
catch ( std::exception & e )
|
||||||
{
|
{
|
||||||
QMessageBox::critical( 0x0,
|
QMessageBox::critical( 0x0,
|
||||||
tr("Unable to save project ") + QgsProject::instance()->setFilename(),
|
tr("Unable to save project ") + QgsProject::instance()->fileName(),
|
||||||
QString::fromLocal8Bit( e.what() ),
|
QString::fromLocal8Bit( e.what() ),
|
||||||
QMessageBox::Ok,
|
QMessageBox::Ok,
|
||||||
Qt::NoButton );
|
Qt::NoButton );
|
||||||
|
@ -481,7 +481,7 @@ QString QgsMapLayer::loadNamedStyle ( const QString theURI, bool &theResultFlag)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QFileInfo project( QgsProject::instance()->setFilename() );
|
QFileInfo project( QgsProject::instance()->fileName() );
|
||||||
QgsDebugMsg( QString("project filename: %1").arg( project.absoluteFilePath() ) );
|
QgsDebugMsg( QString("project filename: %1").arg( project.absoluteFilePath() ) );
|
||||||
|
|
||||||
QString qml;
|
QString qml;
|
||||||
|
@ -411,10 +411,10 @@ QgsProject * QgsProject::theProject_;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString QgsProject::setFilename() const
|
QString QgsProject::fileName() const
|
||||||
{
|
{
|
||||||
return imp_->file.fileName();
|
return imp_->file.fileName();
|
||||||
} // QString QgsProject::setFilename() const
|
} // QString QgsProject::fileName() const
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public:
|
|||||||
void setFilename( QString const & name );
|
void setFilename( QString const & name );
|
||||||
|
|
||||||
/** returns file name */
|
/** returns file name */
|
||||||
QString setFilename() const;
|
QString fileName() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class ProjectTest : public CppUnit::TestFixture
|
|||||||
QgsProject::instance()->dirty( false );
|
QgsProject::instance()->dirty( false );
|
||||||
QgsProject::instance()->setFilename( mFile );
|
QgsProject::instance()->setFilename( mFile );
|
||||||
|
|
||||||
CPPUNIT_ASSERT( mFile == QgsProject::instance()->setFilename() );
|
CPPUNIT_ASSERT( mFile == QgsProject::instance()->fileName() );
|
||||||
CPPUNIT_ASSERT( QgsProject::instance()->isDirty() );
|
CPPUNIT_ASSERT( QgsProject::instance()->isDirty() );
|
||||||
} // testFileName
|
} // testFileName
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user