Browse Source

Disabled movement of dock widges, unless in "Advanced Mode" (File->Advanced Mode)

QGC4.4
Michael Carpenter 12 years ago
parent
commit
434ac62110
  1. 65
      src/ui/MainWindow.cc
  2. 4
      src/ui/MainWindow.h
  3. 14
      src/ui/MainWindow.ui

65
src/ui/MainWindow.cc

@ -104,6 +104,7 @@ MainWindow::MainWindow(QWidget *parent):
lowPowerMode(false) lowPowerMode(false)
{ {
hide(); hide();
isAdvancedMode = false;
emit initStatusChanged("Loading UI Settings.."); emit initStatusChanged("Loading UI Settings..");
loadSettings(); loadSettings();
if (!settings.contains("CURRENT_VIEW")) if (!settings.contains("CURRENT_VIEW"))
@ -163,12 +164,13 @@ MainWindow::MainWindow(QWidget *parent):
actions << ui.actionPilotsView; actions << ui.actionPilotsView;
actions << ui.actionEngineersView; actions << ui.actionEngineersView;
actions << ui.actionSimulation_View; actions << ui.actionSimulation_View;
actions << ui.actionConfiguration_2;
toolBar->setPerspectiveChangeActions(actions); toolBar->setPerspectiveChangeActions(actions);
customStatusBar = new QGCStatusBar(this); customStatusBar = new QGCStatusBar(this);
setStatusBar(customStatusBar); setStatusBar(customStatusBar);
statusBar()->setSizeGripEnabled(true); statusBar()->setSizeGripEnabled(true);
toolBar->addPerspectiveChangeAction(ui.actionConfiguration_2);
emit initStatusChanged("Building common widgets."); emit initStatusChanged("Building common widgets.");
@ -387,6 +389,8 @@ void MainWindow::buildCommonWidgets()
if (!controlDockWidget) if (!controlDockWidget)
{ {
controlDockWidget = new QDockWidget(tr("Control"), this); controlDockWidget = new QDockWidget(tr("Control"), this);
dockToTitleBarMap[controlDockWidget] = controlDockWidget->titleBarWidget();
controlDockWidget->setTitleBarWidget(new QWidget(this));
controlDockWidget->setObjectName("UNMANNED_SYSTEM_CONTROL_DOCKWIDGET"); controlDockWidget->setObjectName("UNMANNED_SYSTEM_CONTROL_DOCKWIDGET");
controlDockWidget->setWidget( new UASControlWidget(this) ); controlDockWidget->setWidget( new UASControlWidget(this) );
addTool(controlDockWidget, tr("Control"), Qt::LeftDockWidgetArea); addTool(controlDockWidget, tr("Control"), Qt::LeftDockWidgetArea);
@ -394,7 +398,9 @@ void MainWindow::buildCommonWidgets()
if (!listDockWidget) if (!listDockWidget)
{ {
listDockWidget = new QDockWidget(tr("Unmanned Systems"), this); listDockWidget = new QDockWidget(/*tr("Unmanned Systems"), */this);
dockToTitleBarMap[listDockWidget] = listDockWidget->titleBarWidget();
listDockWidget->setTitleBarWidget(new QWidget(this));
listDockWidget->setWidget( new UASListWidget(this) ); listDockWidget->setWidget( new UASListWidget(this) );
listDockWidget->setObjectName("UNMANNED_SYSTEMS_LIST_DOCKWIDGET"); listDockWidget->setObjectName("UNMANNED_SYSTEMS_LIST_DOCKWIDGET");
addTool(listDockWidget, tr("Unmanned Systems"), Qt::RightDockWidgetArea); addTool(listDockWidget, tr("Unmanned Systems"), Qt::RightDockWidgetArea);
@ -404,6 +410,8 @@ void MainWindow::buildCommonWidgets()
{ {
waypointsDockWidget = new QDockWidget(tr("Mission Plan"), this); waypointsDockWidget = new QDockWidget(tr("Mission Plan"), this);
waypointsDockWidget->setWidget( new QGCWaypointListMulti(this) ); waypointsDockWidget->setWidget( new QGCWaypointListMulti(this) );
dockToTitleBarMap[waypointsDockWidget] = waypointsDockWidget->titleBarWidget();
waypointsDockWidget->setTitleBarWidget(new QWidget(this));
waypointsDockWidget->setObjectName("WAYPOINT_LIST_DOCKWIDGET"); waypointsDockWidget->setObjectName("WAYPOINT_LIST_DOCKWIDGET");
addTool(waypointsDockWidget, tr("Mission Plan"), Qt::BottomDockWidgetArea); addTool(waypointsDockWidget, tr("Mission Plan"), Qt::BottomDockWidgetArea);
} }
@ -411,6 +419,8 @@ void MainWindow::buildCommonWidgets()
if (!infoDockWidget) if (!infoDockWidget)
{ {
infoDockWidget = new QDockWidget(tr("Status Details"), this); infoDockWidget = new QDockWidget(tr("Status Details"), this);
dockToTitleBarMap[infoDockWidget] = infoDockWidget->titleBarWidget();
infoDockWidget->setTitleBarWidget(new QWidget(this));
infoDockWidget->setWidget( new UASInfoWidget(this) ); infoDockWidget->setWidget( new UASInfoWidget(this) );
infoDockWidget->setObjectName("UAS_STATUS_DETAILS_DOCKWIDGET"); infoDockWidget->setObjectName("UAS_STATUS_DETAILS_DOCKWIDGET");
addTool(infoDockWidget, tr("Status Details"), Qt::RightDockWidgetArea); addTool(infoDockWidget, tr("Status Details"), Qt::RightDockWidgetArea);
@ -419,6 +429,8 @@ void MainWindow::buildCommonWidgets()
if (!debugConsoleDockWidget) if (!debugConsoleDockWidget)
{ {
debugConsoleDockWidget = new QDockWidget(tr("Communication Console"), this); debugConsoleDockWidget = new QDockWidget(tr("Communication Console"), this);
dockToTitleBarMap[debugConsoleDockWidget] = debugConsoleDockWidget->titleBarWidget();
debugConsoleDockWidget->setTitleBarWidget(new QWidget(this));
debugConsoleDockWidget->setWidget( new DebugConsole(this) ); debugConsoleDockWidget->setWidget( new DebugConsole(this) );
debugConsoleDockWidget->setObjectName("COMMUNICATION_DEBUG_CONSOLE_DOCKWIDGET"); debugConsoleDockWidget->setObjectName("COMMUNICATION_DEBUG_CONSOLE_DOCKWIDGET");
@ -441,6 +453,8 @@ void MainWindow::buildCommonWidgets()
if (!mavlinkInspectorWidget) if (!mavlinkInspectorWidget)
{ {
mavlinkInspectorWidget = new QDockWidget(tr("MAVLink Message Inspector"), this); mavlinkInspectorWidget = new QDockWidget(tr("MAVLink Message Inspector"), this);
dockToTitleBarMap[mavlinkInspectorWidget] = mavlinkInspectorWidget->titleBarWidget();
mavlinkInspectorWidget->setTitleBarWidget(new QWidget(this));
mavlinkInspectorWidget->setWidget( new QGCMAVLinkInspector(mavlink, this) ); mavlinkInspectorWidget->setWidget( new QGCMAVLinkInspector(mavlink, this) );
mavlinkInspectorWidget->setObjectName("MAVLINK_INSPECTOR_DOCKWIDGET"); mavlinkInspectorWidget->setObjectName("MAVLINK_INSPECTOR_DOCKWIDGET");
addTool(mavlinkInspectorWidget, tr("MAVLink Inspector"), Qt::RightDockWidgetArea); addTool(mavlinkInspectorWidget, tr("MAVLink Inspector"), Qt::RightDockWidgetArea);
@ -467,6 +481,8 @@ void MainWindow::buildCommonWidgets()
if (!parametersDockWidget) if (!parametersDockWidget)
{ {
parametersDockWidget = new QDockWidget(tr("Onboard Parameters"), this); parametersDockWidget = new QDockWidget(tr("Onboard Parameters"), this);
dockToTitleBarMap[parametersDockWidget] = parametersDockWidget->titleBarWidget();
parametersDockWidget->setTitleBarWidget(new QWidget(this));
parametersDockWidget->setWidget( new ParameterInterface(this) ); parametersDockWidget->setWidget( new ParameterInterface(this) );
parametersDockWidget->setObjectName("PARAMETER_INTERFACE_DOCKWIDGET"); parametersDockWidget->setObjectName("PARAMETER_INTERFACE_DOCKWIDGET");
addTool(parametersDockWidget, tr("Onboard Parameters"), Qt::RightDockWidgetArea); addTool(parametersDockWidget, tr("Onboard Parameters"), Qt::RightDockWidgetArea);
@ -475,6 +491,8 @@ void MainWindow::buildCommonWidgets()
if (!hsiDockWidget) if (!hsiDockWidget)
{ {
hsiDockWidget = new QDockWidget(tr("Horizontal Situation Indicator"), this); hsiDockWidget = new QDockWidget(tr("Horizontal Situation Indicator"), this);
dockToTitleBarMap[hsiDockWidget] = hsiDockWidget->titleBarWidget();
hsiDockWidget->setTitleBarWidget(new QWidget(this));
hsiDockWidget->setWidget( new HSIDisplay(this) ); hsiDockWidget->setWidget( new HSIDisplay(this) );
hsiDockWidget->setObjectName("HORIZONTAL_SITUATION_INDICATOR_DOCK_WIDGET"); hsiDockWidget->setObjectName("HORIZONTAL_SITUATION_INDICATOR_DOCK_WIDGET");
addTool(hsiDockWidget, tr("Horizontal Situation"), Qt::BottomDockWidgetArea); addTool(hsiDockWidget, tr("Horizontal Situation"), Qt::BottomDockWidgetArea);
@ -483,6 +501,8 @@ void MainWindow::buildCommonWidgets()
if (!headDown1DockWidget) if (!headDown1DockWidget)
{ {
headDown1DockWidget = new QDockWidget(tr("Flight Display"), this); headDown1DockWidget = new QDockWidget(tr("Flight Display"), this);
dockToTitleBarMap[headDown1DockWidget] = headDown1DockWidget->titleBarWidget();
headDown1DockWidget->setTitleBarWidget(new QWidget(this));
HDDisplay* hdDisplay = new HDDisplay(acceptList, "Flight Display", this); HDDisplay* hdDisplay = new HDDisplay(acceptList, "Flight Display", this);
hdDisplay->addSource(mavlinkDecoder); hdDisplay->addSource(mavlinkDecoder);
headDown1DockWidget->setWidget(hdDisplay); headDown1DockWidget->setWidget(hdDisplay);
@ -493,6 +513,8 @@ void MainWindow::buildCommonWidgets()
if (!headDown2DockWidget) if (!headDown2DockWidget)
{ {
headDown2DockWidget = new QDockWidget(tr("Actuator Status"), this); headDown2DockWidget = new QDockWidget(tr("Actuator Status"), this);
dockToTitleBarMap[headDown2DockWidget] = headDown2DockWidget->titleBarWidget();
headDown2DockWidget->setTitleBarWidget(new QWidget(this));
HDDisplay* hdDisplay = new HDDisplay(acceptList2, "Actuator Status", this); HDDisplay* hdDisplay = new HDDisplay(acceptList2, "Actuator Status", this);
hdDisplay->addSource(mavlinkDecoder); hdDisplay->addSource(mavlinkDecoder);
headDown2DockWidget->setWidget(hdDisplay); headDown2DockWidget->setWidget(hdDisplay);
@ -503,6 +525,8 @@ void MainWindow::buildCommonWidgets()
if (!rcViewDockWidget) if (!rcViewDockWidget)
{ {
rcViewDockWidget = new QDockWidget(tr("Radio Control"), this); rcViewDockWidget = new QDockWidget(tr("Radio Control"), this);
dockToTitleBarMap[rcViewDockWidget] = rcViewDockWidget->titleBarWidget();
rcViewDockWidget->setTitleBarWidget(new QWidget(this));
rcViewDockWidget->setWidget( new QGCRemoteControlView(this) ); rcViewDockWidget->setWidget( new QGCRemoteControlView(this) );
rcViewDockWidget->setObjectName("RADIO_CONTROL_CHANNELS_DOCK_WIDGET"); rcViewDockWidget->setObjectName("RADIO_CONTROL_CHANNELS_DOCK_WIDGET");
addTool(rcViewDockWidget, tr("Radio Control"), Qt::BottomDockWidgetArea); addTool(rcViewDockWidget, tr("Radio Control"), Qt::BottomDockWidgetArea);
@ -511,6 +535,8 @@ void MainWindow::buildCommonWidgets()
if (!headUpDockWidget) if (!headUpDockWidget)
{ {
headUpDockWidget = new QDockWidget(tr("HUD"), this); headUpDockWidget = new QDockWidget(tr("HUD"), this);
dockToTitleBarMap[headUpDockWidget] = headUpDockWidget->titleBarWidget();
headUpDockWidget->setTitleBarWidget(new QWidget(this));
headUpDockWidget->setWidget( new HUD(320, 240, this)); headUpDockWidget->setWidget( new HUD(320, 240, this));
headUpDockWidget->setObjectName("HEAD_UP_DISPLAY_DOCK_WIDGET"); headUpDockWidget->setObjectName("HEAD_UP_DISPLAY_DOCK_WIDGET");
addTool(headUpDockWidget, tr("Head Up Display"), Qt::RightDockWidgetArea); addTool(headUpDockWidget, tr("Head Up Display"), Qt::RightDockWidgetArea);
@ -519,6 +545,8 @@ void MainWindow::buildCommonWidgets()
if (!video1DockWidget) if (!video1DockWidget)
{ {
video1DockWidget = new QDockWidget(tr("Video Stream 1"), this); video1DockWidget = new QDockWidget(tr("Video Stream 1"), this);
dockToTitleBarMap[video1DockWidget] = video1DockWidget->titleBarWidget();
video1DockWidget->setTitleBarWidget(new QWidget(this));
QGCRGBDView* video1 = new QGCRGBDView(160, 120, this); QGCRGBDView* video1 = new QGCRGBDView(160, 120, this);
video1->enableHUDInstruments(false); video1->enableHUDInstruments(false);
video1->enableVideo(false); video1->enableVideo(false);
@ -531,6 +559,8 @@ void MainWindow::buildCommonWidgets()
if (!video2DockWidget) if (!video2DockWidget)
{ {
video2DockWidget = new QDockWidget(tr("Video Stream 2"), this); video2DockWidget = new QDockWidget(tr("Video Stream 2"), this);
dockToTitleBarMap[video2DockWidget] = video2DockWidget->titleBarWidget();
video2DockWidget->setTitleBarWidget(new QWidget(this));
QGCRGBDView* video2 = new QGCRGBDView(160, 120, this); QGCRGBDView* video2 = new QGCRGBDView(160, 120, this);
video2->enableHUDInstruments(false); video2->enableHUDInstruments(false);
video2->enableVideo(false); video2->enableVideo(false);
@ -1049,6 +1079,7 @@ void MainWindow::connectCommonActions()
perspectives->addAction(ui.actionPilotsView); perspectives->addAction(ui.actionPilotsView);
perspectives->addAction(ui.actionSimulation_View); perspectives->addAction(ui.actionSimulation_View);
perspectives->addAction(ui.actionOperatorsView); perspectives->addAction(ui.actionOperatorsView);
perspectives->addAction(ui.actionConfiguration_2);
perspectives->addAction(ui.actionFirmwareUpdateView); perspectives->addAction(ui.actionFirmwareUpdateView);
perspectives->addAction(ui.actionUnconnectedView); perspectives->addAction(ui.actionUnconnectedView);
perspectives->setExclusive(true); perspectives->setExclusive(true);
@ -1072,6 +1103,7 @@ void MainWindow::connectCommonActions()
// 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()));
connect(ui.actionAdvanced_Mode,SIGNAL(triggered()),this,SLOT(setAdvancedMode()));
// Connect internal actions // Connect internal actions
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(UASCreated(UASInterface*))); connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(UASCreated(UASInterface*)));
@ -1688,6 +1720,35 @@ void MainWindow::loadViewState()
restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion()); restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion());
} }
} }
void MainWindow::setAdvancedMode()
{
if (!isAdvancedMode)
{
ui.actionAdvanced_Mode->setChecked(true);
isAdvancedMode = true;
for (QMap<QDockWidget*,QWidget*>::const_iterator i=dockToTitleBarMap.constBegin();i!=dockToTitleBarMap.constEnd();i++)
{
//QWidget *widget = i.value();
QWidget *widget = i.key()->titleBarWidget();
i.key()->setTitleBarWidget(i.value());
dockToTitleBarMap[i.key()] = widget;
}
}
else
{
ui.actionAdvanced_Mode->setChecked(false);
isAdvancedMode = false;
for (QMap<QDockWidget*,QWidget*>::const_iterator i=dockToTitleBarMap.constBegin();i!=dockToTitleBarMap.constEnd();i++)
{
//QWidget *widget = i.value();
QWidget *widget = i.key()->titleBarWidget();
i.key()->setTitleBarWidget(i.value());
dockToTitleBarMap[i.key()] = widget;
}
}
}
void MainWindow::loadEngineerView() void MainWindow::loadEngineerView()
{ {

4
src/ui/MainWindow.h

@ -155,6 +155,8 @@ public slots:
void stopVideoCapture(); void stopVideoCapture();
void saveScreen(); void saveScreen();
/** @brief Sets advanced mode, allowing for editing of tool widget locations */
void setAdvancedMode();
/** @brief Load configuration view */ /** @brief Load configuration view */
void loadConfigurationView(); void loadConfigurationView();
/** @brief Load default view when no MAV is connected */ /** @brief Load default view when no MAV is connected */
@ -419,6 +421,8 @@ protected:
QTimer windowNameUpdateTimer; QTimer windowNameUpdateTimer;
private: private:
QMap<QDockWidget*,QWidget*> dockToTitleBarMap;
bool isAdvancedMode;
Ui::MainWindow ui; Ui::MainWindow ui;
QString getWindowStateKey(); QString getWindowStateKey();

14
src/ui/MainWindow.ui

@ -72,6 +72,7 @@
<addaction name="actionJoystickSettings"/> <addaction name="actionJoystickSettings"/>
<addaction name="actionSettings"/> <addaction name="actionSettings"/>
<addaction name="menuPreferences"/> <addaction name="menuPreferences"/>
<addaction name="actionAdvanced_Mode"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
</widget> </widget>
@ -467,9 +468,12 @@
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Open the simulation view</string> <string>Open the simulation view</string>
</property> </property>
</action> </action>
<action name="actionConfiguration_2"> <action name="actionConfiguration_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="../../qgroundcontrol.qrc"> <iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/categories/preferences-system.svg</normaloff>:/files/images/categories/preferences-system.svg</iconset> <normaloff>:/files/images/categories/preferences-system.svg</normaloff>:/files/images/categories/preferences-system.svg</iconset>
@ -478,6 +482,14 @@
<string>Configuration</string> <string>Configuration</string>
</property> </property>
</action> </action>
<action name="actionAdvanced_Mode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Advanced Mode</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>

Loading…
Cancel
Save