@ -158,7 +158,7 @@ MainWindow::MainWindow(QWidget *parent):
@@ -158,7 +158,7 @@ MainWindow::MainWindow(QWidget *parent):
hide ( ) ;
// We only need this menu if we have more than one system
// ui.menuConnected_Systems->setEnabled(false);
// ui.menuConnected_Systems->setEnabled(false);
// Set dock options
setDockOptions ( AnimatedDocks | AllowTabbedDocks | AllowNestedDocks ) ;
@ -295,11 +295,11 @@ MainWindow::~MainWindow()
@@ -295,11 +295,11 @@ MainWindow::~MainWindow()
delete mavlink ;
mavlink = NULL ;
}
// if (simulationLink)
// {
// simulationLink->deleteLater();
// simulationLink = NULL;
// }
// if (simulationLink)
// {
// simulationLink->deleteLater();
// simulationLink = NULL;
// }
if ( joystick )
{
joystick - > shutdown ( ) ;
@ -356,7 +356,7 @@ QString MainWindow::getWindowStateKey()
@@ -356,7 +356,7 @@ QString MainWindow::getWindowStateKey()
}
else
return QString : : number ( currentView ) + " _windowstate " ;
return QString : : number ( currentView ) + " _windowstate " ;
}
QString MainWindow : : getWindowGeometryKey ( )
@ -410,7 +410,7 @@ void MainWindow::buildCustomWidget()
@@ -410,7 +410,7 @@ void MainWindow::buildCustomWidget()
switch ( view )
{
case VIEW_ENGINEER :
dock = createDockWidget ( data View, tool , tool - > getTitle ( ) , tool - > objectName ( ) , ( VIEW_SECTIONS ) view , location ) ;
dock = createDockWidget ( engineering View, 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 ) ;
@ -421,6 +421,9 @@ void MainWindow::buildCustomWidget()
@@ -421,6 +421,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 ;
@ -480,15 +483,15 @@ void MainWindow::buildCommonWidgets()
@@ -480,15 +483,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 ( ! data View)
if ( ! mavlink View)
{
data View = new SubMainWindow ( this ) ;
data View- > setObjectName ( " VIEW_DATA " ) ;
data View- > setCentralWidget ( new QGCDataPlot2D ( this ) ) ;
addCentralWidget ( data View, tr ( " Logfile Plot " ) ) ;
mavlink View = new SubMainWindow ( this ) ;
mavlink View- > setObjectName ( " VIEW_MAVLINK " ) ;
mavlink View- > setCentralWidget ( new XMLCommProtocolWidget ( this ) ) ;
addCentralWidget ( mavlink View, tr ( " Mavlink Generator " ) ) ;
}
if ( ! simView )
{
@ -503,38 +506,38 @@ void MainWindow::buildCommonWidgets()
@@ -503,38 +506,38 @@ void MainWindow::buildCommonWidgets()
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
createDockWidget ( simView , new UASControlWidget ( this ) , tr ( " Control " ) , " UNMANNED_SYSTEM_CONTROL_DOCKWIDGET " , VIEW_SIMULATION , Qt : : LeftDockWidgetArea ) ;
createDockWidget ( simView , new UASControlWidget ( this ) , tr ( " Control " ) , " UNMANNED_SYSTEM_CONTROL_DOCKWIDGET " , VIEW_SIMULATION , Qt : : LeftDockWidgetArea ) ;
createDockWidget ( plannerView , new UASListWidget ( this ) , tr ( " Unmanned Systems " ) , " UNMANNED_SYSTEM_LIST_DOCKWIDGET " , VIEW_MISSION , Qt : : LeftDockWidgetArea ) ;
createDockWidget ( plannerView , new UASListWidget ( this ) , tr ( " Unmanned Systems " ) , " UNMANNED_SYSTEM_LIST_DOCKWIDGET " , VIEW_MISSION , Qt : : LeftDockWidgetArea ) ;
{
{
//createDockWidget(plannerView,new QGCWaypointListMulti(this),tr("Mission Plan"),"WAYPOINT_LIST_DOCKWIDGET",VIEW_MISSION,Qt::BottomDockWidgetArea);
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Mission Plan " ) ) ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
menuToDockNameMap [ tempAction ] = " WAYPOINT_LIST_DOCKWIDGET " ;
}
}
createDockWidget ( simView , new QGCWaypointListMulti ( this ) , tr ( " Mission Plan " ) , " WAYPOINT_LIST_DOCKWIDGET " , VIEW_SIMULATION , Qt : : BottomDockWidgetArea ) ;
createDockWidget ( engineeringView , new QGCMAVLinkInspector ( mavlink , this ) , tr ( " MAVLink Inspector " ) , " MAVLINK_INSPECTOR_DOCKWIDGET " , VIEW_ENGINEER , Qt : : RightDockWidgetArea ) ;
createDockWidget ( simView , new QGCWaypointListMulti ( this ) , tr ( " Mission Plan " ) , " WAYPOINT_LIST_DOCKWIDGET " , VIEW_SIMULATION , Qt : : BottomDockWidgetArea ) ;
createDockWidget ( engineeringView , new QGCMAVLinkInspector ( mavlink , this ) , tr ( " MAVLink Inspector " ) , " MAVLINK_INSPECTOR_DOCKWIDGET " , VIEW_ENGINEER , Qt : : RightDockWidgetArea ) ;
createDockWidget ( engineeringView , new ParameterInterface ( this ) , tr ( " Onboard Parameters " ) , " PARAMETER_INTERFACE_DOCKWIDGET " , VIEW_ENGINEER , Qt : : RightDockWidgetArea ) ;
createDockWidget ( simView , new ParameterInterface ( this ) , tr ( " Onboard Parameters " ) , " PARAMETER_INTERFACE_DOCKWIDGET " , VIEW_SIMULATION , Qt : : RightDockWidgetArea ) ;
createDockWidget ( engineeringView , new ParameterInterface ( this ) , tr ( " Onboard Parameters " ) , " PARAMETER_INTERFACE_DOCKWIDGET " , VIEW_ENGINEER , Qt : : RightDockWidgetArea ) ;
createDockWidget ( simView , new ParameterInterface ( this ) , tr ( " Onboard Parameters " ) , " PARAMETER_INTERFACE_DOCKWIDGET " , VIEW_SIMULATION , Qt : : RightDockWidgetArea ) ;
{
{
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Status Details " ) ) ;
menuToDockNameMap [ tempAction ] = " UAS_STATUS_DETAILS_DOCKWIDGET " ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
}
{
}
{
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Communication Console " ) ) ;
menuToDockNameMap [ tempAction ] = " COMMUNICATION_DEBUG_CONSOLE_DOCKWIDGET " ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
}
createDockWidget ( simView , new HSIDisplay ( this ) , tr ( " Horizontal Situation " ) , " HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET " , VIEW_SIMULATION , Qt : : BottomDockWidgetArea ) ;
}
createDockWidget ( simView , new HSIDisplay ( this ) , tr ( " Horizontal Situation " ) , " HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET " , VIEW_SIMULATION , Qt : : BottomDockWidgetArea ) ;
@ -558,23 +561,23 @@ void MainWindow::buildCommonWidgets()
@@ -558,23 +561,23 @@ void MainWindow::buildCommonWidgets()
//createDockWidget(pilotView,hdDisplay2,tr("Actuator Status"),"HEAD_DOWN_DISPLAY_2_DOCKWIDGET",VIEW_FLIGHT,Qt::RightDockWidgetArea);
{
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Flight Display " ) ) ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
menuToDockNameMap [ tempAction ] = " HEAD_DOWN_DISPLAY_1_DOCKWIDGET " ;
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Flight Display " ) ) ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
menuToDockNameMap [ tempAction ] = " HEAD_DOWN_DISPLAY_1_DOCKWIDGET " ;
}
{
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Actuator Status " ) ) ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
menuToDockNameMap [ tempAction ] = " HEAD_DOWN_DISPLAY_2_DOCKWIDGET " ;
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Actuator Status " ) ) ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
menuToDockNameMap [ tempAction ] = " HEAD_DOWN_DISPLAY_2_DOCKWIDGET " ;
}
{
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Radio Control " ) ) ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
QAction * tempAction = ui . menuTools - > addAction ( tr ( " Radio Control " ) ) ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
}
@ -600,11 +603,11 @@ void MainWindow::buildCommonWidgets()
@@ -600,11 +603,11 @@ void MainWindow::buildCommonWidgets()
} */
// if (!firmwareUpdateWidget)
// {
// firmwareUpdateWidget = new QGCFirmwareUpdate(this);
// addCentralWidget(firmwareUpdateWidget, "Firmware Update");
// }
// if (!firmwareUpdateWidget)
// {
// firmwareUpdateWidget = new QGCFirmwareUpdate(this);
// addCentralWidget(firmwareUpdateWidget, "Firmware Update");
// }
/*if (!hudWidget)
{
@ -690,7 +693,7 @@ QDockWidget* MainWindow::createDockWidget(QWidget *parent,QWidget *child,QString
@@ -690,7 +693,7 @@ QDockWidget* MainWindow::createDockWidget(QWidget *parent,QWidget *child,QString
{
//if (child->objectName() == "")
//{
child - > setObjectName ( objectname ) ;
child - > setObjectName ( objectname ) ;
//}
QDockWidget * widget = new QDockWidget ( title , this ) ;
if ( ! isAdvancedMode )
@ -862,16 +865,16 @@ void MainWindow::addCentralWidget(QWidget* widget, const QString& title)
@@ -862,16 +865,16 @@ void MainWindow::addCentralWidget(QWidget* widget, const QString& title)
{
centerStack - > addWidget ( widget ) ;
// QAction* tempAction = ui.menuMain->addAction(title);
// QAction* tempAction = ui.menuMain->addAction(title);
// tempAction->setCheckable(true);
// QVariant var;
// var.setValue((QWidget*)widget);
// tempAction->setData(var);
// centerStackActionGroup->addAction(tempAction);
// connect(tempAction,SIGNAL(triggered()),this, SLOT(showCentralWidget()));
// tempAction->setCheckable(true);
// QVariant var;
// var.setValue((QWidget*)widget);
// tempAction->setData(var);
// centerStackActionGroup->addAction(tempAction);
// connect(tempAction,SIGNAL(triggered()),this, SLOT(showCentralWidget()));
//connect(widget, SIGNAL(visibilityChanged(bool)), tempAction, SLOT(setChecked(bool)));
// tempAction->setChecked(widget->isVisible());
// tempAction->setChecked(widget->isVisible());
}
}
@ -891,17 +894,14 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
@@ -891,17 +894,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();
}
}
@ -975,7 +975,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, int view)
@@ -975,7 +975,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, int view)
switch ( ( VIEW_SECTIONS ) view )
{
case VIEW_ENGINEER :
createDockWidget ( data View, tool , tool - > getTitle ( ) , tool - > objectName ( ) + " DOCK " , ( VIEW_SECTIONS ) view , Qt : : LeftDockWidgetArea ) ;
createDockWidget ( engineering View, 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 ) ;
@ -987,16 +987,16 @@ void MainWindow::loadCustomWidget(const QString& fileName, int view)
@@ -987,16 +987,16 @@ void MainWindow::loadCustomWidget(const QString& fileName, int view)
createDockWidget ( plannerView , tool , tool - > getTitle ( ) , tool - > objectName ( ) + " DOCK " , ( VIEW_SECTIONS ) view , Qt : : LeftDockWidgetArea ) ;
break ;
default :
{
//Delete tool, create menu item to tie it to.
customWidgetNameToFilenameMap [ tool - > objectName ( ) + " DOCK " ] = fileName ;
QAction * tempAction = ui . menuTools - > addAction ( tool - > getTitle ( ) ) ;
menuToDockNameMap [ tempAction ] = tool - > objectName ( ) + " DOCK " ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
tool - > deleteLater ( ) ;
//createDockWidget(centerStack->currentWidget(),tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
}
{
//Delete tool, create menu item to tie it to.
customWidgetNameToFilenameMap [ tool - > objectName ( ) + " DOCK " ] = fileName ;
QAction * tempAction = ui . menuTools - > addAction ( tool - > getTitle ( ) ) ;
menuToDockNameMap [ tempAction ] = tool - > objectName ( ) + " DOCK " ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
tool - > deleteLater ( ) ;
//createDockWidget(centerStack->currentWidget(),tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
}
break ;
}
}
@ -1020,7 +1020,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
@@ -1020,7 +1020,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
switch ( view )
{
case VIEW_ENGINEER :
createDockWidget ( data View, tool , tool - > getTitle ( ) , tool - > objectName ( ) + " DOCK " , ( VIEW_SECTIONS ) view , Qt : : LeftDockWidgetArea ) ;
createDockWidget ( engineering View, 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 ) ;
@ -1032,16 +1032,16 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
@@ -1032,16 +1032,16 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
createDockWidget ( plannerView , tool , tool - > getTitle ( ) , tool - > objectName ( ) + " DOCK " , ( VIEW_SECTIONS ) view , Qt : : LeftDockWidgetArea ) ;
break ;
default :
{
//Delete tool, create menu item to tie it to.
customWidgetNameToFilenameMap [ tool - > objectName ( ) + " DOCK " ] = fileName ;
QAction * tempAction = ui . menuTools - > addAction ( tool - > getTitle ( ) ) ;
menuToDockNameMap [ tempAction ] = tool - > objectName ( ) + " DOCK " ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
tool - > deleteLater ( ) ;
//createDockWidget(centerStack->currentWidget(),tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
}
{
//Delete tool, create menu item to tie it to.
customWidgetNameToFilenameMap [ tool - > objectName ( ) + " DOCK " ] = fileName ;
QAction * tempAction = ui . menuTools - > addAction ( tool - > getTitle ( ) ) ;
menuToDockNameMap [ tempAction ] = tool - > objectName ( ) + " DOCK " ;
tempAction - > setCheckable ( true ) ;
connect ( tempAction , SIGNAL ( triggered ( bool ) ) , this , SLOT ( showTool ( bool ) ) ) ;
tool - > deleteLater ( ) ;
//createDockWidget(centerStack->currentWidget(),tool,tool->getTitle(),tool->objectName()+"DOCK",(VIEW_SECTIONS)view,Qt::LeftDockWidgetArea);
}
break ;
}
@ -1575,8 +1575,8 @@ void MainWindow::setActiveUAS(UASInterface* uas)
@@ -1575,8 +1575,8 @@ void MainWindow::setActiveUAS(UASInterface* uas)
{
Q_UNUSED ( uas ) ;
// Enable and rename menu
// ui.menuUnmanned_System->setTitle(uas->getUASName());
// if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true);
// ui.menuUnmanned_System->setTitle(uas->getUASName());
// if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true);
if ( settings . contains ( getWindowStateKey ( ) ) )
{
SubMainWindow * win = qobject_cast < SubMainWindow * > ( centerStack - > currentWidget ( ) ) ;
@ -1593,14 +1593,14 @@ void MainWindow::UASSpecsChanged(int uas)
@@ -1593,14 +1593,14 @@ void MainWindow::UASSpecsChanged(int uas)
{
if ( activeUAS - > getUASID ( ) = = uas )
{
// ui.menuUnmanned_System->setTitle(activeUAS->getUASName());
// ui.menuUnmanned_System->setTitle(activeUAS->getUASName());
}
}
else
{
// Last system deleted
// ui.menuUnmanned_System->setTitle(tr("No System"));
// ui.menuUnmanned_System->setEnabled(false);
// ui.menuUnmanned_System->setTitle(tr("No System"));
// ui.menuUnmanned_System->setEnabled(false);
}
}
@ -1609,12 +1609,12 @@ void MainWindow::UASCreated(UASInterface* uas)
@@ -1609,12 +1609,12 @@ void MainWindow::UASCreated(UASInterface* uas)
// Check if this is the 2nd system and we need a switch menu
if ( UASManager : : instance ( ) - > getUASList ( ) . count ( ) > 1 )
// ui.menuConnected_Systems->setEnabled(true);
// ui.menuConnected_Systems->setEnabled(true);
// Connect the UAS to the full user interface
// Connect the UAS to the full user interface
//if (uas != NULL)
//{
//if (uas != NULL)
//{
// The pilot, operator and engineer views were not available on startup, enable them now
ui . actionFlightView - > setEnabled ( true ) ;
ui . actionMissionView - > setEnabled ( true ) ;
@ -1689,69 +1689,69 @@ void MainWindow::UASCreated(UASInterface* uas)
@@ -1689,69 +1689,69 @@ void MainWindow::UASCreated(UASInterface* uas)
break ;
}
// XXX The multi-UAS selection menu has been disabled for now,
// its redundant with right-clicking the UAS in the list.
// this code piece might be removed later if this is the final
// conclusion (May 2013)
// QAction* uasAction = new QAction(icon, tr("Select %1 for control").arg(uas->getUASName()), ui.menuConnected_Systems);
// connect(uas, SIGNAL(systemRemoved()), uasAction, SLOT(deleteLater()));
// connect(uasAction, SIGNAL(triggered()), uas, SLOT(setSelected()));
// ui.menuConnected_Systems->addAction(uasAction);
// XXX The multi-UAS selection menu has been disabled for now,
// its redundant with right-clicking the UAS in the list.
// this code piece might be removed later if this is the final
// conclusion (May 2013)
// QAction* uasAction = new QAction(icon, tr("Select %1 for control").arg(uas->getUASName()), ui.menuConnected_Systems);
// connect(uas, SIGNAL(systemRemoved()), uasAction, SLOT(deleteLater()));
// connect(uasAction, SIGNAL(triggered()), uas, SLOT(setSelected()));
// ui.menuConnected_Systems->addAction(uasAction);
connect ( uas , SIGNAL ( systemSpecsChanged ( int ) ) , this , SLOT ( UASSpecsChanged ( int ) ) ) ;
connect ( uas , SIGNAL ( systemSpecsChanged ( int ) ) , this , SLOT ( UASSpecsChanged ( int ) ) ) ;
// HIL
showHILConfigurationWidget ( uas ) ;
// HIL
showHILConfigurationWidget ( uas ) ;
if ( ! linechartWidget )
{
linechartWidget = new Linecharts ( this ) ;
//linechartWidget->hide();
if ( ! linechartWidget )
{
linechartWidget = new Linecharts ( this ) ;
//linechartWidget->hide();
}
}
linechartWidget - > addSource ( mavlinkDecoder ) ;
if ( data View- > centralWidget ( ) ! = linechartWidget )
{
data View - > setCentralWidget ( linechartWidget ) ;
linechartWidget - > show ( ) ;
}
linechartWidget - > addSource ( mavlinkDecoder ) ;
if ( engineering View- > centralWidget ( ) ! = linechartWidget )
{
engineering View- > setCentralWidget ( linechartWidget ) ;
linechartWidget - > show ( ) ;
}
// Load default custom widgets for this autopilot type
loadCustomWidgetsFromDefaults ( uas - > getSystemTypeName ( ) , uas - > getAutopilotTypeName ( ) ) ;
// Load default custom widgets for this autopilot type
loadCustomWidgetsFromDefaults ( uas - > getSystemTypeName ( ) , uas - > getAutopilotTypeName ( ) ) ;
if ( uas - > getAutopilotType ( ) = = MAV_AUTOPILOT_PIXHAWK )
if ( uas - > getAutopilotType ( ) = = MAV_AUTOPILOT_PIXHAWK )
{
// Dock widgets
if ( ! detectionDockWidget )
{
// Dock widgets
if ( ! detectionDockWidget )
{
detectionDockWidget = new QDockWidget ( tr ( " Object Recognition " ) , this ) ;
detectionDockWidget - > setWidget ( new ObjectDetectionView ( " files/images/patterns " , this ) ) ;
detectionDockWidget - > setObjectName ( " OBJECT_DETECTION_DOCK_WIDGET " ) ;
//addTool(detectionDockWidget, tr("Object Recognition"), Qt::RightDockWidgetArea);
}
detectionDockWidget = new QDockWidget ( tr ( " Object Recognition " ) , this ) ;
detectionDockWidget - > setWidget ( new ObjectDetectionView ( " files/images/patterns " , this ) ) ;
detectionDockWidget - > setObjectName ( " OBJECT_DETECTION_DOCK_WIDGET " ) ;
//addTool(detectionDockWidget, tr("Object Recognition"), Qt::RightDockWidgetArea);
}
if ( ! watchdogControlDockWidget )
{
watchdogControlDockWidget = new QDockWidget ( tr ( " Process Control " ) , this ) ;
watchdogControlDockWidget - > setWidget ( new WatchdogControl ( this ) ) ;
watchdogControlDockWidget - > setObjectName ( " WATCHDOG_CONTROL_DOCKWIDGET " ) ;
//addTool(watchdogControlDockWidget, tr("Process Control"), Qt::BottomDockWidgetArea);
}
if ( ! watchdogControlDockWidget )
{
watchdogControlDockWidget = new QDockWidget ( tr ( " Process Control " ) , this ) ;
watchdogControlDockWidget - > setWidget ( new WatchdogControl ( this ) ) ;
watchdogControlDockWidget - > setObjectName ( " WATCHDOG_CONTROL_DOCKWIDGET " ) ;
//addTool(watchdogControlDockWidget, tr("Process Control"), Qt::BottomDockWidgetArea);
}
}
// Change the view only if this is the first UAS
// Change the view only if this is the first UAS
// If this is the first connected UAS, it is both created as well as
// the currently active UAS
if ( UASManager : : instance ( ) - > getUASList ( ) . size ( ) = = 1 )
// If this is the first connected UAS, it is both created as well as
// the currently active UAS
if ( UASManager : : instance ( ) - > getUASList ( ) . size ( ) = = 1 )
{
// Load last view if setting is present
if ( settings . contains ( " CURRENT_VIEW_WITH_UAS_CONNECTED " ) )
{
// Load last view if setting is present
if ( settings . contains ( " CURRENT_VIEW_WITH_UAS_CONNECTED " ) )
{
/*int view = settings.value("CURRENT_VIEW_WITH_UAS_CONNECTED").toInt();
/*int view = settings.value("CURRENT_VIEW_WITH_UAS_CONNECTED").toInt();
switch ( view )
{
case VIEW_ENGINEER :
@ -1777,17 +1777,17 @@ void MainWindow::UASCreated(UASInterface* uas)
@@ -1777,17 +1777,17 @@ void MainWindow::UASCreated(UASInterface* uas)
loadOperatorView ( ) ;
break ;
} */
}
else
{
// loadOperatorView();
}
}
else
{
// loadOperatorView();
}
}
//}
// if (!ui.menuConnected_Systems->isEnabled()) ui.menuConnected_Systems->setEnabled(true);
// if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true);
// if (!ui.menuConnected_Systems->isEnabled()) ui.menuConnected_Systems->setEnabled(true);
// if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true);
// Reload view state in case new widgets were added
loadViewState ( ) ;
@ -1799,18 +1799,18 @@ void MainWindow::UASDeleted(UASInterface* uas)
@@ -1799,18 +1799,18 @@ void MainWindow::UASDeleted(UASInterface* uas)
if ( UASManager : : instance ( ) - > getUASList ( ) . count ( ) = = 0 )
{
// Last system deleted
// ui.menuUnmanned_System->setTitle(tr("No System"));
// ui.menuUnmanned_System->setEnabled(false);
// ui.menuUnmanned_System->setTitle(tr("No System"));
// ui.menuUnmanned_System->setEnabled(false);
}
// QAction* act;
// QList<QAction*> actions = ui.menuConnected_Systems->actions();
// QAction* act;
// QList<QAction*> actions = ui.menuConnected_Systems->actions();
// foreach (act, actions)
// {
// if (act->text().contains(uas->getUASName()))
// ui.menuConnected_Systems->removeAction(act);
// }
// foreach (act, actions)
// {
// if (act->text().contains(uas->getUASName()))
// ui.menuConnected_Systems->removeAction(act);
// }
}
/**
@ -1846,7 +1846,7 @@ void MainWindow::loadViewState()
@@ -1846,7 +1846,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 ( data View) = = index )
if ( centerStack - > indexOf ( engineering View) = = index )
{
// Rewrite to realtime plot
//index = centerStack->indexOf(linechartWidget);
@ -1869,13 +1869,13 @@ void MainWindow::loadViewState()
@@ -1869,13 +1869,13 @@ void MainWindow::loadViewState()
centerStack - > setCurrentWidget ( configView ) ;
break ;
case VIEW_ENGINEER :
centerStack - > setCurrentWidget ( data View) ;
centerStack - > setCurrentWidget ( engineering View) ;
break ;
case VIEW_FLIGHT :
centerStack - > setCurrentWidget ( pilotView ) ;
break ;
case VIEW_MAVLINK :
centerStack - > setCurrentWidget ( engineering View) ;
centerStack - > setCurrentWidget ( mavlink View) ;
break ;
case VIEW_FIRMWAREUPDATE :
centerStack - > setCurrentWidget ( firmwareUpdateWidget ) ;
@ -2043,25 +2043,25 @@ void MainWindow::loadFirmwareUpdateView()
@@ -2043,25 +2043,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 )