Skip to content

Commit

Permalink
File/Widgets menu are only in advanced mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Donald Gagne authored and Donald Gagne committed Mar 28, 2017
1 parent e7c302d commit 2d714ea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/ui/MainWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "LogCompressor.h"
#include "UAS.h"
#include "QGCImageProvider.h"
#include "QGCCorePlugin.h"

#ifndef __mobile__
#include "Linecharts.h"
Expand Down Expand Up @@ -175,6 +176,9 @@ MainWindow::MainWindow()
_ui.menuWidgets->addAction(qmlTestAction);
#endif

connect(qgcApp()->toolbox()->corePlugin(), &QGCCorePlugin::showAdvancedUIChanged, this, &MainWindow::_showAdvancedUIChanged);
_showAdvancedUIChanged(qgcApp()->toolbox()->corePlugin()->showAdvancedUI());

// Status Bar
setStatusBar(new QStatusBar(this));
statusBar()->setSizeGripEnabled(true);
Expand Down Expand Up @@ -558,3 +562,13 @@ QObject* MainWindow::rootQmlObject(void)
{
return _mainQmlWidgetHolder->getRootObject();
}

void MainWindow::_showAdvancedUIChanged(bool advanced)
{
if (advanced) {
menuBar()->addMenu(_ui.menuFile);
menuBar()->addMenu(_ui.menuWidgets);
} else {
menuBar()->clear();
}
}
1 change: 1 addition & 0 deletions src/ui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ private slots:
void _closeWindow(void) { close(); }
void _vehicleAdded(Vehicle* vehicle);
void _showDockWidgetAction(bool show);
void _showAdvancedUIChanged(bool advanced);

#ifdef UNITTEST_BUILD
void _showQmlTestWidget(void);
Expand Down
6 changes: 3 additions & 3 deletions src/ui/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
Expand All @@ -68,7 +68,7 @@
<string>Widgets</string>
</property>
</widget>
<addaction name="menuMGround"/>
<addaction name="menuFile"/>
<addaction name="menuWidgets"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
Expand Down Expand Up @@ -98,7 +98,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>Show Status Bar</string>
<string>Replay Flight Data</string>
</property>
</action>
</widget>
Expand Down

0 comments on commit 2d714ea

Please sign in to comment.