Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
dc3b21fb
Commit
dc3b21fb
authored
Sep 21, 2011
by
LM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed and thoroughly tested custom widgets
parent
5ec5d936
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
178 additions
and
120 deletions
+178
-120
MainWindow.cc
src/ui/MainWindow.cc
+83
-53
QGCWaypointListMulti.cc
src/ui/QGCWaypointListMulti.cc
+1
-0
WaypointList.ui
src/ui/WaypointList.ui
+36
-36
QGCToolWidget.cc
src/ui/designer/QGCToolWidget.cc
+57
-30
QGCToolWidget.h
src/ui/designer/QGCToolWidget.h
+1
-1
No files found.
src/ui/MainWindow.cc
View file @
dc3b21fb
...
@@ -126,6 +126,9 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -126,6 +126,9 @@ MainWindow::MainWindow(QWidget *parent):
configureWindowName
();
configureWindowName
();
// Setup corners
setCorner
(
Qt
::
BottomRightCorner
,
Qt
::
RightDockWidgetArea
);
// Setup UI state machines
// Setup UI state machines
centerStackActionGroup
.
setExclusive
(
true
);
centerStackActionGroup
.
setExclusive
(
true
);
...
@@ -146,28 +149,6 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -146,28 +149,6 @@ MainWindow::MainWindow(QWidget *parent):
// Create actions
// Create actions
connectCommonActions
();
connectCommonActions
();
buildCustomWidget
();
// Restore the window setup
if
(
settings
.
contains
(
getWindowStateKey
()))
{
loadViewState
();
}
// Restore the window position and size
if
(
settings
.
contains
(
getWindowGeometryKey
()))
{
// Restore the window geometry
restoreGeometry
(
settings
.
value
(
getWindowGeometryKey
()).
toByteArray
());
}
else
{
// Adjust the size
adjustSize
();
}
// Populate link menu
// Populate link menu
QList
<
LinkInterface
*>
links
=
LinkManager
::
instance
()
->
getLinks
();
QList
<
LinkInterface
*>
links
=
LinkManager
::
instance
()
->
getLinks
();
foreach
(
LinkInterface
*
link
,
links
)
foreach
(
LinkInterface
*
link
,
links
)
...
@@ -197,7 +178,33 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -197,7 +178,33 @@ MainWindow::MainWindow(QWidget *parent):
// Initialize window state
// Initialize window state
windowStateVal
=
windowState
();
windowStateVal
=
windowState
();
show
();
// Restore the window setup
loadViewState
();
// Restore the window position and size
if
(
settings
.
contains
(
getWindowGeometryKey
()))
{
// Restore the window geometry
restoreGeometry
(
settings
.
value
(
getWindowGeometryKey
()).
toByteArray
());
show
();
}
else
{
// Adjust the size
const
int
screenWidth
=
QApplication
::
desktop
()
->
width
();
const
int
screenHeight
=
QApplication
::
desktop
()
->
height
();
if
(
screenWidth
<
1200
)
{
showFullScreen
();
}
else
{
resize
(
screenWidth
*
0.67
f
,
qMin
(
screenHeight
,
(
int
)(
screenWidth
*
0.67
f
*
0.67
f
)));
show
();
}
}
connect
(
&
windowNameUpdateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
configureWindowName
()));
connect
(
&
windowNameUpdateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
configureWindowName
()));
windowNameUpdateTimer
.
start
(
15000
);
windowNameUpdateTimer
.
start
(
15000
);
...
@@ -381,19 +388,8 @@ void MainWindow::buildCommonWidgets()
...
@@ -381,19 +388,8 @@ void MainWindow::buildCommonWidgets()
acceptList
->
append
(
"-105,pitch deg,deg,+105,s"
);
acceptList
->
append
(
"-105,pitch deg,deg,+105,s"
);
acceptList
->
append
(
"-105,heading deg,deg,+105,s"
);
acceptList
->
append
(
"-105,heading deg,deg,+105,s"
);
acceptList
->
append
(
"-60,rollspeed d/s,deg/s,+60,s"
);
acceptList
->
append
(
"-60,pitchspeed d/s,deg/s,+60,s"
);
acceptList
->
append
(
"-60,yawspeed d/s,deg/s,+60,s"
);
acceptList
->
append
(
"0,airspeed,m/s,30"
);
acceptList
->
append
(
"0,groundspeed,m/s,30"
);
acceptList
->
append
(
"0,climbrate,m/s,30"
);
acceptList
->
append
(
"0,throttle,%,100"
);
//FIXME: memory of acceptList2 will never be freed again
//FIXME: memory of acceptList2 will never be freed again
QStringList
*
acceptList2
=
new
QStringList
();
QStringList
*
acceptList2
=
new
QStringList
();
acceptList2
->
append
(
"900,servo #6,us,2100,s"
);
acceptList2
->
append
(
"900,servo #7,us,2100,s"
);
acceptList2
->
append
(
"900,servo #8,us,2100,s"
);
acceptList2
->
append
(
"0,abs pressure,hPa,65500"
);
acceptList2
->
append
(
"0,abs pressure,hPa,65500"
);
if
(
!
parametersDockWidget
)
{
if
(
!
parametersDockWidget
)
{
...
@@ -1059,15 +1055,18 @@ void MainWindow::addLink(LinkInterface *link)
...
@@ -1059,15 +1055,18 @@ void MainWindow::addLink(LinkInterface *link)
bool
found
=
false
;
bool
found
=
false
;
foreach
(
QAction
*
act
,
actions
)
{
foreach
(
QAction
*
act
,
actions
)
if
(
act
->
data
().
toInt
()
==
LinkManager
::
instance
()
->
getLinks
().
indexOf
(
link
))
{
{
if
(
act
->
data
().
toInt
()
==
LinkManager
::
instance
()
->
getLinks
().
indexOf
(
link
))
{
found
=
true
;
found
=
true
;
}
}
}
}
UDPLink
*
udp
=
dynamic_cast
<
UDPLink
*>
(
link
);
UDPLink
*
udp
=
dynamic_cast
<
UDPLink
*>
(
link
);
if
(
!
found
||
udp
)
{
if
(
!
found
||
udp
)
{
CommConfigurationWindow
*
commWidget
=
new
CommConfigurationWindow
(
link
,
mavlink
,
this
);
CommConfigurationWindow
*
commWidget
=
new
CommConfigurationWindow
(
link
,
mavlink
,
this
);
QAction
*
action
=
commWidget
->
getAction
();
QAction
*
action
=
commWidget
->
getAction
();
ui
.
menuNetwork
->
addAction
(
action
);
ui
.
menuNetwork
->
addAction
(
action
);
...
@@ -1076,7 +1075,8 @@ void MainWindow::addLink(LinkInterface *link)
...
@@ -1076,7 +1075,8 @@ void MainWindow::addLink(LinkInterface *link)
connect
(
link
,
SIGNAL
(
communicationError
(
QString
,
QString
)),
this
,
SLOT
(
showCriticalMessage
(
QString
,
QString
)),
Qt
::
QueuedConnection
);
connect
(
link
,
SIGNAL
(
communicationError
(
QString
,
QString
)),
this
,
SLOT
(
showCriticalMessage
(
QString
,
QString
)),
Qt
::
QueuedConnection
);
// Special case for simulationlink
// Special case for simulationlink
MAVLinkSimulationLink
*
sim
=
dynamic_cast
<
MAVLinkSimulationLink
*>
(
link
);
MAVLinkSimulationLink
*
sim
=
dynamic_cast
<
MAVLinkSimulationLink
*>
(
link
);
if
(
sim
)
{
if
(
sim
)
{
//connect(sim, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)));
//connect(sim, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)));
connect
(
ui
.
actionSimulate
,
SIGNAL
(
triggered
(
bool
)),
sim
,
SLOT
(
connectLink
(
bool
)));
connect
(
ui
.
actionSimulate
,
SIGNAL
(
triggered
(
bool
)),
sim
,
SLOT
(
connectLink
(
bool
)));
}
}
...
@@ -1093,8 +1093,10 @@ void MainWindow::setActiveUAS(UASInterface* uas)
...
@@ -1093,8 +1093,10 @@ void MainWindow::setActiveUAS(UASInterface* uas)
void
MainWindow
::
UASSpecsChanged
(
int
uas
)
void
MainWindow
::
UASSpecsChanged
(
int
uas
)
{
{
UASInterface
*
activeUAS
=
UASManager
::
instance
()
->
getActiveUAS
();
UASInterface
*
activeUAS
=
UASManager
::
instance
()
->
getActiveUAS
();
if
(
activeUAS
)
{
if
(
activeUAS
)
if
(
activeUAS
->
getUASID
()
==
uas
)
{
{
if
(
activeUAS
->
getUASID
()
==
uas
)
{
ui
.
menuUnmanned_System
->
setTitle
(
activeUAS
->
getUASName
());
ui
.
menuUnmanned_System
->
setTitle
(
activeUAS
->
getUASName
());
}
}
}
}
...
@@ -1152,18 +1154,22 @@ void MainWindow::UASCreated(UASInterface* uas)
...
@@ -1152,18 +1154,22 @@ void MainWindow::UASCreated(UASInterface* uas)
ui
.
menuConnected_Systems
->
addAction
(
uasAction
);
ui
.
menuConnected_Systems
->
addAction
(
uasAction
);
// FIXME Should be not inside the mainwindow
// FIXME Should be not inside the mainwindow
if
(
debugConsoleDockWidget
)
{
if
(
debugConsoleDockWidget
)
{
DebugConsole
*
debugConsole
=
dynamic_cast
<
DebugConsole
*>
(
debugConsoleDockWidget
->
widget
());
DebugConsole
*
debugConsole
=
dynamic_cast
<
DebugConsole
*>
(
debugConsoleDockWidget
->
widget
());
if
(
debugConsole
)
{
if
(
debugConsole
)
{
connect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
connect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
debugConsole
,
SLOT
(
receiveTextMessage
(
int
,
int
,
int
,
QString
)));
debugConsole
,
SLOT
(
receiveTextMessage
(
int
,
int
,
int
,
QString
)));
}
}
}
}
// Health / System status indicator
// Health / System status indicator
if
(
infoDockWidget
)
{
if
(
infoDockWidget
)
{
UASInfoWidget
*
infoWidget
=
dynamic_cast
<
UASInfoWidget
*>
(
infoDockWidget
->
widget
());
UASInfoWidget
*
infoWidget
=
dynamic_cast
<
UASInfoWidget
*>
(
infoDockWidget
->
widget
());
if
(
infoWidget
)
{
if
(
infoWidget
)
{
infoWidget
->
addUAS
(
uas
);
infoWidget
->
addUAS
(
uas
);
}
}
}
}
...
@@ -1202,7 +1208,8 @@ void MainWindow::UASCreated(UASInterface* uas)
...
@@ -1202,7 +1208,8 @@ void MainWindow::UASCreated(UASInterface* uas)
addTool
(
detectionDockWidget
,
tr
(
"Object Recognition"
),
Qt
::
RightDockWidgetArea
);
addTool
(
detectionDockWidget
,
tr
(
"Object Recognition"
),
Qt
::
RightDockWidgetArea
);
}
}
if
(
!
watchdogControlDockWidget
)
{
if
(
!
watchdogControlDockWidget
)
{
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"
);
...
@@ -1288,6 +1295,10 @@ void MainWindow::loadViewState()
...
@@ -1288,6 +1295,10 @@ void MainWindow::loadViewState()
}
}
else
else
{
{
// Hide custom widgets
if
(
detectionDockWidget
)
detectionDockWidget
->
hide
();
if
(
watchdogControlDockWidget
)
watchdogControlDockWidget
->
hide
();
// Load defaults
// Load defaults
switch
(
currentView
)
switch
(
currentView
)
{
{
...
@@ -1324,7 +1335,7 @@ void MainWindow::loadViewState()
...
@@ -1324,7 +1335,7 @@ void MainWindow::loadViewState()
headDown2DockWidget
->
show
();
headDown2DockWidget
->
show
();
rcViewDockWidget
->
hide
();
rcViewDockWidget
->
hide
();
headUpDockWidget
->
hide
();
headUpDockWidget
->
hide
();
video1DockWidget
->
show
();
video1DockWidget
->
hide
();
video2DockWidget
->
hide
();
video2DockWidget
->
hide
();
break
;
break
;
case
VIEW_MAVLINK
:
case
VIEW_MAVLINK
:
...
@@ -1346,25 +1357,42 @@ void MainWindow::loadViewState()
...
@@ -1346,25 +1357,42 @@ void MainWindow::loadViewState()
video2DockWidget
->
hide
();
video2DockWidget
->
hide
();
break
;
break
;
case
VIEW_OPERATOR
:
case
VIEW_OPERATOR
:
centerStack
->
setCurrentWidget
(
mapWidget
);
controlDockWidget
->
hide
();
listDockWidget
->
show
();
waypointsDockWidget
->
show
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
show
();
logPlayerDockWidget
->
show
();
parametersDockWidget
->
hide
();
hsiDockWidget
->
show
();
headDown1DockWidget
->
hide
();
headDown2DockWidget
->
hide
();
rcViewDockWidget
->
hide
();
headUpDockWidget
->
show
();
video1DockWidget
->
hide
();
video2DockWidget
->
hide
();
mavlinkInspectorWidget
->
hide
();
break
;
case
VIEW_UNCONNECTED
:
case
VIEW_UNCONNECTED
:
case
VIEW_FULL
:
case
VIEW_FULL
:
default:
default:
centerStack
->
setCurrentWidget
(
mapWidget
);
centerStack
->
setCurrentWidget
(
mapWidget
);
controlDockWidget
->
show
();
controlDockWidget
->
hide
();
listDockWidget
->
show
();
listDockWidget
->
show
();
waypointsDockWidget
->
show
();
waypointsDockWidget
->
hide
();
infoDockWidget
->
show
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
show
();
debugConsoleDockWidget
->
show
();
logPlayerDockWidget
->
show
();
logPlayerDockWidget
->
show
();
mavlinkInspectorWidget
->
show
();
parametersDockWidget
->
hide
();
parametersDockWidget
->
hide
();
hsiDockWidget
->
show
();
hsiDockWidget
->
hide
();
headDown1DockWidget
->
hide
();
headDown1DockWidget
->
hide
();
headDown2DockWidget
->
hide
();
headDown2DockWidget
->
hide
();
rcViewDockWidget
->
hide
();
rcViewDockWidget
->
hide
();
headUpDockWidget
->
show
();
headUpDockWidget
->
show
();
video1DockWidget
->
hide
();
video1DockWidget
->
hide
();
video2DockWidget
->
hide
();
video2DockWidget
->
hide
();
mavlinkInspectorWidget
->
show
();
break
;
break
;
}
}
}
}
...
@@ -1378,7 +1406,8 @@ void MainWindow::loadViewState()
...
@@ -1378,7 +1406,8 @@ void MainWindow::loadViewState()
void
MainWindow
::
loadEngineerView
()
void
MainWindow
::
loadEngineerView
()
{
{
if
(
currentView
!=
VIEW_ENGINEER
)
{
if
(
currentView
!=
VIEW_ENGINEER
)
{
storeViewState
();
storeViewState
();
currentView
=
VIEW_ENGINEER
;
currentView
=
VIEW_ENGINEER
;
ui
.
actionEngineersView
->
setChecked
(
true
);
ui
.
actionEngineersView
->
setChecked
(
true
);
...
@@ -1388,7 +1417,8 @@ void MainWindow::loadEngineerView()
...
@@ -1388,7 +1417,8 @@ void MainWindow::loadEngineerView()
void
MainWindow
::
loadOperatorView
()
void
MainWindow
::
loadOperatorView
()
{
{
if
(
currentView
!=
VIEW_OPERATOR
)
{
if
(
currentView
!=
VIEW_OPERATOR
)
{
storeViewState
();
storeViewState
();
currentView
=
VIEW_OPERATOR
;
currentView
=
VIEW_OPERATOR
;
ui
.
actionOperatorsView
->
setChecked
(
true
);
ui
.
actionOperatorsView
->
setChecked
(
true
);
...
...
src/ui/QGCWaypointListMulti.cc
View file @
dc3b21fb
...
@@ -7,6 +7,7 @@ QGCWaypointListMulti::QGCWaypointListMulti(QWidget *parent) :
...
@@ -7,6 +7,7 @@ QGCWaypointListMulti::QGCWaypointListMulti(QWidget *parent) :
ui
(
new
Ui
::
QGCWaypointListMulti
)
ui
(
new
Ui
::
QGCWaypointListMulti
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
setMinimumSize
(
600
,
80
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
systemCreated
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
systemCreated
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
int
)),
this
,
SLOT
(
systemSetActive
(
int
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
int
)),
this
,
SLOT
(
systemSetActive
(
int
)));
}
}
...
...
src/ui/WaypointList.ui
View file @
dc3b21fb
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
476
</width>
<width>
798
</width>
<height>
218
</height>
<height>
218
</height>
</rect>
</rect>
</property>
</property>
...
@@ -19,14 +19,14 @@
...
@@ -19,14 +19,14 @@
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
Form
</string>
<string>
Form
</string>
</property>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"100,0,0,0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"100,0,0,0"
columnstretch=
"1,1,5,5,100,10,5,5,5,5,5"
>
<property
name=
"margin"
>
<property
name=
"margin"
>
<number>
4
</number>
<number>
4
</number>
</property>
</property>
<property
name=
"spacing"
>
<property
name=
"spacing"
>
<number>
4
</number>
<number>
4
</number>
</property>
</property>
<item
row=
"0"
column=
"0"
colspan=
"1
0
"
>
<item
row=
"0"
column=
"0"
colspan=
"1
1
"
>
<widget
class=
"QScrollArea"
name=
"scrollArea"
>
<widget
class=
"QScrollArea"
name=
"scrollArea"
>
<property
name=
"widgetResizable"
>
<property
name=
"widgetResizable"
>
<bool>
true
</bool>
<bool>
true
</bool>
...
@@ -36,8 +36,8 @@
...
@@ -36,8 +36,8 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
464
</width>
<width>
786
</width>
<height>
1
58
</height>
<height>
1
74
</height>
</rect>
</rect>
</property>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
</widget>
</widget>
</widget>
</widget>
</item>
</item>
<item
row=
"2"
column=
"
8
"
>
<item
row=
"2"
column=
"
9
"
>
<widget
class=
"QPushButton"
name=
"readButton"
>
<widget
class=
"QPushButton"
name=
"readButton"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
Read all waypoints from the MAV. Clears the list on this computer.
</string>
<string>
Read all waypoints from the MAV. Clears the list on this computer.
</string>
...
@@ -79,12 +79,12 @@
...
@@ -79,12 +79,12 @@
<string>
Read
</string>
<string>
Read
</string>
</property>
</property>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/status/software-update-available.svg
</normaloff>
:/images/status/software-update-available.svg
</iconset>
<normaloff>
:/images/status/software-update-available.svg
</normaloff>
:/images/status/software-update-available.svg
</iconset>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"2"
column=
"
9
"
>
<item
row=
"2"
column=
"
10
"
>
<widget
class=
"QPushButton"
name=
"transmitButton"
>
<widget
class=
"QPushButton"
name=
"transmitButton"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
Transmit all waypoints on this list to the MAV.
</string>
<string>
Transmit all waypoints on this list to the MAV.
</string>
...
@@ -99,28 +99,12 @@
...
@@ -99,28 +99,12 @@
<string>
Write
</string>
<string>
Write
</string>
</property>
</property>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/devices/network-wireless.svg
</normaloff>
:/images/devices/network-wireless.svg
</iconset>
<normaloff>
:/images/devices/network-wireless.svg
</normaloff>
:/images/devices/network-wireless.svg
</iconset>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"0"
colspan=
"10"
>
<item
row=
"2"
column=
"7"
>
<widget
class=
"QLabel"
name=
"statusLabel"
>
<property
name=
"toolTip"
>
<string>
The current waypoint transmission status
</string>
</property>
<property
name=
"statusTip"
>
<string>
The current waypoint transmission status
</string>
</property>
<property
name=
"whatsThis"
>
<string>
The current waypoint transmission status
</string>
</property>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"6"
>
<widget
class=
"QToolButton"
name=
"addButton"
>
<widget
class=
"QToolButton"
name=
"addButton"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
Add a new waypoint to this list. Transmit via write to the MAV.
</string>
<string>
Add a new waypoint to this list. Transmit via write to the MAV.
</string>
...
@@ -135,7 +119,7 @@
...
@@ -135,7 +119,7 @@
<string>
...
</string>
<string>
...
</string>
</property>
</property>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/actions/list-add.svg
</normaloff>
:/images/actions/list-add.svg
</iconset>
<normaloff>
:/images/actions/list-add.svg
</normaloff>
:/images/actions/list-add.svg
</iconset>
</property>
</property>
</widget>
</widget>
...
@@ -172,7 +156,7 @@
...
@@ -172,7 +156,7 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"2"
column=
"
4
"
>
<item
row=
"2"
column=
"
5
"
>
<spacer
name=
"horizontalSpacer"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
...
@@ -185,7 +169,7 @@
...
@@ -185,7 +169,7 @@
</property>
</property>
</spacer>
</spacer>
</item>
</item>
<item
row=
"2"
column=
"
5
"
>
<item
row=
"2"
column=
"
6
"
>
<widget
class=
"QToolButton"
name=
"positionAddButton"
>
<widget
class=
"QToolButton"
name=
"positionAddButton"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
Set the current vehicle position as new waypoint
</string>
<string>
Set the current vehicle position as new waypoint
</string>
...
@@ -200,12 +184,12 @@
...
@@ -200,12 +184,12 @@
<string>
...
</string>
<string>
...
</string>
</property>
</property>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/actions/go-bottom.svg
</normaloff>
:/images/actions/go-bottom.svg
</iconset>
<normaloff>
:/images/actions/go-bottom.svg
</normaloff>
:/images/actions/go-bottom.svg
</iconset>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"2"
column=
"
7
"
>
<item
row=
"2"
column=
"
8
"
>
<widget
class=
"QToolButton"
name=
"clearWPListButton"
>
<widget
class=
"QToolButton"
name=
"clearWPListButton"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
Delete all waypoints from this list. You have to click write to clear the list on the MAV as well.
</string>
<string>
Delete all waypoints from this list. You have to click write to clear the list on the MAV as well.
</string>
...
@@ -220,15 +204,31 @@
...
@@ -220,15 +204,31 @@
<string>
...
</string>
<string>
...
</string>
</property>
</property>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/actions/process-stop.svg
</normaloff>
:/images/actions/process-stop.svg
</iconset>
<normaloff>
:/images/actions/process-stop.svg
</normaloff>
:/images/actions/process-stop.svg
</iconset>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"2"
column=
"4"
>
<widget
class=
"QLabel"
name=
"statusLabel"
>
<property
name=
"toolTip"
>
<string>
The current waypoint transmission status
</string>
</property>
<property
name=
"statusTip"
>
<string>
The current waypoint transmission status
</string>
</property>
<property
name=
"whatsThis"
>
<string>
The current waypoint transmission status
</string>
</property>
<property
name=
"text"
>
<string>
Please add first waypoint.
</string>
</property>
</widget>
</item>
</layout>
</layout>
<action
name=
"actionAddWaypoint"
>
<action
name=
"actionAddWaypoint"
>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/actions/list-add.svg
</normaloff>
:/images/actions/list-add.svg
</iconset>
<normaloff>
:/images/actions/list-add.svg
</normaloff>
:/images/actions/list-add.svg
</iconset>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</action>
</action>
<action
name=
"actionTransmit"
>
<action
name=
"actionTransmit"
>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/devices/network-wireless.svg
</normaloff>
:/images/devices/network-wireless.svg
</iconset>
<normaloff>
:/images/devices/network-wireless.svg
</normaloff>
:/images/devices/network-wireless.svg
</iconset>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</action>
</action>
<action
name=
"actionRead"
>
<action
name=
"actionRead"
>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/status/software-update-available.svg
</normaloff>
:/images/status/software-update-available.svg
</iconset>
<normaloff>
:/images/status/software-update-available.svg
</normaloff>
:/images/status/software-update-available.svg
</iconset>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
...
@@ -261,7 +261,7 @@
...
@@ -261,7 +261,7 @@
</action>
</action>
</widget>
</widget>
<resources>
<resources>
<include
location=
"../../
mavground
.qrc"
/>
<include
location=
"../../
qgroundcontrol
.qrc"
/>
</resources>
</resources>
<connections/>
<connections/>
</ui>
</ui>
src/ui/designer/QGCToolWidget.cc
View file @
dc3b21fb
...
@@ -14,20 +14,23 @@
...
@@ -14,20 +14,23 @@
#include "QGCCommandButton.h"
#include "QGCCommandButton.h"
#include "UASManager.h"
#include "UASManager.h"
QGCToolWidget
::
QGCToolWidget
(
const
QString
&
title
,
QWidget
*
parent
)
:
QGCToolWidget
::
QGCToolWidget
(
const
QString
&
title
,
QWidget
*
parent
,
QSettings
*
settings
)
:
QWidget
(
parent
),
QWidget
(
parent
),
mav
(
NULL
),
mav
(
NULL
),
mainMenuAction
(
NULL
),
mainMenuAction
(
NULL
),
widgetTitle
(
title
),
widgetTitle
(
title
),
ui
(
new
Ui
::
QGCToolWidget
)
ui
(
new
Ui
::
QGCToolWidget
)
{
{
ui
->
setupUi
(
this
);
if
(
settings
)
loadSettings
(
*
settings
);
if
(
title
==
"Unnamed Tool"
)
if
(
title
==
"Unnamed Tool"
)
{
{
widgetTitle
=
QString
(
"%1 %2"
).
arg
(
title
).
arg
(
QGCToolWidget
::
instances
()
->
count
());
widgetTitle
=
QString
(
"%1 %2"
).
arg
(
title
).
arg
(
QGCToolWidget
::
instances
()
->
count
());
}
}
qDebug
()
<<
"WidgetTitle"
<<
widgetTitle
;
qDebug
()
<<
"WidgetTitle"
<<
widgetTitle
;
ui
->
setupUi
(
this
);
setObjectName
(
t
itle
);
setObjectName
(
widgetT
itle
);
createActions
();
createActions
();
toolLayout
=
ui
->
toolLayout
;
toolLayout
=
ui
->
toolLayout
;
toolLayout
->
setAlignment
(
Qt
::
AlignTop
);
toolLayout
->
setAlignment
(
Qt
::
AlignTop
);
...
@@ -35,19 +38,18 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent) :
...
@@ -35,19 +38,18 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent) :
QDockWidget
*
dock
=
dynamic_cast
<
QDockWidget
*>
(
this
->
parentWidget
());
QDockWidget
*
dock
=
dynamic_cast
<
QDockWidget
*>
(
this
->
parentWidget
());
if
(
dock
)
{
if
(
dock
)
{
dock
->
setWindowTitle
(
t
itle
);
dock
->
setWindowTitle
(
widgetT
itle
);
dock
->
setObjectName
(
t
itle
+
"DOCK"
);
dock
->
setObjectName
(
widgetT
itle
+
"DOCK"
);
}
}
// Try with parent
// Try with parent
dock
=
dynamic_cast
<
QDockWidget
*>
(
parent
);
dock
=
dynamic_cast
<
QDockWidget
*>
(
parent
);
if
(
dock
)
{
if
(
dock
)
{
dock
->
setWindowTitle
(
t
itle
);
dock
->
setWindowTitle
(
widgetT
itle
);
dock
->
setObjectName
(
t
itle
+
"DOCK"
);
dock
->
setObjectName
(
widgetT
itle
+
"DOCK"
);
}
}
this
->
setWindowTitle
(
title
);
this
->
setWindowTitle
(
widgetTitle
);
QList
<
UASInterface
*>
systems
=
UASManager
::
instance
()
->
getUASList
();
QList
<
UASInterface
*>
systems
=
UASManager
::
instance
()
->
getUASList
();
foreach
(
UASInterface
*
uas
,
systems
)
foreach
(
UASInterface
*
uas
,
systems
)
{
{
...
@@ -58,7 +60,11 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent) :
...
@@ -58,7 +60,11 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent) :
}
}
}
}
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
addUAS
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
addUAS
(
UASInterface
*
)));
if
(
!
instances
()
->
contains
(
title
))
instances
()
->
insert
(
title
,
this
);
if
(
!
instances
()
->
contains
(
widgetTitle
))
instances
()
->
insert
(
widgetTitle
,
this
);
// Enforce storage if this not loaded from settings
// is MUST NOT BE SAVED if it was loaded from settings!
if
(
!
settings
)
storeWidgetsToSettings
();
}
}
QGCToolWidget
::~
QGCToolWidget
()
QGCToolWidget
::~
QGCToolWidget
()
...
@@ -106,18 +112,22 @@ QList<QGCToolWidget*> QGCToolWidget::createWidgetsFromSettings(QWidget* parent,
...
@@ -106,18 +112,22 @@ QList<QGCToolWidget*> QGCToolWidget::createWidgetsFromSettings(QWidget* parent,
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
{
settings
->
setArrayIndex
(
i
);
settings
->
setArrayIndex
(
i
);
QString
name
=
settings
->
value
(
"TITLE"
,
tr
(
"UNKNOWN WIDGET %1"
).
arg
(
i
)
).
toString
();
QString
name
=
settings
->
value
(
"TITLE"
,
""
).
toString
();
if
(
!
instances
()
->
contains
(
name
))
if
(
!
instances
()
->
contains
(
name
)
&&
name
.
length
()
!=
0
)
{
{
qDebug
()
<<
"CREATED WIDGET:"
<<
name
;
qDebug
()
<<
"CREATED WIDGET:"
<<
name
;
QGCToolWidget
*
tool
=
new
QGCToolWidget
(
name
,
parent
);
QGCToolWidget
*
tool
=
new
QGCToolWidget
(
name
,
parent
,
settings
);
instances
()
->
insert
(
name
,
tool
);
newWidgets
.
append
(
tool
);
newWidgets
.
append
(
tool
);
}
}
else
if
(
name
.
length
()
==
0
)
{
// Silently catch empty widget name - sanity check
// to survive broken settings (e.g. from user manipulation)
}
else
else
{
{
qDebug
()
<<
"WIDGET
DID ALREADY EXIST, REJECTING"
;
qDebug
()
<<
"WIDGET
"
<<
name
<<
"
DID ALREADY EXIST, REJECTING"
;
}
}
}
}
settings
->
endArray
();
settings
->
endArray
();
...
@@ -145,7 +155,9 @@ bool QGCToolWidget::loadSettings(const QString& settings, bool singleinstance)
...
@@ -145,7 +155,9 @@ bool QGCToolWidget::loadSettings(const QString& settings, bool singleinstance)
{
{
QString
widgetName
=
groups
.
first
();
QString
widgetName
=
groups
.
first
();
if
(
singleinstance
&&
QGCToolWidget
::
instances
()
->
keys
().
contains
(
widgetName
))
return
false
;
if
(
singleinstance
&&
QGCToolWidget
::
instances
()
->
keys
().
contains
(
widgetName
))
return
false
;
setTitle
(
widgetName
);
// Do not use setTitle() here,
// interferes with loading settings
widgetTitle
=
widgetName
;
qDebug
()
<<
"WIDGET TITLE LOADED: "
<<
widgetName
;
qDebug
()
<<
"WIDGET TITLE LOADED: "
<<
widgetName
;
loadSettings
(
set
);
loadSettings
(
set
);
return
true
;
return
true
;
...
@@ -214,11 +226,24 @@ void QGCToolWidget::storeWidgetsToSettings(QString settingsFile)
...
@@ -214,11 +226,24 @@ void QGCToolWidget::storeWidgetsToSettings(QString settingsFile)
qDebug
()
<<
"STORING SETTINGS TO DEFAULT"
<<
settings
->
fileName
();
qDebug
()
<<
"STORING SETTINGS TO DEFAULT"
<<
settings
->
fileName
();
}
}
int
preArraySize
=
settings
->
beginReadArray
(
"QGC_TOOL_WIDGET_NAMES"
);
settings
->
endArray
();
settings
->
beginWriteArray
(
"QGC_TOOL_WIDGET_NAMES"
);
settings
->
beginWriteArray
(
"QGC_TOOL_WIDGET_NAMES"
);
for
(
int
i
=
0
;
i
<
instances
()
->
size
(
);
++
i
)
for
(
int
i
=
0
;
i
<
qMax
(
preArraySize
,
instances
()
->
size
()
);
++
i
)
{
{
settings
->
setArrayIndex
(
i
);
settings
->
setArrayIndex
(
i
);
settings
->
setValue
(
"TITLE"
,
instances
()
->
values
().
at
(
i
)
->
getTitle
());
if
(
i
<
instances
()
->
size
())
{
// Updating value
settings
->
setValue
(
"TITLE"
,
instances
()
->
values
().
at
(
i
)
->
getTitle
());
qDebug
()
<<
"WRITING TITLE"
<<
instances
()
->
values
().
at
(
i
)
->
getTitle
();
}
else
{
// Deleting old value
settings
->
remove
(
"TITLE"
);
}
}
}
settings
->
endArray
();
settings
->
endArray
();
...
@@ -244,8 +269,8 @@ void QGCToolWidget::storeSettings(const QString& settingsFile)
...
@@ -244,8 +269,8 @@ void QGCToolWidget::storeSettings(const QString& settingsFile)
void
QGCToolWidget
::
storeSettings
(
QSettings
&
settings
)
void
QGCToolWidget
::
storeSettings
(
QSettings
&
settings
)
{
{
QString
widgetName
=
getTitle
()
;
qDebug
()
<<
"WRITING WIDGET"
<<
widgetTitle
<<
"TO SETTINGS"
;
settings
.
beginGroup
(
widget
Nam
e
);
settings
.
beginGroup
(
widget
Titl
e
);
settings
.
beginWriteArray
(
"QGC_TOOL_WIDGET_ITEMS"
);
settings
.
beginWriteArray
(
"QGC_TOOL_WIDGET_ITEMS"
);
int
k
=
0
;
// QGCToolItem counter
int
k
=
0
;
// QGCToolItem counter
for
(
int
j
=
0
;
j
<
children
().
size
();
++
j
)
for
(
int
j
=
0
;
j
<
children
().
size
();
++
j
)
...
@@ -254,6 +279,7 @@ void QGCToolWidget::storeSettings(QSettings& settings)
...
@@ -254,6 +279,7 @@ void QGCToolWidget::storeSettings(QSettings& settings)
QGCToolWidgetItem
*
item
=
dynamic_cast
<
QGCToolWidgetItem
*>
(
children
().
at
(
j
));
QGCToolWidgetItem
*
item
=
dynamic_cast
<
QGCToolWidgetItem
*>
(
children
().
at
(
j
));
if
(
item
)
if
(
item
)
{
{
// Only count actual tool widget item children
settings
.
setArrayIndex
(
k
++
);
settings
.
setArrayIndex
(
k
++
);
// Store the ToolWidgetItem
// Store the ToolWidgetItem
item
->
writeSettings
(
settings
);
item
->
writeSettings
(
settings
);
...
@@ -424,20 +450,19 @@ void QGCToolWidget::setTitle()
...
@@ -424,20 +450,19 @@ void QGCToolWidget::setTitle()
void
QGCToolWidget
::
setWindowTitle
(
const
QString
&
title
)
void
QGCToolWidget
::
setWindowTitle
(
const
QString
&
title
)
{
{
// Sets title and calls setWindowTitle on QWidget
// Sets title and calls setWindowTitle on QWidget
setTitle
(
title
);
widgetTitle
=
title
;
QWidget
::
setWindowTitle
(
title
);
}
}
void
QGCToolWidget
::
setTitle
(
QString
title
)
void
QGCToolWidget
::
setTitle
(
QString
title
)
{
{
// Remove references to old title
// Remove references to old title
QDockWidget
*
parent
=
dynamic_cast
<
QDockWidget
*>
(
this
->
parentWidget
());
QSettings
settings
;
if
(
parent
)
settings
.
beginGroup
(
widgetTitle
);
{
settings
.
remove
(
""
);
QSettings
settings
;
settings
.
endGroup
();
settings
.
beginGroup
(
widgetTitle
);
settings
.
sync
();
settings
.
remove
(
""
);
settings
.
endGroup
();
}
if
(
instances
()
->
contains
(
widgetTitle
))
instances
()
->
remove
(
widgetTitle
);
if
(
instances
()
->
contains
(
widgetTitle
))
instances
()
->
remove
(
widgetTitle
);
// Switch to new title
// Switch to new title
...
@@ -445,7 +470,10 @@ void QGCToolWidget::setTitle(QString title)
...
@@ -445,7 +470,10 @@ void QGCToolWidget::setTitle(QString title)
if
(
!
instances
()
->
contains
(
title
))
instances
()
->
insert
(
title
,
this
);
if
(
!
instances
()
->
contains
(
title
))
instances
()
->
insert
(
title
,
this
);
QWidget
::
setWindowTitle
(
title
);
QWidget
::
setWindowTitle
(
title
);
QDockWidget
*
parent
=
dynamic_cast
<
QDockWidget
*>
(
this
->
parentWidget
());
if
(
parent
)
parent
->
setWindowTitle
(
title
);
if
(
parent
)
parent
->
setWindowTitle
(
title
);
// Store all widgets
storeWidgetsToSettings
();
emit
titleChanged
(
title
);
emit
titleChanged
(
title
);
if
(
mainMenuAction
)
mainMenuAction
->
setText
(
title
);
if
(
mainMenuAction
)
mainMenuAction
->
setText
(
title
);
...
@@ -470,6 +498,5 @@ void QGCToolWidget::deleteWidget()
...
@@ -470,6 +498,5 @@ void QGCToolWidget::deleteWidget()
storeWidgetsToSettings
();
storeWidgetsToSettings
();
// Delete
// Delete
mainMenuAction
->
deleteLater
();
this
->
deleteLater
();
this
->
deleteLater
();
}
}
src/ui/designer/QGCToolWidget.h
View file @
dc3b21fb
...
@@ -19,7 +19,7 @@ class QGCToolWidget : public QWidget
...
@@ -19,7 +19,7 @@ class QGCToolWidget : public QWidget
Q_OBJECT
Q_OBJECT
public:
public:
explicit
QGCToolWidget
(
const
QString
&
title
=
QString
(
"Unnamed Tool"
),
QWidget
*
parent
=
0
);
explicit
QGCToolWidget
(
const
QString
&
title
=
QString
(
"Unnamed Tool"
),
QWidget
*
parent
=
0
,
QSettings
*
settings
=
0
);
~
QGCToolWidget
();
~
QGCToolWidget
();
/** @brief Factory method to instantiate all tool widgets */
/** @brief Factory method to instantiate all tool widgets */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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