From 61825e575655e9a782fe1da1979a9994e45bb3df Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 2 Jan 2023 15:47:24 +0000 Subject: [PATCH] Make WebEngine support in Map optional for Android --- plugins/feature/map/CMakeLists.txt | 18 +- plugins/feature/map/mapgui.h | 8 +- plugins/feature/map/mapguinowebengine.ui | 414 ++++++++++++++++++ .../map/{mapgui.ui => mapguiwebengine.ui} | 0 plugins/feature/map/mapsettingsdialog.cpp | 10 + 5 files changed, 446 insertions(+), 4 deletions(-) create mode 100644 plugins/feature/map/mapguinowebengine.ui rename plugins/feature/map/{mapgui.ui => mapguiwebengine.ui} (100%) diff --git a/plugins/feature/map/CMakeLists.txt b/plugins/feature/map/CMakeLists.txt index 8d4e51f92..e2dc77c5b 100644 --- a/plugins/feature/map/CMakeLists.txt +++ b/plugins/feature/map/CMakeLists.txt @@ -22,6 +22,15 @@ set(map_HEADERS webserver.h ) +set(Qt${QT_DEFAULT_MAJOR_VERSION}WebEngine_FOUND FALSE) +if(Qt${QT_DEFAULT_MAJOR_VERSION}WebEngine_FOUND) + add_compile_definitions(QT_WEBENGINE_FOUND) + configure_file(mapguiwebengine.ui mapgui.ui) +else() + configure_file(mapguinowebengine.ui mapgui.ui) +endif() +set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_BINARY_DIR}) + include_directories( ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ${Qt${QT_DEFAULT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS} @@ -31,7 +40,7 @@ if(NOT SERVER_MODE) set(map_SOURCES ${map_SOURCES} mapgui.cpp - mapgui.ui + ${CMAKE_CURRENT_BINARY_DIR}/mapgui.ui maplocationdialog.cpp maplocationdialog.ui mapmaidenheaddialog.cpp @@ -70,9 +79,14 @@ if(NOT SERVER_MODE) ) set(TARGET_NAME map) - set(TARGET_LIB "Qt::Widgets" Qt::Quick Qt::QuickWidgets Qt::Positioning Qt::Location Qt::WebEngine Qt::WebEngineCore Qt::WebEngineWidgets) set(TARGET_LIB_GUI "sdrgui") set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR}) + + if(Qt${QT_DEFAULT_MAJOR_VERSION}WebEngine_FOUND) + set(TARGET_LIB "Qt::Widgets" Qt::Quick Qt::QuickWidgets Qt::Positioning Qt::Location Qt::WebEngine Qt::WebEngineCore Qt::WebEngineWidgets) + else() + set(TARGET_LIB "Qt::Widgets" Qt::Quick Qt::QuickWidgets Qt::Positioning Qt::Location) + endif() else() set(TARGET_NAME mapsrv) set(TARGET_LIB "") diff --git a/plugins/feature/map/mapgui.h b/plugins/feature/map/mapgui.h index a6dfd005e..2e8a4c3fe 100644 --- a/plugins/feature/map/mapgui.h +++ b/plugins/feature/map/mapgui.h @@ -22,7 +22,9 @@ #include #include #include +#ifdef QT_WEBENGINE_FOUND #include +#endif #include #include @@ -227,9 +229,11 @@ private slots: void on_ibpBeacons_clicked(); void on_radiotime_clicked(); void receivedCesiumEvent(const QJsonObject &obj); - virtual void showEvent(QShowEvent *event); - virtual bool eventFilter(QObject *obj, QEvent *event); + virtual void showEvent(QShowEvent *event) override; + virtual bool eventFilter(QObject *obj, QEvent *event) override; +#ifdef QT_WEBENGINE_FOUND void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); +#endif void preferenceChanged(int elementType); void giroDataUpdated(const GIRO::GIROStationData& data); void mufUpdated(const QJsonDocument& document); diff --git a/plugins/feature/map/mapguinowebengine.ui b/plugins/feature/map/mapguinowebengine.ui new file mode 100644 index 000000000..93377861c --- /dev/null +++ b/plugins/feature/map/mapguinowebengine.ui @@ -0,0 +1,414 @@ + + + MapGUI + + + + 0 + 0 + 491 + 507 + + + + + 0 + 0 + + + + + 400 + 0 + + + + + Liberation Sans + 9 + + + + Qt::StrongFocus + + + Map + + + + + 0 + 0 + 480 + 41 + + + + + 400 + 0 + + + + Settings + + + + 3 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + Find + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + Enter name of object to find, latitude and longitude, Maidenhead locator or an address + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + Select type of map to display + + + + + + + Maidenhead locator conversion + + + + + + + :/mem.png:/mem.png + + + + + + + Display Beacon dialog + + + + + + + :/antenna.png:/antenna.png + + + + + + + Display IBP Beacon dialog + + + IBP + + + + :/map/icons/ibp.png:/map/icons/ibp.png + + + + + + + Display radio time transmitters dialog + + + + + + + :/map/icons/clock.png:/map/icons/clock.png + + + + + + + Display MUF contours + + + ^ + + + + :/map/icons/muf.png:/map/icons/muf.png + + + true + + + true + + + + + + + Display foF2 contours + + + ^ + + + + :/map/icons/fof2.png:/map/icons/fof2.png + + + true + + + true + + + + + + + Display names + + + ^ + + + + :/info.png:/info.png + + + true + + + true + + + + + + + Display ground tracks for selected item + + + ^ + + + + :/logarithmic.png:/logarithmic.png + + + true + + + true + + + + + + + Display all ground tracks + + + ^ + + + + :/map/icons/groundtracks.png:/map/icons/groundtracks.png + + + true + + + true + + + + + + + Delete all items on the map + + + + + + + :/bin.png:/bin.png + + + + + + + Show settings dialog + + + + + + + :/listing.png:/listing.png + + + + + + + + + + + 0 + 60 + 483 + 223 + + + + + 0 + 0 + + + + Map + + + + 3 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Qt::Vertical + + + + + 0 + 0 + + + + + 100 + 100 + + + + Map + + + QQuickWidget::SizeRootObjectToView + + + + + + + + + + + + + + + QQuickWidget + QWidget +
QtQuickWidgets/QQuickWidget
+
+ + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
+ + RollupContents + QWidget +
gui/rollupcontents.h
+ 1 +
+
+ + find + mapTypes + maidenhead + beacons + displayNames + deleteAll + displaySettings + map + + + + + + +
diff --git a/plugins/feature/map/mapgui.ui b/plugins/feature/map/mapguiwebengine.ui similarity index 100% rename from plugins/feature/map/mapgui.ui rename to plugins/feature/map/mapguiwebengine.ui diff --git a/plugins/feature/map/mapsettingsdialog.cpp b/plugins/feature/map/mapsettingsdialog.cpp index 4d81b0f2c..859cc176a 100644 --- a/plugins/feature/map/mapsettingsdialog.cpp +++ b/plugins/feature/map/mapsettingsdialog.cpp @@ -172,6 +172,16 @@ MapSettingsDialog::MapSettingsDialog(MapSettings *settings, QWidget* parent) : on_map3DEnabled_clicked(m_settings->m_map3DEnabled); connect(&m_dlm, &HttpDownloadManagerGUI::downloadComplete, this, &MapSettingsDialog::downloadComplete); +#ifndef QT_WEBENGINE_FOUND + ui->map3DSettings->setVisible(false); + ui->downloadModels->setVisible(false); + ui->mapItemSettings->hideColumn(COL_3D_MODEL); + ui->mapItemSettings->hideColumn(COL_3D_MIN_PIXELS); + ui->mapItemSettings->hideColumn(COL_3D_LABEL); + ui->mapItemSettings->hideColumn(COL_3D_POINT); + ui->mapItemSettings->hideColumn(COL_3D_TRACK); + ui->mapItemSettings->hideColumn(COL_3D_LABEL_SCALE); +#endif } MapSettingsDialog::~MapSettingsDialog()