Commit 18b0e07e authored by Mariano Lizarraga's avatar Mariano Lizarraga

VERY EXPERIMENTAL. Saving of location for the common widgets now working and...

VERY EXPERIMENTAL. Saving of location for the common widgets now working and persisted across sessions. Needs to be extended to the individual autopilot widgets
parent ba37793f
...@@ -659,7 +659,7 @@ qint64 MAVLinkSimulationLink::bytesAvailable() ...@@ -659,7 +659,7 @@ qint64 MAVLinkSimulationLink::bytesAvailable()
void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size)
{ {
qDebug() << "Simulation received " << size << " bytes from groundstation: "; //qDebug() << "Simulation received " << size << " bytes from groundstation: ";
// Increase write counter // Increase write counter
//bitsSentTotal += size * 8; //bitsSentTotal += size * 8;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
**/ **/
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
toolsMenuActions(),
settings() settings()
{ {
this->hide(); this->hide();
...@@ -89,33 +90,39 @@ MainWindow::~MainWindow() ...@@ -89,33 +90,39 @@ MainWindow::~MainWindow()
} }
void MainWindow::buildCommonWidgets() void MainWindow::buildCommonWidgets()
{ {
//TODO: move protocol outside UI //TODO: move protocol outside UI
mavlink = new MAVLinkProtocol(); mavlink = new MAVLinkProtocol();
// Center widgets
mapWidget = new MapWidget(this);
protocolWidget = new XMLCommProtocolWidget(this);
// Dock widgets // Dock widgets
controlDockWidget = new QDockWidget(tr("Control"), this); controlDockWidget = new QDockWidget(tr("Control"), this);
controlDockWidget->setWidget( new UASControlWidget(this) ); controlDockWidget->setWidget( new UASControlWidget(this) );
addToToolsMenu (controlDockWidget, tr("UAS Control"), SLOT(showToolWidget()), MENU_UAS_CONTROL, Qt::LeftDockWidgetArea);
listDockWidget = new QDockWidget(tr("Unmanned Systems"), this); listDockWidget = new QDockWidget(tr("Unmanned Systems"), this);
listDockWidget->setWidget( new UASListWidget(this) ); listDockWidget->setWidget( new UASListWidget(this) );
addToToolsMenu (listDockWidget, tr("UAS List"), SLOT(showToolWidget()), MENU_UAS_LIST, Qt::RightDockWidgetArea);
waypointsDockWidget = new QDockWidget(tr("Waypoint List"), this); waypointsDockWidget = new QDockWidget(tr("Waypoint List"), this);
waypointsDockWidget->setWidget( new WaypointList(this, NULL) ); waypointsDockWidget->setWidget( new WaypointList(this, NULL) );
addToToolsMenu (waypointsDockWidget, tr("Waypoints List"), SLOT(showToolWidget()), MENU_WAYPOINTS, Qt::BottomDockWidgetArea);
infoDockWidget = new QDockWidget(tr("Status Details"), this); infoDockWidget = new QDockWidget(tr("Status Details"), this);
infoDockWidget->setWidget( new UASInfoWidget(this) ); infoDockWidget->setWidget( new UASInfoWidget(this) );
addToToolsMenu (infoDockWidget, tr("Status Details"), SLOT(showToolWidget()), MENU_STATUS, Qt::RightDockWidgetArea);
debugConsoleDockWidget = new QDockWidget(tr("Communication Console"), this); debugConsoleDockWidget = new QDockWidget(tr("Communication Console"), this);
debugConsoleDockWidget->setWidget( new DebugConsole(this) ); debugConsoleDockWidget->setWidget( new DebugConsole(this) );
addToToolsMenu (debugConsoleDockWidget, tr("Communication Console"), SLOT(showToolWidget()), MENU_DEBUG_CONSOLE, Qt::BottomDockWidgetArea);
} // Center widgets
mapWidget = new MapWidget(this);
protocolWidget = new XMLCommProtocolWidget(this);
}
void MainWindow::buildPxWidgets() void MainWindow::buildPxWidgets()
{ {
//FIXME: memory of acceptList will never be freed again //FIXME: memory of acceptList will never be freed again
...@@ -151,27 +158,37 @@ void MainWindow::buildPxWidgets() ...@@ -151,27 +158,37 @@ void MainWindow::buildPxWidgets()
// Dock widgets // Dock widgets
detectionDockWidget = new QDockWidget(tr("Object Recognition"), this); detectionDockWidget = new QDockWidget(tr("Object Recognition"), this);
detectionDockWidget->setWidget( new ObjectDetectionView("images/patterns", this) ); detectionDockWidget->setWidget( new ObjectDetectionView("images/patterns", this) );
addToToolsMenu (detectionDockWidget, tr("Object Recognition"), SLOT(showToolWidget()), MENU_DETECTION, Qt::RightDockWidgetArea);
parametersDockWidget = new QDockWidget(tr("Onboard Parameters"), this); parametersDockWidget = new QDockWidget(tr("Onboard Parameters"), this);
parametersDockWidget->setWidget( new ParameterInterface(this) ); parametersDockWidget->setWidget( new ParameterInterface(this) );
addToToolsMenu (parametersDockWidget, tr("Onboard Parameters"), SLOT(showToolWidget()), MENU_PARAMETERS, Qt::RightDockWidgetArea);
watchdogControlDockWidget = new QDockWidget(tr("Process Control"), this); watchdogControlDockWidget = new QDockWidget(tr("Process Control"), this);
watchdogControlDockWidget->setWidget( new WatchdogControl(this) ); watchdogControlDockWidget->setWidget( new WatchdogControl(this) );
addToToolsMenu (watchdogControlDockWidget, tr("Process Control"), SLOT(showToolWidget()), MENU_WATCHDOG, Qt::BottomDockWidgetArea);
hsiDockWidget = new QDockWidget(tr("Horizontal Situation Indicator"), this); hsiDockWidget = new QDockWidget(tr("Horizontal Situation Indicator"), this);
hsiDockWidget->setWidget( new HSIDisplay(this) ); hsiDockWidget->setWidget( new HSIDisplay(this) );
addToToolsMenu (hsiDockWidget, tr("HSI"), SLOT(showToolWidget()), MENU_HSI, Qt::BottomDockWidgetArea);
headDown1DockWidget = new QDockWidget(tr("Primary Flight Display"), this); headDown1DockWidget = new QDockWidget(tr("Primary Flight Display"), this);
headDown1DockWidget->setWidget( new HDDisplay(acceptList, this) ); headDown1DockWidget->setWidget( new HDDisplay(acceptList, this) );
addToToolsMenu (headDown1DockWidget, tr("Flight Display"), SLOT(showToolWidget()), MENU_HDD_1, Qt::RightDockWidgetArea);
headDown2DockWidget = new QDockWidget(tr("Payload Status"), this); headDown2DockWidget = new QDockWidget(tr("Payload Status"), this);
headDown2DockWidget->setWidget( new HDDisplay(acceptList2, this) ); headDown2DockWidget->setWidget( new HDDisplay(acceptList2, this) );
addToToolsMenu (headDown2DockWidget, tr("Payload Status"), SLOT(showToolWidget()), MENU_HDD_2, Qt::RightDockWidgetArea);
rcViewDockWidget = new QDockWidget(tr("Radio Control"), this); rcViewDockWidget = new QDockWidget(tr("Radio Control"), this);
rcViewDockWidget->setWidget( new QGCRemoteControlView(this) ); rcViewDockWidget->setWidget( new QGCRemoteControlView(this) );
addToToolsMenu (rcViewDockWidget, tr("Radio Control"), SLOT(showToolWidget()), MENU_RC_VIEW, Qt::BottomDockWidgetArea);
headUpDockWidget = new QDockWidget(tr("Control Indicator"), this); headUpDockWidget = new QDockWidget(tr("HUD"), this);
headUpDockWidget->setWidget( new HUD(320, 240, this)); headUpDockWidget->setWidget( new HUD(320, 240, this));
addToToolsMenu (headUpDockWidget, tr("Control Indicator"), SLOT(showToolWidget()), MENU_HUD, Qt::LeftDockWidgetArea);
// Dialogue widgets // Dialogue widgets
//FIXME: free memory in destructor //FIXME: free memory in destructor
...@@ -183,32 +200,154 @@ void MainWindow::buildSlugsWidgets() ...@@ -183,32 +200,154 @@ void MainWindow::buildSlugsWidgets()
{ {
// Center widgets // Center widgets
linechartWidget = new Linecharts(this); linechartWidget = new Linecharts(this);
hudWidget = new HUD(320, 240, this);
// Dock widgets // Dock widgets
headUpDockWidget = new QDockWidget(tr("Control Indicator"), this);
headUpDockWidget->setWidget( new HUD(320, 240, this));
addToToolsMenu (headUpDockWidget, tr("HUD"), SLOT(showToolWidget()), MENU_HUD, Qt::LeftDockWidgetArea);
rcViewDockWidget = new QDockWidget(tr("Radio Control"), this); rcViewDockWidget = new QDockWidget(tr("Radio Control"), this);
rcViewDockWidget->setWidget( new QGCRemoteControlView(this) ); rcViewDockWidget->setWidget( new QGCRemoteControlView(this) );
addToToolsMenu (rcViewDockWidget, tr("Radio Control"), SLOT(showToolWidget()), MENU_RC_VIEW, Qt::BottomDockWidgetArea);
headUpDockWidget = new QDockWidget(tr("Control Indicator"), this);
headUpDockWidget->setWidget( new HUD(320, 240, this));
// Dialog widgets // Dialog widgets
slugsDataWidget = new QDockWidget(tr("Slugs Data"), this); slugsDataWidget = new QDockWidget(tr("Slugs Data"), this);
slugsDataWidget->setWidget( new SlugsDataSensorView(this)); slugsDataWidget->setWidget( new SlugsDataSensorView(this));
addToToolsMenu (slugsDataWidget, tr("Telemetry Data"), SLOT(showToolWidget()), MENU_SLUGS_DATA, Qt::RightDockWidgetArea);
slugsPIDControlWidget = new QDockWidget(tr("PID Control"), this); slugsPIDControlWidget = new QDockWidget(tr("PID Control"), this);
slugsPIDControlWidget->setWidget(new SlugsPIDControl(this)); slugsPIDControlWidget->setWidget(new SlugsPIDControl(this));
addToToolsMenu (slugsPIDControlWidget, tr("PID Configuration"), SLOT(showToolWidget()), MENU_SLUGS_PID, Qt::LeftDockWidgetArea);
slugsHilSimWidget = new QDockWidget(tr("Slugs Hil Sim"), this); slugsHilSimWidget = new QDockWidget(tr("Slugs Hil Sim"), this);
slugsHilSimWidget->setWidget( new SlugsHilSim(this)); slugsHilSimWidget->setWidget( new SlugsHilSim(this));
addToToolsMenu (slugsHilSimWidget, tr("HIL Sim Configuration"), SLOT(showToolWidget()), MENU_SLUGS_HIL, Qt::LeftDockWidgetArea);
slugsCamControlWidget = new QDockWidget(tr("Video Camera Control"), this); slugsCamControlWidget = new QDockWidget(tr("Video Camera Control"), this);
slugsCamControlWidget->setWidget(new SlugsVideoCamControl(this)); slugsCamControlWidget->setWidget(new SlugsVideoCamControl(this));
addToToolsMenu (slugsCamControlWidget, tr("Camera Control"), SLOT(showToolWidget()), MENU_SLUGS_CAMERA, Qt::BottomDockWidgetArea);
} }
/** /**
* Connect the signals and slots of the common window widgets * Connect the signals and slots of the common window widgets
*/ */
void MainWindow::addToToolsMenu ( QWidget* widget,
const QString title,
const char * slotName,
TOOLS_WIDGET_NAMES tool,
Qt::DockWidgetArea location){
QAction* tempAction;
QString posKey, chKey;
tempAction = ui.menuTools->addAction(title);
tempAction->setCheckable(true);
tempAction->setData(tool);
// populate the Hashes
toolsMenuActions[tool] = tempAction;
dockWidgets[tool] = widget;
// Based on Settings check/uncheck
// Postion key = menu/widget/position/pos_value
posKey = buildMenuKey (SUB_SECTION_LOCATION,tool);
if (!settings.contains(posKey)){
settings.setValue(posKey,location);
dockWidgetLocations[tool] = location;
} else {
dockWidgetLocations[tool] = static_cast <Qt::DockWidgetArea> (settings.value(posKey).toInt());
}
// Checked key = menu/widget/checked/pos_value
chKey = buildMenuKey(SUB_SECTION_CHECKED,tool);
if (!settings.contains(chKey)){
settings.setValue(chKey,false);
tempAction->setChecked(false);
} else {
tempAction->setChecked(settings.value(chKey).toBool());
}
// connect the action
connect(tempAction,SIGNAL(triggered()),this, slotName);
connect(static_cast <QDockWidget *>(dockWidgets[tool]),
SIGNAL(visibilityChanged(bool)), this, SLOT(updateVisibilitySettings(bool)));
connect(static_cast <QDockWidget *>(dockWidgets[tool]),
SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(updateLocationSettings(Qt::DockWidgetArea)));
}
QString MainWindow::buildMenuKey(SETTINGS_SECTIONS section, TOOLS_WIDGET_NAMES tool){
return (QString::number(SECTION_MENU) + "/" +
QString::number(tool) + "/" +
QString::number(section) + "/" );
}
void MainWindow::showToolWidget(){
QAction* temp = qobject_cast<QAction *>(sender());
int tool = temp->data().toInt();
if (temp && dockWidgets[tool]){
if (temp->isChecked()){
addDockWidget(dockWidgetLocations[tool], static_cast <QDockWidget *> (dockWidgets[tool]));
static_cast <QDockWidget *>(dockWidgets[tool])->show();
} else {
removeDockWidget(static_cast <QDockWidget *>(dockWidgets[tool]));
}
QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(tool));
settings.setValue(chKey,temp->isChecked());
}
}
void MainWindow::updateVisibilitySettings (bool vis){
Q_UNUSED(vis);
// This is commented since when the application closes
// sets the visibility to false.
// TODO: A workaround is needed. The QApplication::aboutToQuit
// did not work
/*
QDockWidget* temp = qobject_cast<QDockWidget *>(sender());
QHashIterator<int, QWidget*> i(dockWidgets);
while (i.hasNext()) {
i.next();
if ((static_cast <QDockWidget *>(dockWidgets[i.key()])) == temp){
QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(i.key()));
qDebug() << "Key in visibility changed" << chKey;
settings.setValue(chKey,vis);
toolsMenuActions[i.key()]->setChecked(vis);
break;
}
}
*/
}
void MainWindow::updateLocationSettings (Qt::DockWidgetArea location){
QDockWidget* temp = qobject_cast<QDockWidget *>(sender());
QHashIterator<int, QWidget*> i(dockWidgets);
while (i.hasNext()) {
i.next();
if ((static_cast <QDockWidget *>(dockWidgets[i.key()])) == temp){
QString posKey = buildMenuKey (SUB_SECTION_LOCATION,static_cast<TOOLS_WIDGET_NAMES>(i.key()));
settings.setValue(posKey,location);
break;
}
}
}
void MainWindow::connectCommonWidgets() void MainWindow::connectCommonWidgets()
{ {
if (infoDockWidget && infoDockWidget->widget()) if (infoDockWidget && infoDockWidget->widget())
...@@ -278,8 +417,8 @@ void MainWindow::connectSlugsWidgets() ...@@ -278,8 +417,8 @@ void MainWindow::connectSlugsWidgets()
void MainWindow::arrangeCommonCenterStack() void MainWindow::arrangeCommonCenterStack()
{ {
centerStack = new QStackedWidget(this); centerStack = new QStackedWidget(this);
if (!centerStack) return; if (!centerStack) return;
if (mapWidget) centerStack->addWidget(mapWidget); if (mapWidget) centerStack->addWidget(mapWidget);
...@@ -444,62 +583,9 @@ void MainWindow::showStatusMessage(const QString& status) ...@@ -444,62 +583,9 @@ void MainWindow::showStatusMessage(const QString& status)
* *
**/ **/
void MainWindow::buildHelpMenu (){
QIcon icon;
icon = QIcon(":/images/apps/utilities-system-monitor.svg");
actionOnline_documentation = new QAction(icon,tr("Online Documentation"), this);
icon = QIcon(":/images/status/software-update-available.svg");
actionProject_Roadmap = new QAction(icon,tr("Project Roadmap"), this);
icon = QIcon(":/images/categories/preferences-system.svg");
actionCredits_Developers = new QAction(icon,tr("Developer Credits"), this);
helpMenu = ui.menuBar->addMenu(tr("Help"));
helpMenu->addAction(actionOnline_documentation);
helpMenu->addAction(actionProject_Roadmap);
helpMenu->addAction(actionCredits_Developers);
}
void MainWindow::buildViewsMenu (){
QIcon icon;
icon = QIcon(":/images/status/weather-overcast.svg");
actionFlightView = new QAction(icon,"Flight View", this);
icon = QIcon(":/images/apps/utilities-system-monitor.svg");
actionEngineerView = new QAction(icon,"Engineer View", this);
icon = QIcon(":/images/status/network-wireless-encrypted.svg");
actionCalibrationView = new QAction(icon,"Calibration View", this);
icon = QIcon(":/images/devices/network-wired.svg");
actionMavlinkView = new QAction(icon,"Mavlink View", this);
icon = QIcon(":/images/categories/applications-internet.svg");
actionReloadStyle = new QAction(icon,"Reload Style", this);
viewsMenu = ui.menuBar->addMenu("Views");
viewsMenu->addAction(actionFlightView);
viewsMenu->addAction(actionEngineerView);
viewsMenu->addAction(actionCalibrationView);
viewsMenu->addSeparator();
viewsMenu->addAction(actionMavlinkView);
viewsMenu->addAction(actionReloadStyle);
}
void MainWindow::connectCommonActions() void MainWindow::connectCommonActions()
{ {
buildViewsMenu();
buildHelpMenu();
// Connect actions from ui // Connect actions from ui
connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink())); connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink()));
...@@ -516,18 +602,17 @@ void MainWindow::connectCommonActions() ...@@ -516,18 +602,17 @@ void MainWindow::connectCommonActions()
connect(ui.actionConfiguration, SIGNAL(triggered()), UASManager::instance(), SLOT(configureActiveUAS())); connect(ui.actionConfiguration, SIGNAL(triggered()), UASManager::instance(), SLOT(configureActiveUAS()));
// Views actions // Views actions
connect(actionFlightView, SIGNAL(triggered()), this, SLOT(loadPilotView())); connect(ui.actionFlightView, SIGNAL(triggered()), this, SLOT(loadPilotView()));
connect(actionEngineerView, SIGNAL(triggered()), this, SLOT(loadEngineerView())); connect(ui.actionEngineersView, SIGNAL(triggered()), this, SLOT(loadEngineerView()));
connect(actionCalibrationView, SIGNAL(triggered()), this, SLOT(loadOperatorView())); connect(ui.actionCalibrationView, SIGNAL(triggered()), this, SLOT(loadOperatorView()));
connect(actionMavlinkView, SIGNAL(triggered()), this, SLOT(loadMAVLinkView())); connect(ui.actionMavlinkView, SIGNAL(triggered()), this, SLOT(loadMAVLinkView()));
connect(actionReloadStyle, SIGNAL(triggered()), this, SLOT(reloadStylesheet())); connect(ui.actionReloadStyle, SIGNAL(triggered()), this, SLOT(reloadStylesheet()));
// Help Actions // Help Actions
connect(actionOnline_documentation, SIGNAL(triggered()), this, SLOT(showHelp())); connect(ui.actionOnline_documentation, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(actionCredits_Developers, SIGNAL(triggered()), this, SLOT(showCredits())); connect(ui.actionDeveloper_Credits, SIGNAL(triggered()), this, SLOT(showCredits()));
connect(actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap())); connect(ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap()));
} }
...@@ -877,13 +962,16 @@ void MainWindow::loadPixhawkEngineerView() ...@@ -877,13 +962,16 @@ void MainWindow::loadPixhawkEngineerView()
// 3D map // 3D map
if (_3DWidget) if (_3DWidget)
{ {
QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
if (centerStack) if (centerStack)
{ {
//map3DWidget->setActive(true); //map3DWidget->setActive(true);
centerStack->setCurrentWidget(_3DWidget); centerStack->setCurrentWidget(_3DWidget);
} }
} }
#else
if (centerStack && linechartWidget){
centerStack->addWidget(linechartWidget);
}
#endif #endif
// UAS CONTROL // UAS CONTROL
...@@ -1290,9 +1378,13 @@ void MainWindow::load3DView() ...@@ -1290,9 +1378,13 @@ void MainWindow::load3DView()
void MainWindow::loadEngineerView() void MainWindow::loadEngineerView()
{ {
clearView(); clearView();
// Engineer view, used in EMAV2009 // If there is no mav dont siwtch view
int selector = (UASManager::instance()->getActiveUAS())?
UASManager::instance()->getActiveUAS()->getAutopilotType() :
255;
switch (selector){
switch (UASManager::instance()->getActiveUAS()->getAutopilotType()){
case (MAV_AUTOPILOT_GENERIC): case (MAV_AUTOPILOT_GENERIC):
case (MAV_AUTOPILOT_ARDUPILOTMEGA): case (MAV_AUTOPILOT_ARDUPILOTMEGA):
case (MAV_AUTOPILOT_PIXHAWK): case (MAV_AUTOPILOT_PIXHAWK):
...@@ -1320,9 +1412,35 @@ void MainWindow::loadMAVLinkView() ...@@ -1320,9 +1412,35 @@ void MainWindow::loadMAVLinkView()
} }
} }
// TODO: Refactor this code to single function calls
showTheWidget(MENU_UAS_CONTROL);
showTheWidget(MENU_UAS_LIST);
showTheWidget(MENU_WAYPOINTS);
showTheWidget(MENU_STATUS);
showTheWidget(MENU_DEBUG_CONSOLE);
this->show(); this->show();
} }
void MainWindow::showTheWidget (TOOLS_WIDGET_NAMES widget){
bool tempVisible;
Qt::DockWidgetArea tempLocation;
QDockWidget* tempWidget = static_cast <QDockWidget *>(dockWidgets[widget]);
tempVisible = settings.value(buildMenuKey (SUB_SECTION_CHECKED,widget)).toBool();
tempLocation = static_cast <Qt::DockWidgetArea>(settings.value(buildMenuKey (SUB_SECTION_LOCATION,widget)).toInt());
if (tempWidget && tempVisible){
addDockWidget(tempLocation, tempWidget);
tempWidget->show();
}
}
void MainWindow::loadAllView() void MainWindow::loadAllView()
{ {
clearView(); clearView();
...@@ -1415,7 +1533,7 @@ void MainWindow::loadAllView() ...@@ -1415,7 +1533,7 @@ void MainWindow::loadAllView()
void MainWindow::loadWidgets() void MainWindow::loadWidgets()
{ {
//loadOperatorView(); //loadOperatorView();
loadEngineerView(); loadMAVLinkView();
//loadPilotView(); //loadPilotView();
} }
......
...@@ -148,7 +148,70 @@ public slots: ...@@ -148,7 +148,70 @@ public slots:
/** @brief Reload the CSS style sheet */ /** @brief Reload the CSS style sheet */
void reloadStylesheet(); void reloadStylesheet();
void showToolWidget();
void updateVisibilitySettings (bool vis);
void updateLocationSettings (Qt::DockWidgetArea location);
protected: protected:
// These defines are used to save the settings when selecting with
// which widgets populate the views
// FIXME: DO NOT PUT CUSTOM VALUES IN THIS ENUM since it is iterated over
// this will be fixed in a future release.
typedef enum _TOOLS_WIDGET_NAMES {
MENU_UAS_CONTROL,
MENU_UAS_INFO,
MENU_CAMERA,
MENU_UAS_LIST,
MENU_WAYPOINTS,
MENU_STATUS,
MENU_DETECTION,
MENU_DEBUG_CONSOLE,
MENU_PARAMETERS,
MENU_HDD_1,
MENU_HDD_2,
MENU_WATCHDOG,
MENU_HUD,
MENU_HSI,
MENU_RC_VIEW,
MENU_SLUGS_DATA,
MENU_SLUGS_PID,
MENU_SLUGS_HIL,
MENU_SLUGS_CAMERA,
CENTRAL_LINECHART = 255, // Separation from dockwidgets and central widgets
CENTRAL_PROTOCOL,
CENTRAL_MAP,
CENTRAL_3D_LOCAL,
CENTRAL_3D_MAP,
CENTRAL_GOOGLE_EARTH,
CENTRAL_HUD,
CENTRAL_DATA_PLOT,
}TOOLS_WIDGET_NAMES;
typedef enum _SETTINGS_SECTIONS {
SECTION_MENU,
VIEW_ENGINEER,
VIEW_OPERATOR,
VIEW_CALIBRATION,
VIEW_MAVLINK,
SUB_SECTION_CHECKED,
SUB_SECTION_LOCATION,
} SETTINGS_SECTIONS;
QHash<int, QAction*> toolsMenuActions; // Holds ptr to the Menu Actions
QHash<int, QWidget*> dockWidgets; // Holds ptr to the Actual Dock widget
QHash<int, Qt::DockWidgetArea> dockWidgetLocations; // Holds the location
void addToToolsMenu (QWidget* widget, const QString title, const char * slotName, TOOLS_WIDGET_NAMES tool, Qt::DockWidgetArea location);
void showTheWidget (TOOLS_WIDGET_NAMES widget);
int currentView;
int aboutToQuit;
//QHash<int, QString> settingsSections;
QStatusBar* statusBar; QStatusBar* statusBar;
QStatusBar* createStatusBar(); QStatusBar* createStatusBar();
void loadWidgets(); void loadWidgets();
...@@ -174,8 +237,6 @@ protected: ...@@ -174,8 +237,6 @@ protected:
void configureWindowName(); void configureWindowName();
void buildHelpMenu ();
void buildViewsMenu ();
// TODO Should be moved elsewhere, as the protocol does not belong to the UI // TODO Should be moved elsewhere, as the protocol does not belong to the UI
MAVLinkProtocol* mavlink; MAVLinkProtocol* mavlink;
...@@ -234,17 +295,7 @@ protected: ...@@ -234,17 +295,7 @@ protected:
QAction* stopUASAct; QAction* stopUASAct;
QAction* killUASAct; QAction* killUASAct;
QAction* simulateUASAct; QAction* simulateUASAct;
QAction* actionOnline_documentation;
QAction* actionProject_Roadmap;
QAction* actionCredits_Developers;
QAction* actionCalibrationView;
QAction* actionEngineerView;
QAction* actionFlightView;
QAction* actionMavlinkView;
QAction* actionReloadStyle;
QMenu* helpMenu;
QMenu* viewsMenu;
LogCompressor* comp; LogCompressor* comp;
QString screenFileName; QString screenFileName;
...@@ -253,6 +304,8 @@ protected: ...@@ -253,6 +304,8 @@ protected:
private: private:
Ui::MainWindow ui; Ui::MainWindow ui;
QString buildMenuKey (SETTINGS_SECTIONS section , TOOLS_WIDGET_NAMES tool);
}; };
#endif /* _MAINWINDOW_H_ */ #endif /* _MAINWINDOW_H_ */
...@@ -80,12 +80,34 @@ ...@@ -80,12 +80,34 @@
<property name="title"> <property name="title">
<string>Tools</string> <string>Tools</string>
</property> </property>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionOnline_Documentation"/>
<addaction name="actionProject_Roadmap_2"/>
<addaction name="actionDeveloper_Credits"/>
</widget>
<widget class="QMenu" name="menuPerspectives">
<property name="title">
<string>Perspectives</string>
</property>
<addaction name="actionFlightView"/>
<addaction name="actionEngineersView"/>
<addaction name="actionCalibrationView"/>
<addaction name="separator"/>
<addaction name="actionMavlinkView"/>
<addaction name="actionReloadStyle"/>
</widget> </widget>
<addaction name="menuMGround"/> <addaction name="menuMGround"/>
<addaction name="menuNetwork"/> <addaction name="menuNetwork"/>
<addaction name="menuConnected_Systems"/> <addaction name="menuConnected_Systems"/>
<addaction name="menuUnmanned_System"/> <addaction name="menuUnmanned_System"/>
<addaction name="menuTools"/> <addaction name="menuTools"/>
<addaction name="menuPerspectives"/>
<addaction name="menuHelp"/>
</widget> </widget>
<widget class="QToolBar" name="mainToolBar"> <widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea"> <attribute name="toolBarArea">
...@@ -344,6 +366,78 @@ ...@@ -344,6 +366,78 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="actionOnline_Documentation">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
<string>Online Documentation</string>
</property>
</action>
<action name="actionProject_Roadmap_2">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/software-update-available.svg</normaloff>:/images/status/software-update-available.svg</iconset>
</property>
<property name="text">
<string>Project Roadmap</string>
</property>
</action>
<action name="actionDeveloper_Credits">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/preferences-system.svg</normaloff>:/images/categories/preferences-system.svg</iconset>
</property>
<property name="text">
<string>Developer Credits</string>
</property>
</action>
<action name="actionFlightView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/weather-overcast.svg</normaloff>:/images/status/weather-overcast.svg</iconset>
</property>
<property name="text">
<string>Flight</string>
</property>
</action>
<action name="actionEngineersView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
<string>Engineer</string>
</property>
</action>
<action name="actionMavlinkView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/network-wired.svg</normaloff>:/images/devices/network-wired.svg</iconset>
</property>
<property name="text">
<string>Mavlink</string>
</property>
</action>
<action name="actionReloadStyle">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Reload Style</string>
</property>
</action>
<action name="actionCalibrationView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/network-wireless-encrypted.svg</normaloff>:/images/status/network-wireless-encrypted.svg</iconset>
</property>
<property name="text">
<string>Calibration</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
......
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