Skip to content

Commit

Permalink
Rename QFieldService to QFieldCloudService
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 21, 2024
1 parent 23be1f7 commit b4b9c0f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion platform/android/AndroidManifest.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
<meta-data android:name="io.sentry.environment" android:value="@SENTRY_ENV@" />
<meta-data android:name="io.sentry.auto-init" android:value="false" />

<service android:process=":qt" android:name="ch.opengis.@APP_PACKAGE_NAME@.QFieldService">
<service android:process=":qt" android:name="ch.opengis.@APP_PACKAGE_NAME@.QFieldCloudService">
<meta-data android:name="android.app.arguments" android:value="--service"/>
<meta-data android:name="android.app.lib_name" android:value="@string/lib_name"/>
<meta-data android:name="android.app.repository" android:value="default"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* QFieldService.java
* QFieldCloudService.java
* @author Mathieu Pellerin - <mathieu@opengis.ch>
* @version 0.5
*/
Expand Down Expand Up @@ -41,23 +41,23 @@ 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;

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 =
Expand All @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#endif

#if defined( Q_OS_ANDROID )
#include "qfieldservice.h"
#include "qfieldcloudservice.h"
#endif

#include <qgsapplication.h>
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/platforms/android/androidplatformutilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,9 @@ void AndroidPlatformUtilities::uploadPendingAttachments( QFieldCloudConnection *
QTimer::singleShot( 500, [connection]() {
if ( connection )
{
qInfo() << "Launching service from main...";
QJniObject::callStaticMethod<void>( "ch/opengis/" APP_PACKAGE_NAME "/QFieldService",
"startQFieldService",
qInfo() << "Launching QFieldCloud service from main...";
QJniObject::callStaticMethod<void>( "ch/opengis/" APP_PACKAGE_NAME "/QFieldCloudService",
"startQFieldCloudService",
"(Landroid/content/Context;)V",
qtAndroidContext().object() );
}
Expand Down
5 changes: 3 additions & 2 deletions src/service/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})

Expand All @@ -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})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
qfieldservice.cpp - QFieldService
qfieldcloudservice.cpp - QFieldCloudService
---------------------
begin : 04.12.2022
Expand All @@ -16,11 +16,11 @@

#include "qfield_android.h"
#include "qfieldcloudconnection.h"
#include "qfieldservice.h"
#include "qfieldcloudservice.h"

#include <QSettings>

QFieldService::QFieldService( int &argc, char **argv )
QFieldCloudService::QFieldCloudService( int &argc, char **argv )
: QAndroidService( argc, argv )
{
QSettings settings;
Expand All @@ -39,6 +39,6 @@ QFieldService::QFieldService( int &argc, char **argv )
exit( 0 );
}

QFieldService::~QFieldService()
QFieldCloudService::~QFieldCloudService()
{
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
qfieldservice.h - QFieldService
qFieldcloudservice.h - QFieldCloudService
---------------------
begin : 04.12.2022
Expand All @@ -19,12 +19,11 @@
#include <QtCore/private/qandroidextras_p.h>
#include <QtGlobal>

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;
};

0 comments on commit b4b9c0f

Please sign in to comment.