diff --git a/DroneTrackingPanel.qml b/DroneTrackingPanel.qml index ca37493..d4cc0ae 100644 --- a/DroneTrackingPanel.qml +++ b/DroneTrackingPanel.qml @@ -2,6 +2,8 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 import "qrc:/gcsStyle" as GcsStyle +import "./components" +import "./components" as Components /* Welcome to the wild west.... @@ -277,6 +279,7 @@ Rectangle { } ColumnLayout { + Layout.fillWidth: true Layout.alignment: Qt.AlignLeft Layout.leftMargin: GcsStyle.PanelStyle.defaultMargin spacing: 2 @@ -285,6 +288,8 @@ Rectangle { text: modelData.name color: GcsStyle.PanelStyle.textPrimaryColor font.pixelSize: GcsStyle.PanelStyle.fontSizeMedium + Layout.fillWidth: true + elide: Text.ElideRight font.family: GcsStyle.PanelStyle.fontFamily } Text { @@ -295,7 +300,7 @@ Rectangle { font.family: GcsStyle.PanelStyle.fontFamily } } - + Item { Layout.fillWidth: true } // spacer to push // items to right and column layout to left diff --git a/MapController.cpp b/MapController.cpp index be3946f..f992f5d 100644 --- a/MapController.cpp +++ b/MapController.cpp @@ -14,65 +14,8 @@ MapController::MapController(QObject *parent) : QObject(parent), m_currentMapType(0), m_supportedMapTypesCount(3) { - // Populate with dummy drone objects for testing icon markers using setLattitude and setLongitude - DroneClass* drone1 = new DroneClass(this); - drone1->setName("Drone 1"); - drone1->setLatitude(34.059174611493965); - drone1->setLongitude(-117.82051240067321); - addDrone(drone1); - - DroneClass* drone2 = new DroneClass(this); - drone2->setName("Drone 2"); - drone2->setLatitude(34.0600); - drone2->setLongitude(-117.8210); - addDrone(drone2); - - DroneClass* drone3 = new DroneClass(this); - drone3->setName("Drone 3"); - drone3->setLatitude(34.0615); - drone3->setLongitude(-117.8225); - addDrone(drone3); - - DroneClass* drone4 = new DroneClass(this); - drone4->setName("Drone 4"); - drone4->setLatitude(37.7749); - drone4->setLongitude(-122.4194); - addDrone(drone4); - - DroneClass* drone5 = new DroneClass(this); - drone5->setName("Drone 5"); - drone5->setLatitude(34.0119); - drone5->setLongitude(-118.4916); - addDrone(drone5); } -void MapController::addDrone(DroneClass* drone) -{ - if (drone) { - m_drones.append(drone); - } -} - -QVariantList MapController::getAllDrones() const -{ - QVariantList droneList; - for (const DroneClass* drone : m_drones) { - QVariantMap droneData; - droneData["name"] = drone->getName(); - droneData["latitude"] = drone->getLatitude(); - droneData["longitude"] = drone->getLongitude(); - droneList.append(droneData); - } - return droneList; -} - -void MapController::createDrone(const QString &input_name){ - DroneClass* temp = new DroneClass(this); - temp->setName(input_name); - temp->setLatitude(34.06152); - temp->setLongitude(-117.82254); - addDrone(temp); -} void MapController::setCenterPosition(const QVariant &lat, const QVariant &lon) { diff --git a/MapController.h b/MapController.h index 7372b50..6aa347e 100644 --- a/MapController.h +++ b/MapController.h @@ -25,17 +25,12 @@ class MapController : public QObject public: explicit MapController(QObject *parent = nullptr); - // Q_INVOKABLE void debugPrintDrones() const; - Q_INVOKABLE void createDrone(const QString &input_name); - public slots: void setCenterPosition(const QVariant &lat, const QVariant &lon); void setLocationMarking(const QVariant &lat, const QVariant &lon); void changeMapType(int typeIndex); void setZoomLevel(double level); - Q_INVOKABLE void addDrone(DroneClass* drone); - Q_INVOKABLE QVariantList getAllDrones() const; signals: void centerPositionChanged(const QVariant &lat, const QVariant &lon); void locationMarked(const QVariant &lat, const QVariant &lon); @@ -52,4 +47,4 @@ public slots: void updateCenter(const QPair ¢er); void addMarker(const QPair &position); -}; +}; \ No newline at end of file diff --git a/QtMap.qrc b/QtMap.qrc index 3380816..0cd04e6 100644 --- a/QtMap.qrc +++ b/QtMap.qrc @@ -8,10 +8,8 @@ DroneTrackingPanel.qml DroneMenuBar.qml manageDroneWindow.qml - armWindow.qml coordinateNavigationWindow.qml goHomeLandingWindow.qml - takeOffWindow.qml DroneLabelComponent.qml TelemetryPanel.qml components/MenuButton.qml @@ -46,4 +44,4 @@ panelStyle.qml qmldir - + \ No newline at end of file diff --git a/armWindow.qml b/armWindow.qml deleted file mode 100644 index 2f89ce6..0000000 --- a/armWindow.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Controls 2.15 -import "qrc:/gcsStyle" as GcsStyle - - -Window { - - id: armWindow - width: 400 - height: 300 - title: qsTr("ARM Command") - property color panelColor: "green" - - - Rectangle { - id: armBackground - anchors.fill: parent - color: panelColor - - // A temporary button that logs a message when clicked - Button { - id: armButton - text: qsTr("ARM") - anchors.centerIn: parent - onClicked: { - // TEMP: hardcode a target; replace with your real XBee address or ID later - const target = "11062025" // the custom SITL drone - const ok = droneController.sendArm(target, true) // true = arm, false = disarm - console.log("ARM ->", target, ok) - armWindow.close() - } - } - } -} diff --git a/takeOffWindow.qml b/takeOffWindow.qml deleted file mode 100644 index d555c26..0000000 --- a/takeOffWindow.qml +++ /dev/null @@ -1,31 +0,0 @@ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Controls 2.15 -import "qrc:/gcsStyle" as GcsStyle - -Window { - id: takeOffWindow - width: 400 - height: 300 - title: qsTr("Take-off Command") - - Rectangle { - id: takeOffBackground - anchors.fill: parent - color: GcsStyle.PanelStyle.primaryColor - - // A temporary button that logs a message when clicked - Button { - id: takeOffButton - text: qsTr("Takeoff") - anchors.centerIn: parent - onClicked: { - // TEMP: hardcode a target; replace with your real XBee address or ID later - const target = "11062025" // the custom SITL drone - const ok = droneController.sendTakeoffCmd(target) // true = arm, false = disarm - console.log("TAKEOFF ->", target, ok) - takeOffWindow.close() - } - } - } -}