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
323d162e
Commit
323d162e
authored
May 25, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #676 from DonLakeFlyer/BuildFixes
Build fixes
parents
f6ae3249
3b43cf6d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
174 additions
and
24 deletions
+174
-24
qgroundcontrol.pro
qgroundcontrol.pro
+4
-4
CmdLineOptParser.cc
src/CmdLineOptParser.cc
+59
-0
CmdLineOptParser.h
src/CmdLineOptParser.h
+46
-0
QGCCore.cc
src/QGCCore.cc
+19
-5
main.cc
src/main.cc
+39
-10
UAS.cc
src/uas/UAS.cc
+2
-2
PrimaryFlightDisplay.cc
src/ui/PrimaryFlightDisplay.cc
+4
-3
QGCMAVLinkLogPlayer.cc
src/ui/QGCMAVLinkLogPlayer.cc
+1
-0
No files found.
qgroundcontrol.pro
View file @
323d162e
...
...
@@ -187,7 +187,6 @@ DebugBuild {
src
/
qgcunittest
/
MockUAS
.
h
\
src
/
qgcunittest
/
MockQGCUASParamManager
.
h
\
src
/
qgcunittest
/
MultiSignalSpy
.
h
\
src
/
qgcunittest
/
TCPLinkTest
.
h
\
src
/
qgcunittest
/
FlightModeConfigTest
.
h
SOURCES
+=
\
...
...
@@ -196,7 +195,6 @@ DebugBuild {
src
/
qgcunittest
/
MockUAS
.
cc
\
src
/
qgcunittest
/
MockQGCUASParamManager
.
cc
\
src
/
qgcunittest
/
MultiSignalSpy
.
cc
\
src
/
qgcunittest
/
TCPLinkTest
.
cc
\
src
/
qgcunittest
/
FlightModeConfigTest
.
cc
}
...
...
@@ -563,7 +561,8 @@ HEADERS += \
src
/
ui
/
menuactionhelper
.
h
\
src
/
uas
/
UASManagerInterface
.
h
\
src
/
uas
/
QGCUASParamManagerInterface
.
h
\
src
/
uas
/
QGCUASWorker
.
h
src
/
uas
/
QGCUASWorker
.
h
\
src
/
CmdLineOptParser
.
h
SOURCES
+=
\
src
/
main
.
cc
\
...
...
@@ -747,4 +746,5 @@ SOURCES += \
src
/
ui
/
px4_configuration
/
QGCPX4SensorCalibration
.
cc
\
src
/
ui
/
designer
/
QGCXYPlot
.
cc
\
src
/
ui
/
menuactionhelper
.
cpp
\
src
/
uas
/
QGCUASWorker
.
cc
src
/
uas
/
QGCUASWorker
.
cc
\
src
/
CmdLineOptParser
.
cc
src/CmdLineOptParser.cc
0 → 100644
View file @
323d162e
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @brief Command line option parser
///
/// @author Don Gagne <don@thegagnes.com>
#include "CmdLineOptParser.h"
#include <QString>
/// @brief Implements a simple command line parser which sets booleans to true if the option is found.
void
ParseCmdLineOptions
(
int
&
argc
,
///< count of arguments in argv
char
*
argv
[],
///< command line arguments
CmdLineOpt_t
*
prgOpts
,
///< command line options
size_t
cOpts
,
///< count of command line options
bool
removeParsedOptions
)
///< true: remove parsed option from argc/argv
{
// Start with all options off
for
(
size_t
iOption
=
0
;
iOption
<
cOpts
;
iOption
++
)
{
*
prgOpts
[
iOption
].
flag
=
false
;
}
for
(
int
iArg
=
1
;
iArg
<
argc
;
iArg
++
)
{
for
(
size_t
iOption
=
0
;
iOption
<
cOpts
;
iOption
++
)
{
if
(
QString
(
argv
[
iArg
]).
compare
(
prgOpts
[
iOption
].
optionStr
,
Qt
::
CaseInsensitive
)
==
0
)
{
*
prgOpts
[
iOption
].
flag
=
true
;
if
(
removeParsedOptions
)
{
for
(
int
iShift
=
iArg
;
iShift
<
argc
-
1
;
iShift
++
)
{
argv
[
iShift
]
=
argv
[
iShift
+
1
];
}
argc
--
;
iArg
--
;
}
}
}
}
}
src/CmdLineOptParser.h
0 → 100644
View file @
323d162e
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @brief Command line option parser
///
/// @author Don Gagne <don@thegagnes.com>
#ifndef CMDLINEOPTPARSER_H
#define CMDLINEOPTPARSER_H
#include <cstring>
/// @brief Structure used to pass command line options to the ParseCmdLineOptions function.
typedef
struct
{
const
char
*
optionStr
;
///< command line option, for example "--foo"
bool
*
flag
;
///< if option is found this variable will be set to true
}
CmdLineOpt_t
;
void
ParseCmdLineOptions
(
int
&
argc
,
char
*
argv
[],
CmdLineOpt_t
*
prgOpts
,
size_t
cOpts
,
bool
removeParsedOptions
);
#endif
src/QGCCore.cc
View file @
323d162e
...
...
@@ -47,6 +47,7 @@ This file is part of the QGROUNDCONTROL project
#include "MainWindow.h"
#include "QGCWelcomeMainWindow.h"
#include "GAudioOutput.h"
#include "CmdLineOptParser.h"
#ifdef QGC_RTLAB_ENABLED
#include "OpalLink.h"
...
...
@@ -82,12 +83,25 @@ QGCCore::QGCCore(bool firstStart, int &argc, char* argv[]) : QApplication(argc,
// Set settings format
QSettings
::
setDefaultFormat
(
QSettings
::
IniFormat
);
// Check application settings
// clear them if they mismatch
// QGC then falls back to default
// Parse command line options
bool
fClearSettingsOptions
=
false
;
// Clear stored settings
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
{
"--clear-settings"
,
&
fClearSettingsOptions
},
// Add additional command line option flags here
};
ParseCmdLineOptions
(
argc
,
argv
,
rgCmdLineOptions
,
sizeof
(
rgCmdLineOptions
)
/
sizeof
(
rgCmdLineOptions
[
0
]),
false
);
QSettings
settings
;
if
(
fClearSettingsOptions
)
{
// User requested settings to be cleared on command line
settings
.
clear
();
}
// Show user an upgrade message if QGC got upgraded (see code below, after splash screen)
bool
upgraded
=
false
;
enum
MainWindow
::
CUSTOM_MODE
mode
=
MainWindow
::
CUSTOM_MODE_NONE
;
...
...
@@ -98,7 +112,7 @@ QGCCore::QGCCore(bool firstStart, int &argc, char* argv[]) : QApplication(argc,
if
(
qgcVersion
!=
QGC_APPLICATION_VERSION
)
{
lastApplicationVersion
=
qgcVersion
;
settings
.
clear
();
settings
.
clear
();
// Clear settings from different version
// Write current application version
settings
.
setValue
(
"QGC_APPLICATION_VERSION"
,
QGC_APPLICATION_VERSION
);
upgraded
=
true
;
...
...
src/main.cc
View file @
323d162e
...
...
@@ -36,6 +36,10 @@ This file is part of the QGROUNDCONTROL project
#include "TCPLink.h"
#ifdef QT_DEBUG
#include "AutoTest.h"
#include "CmdLineOptParser.h"
#ifdef Q_OS_WIN
#include <crtdbg.h>
#endif
#endif
/* SDL does ugly things to main() */
...
...
@@ -44,10 +48,10 @@ This file is part of the QGROUNDCONTROL project
#endif
// Install a message handler so you do not need
// the MSFT debug tools installed to se
// qDebug(), qWarning(), qCritical and qAbort
#ifdef Q_OS_WIN
/// @brief Message handler which is installed using qInstallMsgHandler so you do not need
/// the MSFT debug tools installed to see qDebug(), qWarning(), qCritical and qAbort
void
msgHandler
(
QtMsgType
type
,
const
char
*
msg
)
{
const
char
symbols
[]
=
{
'I'
,
'E'
,
'!'
,
'X'
};
...
...
@@ -56,6 +60,17 @@ void msgHandler( QtMsgType type, const char* msg )
if
(
type
==
QtFatalMsg
)
abort
();
}
/// @brief CRT Report Hook installed using _CrtSetReportHook. We install this hook when
/// we don't want asserts to pop a dialog on windows.
int
WindowsCrtReportHook
(
int
reportType
,
char
*
message
,
int
*
returnValue
)
{
Q_UNUSED
(
reportType
);
std
::
cerr
<<
message
<<
std
::
endl
;
// Output message to stderr
*
returnValue
=
0
;
// Don't break into debugger
return
true
;
// We handled this fully ourselves
}
#endif
/**
...
...
@@ -81,13 +96,27 @@ int main(int argc, char *argv[])
qRegisterMetaType
<
QAbstractSocket
::
SocketError
>
();
#ifdef QT_DEBUG
if
(
argc
>
1
&&
QString
(
argv
[
1
]).
compare
(
"--unittest"
,
Qt
::
CaseInsensitive
)
==
0
)
{
// Strip off extra command line args so QTest doesn't complain
for
(
int
i
=
1
;
i
<
argc
-
1
;
i
++
)
{
argv
[
i
]
=
argv
[
i
+
1
];
}
// We parse a small set of command line options here prior to QGCCore in order to handle the ones
// which need to be handled before a QApplication object is started.
bool
runUnitTests
=
false
;
// Run unit test
bool
quietWindowsAsserts
=
false
;
// Don't let asserts pop dialog boxes
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
{
"--unittest"
,
&
runUnitTests
},
{
"--no-windows-assert-ui"
,
&
quietWindowsAsserts
},
// Add additional command line option flags here
};
ParseCmdLineOptions
(
argc
,
argv
,
rgCmdLineOptions
,
sizeof
(
rgCmdLineOptions
)
/
sizeof
(
rgCmdLineOptions
[
0
]),
true
);
if
(
quietWindowsAsserts
)
{
#ifdef Q_OS_WIN
_CrtSetReportHook
(
WindowsCrtReportHook
);
#endif
}
if
(
runUnitTests
)
{
// Run the test
int
failures
=
AutoTest
::
run
(
argc
-
1
,
argv
);
if
(
failures
==
0
)
...
...
src/uas/UAS.cc
View file @
323d162e
...
...
@@ -155,6 +155,7 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(),
paramsOnceRequested
(
false
),
paramMgr
(
this
),
simulation
(
0
),
_thread
(
thread
),
// The protected members.
connectionLost
(
false
),
...
...
@@ -164,8 +165,7 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(),
hilEnabled
(
false
),
sensorHil
(
false
),
lastSendTimeGPS
(
0
),
lastSendTimeSensors
(
0
),
_thread
(
thread
)
lastSendTimeSensors
(
0
)
{
moveToThread
(
thread
);
...
...
src/ui/PrimaryFlightDisplay.cc
View file @
323d162e
...
...
@@ -110,6 +110,9 @@ const QString PrimaryFlightDisplay::compassWindNames[] = {
PrimaryFlightDisplay
::
PrimaryFlightDisplay
(
int
width
,
int
height
,
QWidget
*
parent
)
:
QWidget
(
parent
),
_valuesChanged
(
false
),
_valuesLastPainted
(
QGC
::
groundTimeMilliseconds
()),
uas
(
NULL
),
roll
(
0
),
...
...
@@ -141,9 +144,7 @@ PrimaryFlightDisplay::PrimaryFlightDisplay(int width, int height, QWidget *paren
instrumentOpagueBackground
(
QColor
::
fromHsvF
(
0
,
0
,
0.3
,
1.0
)),
font
(
"Bitstream Vera Sans"
),
refreshTimer
(
new
QTimer
(
this
)),
_valuesChanged
(
false
),
_valuesLastPainted
(
QGC
::
groundTimeMilliseconds
())
refreshTimer
(
new
QTimer
(
this
))
{
Q_UNUSED
(
width
);
Q_UNUSED
(
height
);
...
...
src/ui/QGCMAVLinkLogPlayer.cc
View file @
323d162e
...
...
@@ -575,6 +575,7 @@ void QGCMAVLinkLogPlayer::logLoop()
// have at least 3ms until the next one.
int
nextExecutionTime
=
0
;
mavlink_message_t
msg
;
msg
.
len
=
0
;
// FIXME: Hack, remove once Issue #647 is fixed
while
(
nextExecutionTime
<
3
)
{
// Now we're sitting at the start of a MAVLink message, so read it all into a byte array for feeding to our parser.
...
...
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