Skip to content

Commit

Permalink
Move SUPPORTED_* to qfield.h now that we have one, add supported file…
Browse files Browse the repository at this point in the history
… extensions
  • Loading branch information
nirvn committed Feb 9, 2025
1 parent 0f1ea05 commit fd61f19
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/core/localfilesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

#include "localfilesmodel.h"
#include "platformutilities.h"
#include "qfield.h"
#include "qfieldcloudutils.h"
#include "qgismobileapp.h"
#include "webdavconnection.h"

#include <QDir>
Expand Down Expand Up @@ -289,7 +289,7 @@ void LocalFilesModel::reloadModel()
{
datasets << Item( ItemMetaType::Dataset, ItemType::RasterDataset, fi.completeBaseName(), suffix, fi.absoluteFilePath(), fi.size() );
}
else if ( suffix == QStringLiteral( "log" ) || suffix == QStringLiteral( "txt" ) )
else if ( SUPPORTED_FILE_EXTENSIONS.contains( suffix ) )
{
files << Item( ItemMetaType::File, ItemType::OtherFile, fi.completeBaseName(), suffix, fi.absoluteFilePath(), fi.size() );
}
Expand Down
2 changes: 0 additions & 2 deletions src/core/localfilesmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#include <QAbstractListModel>

#define SUPPORTED_DATASET_THUMBNAIL QStringList( { QStringLiteral( "zip" ), QStringLiteral( "tif" ), QStringLiteral( "tiff" ), QStringLiteral( "pdf" ), QStringLiteral( "jpg" ), QStringLiteral( "jpeg" ), QStringLiteral( "png" ), QStringLiteral( "jp2" ), QStringLiteral( "webp" ) } )

/**
* \ingroup core
*/
Expand Down
1 change: 0 additions & 1 deletion src/core/platforms/platformutilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "projectsource.h"
#include "qfield.h"
#include "qfieldcloudconnection.h"
#include "qgismobileapp.h"
#include "qgsmessagelog.h"
#include "resourcesource.h"
#include "stringutils.h"
Expand Down
6 changes: 6 additions & 0 deletions src/core/qfield.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ namespace qfield
#define WITH_SENTRY @WITH_SENTRY@
#define QGIS_PREFIX_PATH "@QGIS_PREFIX_PATH@"

#define SUPPORTED_PROJECT_EXTENSIONS QStringList( { QStringLiteral( "qgs" ), QStringLiteral( "qgz" ) } )
#define SUPPORTED_VECTOR_EXTENSIONS QStringList( { QStringLiteral( "gpkg" ), QStringLiteral( "shp" ), QStringLiteral( "kml" ), QStringLiteral( "kmz" ), QStringLiteral( "geojson" ), QStringLiteral( "json" ), QStringLiteral( "pdf" ), QStringLiteral( "gpx" ), QStringLiteral( "gml" ), QStringLiteral( "mif" ), QStringLiteral( "fgb" ), QStringLiteral( "db" ), QStringLiteral( "sqlite" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ), QStringLiteral( "7z" ), QStringLiteral( "rar" ) } )
#define SUPPORTED_RASTER_EXTENSIONS QStringList( { QStringLiteral( "tif" ), QStringLiteral( "tiff" ), QStringLiteral( "pdf" ), QStringLiteral( "jpg" ), QStringLiteral( "jpeg" ), QStringLiteral( "png" ), QStringLiteral( "gpkg" ), QStringLiteral( "jp2" ), QStringLiteral( "webp" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ), QStringLiteral( "7z" ) } )
#define SUPPORTED_FILE_EXTENSIONS QStringList( { QStringLiteral( "log" ), QStringLiteral( "txt" ), QStringLiteral( "mp4" ), QStringLiteral( "m4a" ), QStringLiteral( "ogg" ), QStringLiteral( "mp3" ) } )
#define SUPPORTED_DATASET_THUMBNAIL QStringList( { QStringLiteral( "zip" ), QStringLiteral( "tif" ), QStringLiteral( "tiff" ), QStringLiteral( "pdf" ), QStringLiteral( "jpg" ), QStringLiteral( "jpeg" ), QStringLiteral( "png" ), QStringLiteral( "jp2" ), QStringLiteral( "webp" ) } )

#endif // QFIELD_H
4 changes: 0 additions & 4 deletions src/core/qgismobileapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ class QgsPrintLayout;

#define REGISTER_SINGLETON( uri, _class, name ) qmlRegisterSingletonType<_class>( uri, 1, 0, name, []( QQmlEngine *engine, QJSEngine *scriptEngine ) -> QObject * { Q_UNUSED(engine); Q_UNUSED(scriptEngine); return new _class(); } )

#define SUPPORTED_PROJECT_EXTENSIONS QStringList( { QStringLiteral( "qgs" ), QStringLiteral( "qgz" ) } )
#define SUPPORTED_VECTOR_EXTENSIONS QStringList( { QStringLiteral( "gpkg" ), QStringLiteral( "shp" ), QStringLiteral( "kml" ), QStringLiteral( "kmz" ), QStringLiteral( "geojson" ), QStringLiteral( "json" ), QStringLiteral( "pdf" ), QStringLiteral( "gpx" ), QStringLiteral( "gml" ), QStringLiteral( "mif" ), QStringLiteral( "fgb" ), QStringLiteral( "db" ), QStringLiteral( "sqlite" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ), QStringLiteral( "7z" ), QStringLiteral( "rar" ) } )
#define SUPPORTED_RASTER_EXTENSIONS QStringList( { QStringLiteral( "tif" ), QStringLiteral( "tiff" ), QStringLiteral( "pdf" ), QStringLiteral( "jpg" ), QStringLiteral( "jpeg" ), QStringLiteral( "png" ), QStringLiteral( "gpkg" ), QStringLiteral( "jp2" ), QStringLiteral( "webp" ), QStringLiteral( "mbtiles" ), QStringLiteral( "vrt" ), QStringLiteral( "zip" ), QStringLiteral( "7z" ) } )

/**
* \defgroup core
* \brief QField C++ classes
Expand Down
2 changes: 1 addition & 1 deletion src/core/recentprojectlistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
***************************************************************************/

#include "platformutilities.h"
#include "qfield.h"
#include "qfieldcloudutils.h"
#include "qgismobileapp.h"
#include "recentprojectlistmodel.h"

#include <QDir>
Expand Down

1 comment on commit fd61f19

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please sign in to comment.