Commit 6a1f5f84 authored by Bryant's avatar Bryant

Merge branch 'master' of https://github.com/mavlink/qgroundcontrol into rem_mavgen

Conflicts:
	src/ui/MainWindow.cc
parents a9aa4968 e0471245
...@@ -270,7 +270,6 @@ void MainWindow::init() ...@@ -270,7 +270,6 @@ void MainWindow::init()
widget->setMinimumWidth(1024); widget->setMinimumWidth(1024);
widget->setFeatures(QDockWidget::NoDockWidgetFeatures); widget->setFeatures(QDockWidget::NoDockWidgetFeatures);
widget->setTitleBarWidget(new QWidget(this)); // Disables the title bar widget->setTitleBarWidget(new QWidget(this)); // Disables the title bar
// /*widget*/->setStyleSheet("QDockWidget { border: 0px solid #FFFFFF; border-radius: 0px; border-bottom: 0px;}");
this->addDockWidget(Qt::TopDockWidgetArea, widget); this->addDockWidget(Qt::TopDockWidgetArea, widget);
} }
...@@ -451,7 +450,6 @@ QString MainWindow::getWindowStateKey() ...@@ -451,7 +450,6 @@ QString MainWindow::getWindowStateKey()
QString MainWindow::getWindowGeometryKey() QString MainWindow::getWindowGeometryKey()
{ {
//return QString::number(currentView)+"_geometry";
return "_geometry"; return "_geometry";
} }
...@@ -478,10 +476,7 @@ void MainWindow::buildCustomWidget() ...@@ -478,10 +476,7 @@ void MainWindow::buildCustomWidget()
// Load dock widget location (default is bottom) // Load dock widget location (default is bottom)
Qt::DockWidgetArea location = tool->getDockWidgetArea(currentView); Qt::DockWidgetArea location = tool->getDockWidgetArea(currentView);
//addDockWidget(location, dock);
//dock->hide();
int view = settings.value(QString("TOOL_PARENT_") + tool->objectName(),-1).toInt(); int view = settings.value(QString("TOOL_PARENT_") + tool->objectName(),-1).toInt();
//settings.setValue(QString("TOOL_PARENT_") + "UNNAMED_TOOL_" + QString::number(ui.menuTools->actions().size()),currentView);
settings.endGroup(); settings.endGroup();
QDockWidget* dock; QDockWidget* dock;
...@@ -513,8 +508,6 @@ void MainWindow::buildCustomWidget() ...@@ -513,8 +508,6 @@ void MainWindow::buildCustomWidget()
// XXX temporary "fix" // XXX temporary "fix"
dock->hide(); dock->hide();
//createDockWidget(0,tool,tool->getTitle(),tool->objectName(),view,location);
} }
} }
} }
...@@ -641,7 +634,6 @@ void MainWindow::buildCommonWidgets() ...@@ -641,7 +634,6 @@ void MainWindow::buildCommonWidgets()
menuActionHelper->createToolAction(tr("Status Details"), "UAS_STATUS_DETAILS_DOCKWIDGET"); menuActionHelper->createToolAction(tr("Status Details"), "UAS_STATUS_DETAILS_DOCKWIDGET");
createDockWidget(pilotView, new DebugConsole(this), tr("Communications Console"), "COMMUNICATION_CONSOLE_DOCKWIDGET", VIEW_FLIGHT, Qt::LeftDockWidgetArea); createDockWidget(pilotView, new DebugConsole(this), tr("Communications Console"), "COMMUNICATION_CONSOLE_DOCKWIDGET", VIEW_FLIGHT, Qt::LeftDockWidgetArea);
//createDockWidget(simView,new HSIDisplay(this),tr("Horizontal Situation"),"HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET",VIEW_SIMULATION,Qt::BottomDockWidgetArea);
menuActionHelper->createToolAction(tr("Flight Display"), "HEAD_DOWN_DISPLAY_1_DOCKWIDGET"); menuActionHelper->createToolAction(tr("Flight Display"), "HEAD_DOWN_DISPLAY_1_DOCKWIDGET");
menuActionHelper->createToolAction(tr("Actuator Status"), "HEAD_DOWN_DISPLAY_2_DOCKWIDGET"); menuActionHelper->createToolAction(tr("Actuator Status"), "HEAD_DOWN_DISPLAY_2_DOCKWIDGET");
...@@ -656,61 +648,8 @@ void MainWindow::buildCommonWidgets() ...@@ -656,61 +648,8 @@ void MainWindow::buildCommonWidgets()
infoview->addSource(mavlinkDecoder); infoview->addSource(mavlinkDecoder);
createDockWidget(pilotView,infoview,tr("Info View"),"UAS_INFO_INFOVIEW_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea); createDockWidget(pilotView,infoview,tr("Info View"),"UAS_INFO_INFOVIEW_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea);
//createDockWidget(pilotView,new HUD(320,240,this),tr("Head Up Display"),"HEAD_UP_DISPLAY_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea,this->width()/1.8);
// createDockWidget(pilotView,new UASQuickView(this),tr("Quick View"),"UAS_INFO_QUICKVIEW_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea);
// createDockWidget(pilotView,new HSIDisplay(this),tr("Horizontal Situation"),"HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea);
// pilotView->setTabPosition(Qt::LeftDockWidgetArea,QTabWidget::North);
// pilotView->tabifyDockWidget((QDockWidget*)centralWidgetToDockWidgetsMap[VIEW_FLIGHT]["HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET"],(QDockWidget*)centralWidgetToDockWidgetsMap[VIEW_FLIGHT]["UAS_INFO_QUICKVIEW_DOCKWIDGET"]);
//UASRawStatusView *view = new UASRawStatusView();
//view->setDecoder(mavlinkDecoder);
//view->show();
//hddisplay->addSource(mavlinkDecoder);
//createDockWidget(pilotView,new HSIDisplay(this),tr("Horizontal Situation"),"HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea);
//pilotView->setTabPosition(Qt::LeftDockWidgetArea,QTabWidget::North);
//pilotView->tabifyDockWidget((QDockWidget*)centralWidgetToDockWidgetsMap[VIEW_FLIGHT]["HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET"],(QDockWidget*)centralWidgetToDockWidgetsMap[VIEW_FLIGHT]["UAS_INFO_QUICKVIEW_DOCKWIDGET"]);
//createDockWidget(pilotView,new UASActionsWidget(this),tr("Actions"),"UNMANNED_SYSTEM_ACTION_DOCKWIDGET",VIEW_FLIGHT,Qt::RightDockWidgetArea);
// Custom widgets, added last to all menus and layouts // Custom widgets, added last to all menus and layouts
buildCustomWidget(); buildCustomWidget();
/*if (!protocolWidget)
{
protocolWidget = new XMLCommProtocolWidget(this);
addCentralWidget(protocolWidget, "Mavlink Generator");
}*/
// if (!firmwareUpdateWidget)
// {
// firmwareUpdateWidget = new QGCFirmwareUpdate(this);
// addCentralWidget(firmwareUpdateWidget, "Firmware Update");
// }
/*if (!hudWidget)
{
hudWidget = new HUD(320, 240, this);
addCentralWidget(hudWidget, tr("Head Up Display"));
}*/
/*if (!configWidget)
{
configWidget = new QGCVehicleConfig(this);
addCentralWidget(configWidget, tr("Vehicle Configuration"));
}*/
/*if (!dataplotWidget)
{
dataplotWidget = new QGCDataPlot2D(this);
addCentralWidget(dataplotWidget, tr("Logfile Plot"));
}*/
} }
void MainWindow::addTool(SubMainWindow *parent,VIEW_SECTIONS view,QDockWidget* widget, const QString& title, Qt::DockWidgetArea area) void MainWindow::addTool(SubMainWindow *parent,VIEW_SECTIONS view,QDockWidget* widget, const QString& title, Qt::DockWidgetArea area)
...@@ -826,7 +765,6 @@ void MainWindow::loadDockWidget(const QString& name) ...@@ -826,7 +765,6 @@ void MainWindow::loadDockWidget(const QString& name)
else if (name == "Radio Control") else if (name == "Radio Control")
{ {
qDebug() << "Error loading window:" << name << "Unknown window type"; qDebug() << "Error loading window:" << name << "Unknown window type";
//createDockWidget(centerStack->currentWidget(),hddisplay,tr("Actuator Status"),"HEADS_DOWN_DISPLAY_2_DOCKWIDGET",currentView,Qt::RightDockWidgetArea);
} }
else if (name == "PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET") else if (name == "PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET")
{ {
...@@ -845,7 +783,6 @@ void MainWindow::loadDockWidget(const QString& name) ...@@ -845,7 +783,6 @@ void MainWindow::loadDockWidget(const QString& name)
if (customWidgetNameToFilenameMap.contains(name)) if (customWidgetNameToFilenameMap.contains(name))
{ {
loadCustomWidget(customWidgetNameToFilenameMap[name],currentView); loadCustomWidget(customWidgetNameToFilenameMap[name],currentView);
//customWidgetNameToFilenameMap.remove(name);
} }
else else
{ {
...@@ -988,7 +925,6 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance) ...@@ -988,7 +925,6 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
qDebug() << "Loading custom tool:" << tool->getTitle() << tool->objectName(); qDebug() << "Loading custom tool:" << tool->getTitle() << tool->objectName();
QSettings settings; QSettings settings;
settings.beginGroup("QGC_MAINWINDOW"); settings.beginGroup("QGC_MAINWINDOW");
//settings.setValue(QString("TOOL_PARENT_") + "UNNAMED_TOOL_" + QString::number(ui.menuTools->actions().size()),currentView);
int view = settings.value(QString("TOOL_PARENT_") + tool->objectName(),-1).toInt(); int view = settings.value(QString("TOOL_PARENT_") + tool->objectName(),-1).toInt();
switch (view) switch (view)
...@@ -1120,10 +1056,6 @@ void MainWindow::configureWindowName() ...@@ -1120,10 +1056,6 @@ void MainWindow::configureWindowName()
windowname.append(")"); windowname.append(")");
setWindowTitle(windowname); setWindowTitle(windowname);
#ifndef Q_WS_MAC
//qApp->setWindowIcon(QIcon(":/core/images/qtcreator_logo_128.png"));
#endif
} }
void MainWindow::startVideoCapture() void MainWindow::startVideoCapture()
...@@ -1138,9 +1070,6 @@ void MainWindow::startVideoCapture() ...@@ -1138,9 +1070,6 @@ void MainWindow::startVideoCapture()
.arg(format)); .arg(format));
delete videoTimer; delete videoTimer;
videoTimer = new QTimer(this); videoTimer = new QTimer(this);
//videoTimer->setInterval(40);
//connect(videoTimer, SIGNAL(timeout()), this, SLOT(saveScreen()));
//videoTimer->stop();
} }
void MainWindow::stopVideoCapture() void MainWindow::stopVideoCapture()
...@@ -1270,7 +1199,6 @@ void MainWindow::connectCommonActions() ...@@ -1270,7 +1199,6 @@ void MainWindow::connectCommonActions()
perspectives->addAction(ui.actionFlightView); perspectives->addAction(ui.actionFlightView);
perspectives->addAction(ui.actionSimulationView); perspectives->addAction(ui.actionSimulationView);
perspectives->addAction(ui.actionMissionView); perspectives->addAction(ui.actionMissionView);
//perspectives->addAction(ui.actionConfiguration_2);
perspectives->addAction(ui.actionHardwareConfig); perspectives->addAction(ui.actionHardwareConfig);
perspectives->addAction(ui.actionSoftwareConfig); perspectives->addAction(ui.actionSoftwareConfig);
perspectives->addAction(ui.actionTerminalView); perspectives->addAction(ui.actionTerminalView);
...@@ -1485,7 +1413,7 @@ LinkInterface* MainWindow::addLink() ...@@ -1485,7 +1413,7 @@ LinkInterface* MainWindow::addLink()
foreach (QAction* act, actions) foreach (QAction* act, actions)
{ {
if (act->data().toInt() == linkID) if (act->data().toInt() == linkID)
{ // LinkManager::instance()->getLinks().indexOf(link) {
act->trigger(); act->trigger();
break; break;
} }
...@@ -1508,7 +1436,7 @@ bool MainWindow::configLink(LinkInterface *link) ...@@ -1508,7 +1436,7 @@ bool MainWindow::configLink(LinkInterface *link)
foreach (QAction* action, actions) foreach (QAction* action, actions)
{ {
if (action->data().toInt() == linkID) if (action->data().toInt() == linkID)
{ // LinkManager::instance()->getLinks().indexOf(link) {
found = true; found = true;
action->trigger(); // Show the Link Config Dialog action->trigger(); // Show the Link Config Dialog
} }
...@@ -1537,7 +1465,7 @@ void MainWindow::addLink(LinkInterface *link) ...@@ -1537,7 +1465,7 @@ void MainWindow::addLink(LinkInterface *link)
foreach (QAction* act, actions) foreach (QAction* act, actions)
{ {
if (act->data().toInt() == linkID) if (act->data().toInt() == linkID)
{ // LinkManager::instance()->getLinks().indexOf(link) {
found = true; found = true;
} }
} }
...@@ -1561,10 +1489,6 @@ void MainWindow::simulateLink(bool simulate) { ...@@ -1561,10 +1489,6 @@ void MainWindow::simulateLink(bool simulate) {
simulationLink->connectLink(simulate); simulationLink->connectLink(simulate);
} }
//void MainWindow::configLink(LinkInterface *link)
//{
//}
void MainWindow::commsWidgetDestroyed(QObject *obj) void MainWindow::commsWidgetDestroyed(QObject *obj)
{ {
if (commsWidgetList.contains(obj)) if (commsWidgetList.contains(obj))
...@@ -1576,13 +1500,9 @@ void MainWindow::commsWidgetDestroyed(QObject *obj) ...@@ -1576,13 +1500,9 @@ void MainWindow::commsWidgetDestroyed(QObject *obj)
void MainWindow::setActiveUAS(UASInterface* uas) void MainWindow::setActiveUAS(UASInterface* uas)
{ {
Q_UNUSED(uas); Q_UNUSED(uas);
// Enable and rename menu
// ui.menuUnmanned_System->setTitle(uas->getUASName());
// if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true);
if (settings.contains(getWindowStateKey())) if (settings.contains(getWindowStateKey()))
{ {
SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget()); SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget());
//settings.setValue(getWindowStateKey(), win->saveState(QGC::applicationVersion()))
win->restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion()); win->restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion());
} }
...@@ -1590,114 +1510,85 @@ void MainWindow::setActiveUAS(UASInterface* uas) ...@@ -1590,114 +1510,85 @@ void MainWindow::setActiveUAS(UASInterface* uas)
void MainWindow::UASSpecsChanged(int uas) void MainWindow::UASSpecsChanged(int uas)
{ {
UASInterface* activeUAS = UASManager::instance()->getActiveUAS(); Q_UNUSED(uas);
if (activeUAS) // TODO: Update UAS properties if its specs change
{
if (activeUAS->getUASID() == uas)
{
// ui.menuUnmanned_System->setTitle(activeUAS->getUASName());
}
}
else
{
// Last system deleted
// ui.menuUnmanned_System->setTitle(tr("No System"));
// ui.menuUnmanned_System->setEnabled(false);
}
} }
void MainWindow::UASCreated(UASInterface* uas) void MainWindow::UASCreated(UASInterface* uas)
{ {
// The pilot, operator and engineer views were not available on startup, enable them now
// Check if this is the 2nd system and we need a switch menu ui.actionFlightView->setEnabled(true);
if (UASManager::instance()->getUASList().count() > 1) ui.actionMissionView->setEnabled(true);
// ui.menuConnected_Systems->setEnabled(true); ui.actionEngineersView->setEnabled(true);
// The UAS actions are not enabled without connection to system
// Connect the UAS to the full user interface ui.actionLiftoff->setEnabled(true);
ui.actionLand->setEnabled(true);
//if (uas != NULL) ui.actionEmergency_Kill->setEnabled(true);
//{ ui.actionEmergency_Land->setEnabled(true);
// The pilot, operator and engineer views were not available on startup, enable them now ui.actionShutdownMAV->setEnabled(true);
ui.actionFlightView->setEnabled(true);
ui.actionMissionView->setEnabled(true); QIcon icon;
ui.actionEngineersView->setEnabled(true); // Set matching icon
// The UAS actions are not enabled without connection to system switch (uas->getSystemType())
ui.actionLiftoff->setEnabled(true); {
ui.actionLand->setEnabled(true); case MAV_TYPE_GENERIC:
ui.actionEmergency_Kill->setEnabled(true); icon = QIcon(":files/images/mavs/generic.svg");
ui.actionEmergency_Land->setEnabled(true); break;
ui.actionShutdownMAV->setEnabled(true); case MAV_TYPE_FIXED_WING:
icon = QIcon(":files/images/mavs/fixed-wing.svg");
QIcon icon; break;
// Set matching icon case MAV_TYPE_QUADROTOR:
switch (uas->getSystemType()) icon = QIcon(":files/images/mavs/quadrotor.svg");
{ break;
case MAV_TYPE_GENERIC: case MAV_TYPE_COAXIAL:
icon = QIcon(":files/images/mavs/generic.svg"); icon = QIcon(":files/images/mavs/coaxial.svg");
break; break;
case MAV_TYPE_FIXED_WING: case MAV_TYPE_HELICOPTER:
icon = QIcon(":files/images/mavs/fixed-wing.svg"); icon = QIcon(":files/images/mavs/helicopter.svg");
break; break;
case MAV_TYPE_QUADROTOR: case MAV_TYPE_ANTENNA_TRACKER:
icon = QIcon(":files/images/mavs/quadrotor.svg"); icon = QIcon(":files/images/mavs/antenna-tracker.svg");
break; break;
case MAV_TYPE_COAXIAL: case MAV_TYPE_GCS:
icon = QIcon(":files/images/mavs/coaxial.svg"); icon = QIcon(":files/images/mavs/groundstation.svg");
break; break;
case MAV_TYPE_HELICOPTER: case MAV_TYPE_AIRSHIP:
icon = QIcon(":files/images/mavs/helicopter.svg"); icon = QIcon(":files/images/mavs/airship.svg");
break; break;
case MAV_TYPE_ANTENNA_TRACKER: case MAV_TYPE_FREE_BALLOON:
icon = QIcon(":files/images/mavs/antenna-tracker.svg"); icon = QIcon(":files/images/mavs/free-balloon.svg");
break; break;
case MAV_TYPE_GCS: case MAV_TYPE_ROCKET:
icon = QIcon(":files/images/mavs/groundstation.svg"); icon = QIcon(":files/images/mavs/rocket.svg");
break; break;
case MAV_TYPE_AIRSHIP: case MAV_TYPE_GROUND_ROVER:
icon = QIcon(":files/images/mavs/airship.svg"); icon = QIcon(":files/images/mavs/ground-rover.svg");
break; break;
case MAV_TYPE_FREE_BALLOON: case MAV_TYPE_SURFACE_BOAT:
icon = QIcon(":files/images/mavs/free-balloon.svg"); icon = QIcon(":files/images/mavs/surface-boat.svg");
break; break;
case MAV_TYPE_ROCKET: case MAV_TYPE_SUBMARINE:
icon = QIcon(":files/images/mavs/rocket.svg"); icon = QIcon(":files/images/mavs/submarine.svg");
break; break;
case MAV_TYPE_GROUND_ROVER: case MAV_TYPE_HEXAROTOR:
icon = QIcon(":files/images/mavs/ground-rover.svg"); icon = QIcon(":files/images/mavs/hexarotor.svg");
break; break;
case MAV_TYPE_SURFACE_BOAT: case MAV_TYPE_OCTOROTOR:
icon = QIcon(":files/images/mavs/surface-boat.svg"); icon = QIcon(":files/images/mavs/octorotor.svg");
break; break;
case MAV_TYPE_SUBMARINE: case MAV_TYPE_TRICOPTER:
icon = QIcon(":files/images/mavs/submarine.svg"); icon = QIcon(":files/images/mavs/tricopter.svg");
break; break;
case MAV_TYPE_HEXAROTOR: case MAV_TYPE_FLAPPING_WING:
icon = QIcon(":files/images/mavs/hexarotor.svg"); icon = QIcon(":files/images/mavs/flapping-wing.svg");
break; break;
case MAV_TYPE_OCTOROTOR: case MAV_TYPE_KITE:
icon = QIcon(":files/images/mavs/octorotor.svg"); icon = QIcon(":files/images/mavs/kite.svg");
break; break;
case MAV_TYPE_TRICOPTER: default:
icon = QIcon(":files/images/mavs/tricopter.svg"); icon = QIcon(":files/images/mavs/unknown.svg");
break; break;
case MAV_TYPE_FLAPPING_WING: }
icon = QIcon(":files/images/mavs/flapping-wing.svg");
break;
case MAV_TYPE_KITE:
icon = QIcon(":files/images/mavs/kite.svg");
break;
default:
icon = QIcon(":files/images/mavs/unknown.svg");
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(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)));
...@@ -1710,8 +1601,6 @@ void MainWindow::UASCreated(UASInterface* uas) ...@@ -1710,8 +1601,6 @@ void MainWindow::UASCreated(UASInterface* uas)
if (!linechartWidget) if (!linechartWidget)
{ {
linechartWidget = new Linecharts(this); linechartWidget = new Linecharts(this);
//linechartWidget->hide();
} }
linechartWidget->addSource(mavlinkDecoder); linechartWidget->addSource(mavlinkDecoder);
...@@ -1733,7 +1622,6 @@ void MainWindow::UASCreated(UASInterface* uas) ...@@ -1733,7 +1622,6 @@ void MainWindow::UASCreated(UASInterface* uas)
detectionDockWidget = new QDockWidget(tr("Object Recognition"), this); detectionDockWidget = new QDockWidget(tr("Object Recognition"), this);
detectionDockWidget->setWidget( new ObjectDetectionView("files/images/patterns", this) ); detectionDockWidget->setWidget( new ObjectDetectionView("files/images/patterns", this) );
detectionDockWidget->setObjectName("OBJECT_DETECTION_DOCK_WIDGET"); detectionDockWidget->setObjectName("OBJECT_DETECTION_DOCK_WIDGET");
//addTool(detectionDockWidget, tr("Object Recognition"), Qt::RightDockWidgetArea);
} }
if (!watchdogControlDockWidget) if (!watchdogControlDockWidget)
...@@ -1741,57 +1629,9 @@ void MainWindow::UASCreated(UASInterface* uas) ...@@ -1741,57 +1629,9 @@ void MainWindow::UASCreated(UASInterface* uas)
watchdogControlDockWidget = new QDockWidget(tr("Process Control"), this); watchdogControlDockWidget = new QDockWidget(tr("Process Control"), this);
watchdogControlDockWidget->setWidget( new WatchdogControl(this) ); watchdogControlDockWidget->setWidget( new WatchdogControl(this) );
watchdogControlDockWidget->setObjectName("WATCHDOG_CONTROL_DOCKWIDGET"); watchdogControlDockWidget->setObjectName("WATCHDOG_CONTROL_DOCKWIDGET");
//addTool(watchdogControlDockWidget, tr("Process Control"), Qt::BottomDockWidgetArea);
} }
} }
// 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)
{
// 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();
switch (view)
{
case VIEW_ENGINEER:
loadEngineerView();
break;
case VIEW_MAVLINK:
loadMAVLinkView();
break;
case VIEW_FIRMWAREUPDATE:
loadFirmwareUpdateView();
break;
case VIEW_FLIGHT:
loadPilotView();
break;
case VIEW_SIMULATION:
loadSimulationView();
break;
case VIEW_UNCONNECTED:
loadUnconnectedView();
break;
case VIEW_MISSION:
default:
loadOperatorView();
break;
}*/
}
else
{
// loadOperatorView();
}
}
//}
// 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 // Reload view state in case new widgets were added
loadViewState(); loadViewState();
} }
...@@ -1799,21 +1639,7 @@ void MainWindow::UASCreated(UASInterface* uas) ...@@ -1799,21 +1639,7 @@ void MainWindow::UASCreated(UASInterface* uas)
void MainWindow::UASDeleted(UASInterface* uas) void MainWindow::UASDeleted(UASInterface* uas)
{ {
Q_UNUSED(uas); Q_UNUSED(uas);
if (UASManager::instance()->getUASList().count() == 0) // TODO: Update the UI when a UAS is deleted
{
// Last system deleted
// ui.menuUnmanned_System->setTitle(tr("No System"));
// ui.menuUnmanned_System->setEnabled(false);
}
// QAction* act;
// QList<QAction*> actions = ui.menuConnected_Systems->actions();
// foreach (act, actions)
// {
// if (act->text().contains(uas->getUASName()))
// ui.menuConnected_Systems->removeAction(act);
// }
} }
/** /**
...@@ -1848,12 +1674,6 @@ void MainWindow::loadViewState() ...@@ -1848,12 +1674,6 @@ void MainWindow::loadViewState()
{ {
// Restore center stack state // Restore center stack state
int index = settings.value(getWindowStateKey()+"CENTER_WIDGET", -1).toInt(); 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(engineeringView) == index)
{
// Rewrite to realtime plot
//index = centerStack->indexOf(linechartWidget);
}
if (index != -1) if (index != -1)
{ {
...@@ -1881,9 +1701,6 @@ void MainWindow::loadViewState() ...@@ -1881,9 +1701,6 @@ void MainWindow::loadViewState()
case VIEW_FLIGHT: case VIEW_FLIGHT:
centerStack->setCurrentWidget(pilotView); centerStack->setCurrentWidget(pilotView);
break; break;
// case VIEW_FIRMWAREUPDATE:
// centerStack->setCurrentWidget(firmwareUpdateWidget);
// break;
case VIEW_MISSION: case VIEW_MISSION:
centerStack->setCurrentWidget(plannerView); centerStack->setCurrentWidget(plannerView);
break; break;
...@@ -1904,7 +1721,6 @@ void MainWindow::loadViewState() ...@@ -1904,7 +1721,6 @@ void MainWindow::loadViewState()
case VIEW_UNCONNECTED: case VIEW_UNCONNECTED:
case VIEW_FULL: case VIEW_FULL:
default: default:
//centerStack->setCurrentWidget(mapWidget);
if (controlDockWidget) if (controlDockWidget)
{ {
controlDockWidget->hide(); controlDockWidget->hide();
...@@ -1934,7 +1750,6 @@ void MainWindow::loadViewState() ...@@ -1934,7 +1750,6 @@ void MainWindow::loadViewState()
if (settings.contains(getWindowStateKey())) if (settings.contains(getWindowStateKey()))
{ {
SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget()); SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget());
//settings.setValue(getWindowStateKey(), win->saveState(QGC::applicationVersion()))
win->restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion()); win->restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion());
} }
} }
...@@ -2099,7 +1914,6 @@ bool MainWindow::dockWidgetTitleBarsEnabled() const ...@@ -2099,7 +1914,6 @@ bool MainWindow::dockWidgetTitleBarsEnabled() const
bool MainWindow::x11Event(XEvent *event) bool MainWindow::x11Event(XEvent *event)
{ {
emit x11EventOccured(event); emit x11EventOccured(event);
//qDebug("XEvent occured...");
return false; return false;
} }
#endif // QGC_MOUSE_ENABLED_LINUX #endif // QGC_MOUSE_ENABLED_LINUX
...@@ -418,11 +418,6 @@ protected: ...@@ -418,11 +418,6 @@ protected:
// Center widgets // Center widgets
QPointer<Linecharts> linechartWidget; QPointer<Linecharts> linechartWidget;
//QPointer<HUD> hudWidget;
//QPointer<QGCVehicleConfig> configWidget;
//QPointer<QGCMapTool> mapWidget;
//QPointer<XMLCommProtocolWidget> protocolWidget;
//QPointer<QGCDataPlot2D> dataplotWidget;
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
QPointer<QWidget> q3DWidget; QPointer<QWidget> q3DWidget;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment