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
55dd50c1
Unverified
Commit
55dd50c1
authored
Jun 10, 2020
by
Don Gagne
Committed by
GitHub
Jun 10, 2020
Browse files
Merge pull request #8811 from patrickelectric/qt_5_15
Help with Qt 5.15 and 5.14 integration
parents
6db84fcc
d111e784
Changes
24
Hide whitespace changes
Inline
Side-by-side
src/Camera/QGCCameraControl.cc
View file @
55dd50c1
...
...
@@ -1274,17 +1274,26 @@ QGCCameraControl::_processConditionTest(const QString conditionTest)
qCDebug
(
CameraControlVerboseLog
)
<<
"_processConditionTest("
<<
conditionTest
<<
")"
;
int
op
=
TEST_NONE
;
QStringList
test
;
auto
split
=
[
&
conditionTest
](
const
QString
&
sep
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
return
conditionTest
.
split
(
sep
,
QString
::
SkipEmptyParts
);
#else
return
conditionTest
.
split
(
sep
,
Qt
::
SkipEmptyParts
);
#endif
};
if
(
conditionTest
.
contains
(
"!="
))
{
test
=
conditionTest
.
split
(
"!="
,
QString
::
SkipEmptyParts
);
test
=
split
(
"!="
);
op
=
TEST_NOT_EQUAL
;
}
else
if
(
conditionTest
.
contains
(
"="
))
{
test
=
conditionTest
.
split
(
"="
,
QString
::
SkipEmptyParts
);
test
=
split
(
"="
);
op
=
TEST_EQUAL
;
}
else
if
(
conditionTest
.
contains
(
">"
))
{
test
=
conditionTest
.
split
(
">"
,
QString
::
SkipEmptyParts
);
test
=
split
(
">"
);
op
=
TEST_GREATER
;
}
else
if
(
conditionTest
.
contains
(
"<"
))
{
test
=
conditionTest
.
split
(
"<"
,
QString
::
SkipEmptyParts
);
test
=
split
(
"<"
);
op
=
TEST_SMALLER
;
}
if
(
test
.
size
()
==
2
)
{
...
...
@@ -1319,7 +1328,11 @@ QGCCameraControl::_processCondition(const QString condition)
bool
result
=
true
;
bool
andOp
=
true
;
if
(
!
condition
.
isEmpty
())
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList
scond
=
condition
.
split
(
" "
,
QString
::
SkipEmptyParts
);
#else
QStringList
scond
=
condition
.
split
(
" "
,
Qt
::
SkipEmptyParts
);
#endif
while
(
scond
.
size
())
{
QString
test
=
scond
.
first
();
scond
.
removeFirst
();
...
...
src/FactSystem/FactMetaData.cc
View file @
55dd50c1
...
...
@@ -232,7 +232,7 @@ QVariant FactMetaData::rawDefaultValue(void) const
void
FactMetaData
::
setRawDefaultValue
(
const
QVariant
&
rawDefaultValue
)
{
if
(
_type
==
valueTypeString
||
(
_rawMin
<=
rawDefaultValue
&&
rawDefaultValue
<=
_rawMax
))
{
if
(
_type
==
valueTypeString
||
(
isInRawMinLimit
(
rawDefaultValue
)
&&
isInRawMaxLimit
(
rawDefaultValue
)
))
{
_rawDefaultValue
=
rawDefaultValue
;
_defaultValueAvailable
=
true
;
}
else
{
...
...
@@ -242,7 +242,7 @@ void FactMetaData::setRawDefaultValue(const QVariant& rawDefaultValue)
void
FactMetaData
::
setRawMin
(
const
QVariant
&
rawMin
)
{
if
(
rawMin
>=
_minForType
(
))
{
if
(
isInRawMinLimit
(
rawMin
))
{
_rawMin
=
rawMin
;
_minIsDefaultForType
=
false
;
}
else
{
...
...
@@ -255,13 +255,73 @@ void FactMetaData::setRawMin(const QVariant& rawMin)
void
FactMetaData
::
setRawMax
(
const
QVariant
&
rawMax
)
{
if
(
rawMax
>
_maxForType
())
{
qWarning
()
<<
"Attempt to set max above allowable value"
;
_rawMax
=
_maxForType
();
}
else
{
if
(
isInRawMaxLimit
(
rawMax
))
{
_rawMax
=
rawMax
;
_maxIsDefaultForType
=
false
;
}
else
{
qWarning
()
<<
"Attempt to set max above allowable value"
;
_rawMax
=
_maxForType
();
}
}
bool
FactMetaData
::
isInRawMinLimit
(
const
QVariant
&
variantValue
)
const
{
switch
(
_type
)
{
case
valueTypeUint8
:
return
_rawMin
.
value
<
unsigned
char
>
()
<=
variantValue
.
value
<
unsigned
char
>
();
case
valueTypeInt8
:
return
_rawMin
.
value
<
signed
char
>
()
<=
variantValue
.
value
<
signed
char
>
();
case
valueTypeUint16
:
return
_rawMin
.
value
<
unsigned
short
int
>
()
<=
variantValue
.
value
<
unsigned
short
int
>
();
case
valueTypeInt16
:
return
_rawMin
.
value
<
short
int
>
()
<=
variantValue
.
value
<
short
int
>
();
case
valueTypeUint32
:
return
_rawMin
.
value
<
uint32_t
>
()
<=
variantValue
.
value
<
uint32_t
>
();
case
valueTypeInt32
:
return
_rawMin
.
value
<
int32_t
>
()
<=
variantValue
.
value
<
int32_t
>
();
case
valueTypeUint64
:
return
_rawMin
.
value
<
uint64_t
>
()
<=
variantValue
.
value
<
uint64_t
>
();
case
valueTypeInt64
:
return
_rawMin
.
value
<
int64_t
>
()
<=
variantValue
.
value
<
int64_t
>
();
case
valueTypeFloat
:
return
_rawMin
.
value
<
float
>
()
<=
variantValue
.
value
<
float
>
();
case
valueTypeDouble
:
return
_rawMin
.
value
<
double
>
()
<=
variantValue
.
value
<
double
>
();
default:
return
true
;
}
return
true
;
}
bool
FactMetaData
::
isInRawMaxLimit
(
const
QVariant
&
variantValue
)
const
{
switch
(
_type
)
{
case
valueTypeUint8
:
return
_rawMax
.
value
<
unsigned
char
>
()
>=
variantValue
.
value
<
unsigned
char
>
();
case
valueTypeInt8
:
return
_rawMax
.
value
<
signed
char
>
()
>=
variantValue
.
value
<
signed
char
>
();
case
valueTypeUint16
:
return
_rawMax
.
value
<
unsigned
short
int
>
()
>=
variantValue
.
value
<
unsigned
short
int
>
();
case
valueTypeInt16
:
return
_rawMax
.
value
<
short
int
>
()
>=
variantValue
.
value
<
short
int
>
();
case
valueTypeUint32
:
return
_rawMax
.
value
<
uint32_t
>
()
>=
variantValue
.
value
<
uint32_t
>
();
case
valueTypeInt32
:
return
_rawMax
.
value
<
int32_t
>
()
>=
variantValue
.
value
<
int32_t
>
();
case
valueTypeUint64
:
return
_rawMax
.
value
<
uint64_t
>
()
>=
variantValue
.
value
<
uint64_t
>
();
case
valueTypeInt64
:
return
_rawMax
.
value
<
int64_t
>
()
>=
variantValue
.
value
<
int64_t
>
();
case
valueTypeFloat
:
return
_rawMax
.
value
<
float
>
()
>=
variantValue
.
value
<
float
>
();
case
valueTypeDouble
:
return
_rawMax
.
value
<
double
>
()
>=
variantValue
.
value
<
double
>
();
default:
return
true
;
}
return
true
;
}
QVariant
FactMetaData
::
_minForType
(
void
)
const
...
...
@@ -349,7 +409,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
case
FactMetaData
::
valueTypeInt32
:
typedValue
=
QVariant
(
rawValue
.
toInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
(
))
{
if
(
!
isInRawLimit
<
int32_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toInt
()).
arg
(
rawMax
().
toInt
());
}
}
...
...
@@ -357,7 +417,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
case
FactMetaData
::
valueTypeInt64
:
typedValue
=
QVariant
(
rawValue
.
toLongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
(
))
{
if
(
!
isInRawLimit
<
int64_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toInt
()).
arg
(
rawMax
().
toInt
());
}
}
...
...
@@ -367,7 +427,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
case
FactMetaData
::
valueTypeUint32
:
typedValue
=
QVariant
(
rawValue
.
toUInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
(
))
{
if
(
!
isInRawLimit
<
uint32_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toUInt
()).
arg
(
rawMax
().
toUInt
());
}
}
...
...
@@ -375,7 +435,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
case
FactMetaData
::
valueTypeUint64
:
typedValue
=
QVariant
(
rawValue
.
toULongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
(
))
{
if
(
!
isInRawLimit
<
uint64_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toUInt
()).
arg
(
rawMax
().
toUInt
());
}
}
...
...
@@ -383,7 +443,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
case
FactMetaData
::
valueTypeFloat
:
typedValue
=
QVariant
(
rawValue
.
toFloat
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
(
))
{
if
(
!
isInRawLimit
<
float
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toDouble
()).
arg
(
rawMax
().
toDouble
());
}
}
...
...
@@ -392,7 +452,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
case
FactMetaData
::
valueTypeDouble
:
typedValue
=
QVariant
(
rawValue
.
toDouble
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
typedValue
<
rawMin
()
||
typedValue
>
rawMax
(
))
{
if
(
!
isInRawLimit
<
double
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
rawMin
().
toDouble
()).
arg
(
rawMax
().
toDouble
());
}
}
...
...
@@ -437,7 +497,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
case
FactMetaData
::
valueTypeInt32
:
typedValue
=
QVariant
(
cookedValue
.
toInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
(
))
{
if
(
!
isInCookedLimit
<
int32_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toInt
()).
arg
(
cookedMax
().
toInt
());
}
}
...
...
@@ -445,7 +505,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
case
FactMetaData
::
valueTypeInt64
:
typedValue
=
QVariant
(
cookedValue
.
toLongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
(
))
{
if
(
!
isInCookedLimit
<
int64_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toInt
()).
arg
(
cookedMax
().
toInt
());
}
}
...
...
@@ -455,7 +515,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
case
FactMetaData
::
valueTypeUint32
:
typedValue
=
QVariant
(
cookedValue
.
toUInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
(
))
{
if
(
!
isInCookedLimit
<
uint32_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toUInt
()).
arg
(
cookedMax
().
toUInt
());
}
}
...
...
@@ -463,7 +523,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
case
FactMetaData
::
valueTypeUint64
:
typedValue
=
QVariant
(
cookedValue
.
toULongLong
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
(
))
{
if
(
!
isInCookedLimit
<
uint64_t
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toUInt
()).
arg
(
cookedMax
().
toUInt
());
}
}
...
...
@@ -471,7 +531,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
case
FactMetaData
::
valueTypeFloat
:
typedValue
=
QVariant
(
cookedValue
.
toFloat
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
(
))
{
if
(
!
isInCookedLimit
<
float
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toFloat
()).
arg
(
cookedMax
().
toFloat
());
}
}
...
...
@@ -480,7 +540,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co
case
FactMetaData
::
valueTypeDouble
:
typedValue
=
QVariant
(
cookedValue
.
toDouble
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
(
))
{
if
(
!
isInCookedLimit
<
double
>
(
typedValue
))
{
errorString
=
tr
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toDouble
()).
arg
(
cookedMax
().
toDouble
());
}
}
...
...
@@ -515,21 +575,13 @@ bool FactMetaData::clampValue(const QVariant& cookedValue, QVariant& typedValue)
case
FactMetaData
::
valueTypeInt32
:
typedValue
=
QVariant
(
cookedValue
.
toInt
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
clamp
<
int32_t
>
(
typedValue
);
}
break
;
case
FactMetaData
::
valueTypeInt64
:
typedValue
=
QVariant
(
cookedValue
.
toLongLong
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
clamp
<
int64_t
>
(
typedValue
);
}
break
;
case
FactMetaData
::
valueTypeUint8
:
...
...
@@ -537,42 +589,26 @@ bool FactMetaData::clampValue(const QVariant& cookedValue, QVariant& typedValue)
case
FactMetaData
::
valueTypeUint32
:
typedValue
=
QVariant
(
cookedValue
.
toUInt
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
clamp
<
uint32_t
>
(
typedValue
);
}
break
;
case
FactMetaData
::
valueTypeUint64
:
typedValue
=
QVariant
(
cookedValue
.
toULongLong
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
clamp
<
uint64_t
>
(
typedValue
);
}
break
;
case
FactMetaData
::
valueTypeFloat
:
typedValue
=
QVariant
(
cookedValue
.
toFloat
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
clamp
<
float
>
(
typedValue
);
}
break
;
case
FactMetaData
::
valueTypeElapsedTimeInSeconds
:
case
FactMetaData
::
valueTypeDouble
:
typedValue
=
QVariant
(
cookedValue
.
toDouble
(
&
convertOk
));
if
(
convertOk
)
{
if
(
cookedMin
()
>
typedValue
)
{
typedValue
=
cookedMin
();
}
else
if
(
typedValue
>
cookedMax
())
{
typedValue
=
cookedMax
();
}
clamp
<
double
>
(
typedValue
);
}
break
;
case
FactMetaData
::
valueTypeString
:
...
...
src/FactSystem/FactMetaData.h
View file @
55dd50c1
...
...
@@ -200,6 +200,62 @@ private:
QVariant
_maxForType
(
void
)
const
;
void
_setAppSettingsTranslators
(
void
);
/**
* @brief Clamp a value based in the cookedMin and CookedMax values
*
* @tparam T
* @param variantValue
*/
template
<
class
T
>
void
clamp
(
QVariant
&
variantValue
)
const
{
if
(
cookedMin
().
value
<
T
>
()
>
variantValue
.
value
<
T
>
())
{
variantValue
=
cookedMin
();
}
else
if
(
variantValue
.
value
<
T
>
()
>
cookedMax
().
value
<
T
>
())
{
variantValue
=
cookedMax
();
}
}
/**
* @brief Check if value is inside cooked limits
*
* @tparam T
* @param variantValue
*/
template
<
class
T
>
bool
isInCookedLimit
(
const
QVariant
&
variantValue
)
const
{
return
cookedMin
().
value
<
T
>
()
<
variantValue
.
value
<
T
>
()
&&
variantValue
.
value
<
T
>
()
<
cookedMax
().
value
<
T
>
();
}
/**
* @brief Check if value is inside raw limits
*
* @tparam T
* @param variantValue
*/
template
<
class
T
>
bool
isInRawLimit
(
const
QVariant
&
variantValue
)
const
{
return
rawMin
().
value
<
T
>
()
<=
variantValue
.
value
<
T
>
()
&&
variantValue
.
value
<
T
>
()
<
rawMax
().
value
<
T
>
();
}
/**
* @brief Check if value if over min limit
*
* @param variantValue
* @return true
* @return false
*/
bool
isInRawMinLimit
(
const
QVariant
&
variantValue
)
const
;
/**
* @brief Check if value is lower than upper limit
*
* @param variantValue
* @return true
* @return false
*/
bool
isInRawMaxLimit
(
const
QVariant
&
variantValue
)
const
;
// Built in translators
static
QVariant
_defaultTranslator
(
const
QVariant
&
from
)
{
return
from
;
}
static
QVariant
_degreesToRadians
(
const
QVariant
&
degrees
);
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
55dd50c1
...
...
@@ -793,7 +793,11 @@ void APMFirmwarePlugin::_soloVideoHandshake(Vehicle* vehicle, bool originalSoloF
socket
->
connectToHost
(
_artooIP
,
_artooVideoHandshakePort
);
if
(
originalSoloFirmware
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QObject
::
connect
(
socket
,
static_cast
<
void
(
QTcpSocket
::*
)(
QAbstractSocket
::
SocketError
)
>
(
&
QTcpSocket
::
error
),
this
,
&
APMFirmwarePlugin
::
_artooSocketError
);
#else
QObject
::
connect
(
socket
,
&
QAbstractSocket
::
errorOccurred
,
this
,
&
APMFirmwarePlugin
::
_artooSocketError
);
#endif
}
}
...
...
src/JsonHelper.cc
View file @
55dd50c1
...
...
@@ -170,7 +170,11 @@ bool JsonHelper::_parseEnumWorker(const QJsonObject& jsonObject, QMap<QString, Q
}
else
{
// "enumStrings": "Auto,Manual,Shutter Priority,Aperture Priority",
QString
value
=
jsonObject
.
value
(
_enumStringsJsonKey
).
toString
();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
enumStrings
=
defineMap
.
value
(
value
,
value
).
split
(
","
,
QString
::
SkipEmptyParts
);
#else
enumStrings
=
defineMap
.
value
(
value
,
value
).
split
(
","
,
Qt
::
SkipEmptyParts
);
#endif
}
if
(
jsonObject
.
value
(
_enumValuesJsonKey
).
isArray
())
{
...
...
@@ -186,7 +190,11 @@ bool JsonHelper::_parseEnumWorker(const QJsonObject& jsonObject, QMap<QString, Q
}
else
{
// "enumValues": "0,1,2,3,4,5",
QString
value
=
jsonObject
.
value
(
_enumValuesJsonKey
).
toString
();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
enumValues
=
defineMap
.
value
(
value
,
value
).
split
(
","
,
QString
::
SkipEmptyParts
);
#else
enumValues
=
defineMap
.
value
(
value
,
value
).
split
(
","
,
Qt
::
SkipEmptyParts
);
#endif
}
if
(
enumStrings
.
count
()
!=
enumValues
.
count
())
{
...
...
src/LogCompressor.cc
View file @
55dd50c1
...
...
@@ -55,7 +55,11 @@ void LogCompressor::run()
QString
outFileName
;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList
parts
=
QFileInfo
(
infile
.
fileName
()).
absoluteFilePath
().
split
(
"."
,
QString
::
SkipEmptyParts
);
#else
QStringList
parts
=
QFileInfo
(
infile
.
fileName
()).
absoluteFilePath
().
split
(
"."
,
Qt
::
SkipEmptyParts
);
#endif
parts
.
replace
(
0
,
parts
.
first
()
+
"_compressed"
);
parts
.
replace
(
parts
.
size
()
-
1
,
"txt"
);
...
...
src/MissionManager/ComplexMissionItem.cc
View file @
55dd50c1
...
...
@@ -15,6 +15,7 @@
#include
"FlightPathSegment.h"
#include
"MissionController.h"
#include
<QCborValue>
#include
<QSettings>
const
char
*
ComplexMissionItem
::
jsonComplexItemTypeKey
=
"complexItemType"
;
...
...
@@ -78,7 +79,7 @@ void ComplexMissionItem::_savePresetJson(const QString& name, QJsonObject& prese
QSettings
settings
;
settings
.
beginGroup
(
presetsSettingsGroup
());
settings
.
beginGroup
(
_presetSettingsKey
);
settings
.
setValue
(
name
,
Q
JsonDocument
(
presetObject
).
toBinaryData
());
settings
.
setValue
(
name
,
Q
CborMap
::
fromJsonObject
(
presetObject
).
toCborValue
().
toByteArray
());
// Use this to save a survey preset as a JSON file to be included in the build
// as a built-in survey preset that cannot be deleted.
...
...
@@ -107,7 +108,7 @@ QJsonObject ComplexMissionItem::_loadPresetJson(const QString& name)
QSettings
settings
;
settings
.
beginGroup
(
presetsSettingsGroup
());
settings
.
beginGroup
(
_presetSettingsKey
);
return
Q
JsonDocument
::
fromBinaryData
(
settings
.
value
(
name
).
toByteArray
()).
o
bject
();
return
Q
CborValue
(
settings
.
value
(
name
).
toByteArray
()).
toMap
().
toJsonO
bject
();
}
void
ComplexMissionItem
::
addKMLVisuals
(
KMLPlanDomDocument
&
/* domDocument */
)
...
...
src/MissionManager/MissionCommandUIInfo.cc
View file @
55dd50c1
...
...
@@ -384,10 +384,14 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
paramInfo
->
_label
=
paramObject
.
value
(
_labelJsonKey
).
toString
();
paramInfo
->
_decimalPlaces
=
paramObject
.
value
(
_decimalPlacesJsonKey
).
toInt
(
FactMetaData
::
kUnknownDecimalPlaces
);
paramInfo
->
_enumStrings
=
paramObject
.
value
(
_enumStringsJsonKey
).
toString
().
split
(
","
,
QString
::
SkipEmptyParts
);
paramInfo
->
_param
=
i
;
paramInfo
->
_units
=
paramObject
.
value
(
_unitsJsonKey
).
toString
();
paramInfo
->
_nanUnchanged
=
paramObject
.
value
(
_nanUnchangedJsonKey
).
toBool
(
false
);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
paramInfo
->
_enumStrings
=
paramObject
.
value
(
_enumStringsJsonKey
).
toString
().
split
(
","
,
QString
::
SkipEmptyParts
);
#else
paramInfo
->
_enumStrings
=
paramObject
.
value
(
_enumStringsJsonKey
).
toString
().
split
(
","
,
Qt
::
SkipEmptyParts
);
#endif
if
(
paramObject
.
contains
(
_defaultJsonKey
))
{
if
(
paramInfo
->
_nanUnchanged
)
{
...
...
@@ -402,8 +406,11 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
}
else
{
paramInfo
->
_defaultValue
=
paramInfo
->
_nanUnchanged
?
std
::
numeric_limits
<
double
>::
quiet_NaN
()
:
0
;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList
enumValues
=
paramObject
.
value
(
_enumValuesJsonKey
).
toString
().
split
(
","
,
QString
::
SkipEmptyParts
);
#else
QStringList
enumValues
=
paramObject
.
value
(
_enumValuesJsonKey
).
toString
().
split
(
","
,
Qt
::
SkipEmptyParts
);
#endif
for
(
const
QString
&
enumValue
:
enumValues
)
{
bool
convertOk
;
double
value
=
enumValue
.
toDouble
(
&
convertOk
);
...
...
src/MissionManager/QGCMapPolygon.cc
View file @
55dd50c1
...
...
@@ -453,7 +453,12 @@ void QGCMapPolygon::offset(double distance)
QGeoCoordinate
tangentOrigin
=
vertexCoordinate
(
0
);
for
(
int
i
=
0
;
i
<
rgOffsetEdges
.
count
();
i
++
)
{
int
prevIndex
=
i
==
0
?
rgOffsetEdges
.
count
()
-
1
:
i
-
1
;
if
(
rgOffsetEdges
[
prevIndex
].
intersect
(
rgOffsetEdges
[
i
],
&
newVertex
)
==
QLineF
::
NoIntersection
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto
intersect
=
rgOffsetEdges
[
prevIndex
].
intersect
(
rgOffsetEdges
[
i
],
&
newVertex
);
#else
auto
intersect
=
rgOffsetEdges
[
prevIndex
].
intersects
(
rgOffsetEdges
[
i
],
&
newVertex
);
#endif
if
(
intersect
==
QLineF
::
NoIntersection
)
{
// FIXME: Better error handling?
qWarning
(
"Intersection failed"
);
return
;
...
...
src/MissionManager/QGCMapPolyline.cc
View file @
55dd50c1
...
...
@@ -329,7 +329,12 @@ QList<QGeoCoordinate> QGCMapPolyline::offsetPolyline(double distance)
// Intersect the offset edges to generate new central vertices
QPointF
newVertex
;
for
(
int
i
=
1
;
i
<
rgOffsetEdges
.
count
();
i
++
)
{
if
(
rgOffsetEdges
[
i
-
1
].
intersect
(
rgOffsetEdges
[
i
],
&
newVertex
)
==
QLineF
::
NoIntersection
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto
intersect
=
rgOffsetEdges
[
i
-
1
].
intersect
(
rgOffsetEdges
[
i
],
&
newVertex
);
#else
auto
intersect
=
rgOffsetEdges
[
i
-
1
].
intersects
(
rgOffsetEdges
[
i
],
&
newVertex
);
#endif
if
(
intersect
==
QLineF
::
NoIntersection
)
{
// Two lines are colinear
newVertex
=
rgOffsetEdges
[
i
].
p2
();
}
...
...
src/MissionManager/SurveyComplexItem.cc
View file @
55dd50c1
...
...
@@ -520,12 +520,20 @@ void SurveyComplexItem::_intersectLinesWithRect(const QList<QLineF>& lineList, c
QLineF
intersectLine
;
const
QLineF
&
line
=
lineList
[
i
];
auto
isLineBoundedIntersect
=
[
&
line
,
&
intersectPoint
](
const
QLineF
&
linePosition
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
return
line
.
intersect
(
linePosition
,
&
intersectPoint
)
==
QLineF
::
BoundedIntersection
;
#else
return
line
.
intersects
(
linePosition
,
&
intersectPoint
)
==
QLineF
::
BoundedIntersection
;
#endif
};
int
foundCount
=
0
;
if
(
line
.
intersect
(
topLine
,
&
intersectPoint
)
==
QLineF
::
BoundedIntersect
ion
)
{
if
(
isLine
BoundedIntersect
(
topLine
)
)
{
intersectLine
.
setP1
(
intersectPoint
);
foundCount
++
;
}
if
(
line
.
intersect
(
rightLine
,
&
intersectPoint
)
==
QLineF
::
BoundedIntersect
ion
)
{
if
(
isLine
BoundedIntersect
(
rightLine
)
)
{
if
(
foundCount
==
0
)
{
intersectLine
.
setP1
(
intersectPoint
);
}
else
{
...
...
@@ -536,7 +544,7 @@ void SurveyComplexItem::_intersectLinesWithRect(const QList<QLineF>& lineList, c
}
foundCount
++
;
}
if
(
line
.
intersect
(
bottomLine
,
&
intersectPoint
)
==
QLineF
::
BoundedIntersect
ion
)
{
if
(
isLine
BoundedIntersect
(
bottomLine
)
)
{
if
(
foundCount
==
0
)
{
intersectLine
.
setP1
(
intersectPoint
);
}
else
{
...
...
@@ -547,7 +555,7 @@ void SurveyComplexItem::_intersectLinesWithRect(const QList<QLineF>& lineList, c
}
foundCount
++
;
}
if
(
line
.
intersect
(
leftLine
,
&
intersectPoint
)
==
QLineF
::
BoundedIntersect
ion
)
{
if
(
isLine
BoundedIntersect
(
leftLine
)
)
{
if
(
foundCount
==
0
)
{
intersectLine
.
setP1
(
intersectPoint
);
}
else
{
...
...
@@ -577,7 +585,13 @@ void SurveyComplexItem::_intersectLinesWithPolygon(const QList<QLineF>& lineList
for
(
int
j
=
0
;
j
<
polygon
.
count
()
-
1
;
j
++
)
{
QPointF
intersectPoint
;
QLineF
polygonLine
=
QLineF
(
polygon
[
j
],
polygon
[
j
+
1
]);
if
(
line
.
intersect
(
polygonLine
,
&
intersectPoint
)
==
QLineF
::
BoundedIntersection
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto
intersect
=
line
.
intersect
(
polygonLine
,
&
intersectPoint
);
#else
auto
intersect
=
line
.
intersects
(
polygonLine
,
&
intersectPoint
);
#endif
if
(
intersect
==
QLineF
::
BoundedIntersection
)
{
if
(
!
intersections
.
contains
(
intersectPoint
))
{
intersections
.
append
(
intersectPoint
);
}
...
...
@@ -1102,7 +1116,12 @@ bool SurveyComplexItem::_VertexCanSeeOther(const QPolygonF& polygon, const QPoin
if
(
vertexD
==
vertexB
)
continue
;
QLineF
lineCD
(
*
vertexC
,
*
vertexD
);
QPointF
intersection
{};
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto
intersects
=
lineAB
.
intersect
(
lineCD
,
&
intersection
);
#else
auto
intersects
=
lineAB
.
intersects
(
lineCD
,
&
intersection
);
#endif
if
(
intersects
==
QLineF
::
IntersectType
::
BoundedIntersection
)
{
// auto diffIntersection = *vertexA - intersection;
// auto distanceIntersection = sqrtf(diffIntersection.x() * diffIntersection.x() + diffIntersection.y()*diffIntersection.y());
...
...
src/QGCComboBox.cc
View file @
55dd50c1
...
...
@@ -24,5 +24,9 @@ void QGCComboBox::simulateUserSetCurrentIndex(int index)
// We have to manually signal activated
emit
activated
(
index
);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
emit
activated
(
itemText
(
index
));
#else
emit
textActivated
(
itemText
(
index
));
#endif
}
src/QGCFileDownload.cc
View file @
55dd50c1
...
...
@@ -83,9 +83,12 @@ bool QGCFileDownload::download(const QString& remoteFile, bool redirect)
connect
(
networkReply
,
&
QNetworkReply
::
downloadProgress
,
this
,
&
QGCFileDownload
::
downloadProgress
);
connect
(
networkReply
,
&
QNetworkReply
::
finished
,
this
,
&
QGCFileDownload
::
_downloadFinished
);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect
(
networkReply
,
static_cast
<
void
(
QNetworkReply
::*
)(
QNetworkReply
::
NetworkError
)
>
(
&
QNetworkReply
::
error
),
this
,
&
QGCFileDownload
::
_downloadError
);
#else
connect
(
networkReply
,
&
QNetworkReply
::
errorOccurred
,
this
,
&
QGCFileDownload
::
_downloadError
);
#endif
return
true
;
}
...
...
src/QGCTemporaryFile.cc
View file @
55dd50c1
...
...
@@ -18,6 +18,7 @@
#include
"QGCTemporaryFile.h"
#include
<QDir>
#include
<QRandomGenerator>
#include
<QStandardPaths>
QGCTemporaryFile
::
QGCTemporaryFile
(
const
QString
&
fileTemplate
,
QObject
*
parent
)
:
...
...
@@ -40,7 +41,7 @@ bool QGCTemporaryFile::open(QFile::OpenMode openMode)
do
{
QString
uniqueStr
;
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
uniqueStr
+=
rgDigits
[
qrand
()
%
10
];
uniqueStr
+=
rgDigits
[
QRandomGenerator
::
global
()
->
generate
()
%
10
];
}
if
(
_template
.
contains
(
"XXXXXX"
))
{
...
...
src/QmlControls/ParameterEditorController.cc
View file @
55dd50c1
...
...
@@ -168,7 +168,12 @@ bool ParameterEditorController::_shouldShow(Fact* fact)
void
ParameterEditorController
::
_updateParameters
(
void
)
{
QObjectList
newParameterList
;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList
searchItems
=
_searchText
.
split
(
' '
,
QString
::
SkipEmptyParts
);
#else
QStringList
searchItems
=
_searchText
.
split
(
' '
,
Qt
::
SkipEmptyParts
);
#endif
if
(
searchItems
.
isEmpty
()
&&
!
_showModifiedOnly
)
{
int
compId
=
_parameterMgr
->
getComponentId
(
_currentCategory
);
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
55dd50c1
...
...
@@ -221,7 +221,13 @@ bool QGroundControlQmlGlobal::linesIntersect(QPointF line1A, QPointF line1B, QPo
{
QPointF
intersectPoint
;
return
QLineF
(
line1A
,
line1B
).
intersect
(
QLineF
(
line2A
,
line2B
),
&
intersectPoint
)
==
QLineF
::
BoundedIntersection
&&
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
auto
intersect
=
QLineF
(
line1A
,
line1B
).
intersect
(
QLineF
(
line2A
,
line2B
),
&
intersectPoint
);
#else
auto
intersect
=
QLineF
(
line1A
,
line1B
).
intersects
(
QLineF
(
line2A
,
line2B
),
&
intersectPoint
);
#endif
return
intersect
==
QLineF
::
BoundedIntersection
&&
intersectPoint
!=
line1A
&&
intersectPoint
!=
line1B
;
}
...
...
src/QtLocationPlugin/GoogleMapProvider.cpp
View file @
55dd50c1
...
...
@@ -116,7 +116,11 @@ void GoogleMapProvider::_tryCorrectGoogleVersions(QNetworkAccessManager* network
_googleReply
=
networkManager
->
get
(
qheader
);
connect
(
_googleReply
,
&
QNetworkReply
::
finished
,
this
,
&
GoogleMapProvider
::
_googleVersionCompleted
);
connect
(
_googleReply
,
&
QNetworkReply
::
destroyed
,
this
,
&
GoogleMapProvider
::
_replyDestroyed
);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect
(
_googleReply
,
QOverload
<
QNetworkReply
::
NetworkError
>::
of
(
&
QNetworkReply
::
error
),
this
,
&
GoogleMapProvider
::
_networkReplyError
);
#else
connect
(
_googleReply
,
&
QNetworkReply
::
errorOccurred
,
this
,
&
GoogleMapProvider
::
_networkReplyError
);
#endif
networkManager
->
setProxy
(
proxy
);
}
}
...
...
src/QtLocationPlugin/QGCMapTileSet.cpp
View file @
55dd50c1
...
...
@@ -250,7 +250,11 @@ void QGCCachedTileSet::_prepareDownload()
QNetworkReply
*
reply
=
_networkManager
->
get
(
request
);
reply
->
setParent
(
0
);
connect
(
reply
,
&
QNetworkReply
::
finished
,
this
,
&
QGCCachedTileSet
::
_networkReplyFinished
);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect
(
reply
,
static_cast
<
void
(
QNetworkReply
::*
)(
QNetworkReply
::
NetworkError
)
>
(
&
QNetworkReply
::
error
),
this
,
&
QGCCachedTileSet
::
_networkReplyError
);
#else
connect
(
reply
,
&
QNetworkReply
::
errorOccurred
,
this
,
&
QGCCachedTileSet
::
_networkReplyError
);
#endif
_replies
.
insert
(
tile
->
hash
(),
reply
);
#if !defined(__mobile__)
_networkManager
->
setProxy
(
proxy
);
...
...
src/Settings/AppSettings.cc
View file @
55dd50c1
...
...
@@ -243,7 +243,13 @@ MAV_TYPE AppSettings::offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleT
QList
<
int
>
AppSettings
::
firstRunPromptsIdsVariantToList
(
const
QVariant
&
firstRunPromptIds
)
{
QList
<
int
>
rgIds
;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList
strIdList
=
firstRunPromptIds
.
toString
().
split
(
","
,
QString
::
SkipEmptyParts
);
#else
QStringList
strIdList
=
firstRunPromptIds
.
toString
().
split
(
","
,
Qt
::
SkipEmptyParts
);
#endif
for
(
const
QString
&
strId
:
strIdList
)
{
rgIds
.
append
(
strId
.
toInt
());
}
...
...
src/Terrain/TerrainQuery.cc
View file @
55dd50c1
...
...
@@ -127,7 +127,12 @@ void TerrainAirMapQuery::_sendQuery(const QString& path, const QUrlQuery& urlQue
connect
(
networkReply
,
&
QNetworkReply
::
finished
,
this
,
&
TerrainAirMapQuery
::
_requestFinished
);
connect
(
networkReply
,
&
QNetworkReply
::
sslErrors
,
this
,
&
TerrainAirMapQuery
::
_sslErrors
);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect
(
networkReply
,
QOverload
<
QNetworkReply
::
NetworkError
>::
of
(
&
QNetworkReply
::
error
),
this
,
&
TerrainAirMapQuery
::
_requestError
);
#else
connect
(
networkReply
,
&
QNetworkReply
::
errorOccurred
,
this
,
&
TerrainAirMapQuery
::
_requestError
);
#endif
}
void
TerrainAirMapQuery
::
_requestError
(
QNetworkReply
::
NetworkError
code
)
...
...
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