From 20bf53f5520c67e882756d38adf0c364ccb51dd4 Mon Sep 17 00:00:00 2001
From: Gus Grubba <gus@auterion.com>
Date: Thu, 22 Aug 2019 23:22:29 -0400
Subject: [PATCH] Remove unused pairing settings

---
 custom-example/src/CustomPlugin.cc     |   3 -
 qgroundcontrol.qrc                     |   3 +-
 src/PairingManager/PairingSettings.qml | 121 ---------------------------------
 src/api/QGCCorePlugin.cc               |  13 ----
 4 files changed, 1 insertion(+), 139 deletions(-)
 delete mode 100644 src/PairingManager/PairingSettings.qml

diff --git a/custom-example/src/CustomPlugin.cc b/custom-example/src/CustomPlugin.cc
index 5136de9..9008f93 100644
--- a/custom-example/src/CustomPlugin.cc
+++ b/custom-example/src/CustomPlugin.cc
@@ -136,9 +136,6 @@ CustomPlugin::settingsPages()
     if(_customSettingsList.isEmpty()) {
         addSettingsEntry(tr("General"),     "qrc:/qml/GeneralSettings.qml", "qrc:/res/gear-white.svg");
         addSettingsEntry(tr("Comm Links"),  "qrc:/qml/LinkSettings.qml",    "qrc:/res/waves.svg");
-#if defined(QGC_ENABLE_PAIRING)
-        addSettingsEntry(tr("Pairing"),     "qrc:/qml/PairingSettings.qml", "qrc:/res/waves.svg");
-#endif
         addSettingsEntry(tr("Offline Maps"),"qrc:/qml/OfflineMap.qml",      "qrc:/res/waves.svg");
 #if defined(QGC_GST_MICROHARD_ENABLED)
         addSettingsEntry(tr("Microhard"),   "qrc:/qml/MicrohardSettings.qml");
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 92a5aea..b1bc3f5 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -6,7 +6,6 @@
         <file alias="ArmedIndicator.qml">src/ui/toolbar/ArmedIndicator.qml</file>
         <file alias="BatteryIndicator.qml">src/ui/toolbar/BatteryIndicator.qml</file>
         <file alias="GPSIndicator.qml">src/ui/toolbar/GPSIndicator.qml</file>
-        <file alias="PairingIndicator.qml">src/ui/toolbar/PairingIndicator.qml</file>
         <file alias="GPSRTKIndicator.qml">src/ui/toolbar/GPSRTKIndicator.qml</file>
         <file alias="JoystickIndicator.qml">src/ui/toolbar/JoystickIndicator.qml</file>
         <file alias="LinkIndicator.qml">src/ui/toolbar/LinkIndicator.qml</file>
@@ -15,6 +14,7 @@
         <file alias="MessageIndicator.qml">src/ui/toolbar/MessageIndicator.qml</file>
         <file alias="ModeIndicator.qml">src/ui/toolbar/ModeIndicator.qml</file>
         <file alias="MultiVehicleSelector.qml">src/ui/toolbar/MultiVehicleSelector.qml</file>
+        <file alias="PairingIndicator.qml">src/ui/toolbar/PairingIndicator.qml</file>
         <file alias="RCRSSIIndicator.qml">src/ui/toolbar/RCRSSIIndicator.qml</file>
         <file alias="TelemetryRSSIIndicator.qml">src/ui/toolbar/TelemetryRSSIIndicator.qml</file>
         <file alias="VTOLModeIndicator.qml">src/ui/toolbar/VTOLModeIndicator.qml</file>
@@ -56,7 +56,6 @@
         <file alias="MockLinkSettings.qml">src/ui/preferences/MockLinkSettings.qml</file>
         <file alias="MotorComponent.qml">src/AutoPilotPlugins/Common/MotorComponent.qml</file>
         <file alias="OfflineMap.qml">src/QtLocationPlugin/QMLControl/OfflineMap.qml</file>
-        <file alias="PairingSettings.qml">src/PairingManager/PairingSettings.qml</file>
         <file alias="PlanToolBar.qml">src/PlanView/PlanToolBar.qml</file>
         <file alias="PlanToolBarIndicators.qml">src/PlanView/PlanToolBarIndicators.qml</file>
         <file alias="PlanView.qml">src/PlanView/PlanView.qml</file>
diff --git a/src/PairingManager/PairingSettings.qml b/src/PairingManager/PairingSettings.qml
deleted file mode 100644
index b6dd12f..0000000
--- a/src/PairingManager/PairingSettings.qml
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
- *
- *   (c) 2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
- *
- * QGroundControl is licensed according to the terms in the file
- * COPYING.md in the root of the source code directory.
- *
- ****************************************************************************/
-
-
-import QtGraphicalEffects       1.0
-import QtMultimedia             5.5
-import QtQuick                  2.3
-import QtQuick.Controls         1.2
-import QtQuick.Controls.Styles  1.4
-import QtQuick.Dialogs          1.2
-import QtQuick.Layouts          1.2
-import QtLocation               5.3
-import QtPositioning            5.3
-
-import QGroundControl                       1.0
-import QGroundControl.Controllers           1.0
-import QGroundControl.Controls              1.0
-import QGroundControl.FactControls          1.0
-import QGroundControl.FactSystem            1.0
-import QGroundControl.Palette               1.0
-import QGroundControl.ScreenTools           1.0
-import QGroundControl.SettingsManager       1.0
-
-Rectangle {
-    id:                 _root
-    color:              qgcPal.window
-    anchors.fill:       parent
-    anchors.margins:    ScreenTools.defaultFontPixelWidth
-
-    property real _labelWidth:                  ScreenTools.defaultFontPixelWidth * 26
-    property real _valueWidth:                  ScreenTools.defaultFontPixelWidth * 20
-    property real _panelWidth:                  _root.width * _internalWidthRatio
-
-    readonly property real _internalWidthRatio:          0.8
-
-    ExclusiveGroup { id: pairingLinkGroup }
-
-    QGCFlickable {
-        clip:               true
-        anchors.fill:       parent
-        contentHeight:      settingsColumn.height
-        contentWidth:       settingsColumn.width
-        Column {
-            id:                 settingsColumn
-            width:              _root.width
-            spacing:            ScreenTools.defaultFontPixelHeight * 0.5
-            anchors.margins:    ScreenTools.defaultFontPixelWidth
-            Item {
-                width:                      _panelWidth
-                height:                     generalLabel.height
-                anchors.margins:            ScreenTools.defaultFontPixelWidth
-                anchors.horizontalCenter:   parent.horizontalCenter
-                QGCLabel {
-                    id:             pairingMethodsLabel
-                    text:           qsTr("Pairing methods:")
-                    font.family:    ScreenTools.demiboldFontFamily
-                }
-            }
-            Repeater {
-                id: repeater
-                model: QGroundControl.pairingManager.pairingLinkTypeStrings
-                anchors.horizontalCenter:   parent.horizontalCenter
-                delegate: QGCButton {
-                    width:                      _root.width * 0.2
-                    text:                       modelData
-                    exclusiveGroup:             pairingLinkGroup
-                    anchors.horizontalCenter:   settingsColumn.horizontalCenter
-                    onClicked: {
-                        checked = true
-                        if (index === QGroundControl.pairingManager.nfcIndex) {
-                            QGroundControl.pairingManager.startNFCScan();
-                        } else if (index === QGroundControl.pairingManager.microhardIndex) {
-                            QGroundControl.pairingManager.startMicrohardPairing();
-                        }
-                    }
-                }
-            }
-            Item {
-                width:                      _panelWidth
-                height:                     generalLabel.height
-                anchors.margins:            ScreenTools.defaultFontPixelWidth
-                anchors.horizontalCenter:   settingsColumn.horizontalCenter
-                QGCLabel {
-                    id:             generalLabel
-                    text:           QGroundControl.pairingManager.pairingStatusStr
-                    font.family:    ScreenTools.demiboldFontFamily
-                }
-            }
-            Item {
-                width:                      _panelWidth
-                height:                     generalLabel.height
-                anchors.margins:            ScreenTools.defaultFontPixelWidth
-                anchors.horizontalCenter:   settingsColumn.horizontalCenter
-                QGCLabel {
-                    id:             pairingsLabel
-                    text:           qsTr("Paired UAVs:")
-                    font.family:    ScreenTools.demiboldFontFamily
-                }
-            }
-            Repeater {
-                model: QGroundControl.pairingManager.pairedDeviceNameList
-                delegate: QGCButton {
-                    text:   modelData
-                    width:  _root.width * 0.3
-                    anchors.horizontalCenter:   parent.horizontalCenter
-                    exclusiveGroup: pairingLinkGroup
-                    onClicked: {
-                        checked = true
-                        QGroundControl.pairingManager.connectToPairedDevice(text)
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc
index d97504d..9da47e2 100644
--- a/src/api/QGCCorePlugin.cc
+++ b/src/api/QGCCorePlugin.cc
@@ -42,10 +42,6 @@ public:
             delete pCommLinks;
         if(pOfflineMaps)
             delete pOfflineMaps;
-#if defined(QGC_ENABLE_PAIRING)
-        if(pPairing)
-            delete pPairing;
-#endif
 #if defined(QGC_GST_TAISYNC_ENABLED)
         if(pTaisync)
             delete pTaisync;
@@ -76,9 +72,6 @@ public:
 
     QmlComponentInfo* pGeneral                  = nullptr;
     QmlComponentInfo* pCommLinks                = nullptr;
-#if defined(QGC_ENABLE_PAIRING)
-    QmlComponentInfo* pPairing                  = nullptr;
-#endif
     QmlComponentInfo* pOfflineMaps              = nullptr;
 #if defined(QGC_GST_TAISYNC_ENABLED)
     QmlComponentInfo* pTaisync                  = nullptr;
@@ -225,12 +218,6 @@ QVariantList &QGCCorePlugin::settingsPages()
             QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"),
             QUrl::fromUserInput("qrc:/res/waves.svg"));
         _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pCommLinks)));
-#if defined(QGC_ENABLE_PAIRING)
-        _p->pPairing = new QmlComponentInfo(tr("Pairing"),
-            QUrl::fromUserInput("qrc:/qml/PairingSettings.qml"),
-            QUrl::fromUserInput(""));
-        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pPairing)));
-#endif
         _p->pOfflineMaps = new QmlComponentInfo(tr("Offline Maps"),
             QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
             QUrl::fromUserInput("qrc:/res/waves.svg"));