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
82c0424e
Commit
82c0424e
authored
Apr 08, 2018
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Much better error reporting
parent
cd1955e4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
23 deletions
+35
-23
GeoTagController.cc
src/AnalyzeView/GeoTagController.cc
+18
-15
GeoTagController.h
src/AnalyzeView/GeoTagController.h
+3
-2
GeoTagPage.qml
src/AnalyzeView/GeoTagPage.qml
+3
-2
ULogParser.cc
src/AnalyzeView/ULogParser.cc
+5
-3
ULogParser.h
src/AnalyzeView/ULogParser.h
+6
-1
No files found.
src/AnalyzeView/GeoTagController.cc
View file @
82c0424e
...
@@ -70,8 +70,7 @@ void GeoTagController::startTagging(void)
...
@@ -70,8 +70,7 @@ void GeoTagController::startTagging(void)
QDir
imageDirectory
=
QDir
(
_worker
.
imageDirectory
());
QDir
imageDirectory
=
QDir
(
_worker
.
imageDirectory
());
if
(
!
imageDirectory
.
exists
())
{
if
(
!
imageDirectory
.
exists
())
{
_errorMessage
=
tr
(
"Cannot find the image directory"
);
_setErrorMessage
(
tr
(
"Cannot find the image directory"
));
emit
errorMessageChanged
(
_errorMessage
);
return
;
return
;
}
}
if
(
_worker
.
saveDirectory
()
==
""
)
{
if
(
_worker
.
saveDirectory
()
==
""
)
{
...
@@ -83,23 +82,20 @@ void GeoTagController::startTagging(void)
...
@@ -83,23 +82,20 @@ void GeoTagController::startTagging(void)
msgBox
.
setWindowModality
(
Qt
::
ApplicationModal
);
msgBox
.
setWindowModality
(
Qt
::
ApplicationModal
);
msgBox
.
addButton
(
tr
(
"Replace"
),
QMessageBox
::
ActionRole
);
msgBox
.
addButton
(
tr
(
"Replace"
),
QMessageBox
::
ActionRole
);
if
(
msgBox
.
exec
()
==
QMessageBox
::
Cancel
)
{
if
(
msgBox
.
exec
()
==
QMessageBox
::
Cancel
)
{
_errorMessage
=
tr
(
"Images have already been tagged"
);
_setErrorMessage
(
tr
(
"Images have already been tagged"
));
emit
errorMessageChanged
(
_errorMessage
);
return
;
return
;
}
}
QDir
oldTaggedFolder
=
QDir
(
_worker
.
imageDirectory
()
+
"/TAGGED"
);
QDir
oldTaggedFolder
=
QDir
(
_worker
.
imageDirectory
()
+
"/TAGGED"
);
oldTaggedFolder
.
removeRecursively
();
oldTaggedFolder
.
removeRecursively
();
if
(
!
imageDirectory
.
mkdir
(
_worker
.
imageDirectory
()
+
"/TAGGED"
))
{
if
(
!
imageDirectory
.
mkdir
(
_worker
.
imageDirectory
()
+
"/TAGGED"
))
{
_errorMessage
=
tr
(
"Couldn't replace the previously tagged images"
);
_setErrorMessage
(
tr
(
"Couldn't replace the previously tagged images"
));
emit
errorMessageChanged
(
_errorMessage
);
return
;
return
;
}
}
}
}
}
else
{
}
else
{
QDir
saveDirectory
=
QDir
(
_worker
.
saveDirectory
());
QDir
saveDirectory
=
QDir
(
_worker
.
saveDirectory
());
if
(
!
saveDirectory
.
exists
())
{
if
(
!
saveDirectory
.
exists
())
{
_errorMessage
=
tr
(
"Cannot find the save directory"
);
_setErrorMessage
(
tr
(
"Cannot find the save directory"
));
emit
errorMessageChanged
(
_errorMessage
);
return
;
return
;
}
}
saveDirectory
.
setFilter
(
QDir
::
Files
|
QDir
::
Readable
|
QDir
::
NoSymLinks
|
QDir
::
Writable
);
saveDirectory
.
setFilter
(
QDir
::
Files
|
QDir
::
Readable
|
QDir
::
NoSymLinks
|
QDir
::
Writable
);
...
@@ -115,15 +111,13 @@ void GeoTagController::startTagging(void)
...
@@ -115,15 +111,13 @@ void GeoTagController::startTagging(void)
msgBox
.
setWindowModality
(
Qt
::
ApplicationModal
);
msgBox
.
setWindowModality
(
Qt
::
ApplicationModal
);
msgBox
.
addButton
(
tr
(
"Replace"
),
QMessageBox
::
ActionRole
);
msgBox
.
addButton
(
tr
(
"Replace"
),
QMessageBox
::
ActionRole
);
if
(
msgBox
.
exec
()
==
QMessageBox
::
Cancel
)
{
if
(
msgBox
.
exec
()
==
QMessageBox
::
Cancel
)
{
_errorMessage
=
tr
(
"Save folder not empty"
);
_setErrorMessage
(
tr
(
"Save folder not empty"
));
emit
errorMessageChanged
(
_errorMessage
);
return
;
return
;
}
}
foreach
(
QString
dirFile
,
imageList
)
foreach
(
QString
dirFile
,
imageList
)
{
{
if
(
!
saveDirectory
.
remove
(
dirFile
))
{
if
(
!
saveDirectory
.
remove
(
dirFile
))
{
_errorMessage
=
tr
(
"Couldn't replace the existing images"
);
_setErrorMessage
(
tr
(
"Couldn't replace the existing images"
));
emit
errorMessageChanged
(
_errorMessage
);
return
;
return
;
}
}
}
}
...
@@ -144,6 +138,13 @@ void GeoTagController::_workerError(QString errorMessage)
...
@@ -144,6 +138,13 @@ void GeoTagController::_workerError(QString errorMessage)
emit
errorMessageChanged
(
errorMessage
);
emit
errorMessageChanged
(
errorMessage
);
}
}
void
GeoTagController
::
_setErrorMessage
(
const
QString
&
error
)
{
_errorMessage
=
error
;
emit
errorMessageChanged
(
error
);
}
GeoTagWorker
::
GeoTagWorker
(
void
)
GeoTagWorker
::
GeoTagWorker
(
void
)
:
_cancel
(
false
)
:
_cancel
(
false
)
,
_logFile
(
""
)
,
_logFile
(
""
)
...
@@ -210,9 +211,10 @@ void GeoTagWorker::run(void)
...
@@ -210,9 +211,10 @@ void GeoTagWorker::run(void)
// Instantiate appropriate parser
// Instantiate appropriate parser
_triggerList
.
clear
();
_triggerList
.
clear
();
bool
parseComplete
=
false
;
bool
parseComplete
=
false
;
if
(
isULog
)
{
QString
errorString
;
if
(
isULog
)
{
ULogParser
parser
;
ULogParser
parser
;
parseComplete
=
parser
.
getTagsFromLog
(
log
,
_triggerList
);
parseComplete
=
parser
.
getTagsFromLog
(
log
,
_triggerList
,
errorString
);
}
else
{
}
else
{
PX4LogParser
parser
;
PX4LogParser
parser
;
...
@@ -227,7 +229,8 @@ void GeoTagWorker::run(void)
...
@@ -227,7 +229,8 @@ void GeoTagWorker::run(void)
return
;
return
;
}
else
{
}
else
{
qCDebug
(
GeotaggingLog
)
<<
"Log parsing failed"
;
qCDebug
(
GeotaggingLog
)
<<
"Log parsing failed"
;
emit
error
(
tr
(
"Log parsing failed - tagging cancelled"
));
errorString
=
tr
(
"%1 - tagging cancelled"
).
arg
(
errorString
.
isEmpty
()
?
tr
(
"Log parsing failed"
)
:
errorString
);
emit
error
(
errorString
);
return
;
return
;
}
}
}
}
...
...
src/AnalyzeView/GeoTagController.h
View file @
82c0424e
...
@@ -117,8 +117,9 @@ signals:
...
@@ -117,8 +117,9 @@ signals:
void
errorMessageChanged
(
QString
errorMessage
);
void
errorMessageChanged
(
QString
errorMessage
);
private
slots
:
private
slots
:
void
_workerProgressChanged
(
double
progress
);
void
_workerProgressChanged
(
double
progress
);
void
_workerError
(
QString
errorMsg
);
void
_workerError
(
QString
errorMsg
);
void
_setErrorMessage
(
const
QString
&
error
);
private:
private:
QString
_errorMessage
;
QString
_errorMessage
;
...
...
src/AnalyzeView/GeoTagPage.qml
View file @
82c0424e
...
@@ -126,6 +126,7 @@ AnalyzePage {
...
@@ -126,6 +126,7 @@ AnalyzePage {
QGCButton
{
QGCButton
{
text
:
geoController
.
inProgress
?
qsTr
(
"
Cancel Tagging
"
)
:
qsTr
(
"
Start Tagging
"
)
text
:
geoController
.
inProgress
?
qsTr
(
"
Cancel Tagging
"
)
:
qsTr
(
"
Start Tagging
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
onClicked
:
{
onClicked
:
{
if
(
geoController
.
inProgress
)
{
if
(
geoController
.
inProgress
)
{
geoController
.
cancelTagging
()
geoController
.
cancelTagging
()
...
...
src/AnalyzeView/ULogParser.cc
View file @
82c0424e
...
@@ -86,11 +86,13 @@ bool ULogParser::parseFieldFormat(QString& fields)
...
@@ -86,11 +86,13 @@ bool ULogParser::parseFieldFormat(QString& fields)
return
false
;
return
false
;
}
}
bool
ULogParser
::
getTagsFromLog
(
QByteArray
&
log
,
QList
<
GeoTagWorker
::
cameraFeedbackPacket
>&
cameraFeedback
)
bool
ULogParser
::
getTagsFromLog
(
QByteArray
&
log
,
QList
<
GeoTagWorker
::
cameraFeedbackPacket
>&
cameraFeedback
,
QString
&
errorMessage
)
{
{
errorMessage
.
clear
();
//verify it's an ULog file
//verify it's an ULog file
if
(
!
log
.
contains
(
_ULogMagic
))
{
if
(
!
log
.
contains
(
_ULogMagic
))
{
qWarning
()
<<
"Could not detect ULog file header magic"
;
errorMessage
=
tr
(
"Could not detect ULog file header magic"
)
;
return
false
;
return
false
;
}
}
...
@@ -175,7 +177,7 @@ bool ULogParser::getTagsFromLog(QByteArray& log, QList<GeoTagWorker::cameraFeedb
...
@@ -175,7 +177,7 @@ bool ULogParser::getTagsFromLog(QByteArray& log, QList<GeoTagWorker::cameraFeedb
}
}
if
(
cameraFeedback
.
count
()
==
0
)
{
if
(
cameraFeedback
.
count
()
==
0
)
{
qWarning
()
<<
"Could not detect camera_capture packets in ULog"
;
errorMessage
=
tr
(
"Could not detect camera_capture packets in ULog"
)
;
return
false
;
return
false
;
}
}
...
...
src/AnalyzeView/ULogParser.h
View file @
82c0424e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <QGeoCoordinate>
#include <QGeoCoordinate>
#include <QDebug>
#include <QDebug>
#include <QCoreApplication>
#include "GeoTagController.h"
#include "GeoTagController.h"
...
@@ -10,10 +11,14 @@
...
@@ -10,10 +11,14 @@
class
ULogParser
class
ULogParser
{
{
Q_DECLARE_TR_FUNCTIONS
(
ULogParser
)
public:
public:
ULogParser
();
ULogParser
();
~
ULogParser
();
~
ULogParser
();
bool
getTagsFromLog
(
QByteArray
&
log
,
QList
<
GeoTagWorker
::
cameraFeedbackPacket
>&
cameraFeedback
);
/// @return true: failed, errorMessage set
bool
getTagsFromLog
(
QByteArray
&
log
,
QList
<
GeoTagWorker
::
cameraFeedbackPacket
>&
cameraFeedback
,
QString
&
errorMessage
);
private:
private:
...
...
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