Skip to content
Permalink
Browse files

use of smartpointer mTranslator

for better handling if loaded (or in our case existent) or not...
  • Loading branch information
signedav committed Jul 30, 2018
1 parent 090db0d commit 283b1b46b9561111ab8f7482292c5a09e765db2e
Showing with 6 additions and 6 deletions.
  1. +2 −2 src/app/qgsprojectproperties.cpp
  2. +1 −1 src/app/qgsprojectproperties.h
  3. +2 −2 src/core/qgsproject.cpp
  4. +1 −1 src/core/qgsproject.h
@@ -851,7 +851,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( QStringLiteral( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) );
cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) );

connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::generateTsFileButton_clicked );
connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::onGenerateTsFileButton );

projectionSelectorInitialized();
populateRequiredLayers();
@@ -2214,7 +2214,7 @@ void QgsProjectProperties::setCurrentPage( const QString &pageWidgetName )
}
}

void QgsProjectProperties::generateTsFileButton_clicked()
void QgsProjectProperties::onGenerateTsFileButton()
{
QString l = cbtsLocale->currentData().toString();
QgsProject::instance()->generateTsFile( l );
@@ -93,7 +93,7 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
void scaleItemChanged( QListWidgetItem *changedScaleItem );

//! generate the ts file with the locale selected in the checkbox
void generateTsFileButton_clicked();
void onGenerateTsFileButton();

/**
* Set WMS default extent to current canvas extent
@@ -993,7 +993,7 @@ bool QgsProject::read()
else
{
//but delete the translator
delete mTranslator;
mTranslator.reset( nullptr );
}

return rc;
@@ -1010,7 +1010,7 @@ bool QgsProject::readProjectFile( const QString &filename )

if ( QFile( QStringLiteral( "%1/%2.qm" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) ).exists() )
{
mTranslator = new QTranslator();
mTranslator.reset( new QTranslator() );
if ( mTranslator->load( localeFileName, QFileInfo( projectFile.fileName() ).absolutePath() ) )
{
QgsDebugMsg( "Translation loaded" );
@@ -1439,7 +1439,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera

QgsProjectMetadata mMetadata;

QTranslator *mTranslator = nullptr;
std::unique_ptr< QTranslator > mTranslator;

friend class QgsProjectDirtyBlocker;

0 comments on commit 283b1b4

Please sign in to comment.
You can’t perform that action at this time.