From efd7509eb92ea97b1789936b558b4c95909f8146 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 12 Sep 2025 15:29:26 +0700 Subject: [PATCH 1/4] Support project translations when available --- src/app/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index 128a608fdd..8bf548ad2e 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -209,9 +209,13 @@ int main( int argc, char **argv ) QgsApplication app( argc, argv, true, profilePath, QStringLiteral( "mobile" ) ); if ( !qfieldTranslatorLoaded || qfieldTranslator.isEmpty() ) + { ( void ) qfieldTranslator.load( QStringLiteral( "qfield_%1" ).arg( QLocale().name() ), QStringLiteral( ":/i18n/" ), "_" ); + } if ( !qtTranslatorLoaded || qtTranslator.isEmpty() ) + { ( void ) qtTranslator.load( QStringLiteral( "qt_%1" ).arg( QLocale().name() ), QStringLiteral( ":/i18n/" ), "_" ); + } if ( !customLanguage.isEmpty() ) { @@ -222,6 +226,11 @@ int main( int argc, char **argv ) QgsApplication::setLocale( QLocale() ); } + QLocale locale; + const QString localeName = locale.name(); + const int localeTagSeparator = localeName.indexOf( QStringLiteral( "_" ) ); + QgsApplication::settingsLocaleUserLocale->setValue( localeName.mid( 0, localeTagSeparator ) ); + const QString qfieldFontName( qgetenv( "QFIELD_FONT_NAME" ) ); if ( !qfieldFontName.isEmpty() ) { From 7737c8c892081c5039cb74228caed992d699f870 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 12 Sep 2025 15:44:47 +0700 Subject: [PATCH 2/4] Tiny settings spacing improvements --- src/qml/QFieldSettings.qml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/qml/QFieldSettings.qml b/src/qml/QFieldSettings.qml index a2e7f9490e..485ecf60cd 100644 --- a/src/qml/QFieldSettings.qml +++ b/src/qml/QFieldSettings.qml @@ -351,6 +351,7 @@ Page { Layout.fillWidth: true Layout.leftMargin: 20 Layout.rightMargin: 20 + Layout.bottomMargin: 0 columns: 2 columnSpacing: 0 @@ -429,7 +430,7 @@ Page { color: Theme.mainColor wrapMode: Text.WordWrap Layout.fillWidth: true - Layout.topMargin: 5 + Layout.topMargin: 10 Layout.columnSpan: 2 } @@ -455,10 +456,11 @@ Page { Layout.fillWidth: true Layout.leftMargin: 20 Layout.rightMargin: 20 + Layout.bottomMargin: 0 columns: 2 columnSpacing: 0 - rowSpacing: 5 + rowSpacing: 0 Label { text: qsTr('User Interface') @@ -552,12 +554,12 @@ Page { Layout.fillWidth: true Layout.leftMargin: 20 Layout.rightMargin: 20 - Layout.topMargin: 5 Layout.bottomMargin: 5 + Layout.topMargin: 5 columns: 1 columnSpacing: 0 - rowSpacing: 0 + rowSpacing: 5 visible: platformUtilities.capabilities & PlatformUtilities.AdjustBrightness @@ -600,12 +602,12 @@ Page { Layout.fillWidth: true Layout.leftMargin: 20 Layout.rightMargin: 20 + Layout.bottomMargin: 10 Layout.topMargin: 5 - Layout.bottomMargin: 40 columns: 1 columnSpacing: 0 - rowSpacing: 5 + rowSpacing: 10 Label { Layout.fillWidth: true From 398abb84d3e7321b36540bdd0fa6df49ff17fa5d Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 12 Sep 2025 17:21:47 +0700 Subject: [PATCH 3/4] Do not show translated project files, always favor the original project --- src/core/localfilesmodel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/localfilesmodel.cpp b/src/core/localfilesmodel.cpp index 04eb89b40a..8278ef2f58 100644 --- a/src/core/localfilesmodel.cpp +++ b/src/core/localfilesmodel.cpp @@ -277,6 +277,19 @@ void LocalFilesModel::reloadModel() // Skip project preview images continue; } + else if ( suffix == QStringLiteral( "qgs" ) || suffix == QStringLiteral( "qgz" ) ) + { + QRegularExpression re( QStringLiteral( "(.*)_[A-Za-z]{2}" ) ); + QRegularExpressionMatch match = re.match( fi.completeBaseName() ); + if ( match.hasMatch() ) + { + if ( items.contains( QStringLiteral( "%1.qgs" ).arg( match.captured( 1 ) ), Qt::CaseInsensitive ) || items.contains( QStringLiteral( "%1.qgz" ).arg( match.captured( 1 ) ), Qt::CaseInsensitive ) ) + { + // Skip translated project, users should always use the original project + continue; + } + } + } else if ( item == QStringLiteral( "qfield_webdav_configuration.json" ) ) { // Skip QField WebDAV configuration file From d8f269b1f1c64aa5d25a33f68bcf1e799cd4779d Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 12 Sep 2025 17:22:11 +0700 Subject: [PATCH 4/4] Skip the _attachments.zip project sidecar file in the project files view, confusing and harmful --- src/core/localfilesmodel.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/localfilesmodel.cpp b/src/core/localfilesmodel.cpp index 8278ef2f58..636ef00a8a 100644 --- a/src/core/localfilesmodel.cpp +++ b/src/core/localfilesmodel.cpp @@ -290,6 +290,18 @@ void LocalFilesModel::reloadModel() } } } + else if ( suffix == QStringLiteral( "zip" ) ) + { + if ( item.endsWith( QStringLiteral( "_attachments.zip" ), Qt::CaseInsensitive ) ) + { + const QString reducedItemName = item.mid( 0, item.size() - 16 ); + if ( items.contains( QStringLiteral( "%1.qgs" ).arg( reducedItemName ), Qt::CaseInsensitive ) || items.contains( QStringLiteral( "%1.qgz" ).arg( reducedItemName ), Qt::CaseInsensitive ) ) + { + // Skip project attachments sidecar file + continue; + } + } + } else if ( item == QStringLiteral( "qfield_webdav_configuration.json" ) ) { // Skip QField WebDAV configuration file