Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
ab7869ce
Commit
ab7869ce
authored
Dec 28, 2010
by
Mariano Lizarraga
Browse files
Merge branch 'experimental' of git@github.com:pixhawk/qgroundcontrol into mergeRemote
parents
1059752a
cf1558b0
Changes
37
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
ab7869ce
...
...
@@ -249,7 +249,8 @@ HEADERS += src/MG.h \
src
/
ui
/
SlugsHilSim
.
h
\
src
/
ui
/
SlugsPIDControl
.
h
\
src
/
ui
/
SlugsVideoCamControl
.
h
\
src
/
ui
/
SlugsPadCameraControl
.
h
src
/
ui
/
SlugsPadCameraControl
.
h
\
src
/
ui
/
QGCMainWindowAPConfigurator
.
h
contains
(
DEPENDENCIES_PRESENT
,
osg
)
{
message
(
"Including headers for OpenSceneGraph"
)
...
...
@@ -359,7 +360,8 @@ SOURCES += src/main.cc \
src
/
ui
/
SlugsHilSim
.
cc
\
src
/
ui
/
SlugsPIDControl
.
cpp
\
src
/
ui
/
SlugsVideoCamControl
.
cpp
\
src
/
ui
/
SlugsPadCameraControl
.
cpp
src
/
ui
/
SlugsPadCameraControl
.
cpp
\
src
/
ui
/
QGCMainWindowAPConfigurator
.
cc
contains
(
DEPENDENCIES_PRESENT
,
osg
)
{
message
(
"Including sources for OpenSceneGraph"
)
...
...
src/Core.cc
View file @
ab7869ce
...
...
@@ -157,6 +157,9 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
**/
Core
::~
Core
()
{
//mainWindow->storeSettings();
mainWindow
->
hide
();
mainWindow
->
deleteLater
();
// Delete singletons
delete
LinkManager
::
instance
();
delete
UASManager
::
instance
();
...
...
src/QGC.h
View file @
ab7869ce
...
...
@@ -14,6 +14,9 @@ namespace QGC
/** @brief Get the current ground time in microseconds */
quint64
groundTimeUsecs
();
const
QString
APPNAME
=
"QGROUNDCONTROL"
;
const
QString
COMPANYNAME
=
"OPENMAV"
;
}
#endif // QGC_H
src/comm/LinkManager.cc
View file @
ab7869ce
...
...
@@ -32,6 +32,7 @@ This file is part of the QGROUNDCONTROL project
#include
<QList>
#include
<QApplication>
#include
"LinkManager.h"
#include
<iostream>
#include
<QDebug>
...
...
@@ -65,6 +66,7 @@ LinkManager::~LinkManager()
void
LinkManager
::
add
(
LinkInterface
*
link
)
{
if
(
!
link
)
return
;
links
.
append
(
link
);
emit
newLink
(
link
);
}
...
...
@@ -73,6 +75,7 @@ void LinkManager::addProtocol(LinkInterface* link, ProtocolInterface* protocol)
{
// Connect link to protocol
// the protocol will receive new bytes from the link
if
(
!
link
||
!
protocol
)
return
;
connect
(
link
,
SIGNAL
(
bytesReceived
(
LinkInterface
*
,
QByteArray
)),
protocol
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
// Store the connection information in the protocol links map
protocolLinks
.
insertMulti
(
protocol
,
link
);
...
...
@@ -91,7 +94,8 @@ bool LinkManager::connectAll()
foreach
(
LinkInterface
*
link
,
links
)
{
if
(
!
link
->
connect
())
allConnected
=
false
;
if
(
!
link
)
{}
else
if
(
!
link
->
connect
())
allConnected
=
false
;
}
return
allConnected
;
...
...
@@ -103,7 +107,9 @@ bool LinkManager::disconnectAll()
foreach
(
LinkInterface
*
link
,
links
)
{
if
(
!
link
->
disconnect
())
allDisconnected
=
false
;
//static int i=0;
if
(
!
link
){}
else
if
(
!
link
->
disconnect
())
allDisconnected
=
false
;
}
return
allDisconnected
;
...
...
@@ -111,14 +117,32 @@ bool LinkManager::disconnectAll()
bool
LinkManager
::
connectLink
(
LinkInterface
*
link
)
{
if
(
!
link
)
return
false
;
return
link
->
connect
();
}
bool
LinkManager
::
disconnectLink
(
LinkInterface
*
link
)
{
if
(
!
link
)
return
false
;
return
link
->
disconnect
();
}
bool
LinkManager
::
removeLink
(
LinkInterface
*
link
)
{
if
(
link
)
{
for
(
int
i
=
0
;
i
<
QList
<
LinkInterface
*>
(
links
).
size
();
i
++
)
{
if
(
link
==
links
.
at
(
i
))
{
links
.
removeAt
(
i
);
//remove from link list
}
}
return
true
;
}
return
false
;
}
/**
* The access time is linear in the number of links.
*
...
...
src/comm/LinkManager.h
View file @
ab7869ce
...
...
@@ -67,6 +67,8 @@ public slots:
void
add
(
LinkInterface
*
link
);
void
addProtocol
(
LinkInterface
*
link
,
ProtocolInterface
*
protocol
);
bool
removeLink
(
LinkInterface
*
link
);
bool
connectAll
();
bool
connectLink
(
LinkInterface
*
link
);
...
...
src/comm/MAVLinkSimulationLink.cc
View file @
ab7869ce
...
...
@@ -559,16 +559,17 @@ void MAVLinkSimulationLink::mainloop()
// Send controller states
// uint8_t attControl = 1;
// uint8_t posXYControl = 1;
// uint8_t posZControl = 0;
// uint8_t posYawControl = 1;
// uint8_t gpsLock = 2;
// uint8_t visLock = 3;
//uint8_t posLock = qMax(gpsLock, visLock);
#ifdef MAVLINK_ENABLED_PIXHAWK
uint8_t
attControl
=
1
;
uint8_t
posXYControl
=
1
;
uint8_t
posZControl
=
0
;
uint8_t
posYawControl
=
1
;
uint8_t
gpsLock
=
2
;
uint8_t
visLock
=
3
;
uint8_t
posLock
=
qMax
(
gpsLock
,
visLock
);
messageSize
=
mavlink_msg_control_status_pack
(
systemId
,
componentId
,
&
msg
,
posLock
,
visLock
,
gpsLock
,
attControl
,
posXYControl
,
posZControl
,
posYawControl
);
#endif
...
...
src/comm/SerialLink.cc
View file @
ab7869ce
...
...
@@ -30,10 +30,13 @@ This file is part of the QGROUNDCONTROL project
#include
<QTimer>
#include
<QDebug>
#include
<QSettings>
#include
<QMutexLocker>
#include
"SerialLink.h"
#include
"LinkManager.h"
#include
"QGC.h"
#include
<MG.h>
#include
<iostream>
#ifdef _WIN32
#include
"windows.h"
#endif
...
...
@@ -54,12 +57,41 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
#endif
// Set unique ID and add link to the list of links
this
->
id
=
getNextLinkId
();
this
->
baudrate
=
baudrate
;
this
->
flow
=
flow
;
this
->
parity
=
parity
;
this
->
dataBits
=
dataBits
;
this
->
stopBits
=
stopBits
;
this
->
timeout
=
1
;
///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
// Load defaults from settings
QSettings
settings
(
QGC
::
COMPANYNAME
,
QGC
::
APPNAME
);
settings
.
sync
();
if
(
settings
.
contains
(
"SERIALLINK_COMM_PORT"
))
{
this
->
porthandle
=
settings
.
value
(
"SERIALLINK_COMM_PORT"
).
toString
();
}
// *nix (Linux, MacOS tested) serial port support
port
=
new
QextSerialPort
(
porthandle
,
QextSerialPort
::
Polling
);
//port = new QextSerialPort(porthandle, QextSerialPort::EventDriven);
if
(
settings
.
contains
(
"SERIALLINK_COMM_PORT"
))
{
setBaudRate
(
settings
.
value
(
"SERIALLINK_COMM_BAUD"
).
toInt
());
setParityType
(
settings
.
value
(
"SERIALLINK_COMM_PARITY"
).
toInt
());
setStopBitsType
(
settings
.
value
(
"SERIALLINK_COMM_STOPBITS"
).
toInt
());
setDataBitsType
(
settings
.
value
(
"SERIALLINK_COMM_DATABITS"
).
toInt
());
}
else
{
this
->
baudrate
=
baudrate
;
this
->
flow
=
flow
;
this
->
parity
=
parity
;
this
->
dataBits
=
dataBits
;
this
->
stopBits
=
stopBits
;
this
->
timeout
=
1
;
///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
}
port
->
setTimeout
(
timeout
);
// Timeout of 0 ms, we don't want to wait for data, we just poll again next time
port
->
setBaudRate
(
baudrate
);
port
->
setFlowControl
(
flow
);
port
->
setParity
(
parity
);
port
->
setDataBits
(
dataBits
);
port
->
setStopBits
(
stopBits
);
// Set the port name
if
(
porthandle
==
""
)
...
...
@@ -88,15 +120,7 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
//some other error occurred. Inform user.
}
#else
// *nix (Linux, MacOS tested) serial port support
port
=
new
QextSerialPort
(
porthandle
,
QextSerialPort
::
Polling
);
//port = new QextSerialPort(porthandle, QextSerialPort::EventDriven);
port
->
setTimeout
(
timeout
);
// Timeout of 0 ms, we don't want to wait for data, we just poll again next time
port
->
setBaudRate
(
baudrate
);
port
->
setFlowControl
(
flow
);
port
->
setParity
(
parity
);
port
->
setDataBits
(
dataBits
);
port
->
setStopBits
(
stopBits
);
#endif
// Link is setup, register it with link manager
...
...
@@ -106,7 +130,7 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
SerialLink
::~
SerialLink
()
{
disconnect
();
delete
port
;
if
(
port
)
delete
port
;
port
=
NULL
;
}
...
...
@@ -239,6 +263,8 @@ bool SerialLink::disconnect()
port
->
close
();
dataMutex
.
unlock
();
if
(
this
->
isRunning
())
this
->
terminate
();
//stop running the thread, restart it upon connect
bool
closed
=
true
;
//port->isOpen();
...
...
@@ -298,6 +324,15 @@ bool SerialLink::hardwareConnect()
if
(
connectionUp
)
{
emit
connected
();
emit
connected
(
true
);
// Store settings
QSettings
settings
(
QGC
::
COMPANYNAME
,
QGC
::
APPNAME
);
settings
.
setValue
(
"SERIALLINK_COMM_PORT"
,
this
->
porthandle
);
settings
.
setValue
(
"SERIALLINK_COMM_BAUD"
,
getBaudRate
());
settings
.
setValue
(
"SERIALLINK_COMM_PARITY"
,
getParityType
());
settings
.
setValue
(
"SERIALLINK_COMM_STOPBITS"
,
getStopBitsType
());
settings
.
setValue
(
"SERIALLINK_COMM_DATABITS"
,
getDataBitsType
());
settings
.
sync
();
}
return
connectionUp
;
...
...
@@ -311,7 +346,14 @@ bool SerialLink::hardwareConnect()
**/
bool
SerialLink
::
isConnected
()
{
return
port
->
isOpen
();
if
(
port
)
{
return
port
->
isOpen
();
}
else
{
return
false
;
}
}
int
SerialLink
::
getId
()
...
...
@@ -516,7 +558,7 @@ bool SerialLink::setPortName(QString portName)
this
->
porthandle
=
"
\\\\
.
\\
"
+
this
->
porthandle
;
}
#endif
delete
port
;
if
(
port
)
delete
port
;
port
=
new
QextSerialPort
(
porthandle
,
QextSerialPort
::
Polling
);
port
->
setBaudRate
(
baudrate
);
...
...
@@ -707,9 +749,16 @@ bool SerialLink::setBaudRate(int rate)
break
;
}
port
->
setBaudRate
(
this
->
baudrate
);
if
(
reconnect
)
connect
();
return
accepted
;
if
(
port
)
{
port
->
setBaudRate
(
this
->
baudrate
);
if
(
reconnect
)
connect
();
return
accepted
;
}
else
{
return
false
;
}
}
bool
SerialLink
::
setFlowType
(
int
flow
)
...
...
src/input/Freenect.cc
View file @
ab7869ce
...
...
@@ -341,7 +341,7 @@ Freenect::readConfigFile(void)
settings
.
value
(
"transform/R33"
).
toDouble
(),
settings
.
value
(
"transform/Tz"
).
toDouble
(),
0.0
,
0.0
,
0.0
,
1.0
);
transformMatrix
=
transformMatrix
.
transpos
ed
();
transformMatrix
=
transformMatrix
.
invert
ed
();
baseline
=
settings
.
value
(
"transform/baseline"
).
toDouble
();
disparityOffset
=
settings
.
value
(
"transform/disparity_offset"
).
toDouble
();
...
...
src/uas/PxQuadMAV.cc
View file @
ab7869ce
...
...
@@ -41,12 +41,12 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
// Let UAS handle the default message set
UAS
::
receiveMessage
(
link
,
message
);
// mavlink_message_t* msg = &message;
//qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid;
// Only compile this portion if matching MAVLink packets have been compiled
#ifdef MAVLINK_ENABLED_PIXHAWK
mavlink_message_t
*
msg
=
&
message
;
if
(
message
.
sysid
==
uasId
)
{
...
...
src/uas/UAS.cc
View file @
ab7869ce
...
...
@@ -95,6 +95,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
UAS
::~
UAS
()
{
delete
links
;
links
=
NULL
;
}
int
UAS
::
getUASID
()
const
...
...
@@ -126,6 +127,7 @@ void UAS::setSelected()
void
UAS
::
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
if
(
!
link
)
return
;
if
(
!
links
->
contains
(
link
))
{
addLink
(
link
);
...
...
@@ -371,11 +373,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
GAudioOutput
::
instance
()
->
notifyPositive
();
}
positionLock
=
true
;
// Send to patch antenna
mavlink_message_t
msg
;
mavlink_msg_global_position_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
pos
.
usec
,
pos
.
lat
,
pos
.
lon
,
pos
.
alt
,
pos
.
vx
,
pos
.
vy
,
pos
.
vz
);
sendMessage
(
msg
);
}
break
;
case
MAVLINK_MSG_ID_GPS_RAW
:
...
...
@@ -839,6 +836,7 @@ void UAS::sendMessage(mavlink_message_t message)
void
UAS
::
sendMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
if
(
!
link
)
return
;
// Create buffer
uint8_t
buffer
[
MAVLINK_MAX_PACKET_LEN
];
// Write message into buffer, prepending start sign
...
...
src/uas/UASManager.cc
View file @
ab7869ce
...
...
@@ -85,6 +85,11 @@ void UASManager::addUAS(UASInterface* uas)
}
}
QList
<
UASInterface
*>
UASManager
::
getUASList
()
{
return
systems
.
values
();
}
UASInterface
*
UASManager
::
getActiveUAS
()
{
if
(
!
activeUAS
)
...
...
src/uas/UASManager.h
View file @
ab7869ce
...
...
@@ -69,6 +69,8 @@ public:
**/
UASInterface
*
getUASForId
(
int
id
);
QList
<
UASInterface
*>
getUASList
();
public
slots
:
...
...
src/ui/CommConfigurationWindow.cc
View file @
ab7869ce
...
...
@@ -47,6 +47,7 @@ This file is part of the QGROUNDCONTROL project
#endif
#include
"MAVLinkProtocol.h"
#include
"MAVLinkSettingsWidget.h"
#include
"LinkManager.h"
CommConfigurationWindow
::
CommConfigurationWindow
(
LinkInterface
*
link
,
ProtocolInterface
*
protocol
,
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QWidget
(
parent
,
flags
)
{
...
...
@@ -58,6 +59,10 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn
// add link types
ui
.
linkType
->
addItem
(
"Serial"
,
QGC_LINK_SERIAL
);
ui
.
linkType
->
addItem
(
"UDP"
,
QGC_LINK_UDP
);
ui
.
linkType
->
addItem
(
"Simulation"
,
QGC_LINK_SIMULATION
);
ui
.
linkType
->
addItem
(
"Serial Forwarding"
,
QGC_LINK_FORWARDING
);
ui
.
connectionType
->
addItem
(
"MAVLink"
,
QGC_PROTOCOL_MAVLINK
);
// Create action to open this menu
// Create configuration action for this link
...
...
@@ -195,11 +200,20 @@ void CommConfigurationWindow::setLinkName(QString name)
void
CommConfigurationWindow
::
remove
()
{
link
->
disconnect
();
//delete link;
//delete action;
if
(
action
)
delete
action
;
//delete action first since it has a pointer to link
action
=
NULL
;
if
(
link
)
{
LinkManager
::
instance
()
->
removeLink
(
link
);
//remove link from LinkManager list
link
->
disconnect
();
//disconnect port, and also calls terminate() to stop the thread
if
(
link
->
isRunning
())
link
->
terminate
();
// terminate() the serial thread just in case it is still running
link
->
wait
();
// wait() until thread is stoped before deleting
delete
link
;
}
link
=
NULL
;
this
->
window
()
->
close
();
qDebug
()
<<
"TODO: Link cannot be deleted: CommConfigurationWindow::remove() NOT IMPLEMENTED!"
;
}
void
CommConfigurationWindow
::
connectionState
(
bool
connect
)
...
...
src/ui/CommConfigurationWindow.h
View file @
ab7869ce
...
...
@@ -42,7 +42,14 @@ This file is part of the QGROUNDCONTROL project
enum
qgc_link_t
{
QGC_LINK_SERIAL
,
QGC_LINK_UDP
QGC_LINK_UDP
,
QGC_LINK_SIMULATION
,
QGC_LINK_FORWARDING
};
enum
qgc_protocol_t
{
QGC_PROTOCOL_MAVLINK
};
#ifdef OPAL_RT
...
...
src/ui/CommSettings.ui
View file @
ab7869ce
...
...
@@ -43,23 +43,7 @@
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"linkType"
>
<item>
<property
name=
"text"
>
<string>
Serial Link
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
UDP
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Simulation
</string>
</property>
</item>
</widget>
<widget
class=
"QComboBox"
name=
"linkType"
/>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_5"
>
...
...
@@ -71,13 +55,8 @@
<item
row=
"1"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"connectionType"
>
<property
name=
"currentIndex"
>
<number>
0
</number>
<number>
-1
</number>
</property>
<item>
<property
name=
"text"
>
<string>
MAVLink
</string>
</property>
</item>
</widget>
</item>
</layout>
...
...
src/ui/HUD.cc
View file @
ab7869ce
...
...
@@ -165,6 +165,19 @@ HUD::~HUD()
}
void
HUD
::
showEvent
(
QShowEvent
*
event
)
{
Q_UNUSED
(
event
);
if
(
isVisible
())
{
refreshTimer
->
start
();
}
else
{
refreshTimer
->
stop
();
}
}
void
HUD
::
start
()
{
refreshTimer
->
start
();
...
...
src/ui/HUD.h
View file @
ab7869ce
...
...
@@ -123,6 +123,8 @@ protected:
float
refLineWidthToPen
(
float
line
);
/** @brief Rotate a polygon around a point clockwise */
void
rotatePolygonClockWiseRad
(
QPolygonF
&
p
,
float
angle
,
QPointF
origin
);
/** @brief Override base class show */
virtual
void
showEvent
(
QShowEvent
*
event
);
QImage
*
image
;
///< Double buffer image
QImage
glImage
;
///< The background / camera image
...
...
src/ui/MainWindow.cc
View file @
ab7869ce
...
...
@@ -16,6 +16,7 @@
#include
<QHostInfo>
#include
"MG.h"
#include
"QGC.h"
#include
"MAVLinkSimulationLink.h"
#include
"SerialLink.h"
#include
"UDPLink.h"
...
...
@@ -82,6 +83,33 @@ MainWindow::MainWindow(QWidget *parent):
// Adjust the size
adjustSize
();
// Load previous widget setup
// FIXME WORK IN PROGRESS
QSettings
settings
(
QGC
::
COMPANYNAME
,
QGC
::
APPNAME
);
QList
<
QDockWidget
*>
dockwidgets
=
qFindChildren
<
QDockWidget
*>
(
this
);
if
(
dockwidgets
.
size
())
{
settings
.
beginGroup
(
"mainwindow/dockwidgets"
);
for
(
int
i
=
0
;
i
<
dockwidgets
.
size
();
++
i
)
{
QDockWidget
*
dockWidget
=
dockwidgets
.
at
(
i
);
if
(
dockWidget
->
parentWidget
()
==
this
)
{
if
(
settings
.
contains
(
dockWidget
->
windowTitle
()))
{
dockWidget
->
setVisible
(
settings
.
value
(
dockWidget
->
windowTitle
(),
dockWidget
->
isVisible
()).
toBool
());
}
}
}
settings
.
endGroup
();
}
this
->
show
();
}
MainWindow
::~
MainWindow
()
...
...
@@ -127,6 +155,110 @@ void MainWindow::buildCommonWidgets()
}
//=======
//void MainWindow::storeSettings()
//{
// QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
// QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
// if (dockwidgets.size())
// {
// settings.beginGroup("mainwindow/dockwidgets");
// for (int i = 0; i < dockwidgets.size(); ++i)
// {
// QDockWidget *dockWidget = dockwidgets.at(i);
// if (dockWidget->parentWidget() == this)
// {
// settings.setValue(dockWidget->windowTitle(), QVariant(dockWidget->isVisible()));
// }
// }
// settings.endGroup();
// }
// settings.sync();
//}
//QMenu* MainWindow::createCenterWidgetMenu()
//{
// QMenu* menu = NULL;
// QStackedWidget* centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
// if (centerStack)
// {
// if (centerStack->count() > 0)
// {
// menu = new QMenu(this);
// for (int i = 0; i < centerStack->count(); ++i)
// {
// //menu->addAction(centerStack->widget(i)->actions())
// }
// }
// }
// return menu;
//}
//QMenu* MainWindow::createDockWidgetMenu()
//{
// QMenu *menu = 0;
//#ifndef QT_NO_DOCKWIDGET
// QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
// if (dockwidgets.size())
// {
// menu = new QMenu(this);
// for (int i = 0; i < dockwidgets.size(); ++i)
// {
// QDockWidget *dockWidget = dockwidgets.at(i);
// if (dockWidget->parentWidget() == this)
// {
// menu->addAction(dockwidgets.at(i)->toggleViewAction());
// }
// }
// menu->addSeparator();
// }
//#endif
// return menu;
//}
////QList<QWidget* >* MainWindow::getMainWidgets()
////{
////}
////QMenu* QMainWindow::getDockWidgetMenu()
////{
//// Q_D(QMainWindow);
//// QMenu *menu = 0;
////#ifndef QT_NO_DOCKWIDGET
//// QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
//// if (dockwidgets.size()) {
//// menu = new QMenu(this);
//// for (int i = 0; i < dockwidgets.size(); ++i) {
//// QDockWidget *dockWidget = dockwidgets.at(i);
//// if (dockWidget->parentWidget() == this
//// && d->layout->contains(dockWidget)) {
//// menu->addAction(dockwidgets.at(i)->toggleViewAction());
//// }
//// }
//// menu->addSeparator();
//// }
////#endif // QT_NO_DOCKWIDGET
////#ifndef QT_NO_TOOLBAR
//// QList<QToolBar *> toolbars = qFindChildren<QToolBar *>(this);
//// if (toolbars.size()) {
//// if (!menu)
//// menu = new QMenu(this);
//// for (int i = 0; i < toolbars.size(); ++i) {
//// QToolBar *toolBar = toolbars.at(i);
//// if (toolBar->parentWidget() == this
//// && d->layout->contains(toolBar)) {
//// menu->addAction(toolbars.at(i)->toggleViewAction());
//// }
//// }
//// }
////#endif
//// Q_UNUSED(d);
//// return menu;
////}
//>>>>>>> master
void
MainWindow
::
buildPxWidgets
()
{
//FIXME: memory of acceptList will never be freed again
...
...
@@ -172,6 +304,7 @@ void MainWindow::buildPxWidgets()
#endif
// Dock widgets
detectionDockWidget
=
new
QDockWidget
(
tr
(
"Object Recognition"
),
this
);
detectionDockWidget
->
setWidget
(
new
ObjectDetectionView
(
"images/patterns"
,
this
)
);
addToToolsMenu
(
detectionDockWidget
,
tr
(
"Object Recognition"
),
SLOT
(
showToolWidget
()),
MENU_DETECTION
,
Qt
::
RightDockWidgetArea
);
...
...
@@ -189,9 +322,53 @@ void MainWindow::buildPxWidgets()
hsiDockWidget
=
new
QDockWidget
(
tr
(
"Horizontal Situation Indicator"
),
this
);
hsiDockWidget
->
setWidget
(
new
HSIDisplay
(
this
)
);
addToToolsMenu
(
hsiDockWidget
,
tr
(
"HSI"
),
SLOT
(
showToolWidget
()),
MENU_HSI
,
Qt
::
BottomDockWidgetArea
);
headDown1DockWidget
=
new
QDockWidget
(
tr
(
"Primary Flight Display"
),
this
);
//=======
// controlDockWidget = new QDockWidget(tr("Control"), this);
// controlDockWidget->setWidget( new UASControlWidget(this) );
// addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget);
// controlDockWidget->hide();
// infoDockWidget = new QDockWidget(tr("Status Details"), this);
// infoDockWidget->setWidget( new UASInfoWidget(this) );
// addDockWidget(Qt::LeftDockWidgetArea, infoDockWidget);
// //infoDockWidget->hide();
// listDockWidget = new QDockWidget(tr("Unmanned Systems"), this);
// listDockWidget->setWidget( new UASListWidget(this) );
// addDockWidget(Qt::BottomDockWidgetArea, listDockWidget);
// listDockWidget->hide();
// waypointsDockWidget = new QDockWidget(tr("Waypoint List"), this);
// waypointsDockWidget->setWidget( new WaypointList(this, NULL) );
// addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget);
// waypointsDockWidget->hide();
// detectionDockWidget = new QDockWidget(tr("Object Recognition"), this);
// detectionDockWidget->setWidget( new ObjectDetectionView("images/patterns", this) );
// addDockWidget(Qt::RightDockWidgetArea, detectionDockWidget);
// detectionDockWidget->hide();
// debugConsoleDockWidget = new QDockWidget(tr("Communication Console"), this);
// debugConsoleDockWidget->setWidget( new DebugConsole(this) );
// addDockWidget(Qt::BottomDockWidgetArea, debugConsoleDockWidget);
// parametersDockWidget = new QDockWidget(tr("Onboard Parameters"), this);
// parametersDockWidget->setWidget( new ParameterInterface(this) );
// addDockWidget(Qt::RightDockWidgetArea, parametersDockWidget);
// watchdogControlDockWidget = new QDockWidget(tr("Process Control"), this);
// watchdogControlDockWidget->setWidget( new WatchdogControl(this) );
// addDockWidget(Qt::RightDockWidgetArea, watchdogControlDockWidget);
// watchdogControlDockWidget->hide();
// hsiDockWidget = new QDockWidget(tr("Horizontal Situation Indicator"), this);
// hsiDockWidget->setWidget( new HSIDisplay(this) );
// addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget);
//>>>>>>> master
headDown1DockWidget
=
new
QDockWidget
(
tr
(
"System Stats"
),
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
);
...
...
@@ -201,6 +378,18 @@ void MainWindow::buildPxWidgets()
rcViewDockWidget
=
new
QDockWidget
(
tr
(
"Radio Control"
),
this
);
rcViewDockWidget
->
setWidget
(
new
QGCRemoteControlView
(
this
)
);
addToToolsMenu
(
rcViewDockWidget
,
tr
(
"Radio Control"
),
SLOT
(
showToolWidget
()),
MENU_RC_VIEW
,
Qt
::
BottomDockWidgetArea
);
//=======
// addDockWidget(Qt::RightDockWidgetArea, headDown1DockWidget);
// headDown2DockWidget = new QDockWidget(tr("Payload Status"), this);
// headDown2DockWidget->setWidget( new HDDisplay(acceptList2, this) );
// addDockWidget(Qt::RightDockWidgetArea, headDown2DockWidget);
// rcViewDockWidget = new QDockWidget(tr("Radio Control"), this);
// rcViewDockWidget->setWidget( new QGCRemoteControlView(this) );
// addDockWidget(Qt::BottomDockWidgetArea, rcViewDockWidget);
// rcViewDockWidget->hide();
//>>>>>>> master
headUpDockWidget
=
new
QDockWidget
(
tr
(
"HUD"
),
this
);
headUpDockWidget
->
setWidget
(
new
HUD
(
320
,
240
,
this
));
...
...
@@ -234,16 +423,34 @@ void MainWindow::buildSlugsWidgets()
slugsDataWidget
->
setWidget
(
new
SlugsDataSensorView
(
this
));
addToToolsMenu
(
slugsDataWidget
,
tr
(
"Telemetry Data"
),
SLOT
(
showToolWidget
()),
MENU_SLUGS_DATA
,
Qt
::
RightDockWidgetArea
);
//=======
// this->addDockWidget(Qt::LeftDockWidgetArea, headUpDockWidget);
slugsPIDControlWidget
=
new
QDockWidget
(
tr
(
"PID Control"
),
this
);
// // SLUGS
// slugsDataWidget = new QDockWidget(tr("Slugs Data"), this);
// slugsDataWidget->setWidget( new SlugsDataSensorView(this));
// addDockWidget(Qt::LeftDockWidgetArea, slugsDataWidget);
// slugsDataWidget->hide();
//>>>>>>> master
slugsPIDControlWidget
=
new
QDockWidget
(
tr
(
"Slugs PID Control"
),
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
->
setWidget
(
new
SlugsHilSim
(
this
));
addToToolsMenu
(
slugsHilSimWidget
,
tr
(
"HIL Sim Configuration"
),
SLOT
(
showToolWidget
()),
MENU_SLUGS_HIL
,
Qt
::
LeftDockWidgetArea
);
//=======
// addDockWidget(Qt::BottomDockWidgetArea, slugsPIDControlWidget);
// slugsPIDControlWidget->hide();
slugsCamControlWidget
=
new
QDockWidget
(
tr
(
"Video Camera Control"
),
this
);
// slugsHilSimWidget = new QDockWidget(tr("Slugs Hil Sim"), this);
// slugsHilSimWidget->setWidget( new SlugsHilSim(this));
// addDockWidget(Qt::BottomDockWidgetArea, slugsHilSimWidget);
// slugsHilSimWidget->hide();
//>>>>>>> master
slugsCamControlWidget
=
new
QDockWidget
(
tr
(
"Slugs Video Camera Control"
),
this
);
slugsCamControlWidget
->
setWidget
(
new
SlugsVideoCamControl
(
this
));
addToToolsMenu
(
slugsCamControlWidget
,
tr
(
"Camera Control"
),
SLOT
(
showToolWidget
()),
MENU_SLUGS_CAMERA
,
Qt
::
BottomDockWidgetArea
);
...
...
@@ -475,6 +682,13 @@ void MainWindow::updateLocationSettings (Qt::DockWidgetArea location){
break
;
}
}
//=======
// addDockWidget(Qt::BottomDockWidgetArea, slugsCamControlWidget);
// slugsCamControlWidget->hide();
// //FIXME: free memory in destructor
// joystick = new JoystickInput();
//>>>>>>> master
}
/**
...
...
@@ -505,10 +719,6 @@ void MainWindow::connectPxWidgets()
{
if
(
linechartWidget
)
{
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
linechartWidget
,
SLOT
(
addSystem
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
int
)),
linechartWidget
,
SLOT
(
selectSystem
(
int
)));
connect
(
linechartWidget
,
SIGNAL
(
logfileWritten
(
QString
)),
this
,
SLOT
(
loadDataView
(
QString
)));
}
...
...
@@ -1006,7 +1216,8 @@ void MainWindow::clearView()
if
(
dockWidget
)
{
// Remove dock widget from main window
this
->
removeDockWidget
(
dockWidget
);
//this->removeDockWidget(dockWidget);
dockWidget
->
setVisible
(
false
);
// Deletion of dockWidget would also delete all child
// widgets of dockWidget
// Is there a way to unset a widget from QDockWidget?
...
...
@@ -1048,6 +1259,14 @@ void MainWindow::loadMAVLinkView()
currentView
=
VIEW_MAVLINK
;
presentView
();
//=======
// // Slugs Data View
// if (slugsHilSimWidget)
// {
// addDockWidget(Qt::LeftDockWidgetArea, slugsHilSimWidget);
// slugsHilSimWidget->show();
// }
//>>>>>>> master
}
void
MainWindow
::
presentView
()
{
...
...
@@ -1224,12 +1443,18 @@ void MainWindow::presentView() {
}
void
MainWindow
::
showTheCentralWidget
(
TOOLS_WIDGET_NAMES
centralWidget
,
VIEW_SECTIONS
view
){
bool
tempVisible
;
QWidget
*
tempWidget
=
dockWidgets
[
centralWidget
];
//=======
// // ONBOARD PARAMETERS
// if (parametersDockWidget)
// {
// addDockWidget(Qt::RightDockWidgetArea, parametersDockWidget);
// parametersDockWidget->show();
// }
//}
//>>>>>>> master
tempVisible
=
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
view
)).
toBool
();
qDebug
()
<<
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
view
)
<<
tempVisible
;
...
...
@@ -1281,6 +1506,24 @@ void MainWindow::loadAllView()
hdd
->
start
();
}
}
//<<<<<<< HEAD
//=======
//}
//void MainWindow::loadOperatorView()
//{
// clearView();
// // MAP
// if (mapWidget)
// {
// QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
// if (centerStack)
// {
// centerStack->setCurrentWidget(mapWidget);
// }
// }
//>>>>>>> master
// UAS CONTROL
if
(
controlDockWidget
)
...
...
@@ -1341,8 +1584,6 @@ void MainWindow::loadAllView()
addDockWidget
(
Qt
::
RightDockWidgetArea
,
parametersDockWidget
);
parametersDockWidget
->
show
();
}
this
->
show
();
}
void
MainWindow
::
loadWidgets
()
...
...
@@ -1430,7 +1671,6 @@ void MainWindow::load3DMapView()
}
}
#endif
this
->
show
();
}
void
MainWindow
::
loadGoogleEarthView
()
...
...
@@ -1480,7 +1720,6 @@ void MainWindow::loadGoogleEarthView()
hsiDockWidget
->
show
();
}
}
this
->
show
();
#endif
}
...
...
@@ -1534,8 +1773,6 @@ void MainWindow::load3DView()
}
}
#endif
this
->
show
();
}
/*
...
...
@@ -1586,15 +1823,26 @@ void MainWindow::buildWidgets()
listDockWidget = new QDockWidget(tr("Unmanned Systems"), this);
listDockWidget->setWidget( new UASListWidget(this) );
<<<<<<< HEAD
waypointsDockWidget = new QDockWidget(tr("Waypoint List"), this);
waypointsDockWidget->setWidget( new WaypointList(this, NULL) );
infoDockWidget = new QDockWidget(tr("Status Details"), this);
infoDockWidget->setWidget( new UASInfoWidget(this) );
=======
// RADIO CONTROL VIEW
if (rcViewDockWidget)
{
addDockWidget(Qt::BottomDockWidgetArea, rcViewDockWidget);
rcViewDockWidget->show();
}
}
>>>>>>> master
detectionDockWidget = new QDockWidget(tr("Object Recognition"), this);
detectionDockWidget->setWidget( new ObjectDetectionView("images/patterns", this) );
<<<<<<< HEAD
debugConsoleDockWidget = new QDockWidget(tr("Communication Console"), this);
debugConsoleDockWidget->setWidget( new DebugConsole(this) );
...
...
@@ -1635,6 +1883,16 @@ void MainWindow::buildWidgets()
slugsCamControlWidget = new QDockWidget(tr("Video Camera Control"), this);
slugsCamControlWidget->setWidget(new SlugsVideoCamControl(this));
=======
if (protocolWidget)
{
QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
if (centerStack)
{
centerStack->setCurrentWidget(protocolWidget);
}
}
>>>>>>> master
}
void MainWindow::connectWidgets()
...
...
@@ -1707,10 +1965,19 @@ void MainWindow::arrangeCenterStack()
if (dataplotWidget) centerStack->addWidget(dataplotWidget);
setCentralWidget(centerStack);
=======
// ONBOARD PARAMETERS
if (parametersDockWidget)
{
addDockWidget(Qt::RightDockWidgetArea, parametersDockWidget);
parametersDockWidget->show();
}
>>>>>>> master
}
void MainWindow::connectActions()
{
<<<<<<< HEAD
// Connect actions from ui
connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink()));
...
...
@@ -1763,6 +2030,9 @@ void MainWindow::connectActions()
//GlobalOperatorView
// connect(ui.actionGlobalOperatorView,SIGNAL(triggered()),waypointsDockWidget->widget(),SLOT())
=======
//loadEngineerView();
>>>>>>> master
}
*/
src/ui/MainWindow.h
View file @
ab7869ce
...
...
@@ -87,6 +87,9 @@ public:
~
MainWindow
();
public
slots
:
// /** @brief Store the mainwindow settings */
// void storeSettings();
/**
* @brief Shows a status message on the bottom status bar
*
...
...
@@ -324,7 +327,6 @@ protected:
void
configureWindowName
();
// TODO Should be moved elsewhere, as the protocol does not belong to the UI
MAVLinkProtocol
*
mavlink
;
AS4Protocol
*
as4link
;
...
...
@@ -367,6 +369,7 @@ protected:
QPointer
<
QDockWidget
>
hsiDockWidget
;
QPointer
<
QDockWidget
>
rcViewDockWidget
;
QPointer
<
QDockWidget
>
hudDockWidget
;
QPointer
<
QDockWidget
>
slugsDataWidget
;
QPointer
<
QDockWidget
>
slugsPIDControlWidget
;
QPointer
<
QDockWidget
>
slugsHilSimWidget
;
...
...
src/ui/MainWindow.ui
View file @
ab7869ce
...
...
@@ -108,14 +108,7 @@
<addaction
name=
"menuPerspectives"
/>
<addaction
name=
"menuHelp"
/>
</widget>
<widget
class=
"QToolBar"
name=
"mainToolBar"
>
<attribute
name=
"toolBarArea"
>
<enum>
TopToolBarArea
</enum>
</attribute>
<attribute
name=
"toolBarBreak"
>
<bool>
false
</bool>
</attribute>
</widget>
<widget
class=
"QStatusBar"
name=
"statusBar"
/>
<action
name=
"actionExit"
>
<property
name=
"icon"
>
...
...
@@ -461,3 +454,5 @@
</connection>
</connections>
</ui>
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment