Skip to content

Commit

Permalink
Remove obsolete #if Qt versioni checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 17, 2024
1 parent 685b57a commit 3708e44
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 236 deletions.
168 changes: 4 additions & 164 deletions src/core/platforms/android/androidplatformutilities.cpp

Large diffs are not rendered by default.

13 changes: 2 additions & 11 deletions src/core/platforms/android/androidplatformutilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@

#include "platformutilities.h"

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <QAndroidJniObject>
#else
#include <QJniObject>
#endif

class AndroidPlatformUtilities : public PlatformUtilities
{
Expand Down Expand Up @@ -93,17 +89,12 @@ class AndroidPlatformUtilities : public PlatformUtilities
bool checkAndAcquirePermissions( const QString &permissions ) const;
ResourceSource *processCameraActivity( const QString &prefix, const QString &filePath, const QString &suffix, bool isVideo, QObject *parent = nullptr );
ResourceSource *processGalleryActivity( const QString &prefix, const QString &filePath, const QString &mimeType, QObject *parent = nullptr );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
QString getIntentExtra( const QString &, QAndroidJniObject = nullptr ) const;
QAndroidJniObject getNativeIntent() const;
QAndroidJniObject getNativeExtras() const;
QAndroidJniObject mActivity;
#else

QString getIntentExtra( const QString &, QJniObject = nullptr ) const;

QJniObject getNativeIntent() const;
QJniObject getNativeExtras() const;
QJniObject mActivity;
#endif
QString mSystemGenericDataLocation;
};

Expand Down
20 changes: 1 addition & 19 deletions src/core/platforms/android/androidprojectsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,22 @@
#include "qgsmessagelog.h"

#include <QFile>

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <QtAndroid>
#else
#include <QtCore/private/qandroidextras_p.h>
#endif


AndroidProjectSource::AndroidProjectSource( QObject *parent )
: ProjectSource( parent )
, QAndroidActivityResultReceiver()
{
}

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
void AndroidProjectSource::handleActivityResult( int receiverRequestCode, int resultCode, const QAndroidJniObject &data )
#else
void AndroidProjectSource::handleActivityResult( int receiverRequestCode, int resultCode, const QJniObject &data )
#endif
{
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
jint RESULT_OK = QAndroidJniObject::getStaticField<jint>( "android/app/Activity", "RESULT_OK" );
#else
jint RESULT_OK = QJniObject::getStaticField<jint>( "android/app/Activity", "RESULT_OK" );
#endif
if ( receiverRequestCode == 103 && resultCode == RESULT_OK )
{
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
QAndroidJniObject uri = data.callObjectMethod( "getData", "()Landroid/net/Uri;" );
#else
QJniObject uri = data.callObjectMethod( "getData", "()Landroid/net/Uri;" );
#endif

QString path = uri.callObjectMethod( "getPath", "()Ljava/lang/String;" ).toString();

if ( !QFile( path ).exists() )
{
QgsMessageLog::logMessage( tr( "File %1 does not exist" ).arg( path ), QStringLiteral( "QField" ), Qgis::Warning );
Expand Down
8 changes: 0 additions & 8 deletions src/core/platforms/android/androidprojectsource.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@

#include "projectsource.h"

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <QAndroidActivityResultReceiver>
#else
#include <QtCore/private/qandroidextras_p.h>
#endif

class AndroidProjectSource : public ProjectSource, public QAndroidActivityResultReceiver
{
Expand All @@ -33,11 +29,7 @@ class AndroidProjectSource : public ProjectSource, public QAndroidActivityResult
public:
explicit AndroidProjectSource( QObject *parent = nullptr );

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
void handleActivityResult( int receiverRequestCode, int resultCode, const QAndroidJniObject &data ) override;
#else
void handleActivityResult( int receiverRequestCode, int resultCode, const QJniObject &data ) override;
#endif
};

#endif // ANDROIDPROJECTSOURCE_H
2 changes: 0 additions & 2 deletions src/core/platforms/ios/iosplatformutilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ class IosPlatformUtilities : public PlatformUtilities
double systemFontPointSize() const override { return 16.0; }
bool isSystemDarkTheme() const override;

#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 )
Qt::PermissionStatus checkCameraPermission() const override;
void requestCameraPermission( std::function<void( Qt::PermissionStatus )> func ) override;
virtual Qt::PermissionStatus checkMicrophonePermission() const override;
virtual void requestMicrophonePermission( std::function<void( Qt::PermissionStatus )> func ) override;
#endif
};

#endif
2 changes: 0 additions & 2 deletions src/core/platforms/ios/iosplatformutilities.mm
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ - (void)documentInteractionControllerDidEndPreview:
return false;
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
Qt::PermissionStatus IosPlatformUtilities::checkCameraPermission() const {
switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) {
case AVAuthorizationStatusNotDetermined: {
Expand Down Expand Up @@ -242,4 +241,3 @@ - (void)documentInteractionControllerDidEndPreview:
: Qt::PermissionStatus::Denied);
}];
}
#endif
2 changes: 1 addition & 1 deletion src/core/qgismobileapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ QgisMobileapp::QgisMobileapp( QgsApplication *app, QObject *parent )

void QgisMobileapp::initDeclarative( QQmlEngine *engine )
{
#if defined( Q_OS_ANDROID ) && QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
#if defined( Q_OS_ANDROID )
QResource::registerResource( QStringLiteral( "assets:/android_rcc_bundle.rcc" ) );
#endif
engine->addImportPath( QStringLiteral( "qrc:/qml/imports" ) );
Expand Down
25 changes: 3 additions & 22 deletions src/sentry/sentry_classic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,14 @@
#include <QtGlobal>

#include <sentry.h>
#ifdef ANDROID
#include <android/log.h>

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <QAndroidJniEnvironment>
#include <QAndroidJniObject>
#include <QtAndroid>

inline QAndroidJniObject qtAndroidContext()
{
auto result = QtAndroid::androidActivity();
if ( result.isValid() )
return result;
return QtAndroid::androidService();
}

inline void runOnAndroidMainThread( const QtAndroid::Runnable &runnable )
{
QtAndroid::runOnAndroidThread( runnable );
}

#else
#ifdef ANDROID
#include <QJniEnvironment>
#include <QJniObject>
#include <QtCore/private/qandroidextras_p.h>

#include <android/log.h>

inline QJniObject qtAndroidContext()
{
return QJniObject( QCoreApplication::instance()->nativeInterface<QNativeInterface::QAndroidApplication>()->context() );
Expand All @@ -61,7 +43,6 @@ inline void runOnAndroidMainThread( const std::function<void()> &runnable )
} );
}
#endif
#endif

namespace sentry_wrapper
{
Expand Down
7 changes: 1 addition & 6 deletions src/service/qfieldservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@

#include "qfield_service_export.h"

#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <QAndroidService>
#include <QtAndroid>
#else
#include <QtCore/private/qandroidextras_p.h>
#endif
#include <QtGlobal>

class QFIELD_SERVICE_EXPORT QFieldService : public QAndroidService
{
Expand Down
1 change: 0 additions & 1 deletion vcpkg/ports/qtquick3d/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ qt_install_submodule(PATCHES ${${PORT}_PATCHES}
TOOL_NAMES ${TOOL_NAMES}
CONFIGURE_OPTIONS
${FEATURE_OPTIONS}
-DQT_FEATURE_quick3dxr_openxr=OFF
-DCMAKE_FIND_PACKAGE_TARGETS_GLOBAL=ON
CONFIGURE_OPTIONS_RELEASE
CONFIGURE_OPTIONS_DEBUG
Expand Down

0 comments on commit 3708e44

Please sign in to comment.