From b4b9c0febc46b4981def2e4a675e219e8b3a0642 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 21 Dec 2024 10:00:13 +0700 Subject: [PATCH] Rename QFieldService to QFieldCloudService --- platform/android/AndroidManifest.xml.in | 2 +- ...{QFieldService.java => QFieldCloudService.java} | 14 +++++++------- src/app/main.cpp | 4 ++-- .../platforms/android/androidplatformutilities.cpp | 6 +++--- src/service/CMakeLists.txt | 5 +++-- .../{qfieldservice.cpp => qfieldcloudservice.cpp} | 8 ++++---- .../{qfieldservice.h => qfieldcloudservice.h} | 9 ++++----- 7 files changed, 24 insertions(+), 24 deletions(-) rename platform/android/src/ch/opengis/qfield/{QFieldService.java => QFieldCloudService.java} (90%) rename src/service/{qfieldservice.cpp => qfieldcloudservice.cpp} (88%) rename src/service/{qfieldservice.h => qfieldcloudservice.h} (83%) diff --git a/platform/android/AndroidManifest.xml.in b/platform/android/AndroidManifest.xml.in index f1ce868326..1bab8a6e70 100644 --- a/platform/android/AndroidManifest.xml.in +++ b/platform/android/AndroidManifest.xml.in @@ -275,7 +275,7 @@ - + diff --git a/platform/android/src/ch/opengis/qfield/QFieldService.java b/platform/android/src/ch/opengis/qfield/QFieldCloudService.java similarity index 90% rename from platform/android/src/ch/opengis/qfield/QFieldService.java rename to platform/android/src/ch/opengis/qfield/QFieldCloudService.java index 242c0454b6..fac429cc1a 100644 --- a/platform/android/src/ch/opengis/qfield/QFieldService.java +++ b/platform/android/src/ch/opengis/qfield/QFieldCloudService.java @@ -1,5 +1,5 @@ /** - * QFieldService.java + * QFieldCloudService.java * @author Mathieu Pellerin - * @version 0.5 */ @@ -41,7 +41,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import android.util.Log; import org.qtproject.qt.android.bindings.QtService; -public class QFieldService extends QtService { +public class QFieldCloudService extends QtService { private NotificationManager notificationManager; private NotificationChannel notificationChannel; @@ -49,15 +49,15 @@ public class QFieldService extends QtService { private final String CHANNEL_ID = "qfield_service_01"; private final int NOTIFICATION_ID = 101; - public static void startQFieldService(Context context) { - Log.v("QField Service", "Starting QFieldService"); - Intent intent = new Intent(context, QFieldService.class); + public static void startQFieldCloudService(Context context) { + Log.v("QFieldCloudService", "Starting QFieldCloudService"); + Intent intent = new Intent(context, QFieldCloudService.class); context.startService(intent); } @Override public void onCreate() { - Log.v("QField Service", "onCreate triggered"); + Log.v("QFieldCloudService", "onCreate triggered"); super.onCreate(); notificationManager = @@ -77,7 +77,7 @@ public void onCreate() { @Override public void onDestroy() { - Log.v("QField Service", "onDestroy triggered"); + Log.v("QFieldCloudService", "onDestroy triggered"); notificationManager.cancel(NOTIFICATION_ID); super.onDestroy(); } diff --git a/src/app/main.cpp b/src/app/main.cpp index 10af8eaadc..1707280156 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -24,7 +24,7 @@ #endif #if defined( Q_OS_ANDROID ) -#include "qfieldservice.h" +#include "qfieldcloudservice.h" #endif #include @@ -82,7 +82,7 @@ int main( int argc, char **argv ) #if defined( Q_OS_ANDROID ) // For now the service only deals with background attachment uploads and will terminate once all uploads are done - QFieldService app( argc, argv ); + QFieldCloudService app( argc, argv ); #endif return 0; } diff --git a/src/core/platforms/android/androidplatformutilities.cpp b/src/core/platforms/android/androidplatformutilities.cpp index 8587f0abe4..b4c87227d9 100644 --- a/src/core/platforms/android/androidplatformutilities.cpp +++ b/src/core/platforms/android/androidplatformutilities.cpp @@ -697,9 +697,9 @@ void AndroidPlatformUtilities::uploadPendingAttachments( QFieldCloudConnection * QTimer::singleShot( 500, [connection]() { if ( connection ) { - qInfo() << "Launching service from main..."; - QJniObject::callStaticMethod( "ch/opengis/" APP_PACKAGE_NAME "/QFieldService", - "startQFieldService", + qInfo() << "Launching QFieldCloud service from main..."; + QJniObject::callStaticMethod( "ch/opengis/" APP_PACKAGE_NAME "/QFieldCloudService", + "startQFieldCloudService", "(Landroid/content/Context;)V", qtAndroidContext().object() ); } diff --git a/src/service/CMakeLists.txt b/src/service/CMakeLists.txt index fe14cc1e89..4a95012d50 100644 --- a/src/service/CMakeLists.txt +++ b/src/service/CMakeLists.txt @@ -1,5 +1,5 @@ -set(QFIELD_SERVICE_SRCS qfieldservice.cpp) -set(QFIELD_SERVICE_HDRS qfieldservice.h) +set(QFIELD_SERVICE_SRCS qfieldcloudservice.cpp) +set(QFIELD_SERVICE_HDRS qfieldcloudservice.h) add_library(qfield_service STATIC ${QFIELD_SERVICE_SRCS} ${QFIELD_SERVICE_HDRS}) @@ -13,6 +13,7 @@ target_include_directories(qfield_service PUBLIC ${CMAKE_SOURCE_DIR}/src/service) target_compile_features(qfield_service PUBLIC cxx_std_17) + set_target_properties(qfield_service PROPERTIES AUTOMOC TRUE) target_link_libraries(qfield_service PRIVATE qfield_core ${QGIS_CORE_LIBRARY}) diff --git a/src/service/qfieldservice.cpp b/src/service/qfieldcloudservice.cpp similarity index 88% rename from src/service/qfieldservice.cpp rename to src/service/qfieldcloudservice.cpp index 4d54e4b710..92262b0d05 100644 --- a/src/service/qfieldservice.cpp +++ b/src/service/qfieldcloudservice.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - qfieldservice.cpp - QFieldService + qfieldcloudservice.cpp - QFieldCloudService --------------------- begin : 04.12.2022 @@ -16,11 +16,11 @@ #include "qfield_android.h" #include "qfieldcloudconnection.h" -#include "qfieldservice.h" +#include "qfieldcloudservice.h" #include -QFieldService::QFieldService( int &argc, char **argv ) +QFieldCloudService::QFieldCloudService( int &argc, char **argv ) : QAndroidService( argc, argv ) { QSettings settings; @@ -39,6 +39,6 @@ QFieldService::QFieldService( int &argc, char **argv ) exit( 0 ); } -QFieldService::~QFieldService() +QFieldCloudService::~QFieldCloudService() { } diff --git a/src/service/qfieldservice.h b/src/service/qfieldcloudservice.h similarity index 83% rename from src/service/qfieldservice.h rename to src/service/qfieldcloudservice.h index 8b5862532e..7c6d160257 100644 --- a/src/service/qfieldservice.h +++ b/src/service/qfieldcloudservice.h @@ -1,5 +1,5 @@ /*************************************************************************** - qfieldservice.h - QFieldService + qFieldcloudservice.h - QFieldCloudService --------------------- begin : 04.12.2022 @@ -19,12 +19,11 @@ #include #include -class QFIELD_SERVICE_EXPORT QFieldService : public QAndroidService +class QFIELD_SERVICE_EXPORT QFieldCloudService : public QAndroidService { Q_OBJECT public: - QFieldService( int &argc, char **argv ); - - ~QFieldService() override; + QFieldCloudService( int &argc, char **argv ); + ~QFieldCloudService() override; };