From c7c59937f0fe99c093420f90dd189f91b73fb26b Mon Sep 17 00:00:00 2001 From: pixhawk Date: Fri, 28 May 2010 15:20:47 +0200 Subject: [PATCH] Added watchdog views --- qgroundcontrol.pro | 12 ++++++-- src/uas/PxQuadMAV.h | 2 +- src/ui/linechart/LinechartWidget.cc | 3 +- src/ui/uas/UASView.cc | 2 +- src/ui/watchdog/WatchdogControl.cc | 10 +++++- src/ui/watchdog/WatchdogControl.h | 2 ++ src/ui/watchdog/WatchdogProcessView.cc | 26 ++++++++++++++++ src/ui/watchdog/WatchdogProcessView.h | 23 ++++++++++++++ src/ui/watchdog/WatchdogProcessView.ui | 56 ++++++++++++++++++++++++++++++++++ src/ui/watchdog/WatchdogView.cc | 26 ++++++++++++++++ src/ui/watchdog/WatchdogView.h | 23 ++++++++++++++ src/ui/watchdog/WatchdogView.ui | 31 +++++++++++++++++++ 12 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 src/ui/watchdog/WatchdogProcessView.cc create mode 100644 src/ui/watchdog/WatchdogProcessView.h create mode 100644 src/ui/watchdog/WatchdogProcessView.ui create mode 100644 src/ui/watchdog/WatchdogView.cc create mode 100644 src/ui/watchdog/WatchdogView.h create mode 100644 src/ui/watchdog/WatchdogView.ui diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index edc1afd..ca7105b 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -50,7 +50,9 @@ FORMS += src/ui/MainWindow.ui \ src/ui/MAVLinkSettingsWidget.ui \ src/ui/AudioOutputWidget.ui \ src/ui/QGCSensorSettingsWidget.ui \ - src/ui/watchdog/WatchdogControl.ui + src/ui/watchdog/WatchdogControl.ui \ + src/ui/watchdog/WatchdogProcessView.ui \ + src/ui/watchdog/WatchdogView.ui INCLUDEPATH += src \ src/ui \ src/ui/linechart \ @@ -119,7 +121,9 @@ HEADERS += src/MG.h \ src/uas/PxQuadMAV.h \ src/uas/ArduPilotMAV.h \ src/comm/MAVLinkSyntaxHighlighter.h \ - src/ui/watchdog/WatchdogControl.h + src/ui/watchdog/WatchdogControl.h \ + src/ui/watchdog/WatchdogProcessView.h \ + src/ui/watchdog/WatchdogView.h SOURCES += src/main.cc \ src/Core.cc \ src/uas/UASManager.cc \ @@ -170,5 +174,7 @@ SOURCES += src/main.cc \ src/uas/PxQuadMAV.cc \ src/uas/ArduPilotMAV.cc \ src/comm/MAVLinkSyntaxHighlighter.cc \ - src/ui/watchdog/WatchdogControl.cc + src/ui/watchdog/WatchdogControl.cc \ + src/ui/watchdog/WatchdogProcessView.cc \ + src/ui/watchdog/WatchdogView.cc RESOURCES = mavground.qrc diff --git a/src/uas/PxQuadMAV.h b/src/uas/PxQuadMAV.h index af12ab2..65552ee 100644 --- a/src/uas/PxQuadMAV.h +++ b/src/uas/PxQuadMAV.h @@ -14,7 +14,7 @@ public slots: /** @brief Send a command to an onboard process */ void sendProcessCommand(int watchdogId, int processId, unsigned int command); signals: - void watchdogReceived(int systemId, int watchdogId, int processCount); + void watchdogReceived(int systemId, int watchdogId, unsigned int processCount); void processReceived(int systemId, int watchdogId, int processId, QString name, QString arguments, int timeout); void processChanged(int systemId, int watchdogId, int processId, int state, bool muted, int crashed, int pid); }; diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc index 5ed9ce9..ba97621 100644 --- a/src/ui/linechart/LinechartWidget.cc +++ b/src/ui/linechart/LinechartWidget.cc @@ -174,7 +174,8 @@ void LinechartWidget::createLayout() // Connect notifications from the user interface to the plot connect(this, SIGNAL(curveRemoved(QString)), activePlot, SLOT(hideCurve(QString))); - connect(this, SIGNAL(curveSet(QString, int)), activePlot, SLOT(showCurve(QString, int))); + //connect(this, SIGNAL(curveSet(QString, int)), activePlot, SLOT(showshowCurveCurve(QString, int))); + // FIXME // Connect notifications from the plot to the user interface connect(activePlot, SIGNAL(curveAdded(QString)), this, SLOT(addCurve(QString))); diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 9eb0ae9..10dbd9a 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -53,7 +53,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : m_ui->setupUi(this); // Setup communication - connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), this, SLOT(receiveValue(int,QString,double,quint64))); + //connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), this, SLOT(receiveValue(int,QString,double,quint64))); connect(uas, SIGNAL(batteryChanged(UASInterface*, double, double, int)), this, SLOT(updateBattery(UASInterface*, double, double, int))); connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); connect(uas, SIGNAL(thrustChanged(UASInterface*, double)), this, SLOT(updateThrust(UASInterface*, double))); diff --git a/src/ui/watchdog/WatchdogControl.cc b/src/ui/watchdog/WatchdogControl.cc index 2085448..12655dc 100644 --- a/src/ui/watchdog/WatchdogControl.cc +++ b/src/ui/watchdog/WatchdogControl.cc @@ -12,6 +12,14 @@ WatchdogControl::WatchdogControl(QWidget *parent) : ui(new Ui::WatchdogControl) { ui->setupUi(this); + + // UI is initialized, setup layout + listLayout = new QVBoxLayout(m_ui->listWidget); + listLayout->setSpacing(6); + listLayout->setMargin(0); + listLayout->setAlignment(Qt::AlignTop); + m_ui->listWidget->setLayout(listLayout); + connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(setUAS(UASInterface*))); } @@ -27,7 +35,7 @@ void WatchdogControl::setUAS(UASInterface* uas) if (qmav) { connect(qmav, SIGNAL(processReceived(int,int,int,QString,QString,int)), this, SLOT(addProcess(int,int,int,QString,QString,int))); - connect(qmav, SIGNAL(watchdogReceived(int,int,int)), this, SLOT(updateWatchdog(int,int,uint))); + connect(qmav, SIGNAL(watchdogReceived(int,int,uint)), this, SLOT(updateWatchdog(int,int,uint))); connect(qmav, SIGNAL(processChanged(int,int,int,int,bool,int,int)), this, SLOT(updateProcess(int,int,int,int,bool,int,int))); } } diff --git a/src/ui/watchdog/WatchdogControl.h b/src/ui/watchdog/WatchdogControl.h index 543f0f1..0559d6b 100644 --- a/src/ui/watchdog/WatchdogControl.h +++ b/src/ui/watchdog/WatchdogControl.h @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -114,6 +115,7 @@ protected: void changeEvent(QEvent *e); UASInterface* mav; + QHBoxLayout* mainWidgetLayout; private: Ui::WatchdogControl *ui; diff --git a/src/ui/watchdog/WatchdogProcessView.cc b/src/ui/watchdog/WatchdogProcessView.cc new file mode 100644 index 0000000..37d22f4 --- /dev/null +++ b/src/ui/watchdog/WatchdogProcessView.cc @@ -0,0 +1,26 @@ +#include "WatchdogProcessView.h" +#include "ui_WatchdogProcessView.h" + +WatchdogProcessView::WatchdogProcessView(QWidget *parent) : + QWidget(parent), + m_ui(new Ui::WatchdogProcessView) +{ + m_ui->setupUi(this); +} + +WatchdogProcessView::~WatchdogProcessView() +{ + delete m_ui; +} + +void WatchdogProcessView::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + m_ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/ui/watchdog/WatchdogProcessView.h b/src/ui/watchdog/WatchdogProcessView.h new file mode 100644 index 0000000..6d0bec3 --- /dev/null +++ b/src/ui/watchdog/WatchdogProcessView.h @@ -0,0 +1,23 @@ +#ifndef WATCHDOGPROCESSVIEW_H +#define WATCHDOGPROCESSVIEW_H + +#include + +namespace Ui { + class WatchdogProcessView; +} + +class WatchdogProcessView : public QWidget { + Q_OBJECT +public: + WatchdogProcessView(QWidget *parent = 0); + ~WatchdogProcessView(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::WatchdogProcessView *m_ui; +}; + +#endif // WATCHDOGPROCESSVIEW_H diff --git a/src/ui/watchdog/WatchdogProcessView.ui b/src/ui/watchdog/WatchdogProcessView.ui new file mode 100644 index 0000000..ac883b4 --- /dev/null +++ b/src/ui/watchdog/WatchdogProcessView.ui @@ -0,0 +1,56 @@ + + + WatchdogProcessView + + + + 0 + 0 + 400 + 44 + + + + Form + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + ... + + + + + + + ... + + + + + + + + diff --git a/src/ui/watchdog/WatchdogView.cc b/src/ui/watchdog/WatchdogView.cc new file mode 100644 index 0000000..28f8a54 --- /dev/null +++ b/src/ui/watchdog/WatchdogView.cc @@ -0,0 +1,26 @@ +#include "WatchdogView.h" +#include "ui_WatchdogView.h" + +WatchdogView::WatchdogView(QWidget *parent) : + QWidget(parent), + m_ui(new Ui::WatchdogView) +{ + m_ui->setupUi(this); +} + +WatchdogView::~WatchdogView() +{ + delete m_ui; +} + +void WatchdogView::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + m_ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/ui/watchdog/WatchdogView.h b/src/ui/watchdog/WatchdogView.h new file mode 100644 index 0000000..fd1203f --- /dev/null +++ b/src/ui/watchdog/WatchdogView.h @@ -0,0 +1,23 @@ +#ifndef WATCHDOGVIEW_H +#define WATCHDOGVIEW_H + +#include + +namespace Ui { + class WatchdogView; +} + +class WatchdogView : public QWidget { + Q_OBJECT +public: + WatchdogView(QWidget *parent = 0); + ~WatchdogView(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::WatchdogView *m_ui; +}; + +#endif // WATCHDOGVIEW_H diff --git a/src/ui/watchdog/WatchdogView.ui b/src/ui/watchdog/WatchdogView.ui new file mode 100644 index 0000000..fed4dff --- /dev/null +++ b/src/ui/watchdog/WatchdogView.ui @@ -0,0 +1,31 @@ + + + WatchdogView + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Watchdog + + + + + + + + + + +