From c8f0f82182293c3799ebf4fc0a26238c99abfb9f Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Sat, 4 Jan 2025 17:08:17 +0800 Subject: [PATCH] Mobile: Remove unused components from build. Remove import / export components that are not supported in the mobile version from the mobild build. Signed-off-by: Michael Keller --- Subsurface-mobile.pro | 18 ------------------ backend-shared/exportfuncs.cpp | 2 ++ core/file.cpp | 8 ++++++++ core/file.h | 11 +++++++---- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index 97aa5eaae..ba32f603f 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -56,27 +56,17 @@ SOURCES += subsurface-mobile-main.cpp \ core/filterconstraint.cpp \ core/filterpreset.cpp \ core/filterpresettable.cpp \ - core/fit_file.cpp \ core/divelist.cpp \ core/divelog.cpp \ core/gas-model.cpp \ core/gaspressures.cpp \ core/git-access.cpp \ core/globals.cpp \ - core/liquivision.cpp \ core/load-git.cpp \ core/parse-xml.cpp \ core/parse.cpp \ core/picture.cpp \ core/sample.cpp \ - core/import-suunto.cpp \ - core/import-shearwater.cpp \ - core/import-seac.cpp \ - core/import-cobalt.cpp \ - core/import-divinglog.cpp \ - core/import-csv.cpp \ - core/import-asd.cpp \ - core/import-logtrak.cpp \ core/save-html.cpp \ core/statistics.cpp \ core/worldmap-save.cpp \ @@ -84,11 +74,8 @@ SOURCES += subsurface-mobile-main.cpp \ core/version.cpp \ core/save-git.cpp \ core/datatrak.cpp \ - core/ostctools.cpp \ - core/divesoft.cpp \ core/planner.cpp \ core/save-xml.cpp \ - core/cochran.cpp \ core/deco.cpp \ core/divesite.cpp \ core/equipment.cpp \ @@ -225,7 +212,6 @@ HEADERS += \ core/divesite.h \ core/divesitetable.h \ core/checkcloudconnection.h \ - core/cochran.h \ core/color.h \ core/configuredivecomputer.h \ core/datatrak.h \ @@ -382,7 +368,6 @@ android { ../install-root-$${QT_ARCH}/lib/libzip.a \ ../install-root-$${QT_ARCH}/lib/libxslt.a \ ../install-root-$${QT_ARCH}/lib/libxml2.a \ - ../install-root-$${QT_ARCH}/lib/libsqlite3.a \ ../install-root-$${QT_ARCH}/lib/libssl_1_1.so \ ../install-root-$${QT_ARCH}/lib/libcrypto_1_1.so \ ../googlemaps-build/libplugins_geoservices_qtgeoservices_googlemaps_$${QT_ARCH}.so @@ -399,7 +384,6 @@ android { INCLUDEPATH += ../install-root-$${QT_ARCH}/include/ \ ../install-root/lib/libzip/include \ - ../install-root-$${QT_ARCH}/include/libxstl \ ../install-root-$${QT_ARCH}/include/libxml2 \ ../install-root-$${QT_ARCH}/include/libexstl \ ../install-root-$${QT_ARCH}/include/openssl \ @@ -434,13 +418,11 @@ ios { $${ARCH_PATH}/lib/qml/org/kde/kirigami.2/libkirigamiplugin.a \ ../googlemaps-build/libqtgeoservices_googlemaps.a \ -liconv \ - -lsqlite3 \ -lxml2 LIBS += -framework MessageUI INCLUDEPATH += $${ARCH_PATH}/include/ \ - $${ARCH_PATH}/include/libxstl \ $${ARCH_PATH}/include/libexstl \ $${ARCH_PATH}/include/openssl \ . \ diff --git a/backend-shared/exportfuncs.cpp b/backend-shared/exportfuncs.cpp index 91c643780..f77ceb899 100644 --- a/backend-shared/exportfuncs.cpp +++ b/backend-shared/exportfuncs.cpp @@ -325,8 +325,10 @@ std::vector getDiveSitesToExport(bool selectedOnly) return res; } +#if !defined(SUBSURFACE_MOBILE) QFuture exportUsingStyleSheet(const QString &filename, bool doExport, int units, const QString &stylesheet, bool anonymize) { return QtConcurrent::run(export_dives_xslt, filename.toUtf8(), doExport, units, stylesheet.toUtf8(), anonymize); } +#endif diff --git a/core/file.cpp b/core/file.cpp index 438b002c0..4f9093b1d 100644 --- a/core/file.cpp +++ b/core/file.cpp @@ -109,6 +109,7 @@ static int db_test_func(void *, int, char **data, char **) return *data[0] == '0'; } +#if !defined(SUBSURFACE_MOBILE) static int try_to_open_db(const char *filename, std::string &mem, struct divelog *log) { sqlite3 *handle; @@ -189,6 +190,7 @@ static int try_to_open_db(const char *filename, std::string &mem, struct divelog return retval; } +#endif /* * Cochran comma-separated values: depth in feet, temperature in F, pressure in psi. @@ -206,6 +208,7 @@ static int try_to_open_db(const char *filename, std::string &mem, struct divelog * * Followed by the data values (all comma-separated, all one long line). */ +#if !defined(SUBSURFACE_MOBILE) static int open_by_filename(const char *filename, const char *fmt, std::string &mem, struct divelog *log) { // hack to be able to provide a comment for the translated string @@ -236,13 +239,16 @@ static int open_by_filename(const char *filename, const char *fmt, std::string & return 0; } +#endif static int parse_file_buffer(const char *filename, std::string &mem, struct divelog *log) { +#if !defined(SUBSURFACE_MOBILE) int ret; const char *fmt = strrchr(filename, '.'); if (fmt && (ret = open_by_filename(filename, fmt + 1, mem, log)) != 0) return ret; +#endif if (mem.empty()) return report_error("Out of memory parsing file %s\n", filename); @@ -297,6 +303,7 @@ int parse_file(const char *filename, struct divelog *log) return report_error(translate("gettextFromC", "Empty file '%s'"), filename); } +#if !defined(SUBSURFACE_MOBILE) fmt = strrchr(filename, '.'); if (fmt && (!strcasecmp(fmt + 1, "DB") || !strcasecmp(fmt + 1, "BAK") || !strcasecmp(fmt + 1, "SQL"))) { if (!try_to_open_db(filename, mem, log)) @@ -336,6 +343,7 @@ int parse_file(const char *filename, struct divelog *log) if (fmt && (!strcasecmp(fmt + 1, "asd"))) { return scubapro_asd_import(mem, log); } +#endif return parse_file_buffer(filename, mem, log); } diff --git a/core/file.h b/core/file.h index cf23fcd50..05bf6d38e 100644 --- a/core/file.h +++ b/core/file.h @@ -13,10 +13,17 @@ struct divelog; struct zip; +#if !defined(SUBSURFACE_MOBILE) extern int ostctools_import(std::string &buffer, struct divelog *log); extern int divesoft_import(const std::string &buffer, struct divelog *log); +extern int logtrak_import(const std::string &mem, struct divelog *log); +extern int scubapro_asd_import(const std::string &mem, struct divelog *log); extern int fit_file_import(const std::string &buffer, struct divelog *log); +extern int try_to_open_cochran(const char *filename, std::string &mem, struct divelog *log); +extern int try_to_open_liquivision(const char *filename, std::string &mem, struct divelog *log); +#endif + extern int parse_file(const char *filename, struct divelog *log); extern int try_to_open_zip(const char *filename, struct divelog *log); @@ -31,10 +38,6 @@ extern int subsurface_stat(const char *path, struct stat *buf); extern struct zip *subsurface_zip_open_readonly(const char *path, int flags, int *errorp); extern int subsurface_zip_close(struct zip *zip); extern std::pair readfile(const char *filename); // return data, errorcode pair. -extern int try_to_open_cochran(const char *filename, std::string &mem, struct divelog *log); -extern int try_to_open_liquivision(const char *filename, std::string &mem, struct divelog *log); extern int datatrak_import(std::string &mem, std::string &wl_mem, struct divelog *log); -extern int logtrak_import(const std::string &mem, struct divelog *log); -extern int scubapro_asd_import(const std::string &mem, struct divelog *log); #endif // FILE_H