Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
{
Expand All @@ -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() )
{
Expand Down
25 changes: 25 additions & 0 deletions src/core/localfilesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,31 @@ 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 ( 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;
}
}
}
Comment on lines +280 to +304
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn , could you please elaborate a bit more on what the code is doing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mohsenD98 , it's skipping sidecar files that QGIS generates alongside the main .qgs project file. The sidecar files are of no use and should only be accessed by opening the main project.qgs file.

else if ( item == QStringLiteral( "qfield_webdav_configuration.json" ) )
{
// Skip QField WebDAV configuration file
Expand Down
14 changes: 8 additions & 6 deletions src/qml/QFieldSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ Page {
Layout.fillWidth: true
Layout.leftMargin: 20
Layout.rightMargin: 20
Layout.bottomMargin: 0

columns: 2
columnSpacing: 0
Expand Down Expand Up @@ -429,7 +430,7 @@ Page {
color: Theme.mainColor
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.topMargin: 5
Layout.topMargin: 10
Layout.columnSpan: 2
}

Expand All @@ -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')
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
Loading