From b2a051df0723cdeec389cb9913968aa57292f01f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 6 Sep 2012 00:14:46 +0200 Subject: [PATCH] Added clear button to MSG inspector --- src/ui/QGCMAVLinkInspector.cc | 11 +++++++++-- src/ui/QGCMAVLinkInspector.h | 3 +++ src/ui/QGCMAVLinkInspector.ui | 31 +++++++++++++++++++------------ 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/ui/QGCMAVLinkInspector.cc b/src/ui/QGCMAVLinkInspector.cc index a3892d85c..c21ffa9fc 100644 --- a/src/ui/QGCMAVLinkInspector.cc +++ b/src/ui/QGCMAVLinkInspector.cc @@ -19,8 +19,8 @@ QGCMAVLinkInspector::QGCMAVLinkInspector(MAVLinkProtocol* protocol, QWidget *par ui->setupUi(this); /* Insert system */ - ui->systemComboBox->addItem(tr("All Systems"), 0); - ui->componentComboBox->addItem(tr("All Components"), 0); + ui->systemComboBox->addItem(tr("All"), 0); + ui->componentComboBox->addItem(tr("All"), 0); mavlink_message_info_t msg[256] = MAVLINK_MESSAGE_INFO; memcpy(messageInfo, msg, sizeof(mavlink_message_info_t)*256); @@ -38,6 +38,7 @@ QGCMAVLinkInspector::QGCMAVLinkInspector(MAVLinkProtocol* protocol, QWidget *par // ARM UI connect(ui->systemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectDropDownMenuSystem(int))); connect(ui->componentComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectDropDownMenuComponent(int))); + connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearView())); // ARM external connections connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addSystem(UASInterface*))); @@ -89,6 +90,12 @@ void QGCMAVLinkInspector::addComponent(int uas, int component, const QString& na rebuildComponentList(); } +void QGCMAVLinkInspector::clearView() +{ + treeWidgetItems.clear(); + ui->treeWidget->clear(); +} + void QGCMAVLinkInspector::refreshView() { for (int i = 0; i < 256; ++i)//mavlink_message_t msg, receivedMessages) diff --git a/src/ui/QGCMAVLinkInspector.h b/src/ui/QGCMAVLinkInspector.h index cf7cbe79a..1052cfd2e 100644 --- a/src/ui/QGCMAVLinkInspector.h +++ b/src/ui/QGCMAVLinkInspector.h @@ -24,6 +24,9 @@ public: public slots: void receiveMessage(LinkInterface* link,mavlink_message_t message); + /** @brief Clear all messages */ + void clearView(); + /** Update view */ void refreshView(); void addSystem(UASInterface* uas); void addComponent(int uas, int component, const QString& name); diff --git a/src/ui/QGCMAVLinkInspector.ui b/src/ui/QGCMAVLinkInspector.ui index eff2decd6..54526512c 100644 --- a/src/ui/QGCMAVLinkInspector.ui +++ b/src/ui/QGCMAVLinkInspector.ui @@ -13,19 +13,10 @@ Form - + 6 - - - - - 1 - - - - @@ -36,16 +27,32 @@ - + - + Component + + + + Clear + + + + + + + + 1 + + + + -- 2.22.0