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
126ad85e
Commit
126ad85e
authored
Sep 08, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-lin' of
https://github.com/pixhawk/qgroundcontrol
into dev
parents
dee19d0c
df70c98b
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
230 additions
and
78 deletions
+230
-78
QGCCore.cc
src/QGCCore.cc
+1
-1
XMLCommProtocolWidget.h
src/apps/mavlinkgen/ui/XMLCommProtocolWidget.h
+16
-0
UASInterface.h
src/uas/UASInterface.h
+53
-3
HUD.cc
src/ui/HUD.cc
+3
-1
HUD.h
src/ui/HUD.h
+3
-0
MainWindow.cc
src/ui/MainWindow.cc
+75
-35
MainWindow.h
src/ui/MainWindow.h
+8
-16
QGCDataPlot2D.h
src/ui/QGCDataPlot2D.h
+15
-0
QGCToolWidget.cc
src/ui/designer/QGCToolWidget.cc
+6
-1
QGCToolWidget.h
src/ui/designer/QGCToolWidget.h
+1
-1
Linecharts.cc
src/ui/linechart/Linecharts.cc
+19
-16
Linecharts.h
src/ui/linechart/Linecharts.h
+2
-0
QGCMapTool.h
src/ui/map/QGCMapTool.h
+16
-0
QGCGoogleEarthView.cc
src/ui/map3D/QGCGoogleEarthView.cc
+9
-4
QGCGoogleEarthView.h
src/ui/map3D/QGCGoogleEarthView.h
+3
-0
No files found.
src/QGCCore.cc
View file @
126ad85e
...
...
@@ -204,7 +204,7 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
QGCCore
::~
QGCCore
()
{
//mainWindow->storeSettings();
mainWindow
->
hid
e
();
mainWindow
->
clos
e
();
mainWindow
->
deleteLater
();
// Delete singletons
delete
LinkManager
::
instance
();
...
...
src/apps/mavlinkgen/ui/XMLCommProtocolWidget.h
View file @
126ad85e
...
...
@@ -66,6 +66,22 @@ protected:
DomModel
*
model
;
void
changeEvent
(
QEvent
*
e
);
signals:
void
visibilityChanged
(
bool
visible
);
protected:
void
showEvent
(
QShowEvent
*
event
)
{
QWidget
::
showEvent
(
event
);
emit
visibilityChanged
(
true
);
}
void
hideEvent
(
QHideEvent
*
event
)
{
QWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
}
private:
Ui
::
XMLCommProtocolWidget
*
m_ui
;
};
...
...
src/uas/UASInterface.h
View file @
126ad85e
...
...
@@ -176,14 +176,64 @@ public:
/** @brief Get the type of the system (airplane, quadrotor, helicopter,..)*/
virtual
int
getSystemType
()
=
0
;
/** @brief Get the type of the autopilot (PIXHAWK, APM, UDB, PPZ,..) */
virtual
int
getAutopilotType
()
=
0
;
virtual
void
setAutopilotType
(
int
apType
)
=
0
;
QString
getSystemTypeString
(
int
type
)
{
switch
(
type
)
{
default:
case
0
:
return
"MAV_TYPE_GENERIC"
;
case
1
:
return
"MAV_TYPE_FIXED_WING"
;
case
2
:
return
"MAV_TYPE_QUADROTOR"
;
case
3
:
return
"MAV_TYPE_COAXIAL"
;
case
4
:
return
"MAV_TYPE_HELICOPTER"
;
case
5
:
return
"MAV_TYPE_GROUND"
;
case
6
:
return
"MAV_TYPE_GCS"
;
case
7
:
return
"MAV_TYPE_AIRSHIP"
;
case
8
:
return
"MAV_TYPE_FREE_BALLOON"
;
case
9
:
return
"MAV_TYPE_ROCKET"
;
case
10
:
return
"MAV_TYPE_UGV_GROUND_ROVER"
;
case
11
:
return
"MAV_TYPE_UGV_SURFACE_SHIP"
;
}
}
QString
getAutopilotTypeString
(
int
type
)
{
switch
(
type
)
{
default:
case
0
:
return
"MAV_AUTOPILOT_GENERIC"
;
case
1
:
return
"MAV_AUTOPILOT_PIXHAWK"
;
case
2
:
return
"MAV_AUTOPILOT_SLUGS"
;
case
3
:
return
"MAV_AUTOPILOT_ARDUPILOTMEGA"
;
case
4
:
return
"MAV_AUTOPILOT_OPENPILOT"
;
}
}
QColor
getColor
()
{
return
color
;
}
virtual
int
getAutopilotType
()
=
0
;
virtual
void
setAutopilotType
(
int
apType
)
=
0
;
public
slots
:
/** @brief Set a new name for the system */
...
...
src/ui/HUD.cc
View file @
126ad85e
...
...
@@ -200,14 +200,16 @@ void HUD::showEvent(QShowEvent* event)
// events
QGLWidget
::
showEvent
(
event
);
refreshTimer
->
start
(
updateInterval
);
emit
visibilityChanged
(
true
);
}
void
HUD
::
hideEvent
(
QHideEvent
*
event
)
{
// React only to internal (pre-display)
// events
QGLWidget
::
hideEvent
(
event
);
refreshTimer
->
stop
();
QGLWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
}
void
HUD
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
...
...
src/ui/HUD.h
View file @
126ad85e
...
...
@@ -113,6 +113,9 @@ protected slots:
void
drawPolygon
(
QPolygonF
refPolygon
,
QPainter
*
painter
);
signals:
void
visibilityChanged
(
bool
visible
);
protected:
void
commitRawDataToGL
();
/** @brief Convert reference coordinates to screen coordinates */
...
...
src/ui/MainWindow.cc
View file @
126ad85e
...
...
@@ -128,11 +128,8 @@ MainWindow::MainWindow(QWidget *parent):
setCentralWidget
(
centerStack
);
buildCommonWidgets
();
connectCommonWidgets
();
arrangeCommonCenterStack
();
configureWindowName
();
loadStyle
(
currentStyle
);
...
...
@@ -235,7 +232,13 @@ MainWindow::~MainWindow()
delete
dockWidget
->
widget
();
delete
dockWidget
;
}
else
{
delete
dynamic_cast
<
QObject
*>
(
*
i
);
}
}
// Delete all UAS objects
}
/**
...
...
@@ -243,11 +246,9 @@ MainWindow::~MainWindow()
*/
void
MainWindow
::
setDefaultSettingsForAp
()
{
// Check if the settings exist, instantiate defaults if necessary
// // Check if the settings exist, instantiate defaults if necessary
// // UNCONNECTED VIEW DEFAULT
//// QString centralKey = buildMenuKey(SUB_SECTION_CHECKED, CENTRAL_MAP, VIEW_UNCONNECTED);
// if (!settings.contains(centralKey)) {
...
...
@@ -574,6 +575,9 @@ void MainWindow::buildCommonWidgets()
addTool
(
video2DockWidget
,
tr
(
"Video Stream 2"
),
Qt
::
LeftDockWidgetArea
);
}
// Custom widgets, added last to all menus and layouts
buildCustomWidget
();
// Dialogue widgets
//FIXME: free memory in destructor
...
...
@@ -588,6 +592,8 @@ void MainWindow::addTool(QDockWidget* widget, const QString& title, Qt::DockWidg
var
.
setValue
((
QWidget
*
)
widget
);
tempAction
->
setData
(
var
);
connect
(
tempAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showTool
(
bool
)));
connect
(
widget
,
SIGNAL
(
visibilityChanged
(
bool
)),
tempAction
,
SLOT
(
setChecked
(
bool
)));
tempAction
->
setChecked
(
widget
->
isVisible
());
addDockWidget
(
area
,
widget
);
}
...
...
@@ -614,6 +620,8 @@ void MainWindow::addCentralWidget(QWidget* widget, const QString& title)
tempAction
->
setData
(
var
);
centerStackActionGroup
.
addAction
(
tempAction
);
connect
(
tempAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showCentralWidget
()));
connect
(
widget
,
SIGNAL
(
visibilityChanged
(
bool
)),
tempAction
,
SLOT
(
setChecked
(
bool
)));
tempAction
->
setChecked
(
widget
->
isVisible
());
}
}
...
...
@@ -677,15 +685,14 @@ void MainWindow::loadCustomWidget()
{
QString
widgetFileExtension
(
".qgw"
);
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Specify Widget File Name"
),
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
),
tr
(
"QGroundControl Widget (*%1);;"
).
arg
(
widgetFileExtension
));
QGCToolWidget
*
tool
=
new
QGCToolWidget
(
""
,
this
);
tool
->
loadSettings
(
fileName
);
loadCustomWidget
(
fileName
);
}
if
(
QGCToolWidget
::
instances
()
->
size
()
<
2
)
void
MainWindow
::
loadCustomWidget
(
const
QString
&
fileName
,
bool
singleinstance
)
{
QGCToolWidget
*
tool
=
new
QGCToolWidget
(
""
,
this
);
if
(
tool
->
loadSettings
(
fileName
,
true
)
||
!
singleinstance
)
{
// This is the first widget
ui
.
menuTools
->
addSeparator
();
}
// Add widget to UI
QDockWidget
*
dock
=
new
QDockWidget
(
tool
->
getTitle
(),
this
);
connect
(
tool
,
SIGNAL
(
destroyed
()),
dock
,
SLOT
(
deleteLater
()));
...
...
@@ -700,11 +707,36 @@ void MainWindow::loadCustomWidget()
ui
.
menuTools
->
addAction
(
showAction
);
this
->
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
dock
);
dock
->
setVisible
(
true
);
}
else
{
return
;
}
}
void
MainWindow
::
arrangeCommonCenterStack
(
)
void
MainWindow
::
loadCustomWidgetsFromDefaults
(
const
QString
&
systemType
,
const
QString
&
autopilotType
)
{
QString
defaultsDir
=
qApp
->
applicationDirPath
()
+
"/files/"
+
systemType
.
toLower
()
+
"/"
+
autopilotType
.
toLower
()
+
"/widgets/"
;
QDir
widgets
(
defaultsDir
);
QStringList
files
=
widgets
.
entryList
();
if
(
files
.
count
()
==
0
)
{
qDebug
()
<<
"No default custom widgets for system "
<<
systemType
<<
"autopilot"
<<
autopilotType
<<
" found"
;
qDebug
()
<<
"Tried with path: "
<<
defaultsDir
;
}
// Load all custom widgets found in the AP folder
for
(
int
i
=
0
;
i
<
files
.
count
();
++
i
)
{
QString
file
=
files
[
i
];
if
(
file
.
endsWith
(
".qgw"
))
{
// Will only be loaded if not already a custom widget with
// the same name is present
loadCustomWidget
(
file
,
true
);
}
}
}
void
MainWindow
::
loadSettings
()
...
...
@@ -1155,10 +1187,8 @@ void MainWindow::UASCreated(UASInterface* uas)
// Connect the UAS to the full user interface
if
(
uas
!=
NULL
)
{
// Set default settings
setDefaultSettingsForAp
();
if
(
uas
!=
NULL
)
{
// The pilot, operator and engineer views were not available on startup, enable them now
ui
.
actionPilotsView
->
setEnabled
(
true
);
ui
.
actionOperatorsView
->
setEnabled
(
true
);
...
...
@@ -1236,6 +1266,11 @@ void MainWindow::UASCreated(UASInterface* uas)
addCentralWidget
(
linechartWidget
,
tr
(
"Realtime Plot"
));
}
// Load default custom widgets for this autopilot type
loadCustomWidgetsFromDefaults
(
uas
->
getSystemTypeString
(
uas
->
getSystemType
()),
uas
->
getAutopilotTypeString
(
uas
->
getAutopilotType
()));
// Change the view only if this is the first UAS
// If this is the first connected UAS, it is both created as well as
...
...
@@ -1275,10 +1310,9 @@ void MainWindow::UASCreated(UASInterface* uas)
if
(
!
ui
.
menuConnected_Systems
->
isEnabled
())
ui
.
menuConnected_Systems
->
setEnabled
(
true
);
// Custom widgets, added last to all menus and layouts
buildCustomWidget
();
// Restore the mainwindow size
if
(
settings
.
contains
(
getWindowGeometryKey
()))
{
if
(
settings
.
contains
(
getWindowGeometryKey
()))
{
restoreGeometry
(
settings
.
value
(
getWindowGeometryKey
()).
toByteArray
());
}
}
...
...
@@ -1302,7 +1336,13 @@ void MainWindow::loadViewState()
{
// Restore center stack state
int
index
=
settings
.
value
(
getWindowStateKey
()
+
"CENTER_WIDGET"
,
centerStack
->
currentIndex
()).
toInt
();
centerStack
->
setCurrentIndex
(
index
);
// The offline plot view is usually the consequence of a logging run, always show the realtime view first
if
(
centerStack
->
indexOf
(
dataplotWidget
)
==
index
)
{
// Rewrite to realtime plot
index
=
centerStack
->
indexOf
(
linechartWidget
);
}
if
(
index
!=
-
1
)
centerStack
->
setCurrentIndex
(
index
);
// Restore the widget positions and size
if
(
settings
.
contains
(
getWindowStateKey
()))
...
...
src/ui/MainWindow.h
View file @
126ad85e
...
...
@@ -178,9 +178,15 @@ public slots:
/** @brief Add a custom tool widget */
void
createCustomWidget
();
/** @brief Load a custom tool widget from a file */
/** @brief Load a custom tool widget from a file
chosen by user (QFileDialog)
*/
void
loadCustomWidget
();
/** @brief Load a custom tool widget from a file */
void
loadCustomWidget
(
const
QString
&
fileName
,
bool
singleinstance
=
false
);
/** @brief Load custom widgets from default file */
void
loadCustomWidgetsFromDefaults
(
const
QString
&
systemType
,
const
QString
&
autopilotType
);
void
closeEvent
(
QCloseEvent
*
event
);
/** @brief Load data view, allowing to plot flight data */
...
...
@@ -275,21 +281,8 @@ protected:
void
buildCustomWidget
();
void
buildCommonWidgets
();
// void buildPxWidgets();
// void buildSlugsWidgets();
void
connectCommonWidgets
();
// void connectPxWidgets();
// void connectSlugsWidgets();
void
arrangeCommonCenterStack
();
// void arrangePxCenterStack();
// void arrangeSlugsCenterStack();
void
connectCommonActions
();
// void connectPxActions();
// void connectSlugsActions();
void
configureWindowName
();
void
loadSettings
();
...
...
@@ -307,9 +300,7 @@ protected:
// Center widgets
QPointer
<
Linecharts
>
linechartWidget
;
QPointer
<
HUD
>
hudWidget
;
QPointer
<
QGCMapTool
>
mapWidget
;
QPointer
<
XMLCommProtocolWidget
>
protocolWidget
;
QPointer
<
QGCDataPlot2D
>
dataplotWidget
;
...
...
@@ -322,6 +313,7 @@ protected:
#if (defined _MSC_VER) || (defined Q_OS_MAC)
QPointer
<
QGCGoogleEarthView
>
gEarthWidget
;
#endif
// Dock widgets
QPointer
<
QDockWidget
>
controlDockWidget
;
QPointer
<
QDockWidget
>
controlParameterWidget
;
...
...
src/ui/QGCDataPlot2D.h
View file @
126ad85e
...
...
@@ -46,7 +46,22 @@ public slots:
/** @brief Calculate and display regression function*/
bool
calculateRegression
();
signals:
void
visibilityChanged
(
bool
visible
);
protected:
void
showEvent
(
QShowEvent
*
event
)
{
QWidget
::
showEvent
(
event
);
emit
visibilityChanged
(
true
);
}
void
hideEvent
(
QHideEvent
*
event
)
{
QWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
}
void
changeEvent
(
QEvent
*
e
);
IncrementalPlot
*
plot
;
LogCompressor
*
compressor
;
...
...
src/ui/designer/QGCToolWidget.cc
View file @
126ad85e
...
...
@@ -109,14 +109,19 @@ QList<QGCToolWidget*> QGCToolWidget::createWidgetsFromSettings(QWidget* parent,
return
instances
()
->
values
();
}
void
QGCToolWidget
::
loadSettings
(
const
QString
&
settings
)
/**
* @param singleinstance If this is set to true, the widget settings will only be loaded if not another widget with the same title exists
*/
bool
QGCToolWidget
::
loadSettings
(
const
QString
&
settings
,
bool
singleinstance
)
{
QSettings
set
(
settings
,
QSettings
::
IniFormat
);
QStringList
groups
=
set
.
childGroups
();
QString
widgetName
=
groups
.
first
();
if
(
singleinstance
&&
QGCToolWidget
::
instances
()
->
keys
().
contains
(
widgetName
))
return
false
;
setTitle
(
widgetName
);
qDebug
()
<<
"WIDGET TITLE LOADED: "
<<
widgetName
;
loadSettings
(
set
);
return
true
;
}
void
QGCToolWidget
::
loadSettings
(
QSettings
&
settings
)
...
...
src/ui/designer/QGCToolWidget.h
View file @
126ad85e
...
...
@@ -47,7 +47,7 @@ public slots:
/** @brief Load this widget from a QSettings object */
void
loadSettings
(
QSettings
&
settings
);
/** @brief Load this widget from a settings file */
void
loadSettings
(
const
QString
&
settings
);
bool
loadSettings
(
const
QString
&
settings
,
bool
singleinstance
=
false
);
/** @brief Store this widget to a QSettings object */
void
storeSettings
(
QSettings
&
settings
);
/** @brief Store this widget to a settings file */
...
...
src/ui/linechart/Linecharts.cc
View file @
126ad85e
...
...
@@ -30,23 +30,25 @@ void Linecharts::showEvent(QShowEvent* event)
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
)
{
Q_UNUSED
(
event
)
QWidget
*
prevWidget
=
currentWidget
();
if
(
prevWidget
)
{
if
(
prevWidget
)
{
LinechartWidget
*
chart
=
dynamic_cast
<
LinechartWidget
*>
(
prevWidget
);
if
(
chart
)
{
this
->
active
=
true
;
chart
->
setActive
(
true
);
}
}
}
QWidget
::
showEvent
(
event
);
emit
visibilityChanged
(
true
);
}
void
Linecharts
::
hideEvent
(
QHideEvent
*
event
)
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
)
{
Q_UNUSED
(
event
)
QWidget
*
prevWidget
=
currentWidget
();
if
(
prevWidget
)
{
LinechartWidget
*
chart
=
dynamic_cast
<
LinechartWidget
*>
(
prevWidget
);
...
...
@@ -55,7 +57,8 @@ void Linecharts::hideEvent(QHideEvent* event)
chart
->
setActive
(
false
);
}
}
}
QWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
}
void
Linecharts
::
selectSystem
(
int
systemid
)
...
...
src/ui/linechart/Linecharts.h
View file @
126ad85e
...
...
@@ -16,6 +16,7 @@ public:
signals:
/** @brief This signal is emitted once a logfile has been finished writing */
void
logfileWritten
(
QString
fileName
);
void
visibilityChanged
(
bool
visible
);
public
slots
:
/** @brief Select plot for one system */
...
...
@@ -24,6 +25,7 @@ public slots:
void
addSystem
(
UASInterface
*
uas
);
protected:
QMap
<
int
,
LinechartWidget
*>
plots
;
bool
active
;
/** @brief Start updating widget */
...
...
src/ui/map/QGCMapTool.h
View file @
126ad85e
...
...
@@ -20,6 +20,22 @@ public slots:
/** @brief Update slider zoom from map change */
void
setZoom
(
int
zoom
);
signals:
void
visibilityChanged
(
bool
visible
);
protected:
void
showEvent
(
QShowEvent
*
event
)
{
QWidget
::
showEvent
(
event
);
emit
visibilityChanged
(
true
);
}
void
hideEvent
(
QHideEvent
*
event
)
{
QWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
}
private:
Ui
::
QGCMapTool
*
ui
;
};
...
...
src/ui/map3D/QGCGoogleEarthView.cc
View file @
126ad85e
...
...
@@ -376,18 +376,20 @@ void QGCGoogleEarthView::moveToPosition()
void
QGCGoogleEarthView
::
hideEvent
(
QHideEvent
*
event
)
{
Q_UNUSED
(
event
);
updateTimer
->
stop
();
QWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
}
void
QGCGoogleEarthView
::
showEvent
(
QShowEvent
*
event
)
{
// React only to internal (pre-display)
// events
Q
_UNUSED
(
event
)
Q
Widget
::
showEvent
(
event
);
// Enable widget, initialize on first run
if
(
!
webViewInitialized
)
{
if
(
!
webViewInitialized
)
{
#if (defined Q_OS_MAC)
webViewMac
->
setPage
(
new
QGCWebPage
(
webViewMac
));
webViewMac
->
settings
()
->
setAttribute
(
QWebSettings
::
PluginsEnabled
,
true
);
...
...
@@ -404,9 +406,12 @@ void QGCGoogleEarthView::showEvent(QShowEvent* event)
gEarthInitialized
=
false
;
QTimer
::
singleShot
(
3000
,
this
,
SLOT
(
initializeGoogleEarth
()));
}
else
{
}
else
{
updateTimer
->
start
(
refreshRateMs
);
}
emit
visibilityChanged
(
true
);
}
void
QGCGoogleEarthView
::
printWinException
(
int
no
,
QString
str1
,
QString
str2
,
QString
str3
)
...
...
src/ui/map3D/QGCGoogleEarthView.h
View file @
126ad85e
...
...
@@ -137,6 +137,9 @@ public:
/** @brief Get a document element */
QVariant
documentElement
(
QString
name
);
signals:
void
visibilityChanged
(
bool
visible
);
protected:
void
changeEvent
(
QEvent
*
e
);
QTimer
*
updateTimer
;
...
...
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