Skip to content

Commit 439b21e

Browse files
committed
Show project path using native OS format
Avoids showing project paths as d:/... on windows, and instead uses the more familiar d:\... format (cherry-picked from 71347c)
1 parent 8fd4fc6 commit 439b21e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/app/qgisapp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,7 +3251,7 @@ void QgisApp::updateRecentProjectPaths()
32513251

32523252
Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
32533253
{
3254-
QAction* action = mRecentProjectsMenu->addAction( QString( "%1 (%2)" ).arg( recentProject.title != recentProject.path ? recentProject.title : QFileInfo( recentProject.path ).baseName(), recentProject.path ) );
3254+
QAction* action = mRecentProjectsMenu->addAction( QString( "%1 (%2)" ).arg( recentProject.title != recentProject.path ? recentProject.title : QFileInfo( recentProject.path ).baseName(), QDir::toNativeSeparators( recentProject.path ) ) );
32553255
action->setEnabled( QFile::exists(( recentProject.path ) ) );
32563256
action->setData( recentProject.path );
32573257
}
@@ -5041,7 +5041,7 @@ bool QgisApp::fileSave()
50415041
if ( QgsProject::instance()->write() )
50425042
{
50435043
setTitleBarText_( *this ); // update title bar
5044-
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QgsProject::instance()->fileName() ), 5000 );
5044+
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ), 5000 );
50455045

50465046
saveRecentProjectPath( fullPath.filePath() );
50475047

@@ -5051,7 +5051,7 @@ bool QgisApp::fileSave()
50515051
else
50525052
{
50535053
QMessageBox::critical( this,
5054-
tr( "Unable to save project %1" ).arg( QgsProject::instance()->fileName() ),
5054+
tr( "Unable to save project %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ),
50555055
QgsProject::instance()->error() );
50565056
return false;
50575057
}
@@ -5093,15 +5093,15 @@ void QgisApp::fileSaveAs()
50935093
if ( QgsProject::instance()->write() )
50945094
{
50955095
setTitleBarText_( *this ); // update title bar
5096-
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QgsProject::instance()->fileName() ), 5000 );
5096+
statusBar()->showMessage( tr( "Saved project to: %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ), 5000 );
50975097
// add this to the list of recently used project files
50985098
saveRecentProjectPath( fullPath.filePath() );
50995099
mProjectLastModified = fullPath.lastModified();
51005100
}
51015101
else
51025102
{
51035103
QMessageBox::critical( this,
5104-
tr( "Unable to save project %1" ).arg( QgsProject::instance()->fileName() ),
5104+
tr( "Unable to save project %1" ).arg( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) ),
51055105
QgsProject::instance()->error(),
51065106
QMessageBox::Ok,
51075107
Qt::NoButton );

src/app/qgsprojectproperties.cpp

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

155155
mAutoTransaction->setChecked( QgsProject::instance()->autoTransaction() );
156156
title( QgsProject::instance()->title() );
157-
mProjectFileLineEdit->setText( QgsProject::instance()->fileName() );
157+
mProjectFileLineEdit->setText( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) );
158158

159159
// get the manner in which the number of decimal places in the mouse
160160
// 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
@@ -25,6 +25,7 @@
2525
#include <QFileInfo>
2626
#include <QPainter>
2727
#include <QTextDocument>
28+
#include <QDir>
2829

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

0 commit comments

Comments
 (0)