Browse Source

HIL config improvements, fixed confusion about which dock widget is part of which view, main window behaving now

QGC4.4
Lorenz Meier 12 years ago
parent
commit
42de6b7cb1
  1. 3
      src/comm/QGCHilLink.h
  2. 2
      src/comm/QGCXPlaneLink.cc
  3. 2
      src/configuration.h
  4. 3
      src/ui/HSIDisplay.cc
  5. 86
      src/ui/MainWindow.cc
  6. 4
      src/ui/MainWindow.h
  7. 9
      src/ui/QGCHilConfiguration.cc
  8. 1
      src/ui/QGCHilConfiguration.h
  9. 7
      src/ui/QGCHilXPlaneConfiguration.cc
  10. 2
      src/ui/QGCHilXPlaneConfiguration.h
  11. 6
      src/ui/QGCHilXPlaneConfiguration.ui

3
src/comm/QGCHilLink.h

@ -114,6 +114,9 @@ signals: @@ -114,6 +114,9 @@ signals:
/** @brief Selected sim version changed */
void versionChanged(const QString& version);
/** @brief Selected sim version changed */
void versionChanged(const int version);
/** @brief Sensor leve HIL state changed */
void sensorHilChanged(bool enabled);
};

2
src/comm/QGCXPlaneLink.cc

@ -54,7 +54,7 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress @@ -54,7 +54,7 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress
simUpdateLast(QGC::groundTimeMilliseconds()),
simUpdateLastText(QGC::groundTimeMilliseconds()),
simUpdateHz(0),
_sensorHilEnabled(true)
_sensorHilEnabled(false)
{
this->localHost = localHost;
this->localPort = localPort/*+mav->getUASID()*/;

2
src/configuration.h

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION "v. 1.0.9 (beta)"
#define QGC_APPLICATION_VERSION "v. 1.0.7 (beta)"
namespace QGC

3
src/ui/HSIDisplay.cc

@ -854,6 +854,9 @@ void HSIDisplay::setMetricWidth(double width) @@ -854,6 +854,9 @@ void HSIDisplay::setMetricWidth(double width)
*/
void HSIDisplay::setActiveUAS(UASInterface* uas)
{
if (!uas)
return;
if (this->uas != NULL) {
disconnect(this->uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool)));
disconnect(this->uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64)));

86
src/ui/MainWindow.cc

@ -399,7 +399,7 @@ void MainWindow::buildCustomWidget() @@ -399,7 +399,7 @@ void MainWindow::buildCustomWidget()
switch (view)
{
case VIEW_ENGINEER:
dock = createDockWidget(dataView,tool,tool->getTitle(),tool->objectName(),(VIEW_SECTIONS)view,location);
dock = createDockWidget(engineeringView,tool,tool->getTitle(),tool->objectName(),(VIEW_SECTIONS)view,location);
break;
case VIEW_FLIGHT:
dock = createDockWidget(pilotView,tool,tool->getTitle(),tool->objectName(),(VIEW_SECTIONS)view,location);
@ -410,6 +410,9 @@ void MainWindow::buildCustomWidget() @@ -410,6 +410,9 @@ void MainWindow::buildCustomWidget()
case VIEW_MISSION:
dock = createDockWidget(plannerView,tool,tool->getTitle(),tool->objectName(),(VIEW_SECTIONS)view,location);
break;
case VIEW_MAVLINK:
dock = createDockWidget(mavlinkView,tool,tool->getTitle(),tool->objectName(),(VIEW_SECTIONS)view,location);
break;
default:
dock = createDockWidget(centerStack->currentWidget(),tool,tool->getTitle(),tool->objectName(),(VIEW_SECTIONS)view,location);
break;
@ -469,15 +472,15 @@ void MainWindow::buildCommonWidgets() @@ -469,15 +472,15 @@ void MainWindow::buildCommonWidgets()
{
engineeringView = new SubMainWindow(this);
engineeringView->setObjectName("VIEW_ENGINEER");
engineeringView->setCentralWidget(new XMLCommProtocolWidget(this));
addCentralWidget(engineeringView,"Mavlink Generator");
engineeringView->setCentralWidget(new QGCDataPlot2D(this));
addCentralWidget(engineeringView,tr("Logfile Plot"));
}
if (!dataView)
if (!mavlinkView)
{
dataView = new SubMainWindow(this);
dataView->setObjectName("VIEW_DATA");
dataView->setCentralWidget(new QGCDataPlot2D(this));
addCentralWidget(dataView,tr("Logfile Plot"));
mavlinkView = new SubMainWindow(this);
mavlinkView->setObjectName("VIEW_MAVLINK");
mavlinkView->setCentralWidget(new XMLCommProtocolWidget(this));
addCentralWidget(mavlinkView,tr("Mavlink Generator"));
}
if (!simView)
{
@ -879,17 +882,14 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas) @@ -879,17 +882,14 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
if (mav && !hilDocks.contains(mav->getUASID()))
{
QGCHilConfiguration* hconf = new QGCHilConfiguration(mav, this);
QString hilDockName = tr("HIL Config (%1)").arg(uas->getUASName());
QDockWidget* hilDock = new QDockWidget(hilDockName, this);
hilDock->setWidget(hconf);
hilDock->setObjectName(QString("HIL_CONFIG_%1").arg(uas->getUASID()));
//addTool(hilDock, hilDockName, Qt::LeftDockWidgetArea);
QString hilDockName = tr("HIL Config %1").arg(uas->getUASName());
QDockWidget* hilDock = createDockWidget(simView, hconf,hilDockName, hilDockName.toUpper().replace(" ", "_"),VIEW_SIMULATION,Qt::LeftDockWidgetArea);
hilDocks.insert(mav->getUASID(), hilDock);
if (currentView != VIEW_SIMULATION)
hilDock->hide();
else
hilDock->show();
// if (currentView != VIEW_SIMULATION)
// hilDock->hide();
// else
// hilDock->show();
}
}
@ -963,7 +963,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, int view) @@ -963,7 +963,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, int view)
switch ((VIEW_SECTIONS)view)
{
case VIEW_ENGINEER:
createDockWidget(dataView,tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
createDockWidget(engineeringView,tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
break;
case VIEW_FLIGHT:
createDockWidget(pilotView,tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
@ -1008,7 +1008,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance) @@ -1008,7 +1008,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
switch (view)
{
case VIEW_ENGINEER:
createDockWidget(dataView,tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
createDockWidget(engineeringView,tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
break;
case VIEW_FLIGHT:
createDockWidget(pilotView,tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
@ -1748,9 +1748,9 @@ void MainWindow::UASCreated(UASInterface* uas) @@ -1748,9 +1748,9 @@ void MainWindow::UASCreated(UASInterface* uas)
}
linechartWidget->addSource(mavlinkDecoder);
if (dataView->centralWidget() != linechartWidget)
if (engineeringView->centralWidget() != linechartWidget)
{
dataView->setCentralWidget(linechartWidget);
engineeringView->setCentralWidget(linechartWidget);
linechartWidget->show();
}
@ -1881,7 +1881,7 @@ void MainWindow::loadViewState() @@ -1881,7 +1881,7 @@ void MainWindow::loadViewState()
// Restore center stack state
int index = settings.value(getWindowStateKey()+"CENTER_WIDGET", -1).toInt();
// The offline plot view is usually the consequence of a logging run, always show the realtime view first
if (centerStack->indexOf(dataView) == index)
if (centerStack->indexOf(engineeringView) == index)
{
// Rewrite to realtime plot
//index = centerStack->indexOf(linechartWidget);
@ -1904,13 +1904,13 @@ void MainWindow::loadViewState() @@ -1904,13 +1904,13 @@ void MainWindow::loadViewState()
centerStack->setCurrentWidget(configView);
break;
case VIEW_ENGINEER:
centerStack->setCurrentWidget(dataView);
centerStack->setCurrentWidget(engineeringView);
break;
case VIEW_FLIGHT:
centerStack->setCurrentWidget(pilotView);
break;
case VIEW_MAVLINK:
centerStack->setCurrentWidget(engineeringView);
centerStack->setCurrentWidget(mavlinkView);
break;
case VIEW_FIRMWAREUPDATE:
centerStack->setCurrentWidget(firmwareUpdateWidget);
@ -2078,25 +2078,25 @@ void MainWindow::loadFirmwareUpdateView() @@ -2078,25 +2078,25 @@ void MainWindow::loadFirmwareUpdateView()
}
}
void MainWindow::loadDataView(QString fileName)
{
// Plot is now selected, now load data from file
if (dataView)
{
//dataView->setCentralWidget(new QGCDataPlot2D(this));
QGCDataPlot2D *plot = qobject_cast<QGCDataPlot2D*>(dataView->centralWidget());
if (plot)
{
plot->loadFile(fileName);
}
}
/*QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
if (centerStack)
{
centerStack->setCurrentWidget(dataView);
dataplotWidget->loadFile(fileName);
}*/
}
//void MainWindow::loadDataView(QString fileName)
//{
// // Plot is now selected, now load data from file
// if (dataView)
// {
// //dataView->setCentralWidget(new QGCDataPlot2D(this));
// QGCDataPlot2D *plot = qobject_cast<QGCDataPlot2D*>(dataView->centralWidget());
// if (plot)
// {
// plot->loadFile(fileName);
// }
// }
// /*QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
// if (centerStack)
// {
// centerStack->setCurrentWidget(dataView);
// dataplotWidget->loadFile(fileName);
// }*/
//}
QList<QAction*> MainWindow::listLinkMenuActions(void)

4
src/ui/MainWindow.h

@ -226,7 +226,7 @@ public slots: @@ -226,7 +226,7 @@ public slots:
void closeEvent(QCloseEvent* event);
/** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName);
// void loadDataView(QString fileName);
/**
* @brief Shows a Docked Widget based on the action sender
@ -347,7 +347,7 @@ protected: @@ -347,7 +347,7 @@ protected:
QPointer<SubMainWindow> plannerView;
QPointer<SubMainWindow> pilotView;
QPointer<SubMainWindow> configView;
QPointer<SubMainWindow> dataView;
QPointer<SubMainWindow> mavlinkView;
QPointer<SubMainWindow> engineeringView;
QPointer<SubMainWindow> simView;

9
src/ui/QGCHilConfiguration.cc

@ -22,9 +22,9 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) : @@ -22,9 +22,9 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) :
int i = settings.value("SIMULATOR_INDEX", -1).toInt();
if (i > 0) {
ui->simComboBox->blockSignals(true);
// ui->simComboBox->blockSignals(true);
ui->simComboBox->setCurrentIndex(i);
ui->simComboBox->blockSignals(false);
// ui->simComboBox->blockSignals(false);
on_simComboBox_currentIndexChanged(i);
}
@ -46,6 +46,11 @@ QGCHilConfiguration::~QGCHilConfiguration() @@ -46,6 +46,11 @@ QGCHilConfiguration::~QGCHilConfiguration()
delete ui;
}
void QGCHilConfiguration::setVersion(QString version)
{
}
void QGCHilConfiguration::on_simComboBox_currentIndexChanged(int index)
{
//clean up

1
src/ui/QGCHilConfiguration.h

@ -21,6 +21,7 @@ public: @@ -21,6 +21,7 @@ public:
public slots:
/** @brief Receive status message */
void receiveStatusMessage(const QString& message);
void setVersion(QString version);
protected:
UAS* mav;

7
src/ui/QGCHilXPlaneConfiguration.cc

@ -32,6 +32,8 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget * @@ -32,6 +32,8 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
ui->sensorHilCheckBox->setChecked(link->sensorHilEnabled());
connect(link, SIGNAL(sensorHilChanged(bool)), ui->sensorHilCheckBox, SLOT(setChecked(bool)));
connect(ui->sensorHilCheckBox, SIGNAL(clicked(bool)), link, SLOT(enableSensorHIL(bool)));
connect(link, SIGNAL(versionChanged(int)), this, SLOT(setVersion(int)));
}
ui->hostComboBox->clear();
@ -40,6 +42,11 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget * @@ -40,6 +42,11 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
}
void QGCHilXPlaneConfiguration::setVersion(int version)
{
}
void QGCHilXPlaneConfiguration::toggleSimulation(bool connect)
{
Q_UNUSED(connect);

2
src/ui/QGCHilXPlaneConfiguration.h

@ -20,6 +20,8 @@ public: @@ -20,6 +20,8 @@ public:
public slots:
/** @brief Start / stop simulation */
void toggleSimulation(bool connect);
/** @brief Set X-Plane version */
void setVersion(int version);
protected:
QGCHilLink* link;

6
src/ui/QGCHilXPlaneConfiguration.ui

@ -6,14 +6,14 @@ @@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>295</width>
<height>148</height>
<width>570</width>
<height>238</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,100" columnstretch="40,10,10,40">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,100" columnstretch="20,40,40,20">
<property name="margin">
<number>0</number>
</property>

Loading…
Cancel
Save