Skip to content

Commit 71347c4

Browse files
committedMay 4, 2017
Show project path using native OS format
Avoids showing project paths as d:/... on windows, and instead uses the more familiar d:\... format
1 parent 341e258 commit 71347c4

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,7 +3518,8 @@ void QgisApp::updateRecentProjectPaths()
35183518

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

53875388
saveRecentProjectPath( fullPath.filePath() );
53885389

@@ -5392,7 +5393,7 @@ bool QgisApp::fileSave()
53925393
else
53935394
{
53945395
QMessageBox::critical( this,
5395-
tr( "Unable to save project %1" ).arg( QgsProject::instance()->fileName() ),
5396+
tr( "Unable to save project %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ),
53965397
QgsProject::instance()->error() );
53975398
return false;
53985399
}
@@ -5434,15 +5435,15 @@ void QgisApp::fileSaveAs()
54345435
if ( QgsProject::instance()->write() )
54355436
{
54365437
setTitleBarText_( *this ); // update title bar
5437-
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QgsProject::instance()->fileName() ), 5000 );
5438+
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ), 5000 );
54385439
// add this to the list of recently used project files
54395440
saveRecentProjectPath( fullPath.filePath() );
54405441
mProjectLastModified = fullPath.lastModified();
54415442
}
54425443
else
54435444
{
54445445
QMessageBox::critical( this,
5445-
tr( "Unable to save project %1" ).arg( QgsProject::instance()->fileName() ),
5446+
tr( "Unable to save project %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ),
54465447
QgsProject::instance()->error(),
54475448
QMessageBox::Ok,
54485449
Qt::NoButton );

‎src/app/qgsprojectproperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
147147

148148
mAutoTransaction->setChecked( QgsProject::instance()->autoTransaction() );
149149
title( QgsProject::instance()->title() );
150-
mProjectFileLineEdit->setText( QgsProject::instance()->fileName() );
150+
mProjectFileLineEdit->setText( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) );
151151

152152
// get the manner in which the number of decimal places in the mouse
153153
// position display is set (manual or automatic)

‎src/app/qgswelcomepageitemsmodel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <QFileInfo>
2525
#include <QPainter>
2626
#include <QTextDocument>
27+
#include <QDir>
2728

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

0 commit comments

Comments
 (0)
Please sign in to comment.