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

(cherry-picked from 71347c)
  • Loading branch information
nyalldawson committed May 9, 2017
1 parent 8fd4fc6 commit 439b21ea439b7d8f7faf7211f0aa4d218f8f83fd
Showing with 8 additions and 7 deletions.
  1. +5 −5 src/app/qgisapp.cpp
  2. +1 −1 src/app/qgsprojectproperties.cpp
  3. +2 −1 src/app/qgswelcomepageitemsmodel.cpp
@@ -3251,7 +3251,7 @@ void QgisApp::updateRecentProjectPaths()

Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
{
QAction* action = mRecentProjectsMenu->addAction( QString( "%1 (%2)" ).arg( recentProject.title != recentProject.path ? recentProject.title : QFileInfo( recentProject.path ).baseName(), recentProject.path ) );
QAction* action = mRecentProjectsMenu->addAction( QString( "%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 );
}
@@ -5041,7 +5041,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() );

@@ -5051,7 +5051,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;
}
@@ -5093,15 +5093,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 );
@@ -154,7 +154,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)
@@ -25,6 +25,7 @@
#include <QFileInfo>
#include <QPainter>
#include <QTextDocument>
#include <QDir>

QgsWelcomePageItemDelegate::QgsWelcomePageItemDelegate( QObject * parent )
: QStyledItemDelegate( parent )
@@ -146,7 +147,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 ).baseName();
case PathRole:
return mRecentProjects.at( index.row() ).path;
return QDir::toNativeSeparators( mRecentProjects.at( index.row() ).path );
case CrsRole:
if ( mRecentProjects.at( index.row() ).crs != "" )
{

0 comments on commit 439b21e

Please sign in to comment.