Skip to content
Permalink
Browse files
Show project path using native OS format
Avoids showing project paths as d:/... on windows, and instead
uses the more familiar d:\... format
  • Loading branch information
nyalldawson committed May 4, 2017
1 parent 341e258 commit 71347c4564b6c8c495f045f2671f814b820c634b
Showing with 9 additions and 7 deletions.
  1. +6 −5 src/app/qgisapp.cpp
  2. +1 −1 src/app/qgsprojectproperties.cpp
  3. +2 −1 src/app/qgswelcomepageitemsmodel.cpp
@@ -3518,7 +3518,8 @@ void QgisApp::updateRecentProjectPaths()

Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData &recentProject, mRecentProjects )
{
QAction *action = mRecentProjectsMenu->addAction( QStringLiteral( "%1 (%2)" ).arg( recentProject.title != recentProject.path ? recentProject.title : QFileInfo( recentProject.path ).baseName(), recentProject.path ) );
QAction *action = mRecentProjectsMenu->addAction( QStringLiteral( "%1 (%2)" ).arg( recentProject.title != recentProject.path ? recentProject.title : QFileInfo( recentProject.path ).baseName(),
QDir::toNativeSeparators( recentProject.path ) ) );
action->setEnabled( QFile::exists( ( recentProject.path ) ) );
action->setData( recentProject.path );
}
@@ -5382,7 +5383,7 @@ bool QgisApp::fileSave()
if ( QgsProject::instance()->write() )
{
setTitleBarText_( *this ); // update title bar
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QgsProject::instance()->fileName() ), 5000 );
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ), 5000 );

saveRecentProjectPath( fullPath.filePath() );

@@ -5392,7 +5393,7 @@ bool QgisApp::fileSave()
else
{
QMessageBox::critical( this,
tr( "Unable to save project %1" ).arg( QgsProject::instance()->fileName() ),
tr( "Unable to save project %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ),
QgsProject::instance()->error() );
return false;
}
@@ -5434,15 +5435,15 @@ void QgisApp::fileSaveAs()
if ( QgsProject::instance()->write() )
{
setTitleBarText_( *this ); // update title bar
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QgsProject::instance()->fileName() ), 5000 );
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ), 5000 );
// add this to the list of recently used project files
saveRecentProjectPath( fullPath.filePath() );
mProjectLastModified = fullPath.lastModified();
}
else
{
QMessageBox::critical( this,
tr( "Unable to save project %1" ).arg( QgsProject::instance()->fileName() ),
tr( "Unable to save project %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ),
QgsProject::instance()->error(),
QMessageBox::Ok,
Qt::NoButton );
@@ -147,7 +147,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa

mAutoTransaction->setChecked( QgsProject::instance()->autoTransaction() );
title( QgsProject::instance()->title() );
mProjectFileLineEdit->setText( QgsProject::instance()->fileName() );
mProjectFileLineEdit->setText( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) );

// get the manner in which the number of decimal places in the mouse
// position display is set (manual or automatic)
@@ -24,6 +24,7 @@
#include <QFileInfo>
#include <QPainter>
#include <QTextDocument>
#include <QDir>

QgsWelcomePageItemDelegate::QgsWelcomePageItemDelegate( QObject *parent )
: QStyledItemDelegate( parent )
@@ -145,7 +146,7 @@ QVariant QgsWelcomePageItemsModel::data( const QModelIndex &index, int role ) co
case TitleRole:
return mRecentProjects.at( index.row() ).title != mRecentProjects.at( index.row() ).path ? mRecentProjects.at( index.row() ).title : QFileInfo( mRecentProjects.at( index.row() ).path ).completeBaseName();
case PathRole:
return mRecentProjects.at( index.row() ).path;
return QDir::toNativeSeparators( mRecentProjects.at( index.row() ).path );
case CrsRole:
if ( mRecentProjects.at( index.row() ).crs != QLatin1String( "" ) )
{

0 comments on commit 71347c4

Please sign in to comment.