Skip to content

Commit

Permalink
follow-up fixes in code
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 16, 2023
1 parent 919c4c8 commit 70536d5
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 24 deletions.
12 changes: 6 additions & 6 deletions src/app/main.cpp
Expand Up @@ -1008,16 +1008,16 @@ int main( int argc, char *argv[] )
{
/* Translation file for QGIS.
*/
QString myUserTranslation = QgsApplication::settingsLocaleUserLocale.value();
QString myGlobalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
QString myUserTranslation = QgsApplication::settingsLocaleUserLocale->value();
QString myGlobalLocale = QgsApplication::settingsLocaleGlobalLocale->value();
bool myShowGroupSeparatorFlag = false; // Default to false
bool myLocaleOverrideFlag = QgsApplication::settingsLocaleOverrideFlag.value();
bool myLocaleOverrideFlag = QgsApplication::settingsLocaleOverrideFlag->value();

// Override Show Group Separator if the global override flag is set
if ( myLocaleOverrideFlag )
{
// Default to false again
myShowGroupSeparatorFlag = QgsApplication::settingsLocaleShowGroupSeparator.value();
myShowGroupSeparatorFlag = QgsApplication::settingsLocaleShowGroupSeparator->value();
}

//
Expand All @@ -1031,7 +1031,7 @@ int main( int argc, char *argv[] )
//
if ( !translationCode.isNull() && !translationCode.isEmpty() )
{
QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
QgsApplication::settingsLocaleUserLocale->setValue( translationCode );
}
else
{
Expand All @@ -1040,7 +1040,7 @@ int main( int argc, char *argv[] )
translationCode = QLocale().name();
//setting the locale/userLocale when the --lang= option is not set will allow third party
//plugins to always use the same locale as the QGIS, otherwise they can be out of sync
QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
QgsApplication::settingsLocaleUserLocale->setValue( translationCode );
}
else
{
Expand Down
16 changes: 8 additions & 8 deletions src/app/options/qgsoptions.cpp
Expand Up @@ -982,9 +982,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
//
QString currentLocale = QLocale().name();
lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( currentLocale ) );
QString userLocale = QgsApplication::settingsLocaleUserLocale.value();
bool showGroupSeparator = QgsApplication::settingsLocaleShowGroupSeparator.value();
QString globalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
QString userLocale = QgsApplication::settingsLocaleUserLocale->value();
bool showGroupSeparator = QgsApplication::settingsLocaleShowGroupSeparator->value();
QString globalLocale = QgsApplication::settingsLocaleGlobalLocale->value();
const QStringList language18nList( i18nList() );
for ( const auto &l : language18nList )
{
Expand All @@ -1011,7 +1011,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti

cboTranslation->setCurrentIndex( cboTranslation->findData( userLocale ) );
cboGlobalLocale->setCurrentIndex( cboGlobalLocale->findData( globalLocale ) );
grpLocale->setChecked( QgsApplication::settingsLocaleOverrideFlag.value() );
grpLocale->setChecked( QgsApplication::settingsLocaleOverrideFlag->value() );
cbShowGroupSeparator->setChecked( showGroupSeparator );


Expand Down Expand Up @@ -1809,12 +1809,12 @@ void QgsOptions::saveOptions()
//
// Locale settings
//
QgsApplication::settingsLocaleUserLocale.setValue( cboTranslation->currentData().toString() );
QgsApplication::settingsLocaleOverrideFlag.setValue( grpLocale->isChecked() );
QgsApplication::settingsLocaleGlobalLocale.setValue( cboGlobalLocale->currentData( ).toString() );
QgsApplication::settingsLocaleUserLocale->setValue( cboTranslation->currentData().toString() );
QgsApplication::settingsLocaleOverrideFlag->setValue( grpLocale->isChecked() );
QgsApplication::settingsLocaleGlobalLocale->setValue( cboGlobalLocale->currentData( ).toString() );

// Number settings
QgsApplication::settingsLocaleShowGroupSeparator.setValue( cbShowGroupSeparator->isChecked( ) );
QgsApplication::settingsLocaleShowGroupSeparator->setValue( cbShowGroupSeparator->isChecked( ) );

QgsLocalDefaultSettings::setBearingFormat( mBearingFormat.get() );
QgsLocalDefaultSettings::setGeographicCoordinateFormat( mCoordinateFormat.get() );
Expand Down
1 change: 1 addition & 0 deletions src/app/options/qgsvectorrenderingoptions.cpp
Expand Up @@ -13,6 +13,7 @@
* *
***************************************************************************/

#include "qgsabstractgeometry.h"
#include "qgsvectorrenderingoptions.h"
#include "qgssettings.h"
#include "qgsapplication.h"
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsprojectproperties.cpp
Expand Up @@ -1080,7 +1080,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
}

cbtsLocale->addItem( QIcon( QStringLiteral( ":/images/flags/%1.svg" ).arg( QLatin1String( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) );
cbtsLocale->setCurrentIndex( cbtsLocale->findData( QgsApplication::settingsLocaleUserLocale.value() ) );
cbtsLocale->setCurrentIndex( cbtsLocale->findData( QgsApplication::settingsLocaleUserLocale->value() ) );

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

Expand Down
1 change: 1 addition & 0 deletions src/core/settings/qgssettingsregistrycore.cpp
Expand Up @@ -30,6 +30,7 @@
#include "qgsgpsconnection.h"
#include "qgsbabelformatregistry.h"
#include "qgsgpslogger.h"
#include "qgsvectortileconnection.h"


QgsSettingsRegistryCore::QgsSettingsRegistryCore()
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/testqgscompositionconverter.cpp
Expand Up @@ -166,7 +166,7 @@ void TestQgsCompositionConverter::initTestCase()
{
QgsApplication::init();
QgsApplication::initQgis();
QgsApplication::settingsSearchPathsForSVG.setValue( QStringList() << QStringLiteral( TEST_DATA_DIR ) );
QgsApplication::settingsSearchPathsForSVG->setValue( QStringList() << QStringLiteral( TEST_DATA_DIR ) );
}

void TestQgsCompositionConverter::init()
Expand Down
8 changes: 4 additions & 4 deletions tests/src/core/testqgsgeonodeconnection.cpp
Expand Up @@ -88,11 +88,11 @@ void TestQgsGeoNodeConnection::initTestCase()
QgsSettings settings;

// Testing real server, demo.geonode.org. Need to be changed later.
QgsOwsConnection::settingsConnectionUrl.setValue( mDemoGeoNodeURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mDemoGeoNodeName} );
QgsOwsConnection::settingsConnectionUrl->setValue( mDemoGeoNodeURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mDemoGeoNodeName} );
// Testing real server, staging.geonode.kartoza.com. Need to be changed later.
QgsOwsConnection::settingsConnectionUrl.setValue( mKartozaGeoNodeQGISServerURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mKartozaGeoNodeQGISServerName} );
QgsOwsConnection::settingsConnectionUrl->setValue( mKartozaGeoNodeQGISServerURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mKartozaGeoNodeQGISServerName} );
// Testing real server, staginggs.geonode.kartoza.com. Need to be changed later.
QgsOwsConnection::settingsConnectionUrl.setValue( mKartozaGeoNodeGeoServerURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mKartozaGeoNodeGeoServerName} );
QgsOwsConnection::settingsConnectionUrl->setValue( mKartozaGeoNodeGeoServerURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mKartozaGeoNodeGeoServerName} );
}

// Test the creation of geonode connection
Expand All @@ -110,7 +110,7 @@ void TestQgsGeoNodeConnection::testCreation()
QVERIFY( !connectionList.contains( mGeoNodeConnectionName ) );

// Add new GeoNode Connection
QgsOwsConnection::settingsConnectionUrl.setValue( mGeoNodeConnectionURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mGeoNodeConnectionName} );
QgsOwsConnection::settingsConnectionUrl->setValue( mGeoNodeConnectionURL, {QgsGeoNodeConnectionUtils::sGeoNodeConnection.toLower(), mGeoNodeConnectionName} );

const QStringList newConnectionList = QgsGeoNodeConnectionUtils::connectionList();
const int newNumberOfConnection = newConnectionList.count();
Expand Down
8 changes: 4 additions & 4 deletions tests/src/core/testqgstranslateproject.cpp
Expand Up @@ -57,12 +57,12 @@ void TestQgsTranslateProject::initTestCase()
QgsApplication::init();
QgsApplication::initQgis();

original_locale = QgsApplication::settingsLocaleUserLocale.value();
original_locale = QgsApplication::settingsLocaleUserLocale->value();
}

void TestQgsTranslateProject::cleanupTestCase()
{
QgsApplication::settingsLocaleUserLocale.setValue( original_locale );
QgsApplication::settingsLocaleUserLocale->setValue( original_locale );
QgsApplication::exitQgis();

//delete translated project file
Expand Down Expand Up @@ -91,7 +91,7 @@ void TestQgsTranslateProject::cleanup()
void TestQgsTranslateProject::createTsFile()
{
//open project in english
QgsApplication::settingsLocaleUserLocale.setValue( "en" );
QgsApplication::settingsLocaleUserLocale->setValue( "en" );
QString projectFileName( TEST_DATA_DIR );
projectFileName = projectFileName + "/project_translation/points_translation.qgs";
QgsProject::instance()->read( projectFileName );
Expand Down Expand Up @@ -163,7 +163,7 @@ void TestQgsTranslateProject::createTsFile()
void TestQgsTranslateProject::translateProject()
{
//open project in german
QgsApplication::settingsLocaleUserLocale.setValue( "de" );
QgsApplication::settingsLocaleUserLocale->setValue( "de" );
QString projectFileName( TEST_DATA_DIR );
projectFileName = projectFileName + "/project_translation/points_translation.qgs";
QgsProject::instance()->read( projectFileName );
Expand Down

0 comments on commit 70536d5

Please sign in to comment.