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
Hide 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)
QDir
imageDirectory
=
QDir
(
_worker
.
imageDirectory
());
if
(
!
imageDirectory
.
exists
())
{
_errorMessage
=
tr
(
"Cannot find the image directory"
);
emit
errorMessageChanged
(
_errorMessage
);
_setErrorMessage
(
tr
(
"Cannot find the image directory"
));
return
;
}
if
(
_worker
.
saveDirectory
()
==
""
)
{
...
...
@@ -83,23 +82,20 @@ void GeoTagController::startTagging(void)
msgBox
.
setWindowModality
(
Qt
::
ApplicationModal
);
msgBox
.
addButton
(
tr
(
"Replace"
),
QMessageBox
::
ActionRole
);
if
(
msgBox
.
exec
()
==
QMessageBox
::
Cancel
)
{
_errorMessage
=
tr
(
"Images have already been tagged"
);
emit
errorMessageChanged
(
_errorMessage
);
_setErrorMessage
(
tr
(
"Images have already been tagged"
));
return
;
}
QDir
oldTaggedFolder
=
QDir
(
_worker
.
imageDirectory
()
+
"/TAGGED"
);
oldTaggedFolder
.
removeRecursively
();
if
(
!
imageDirectory
.
mkdir
(
_worker
.
imageDirectory
()
+
"/TAGGED"
))
{
_errorMessage
=
tr
(
"Couldn't replace the previously tagged images"
);
emit
errorMessageChanged
(
_errorMessage
);
_setErrorMessage
(
tr
(
"Couldn't replace the previously tagged images"
));
return
;
}
}
}
else
{
QDir
saveDirectory
=
QDir
(
_worker
.
saveDirectory
());
if
(
!
saveDirectory
.
exists
())
{
_errorMessage
=
tr
(
"Cannot find the save directory"
);
emit
errorMessageChanged
(
_errorMessage
);
_setErrorMessage
(
tr
(
"Cannot find the save directory"
));
return
;
}
saveDirectory
.
setFilter
(
QDir
::
Files
|
QDir
::
Readable
|
QDir
::
NoSymLinks
|
QDir
::
Writable
);
...
...
@@ -115,15 +111,13 @@ void GeoTagController::startTagging(void)
msgBox
.
setWindowModality
(
Qt
::
ApplicationModal
);
msgBox
.
addButton
(
tr
(
"Replace"
),
QMessageBox
::
ActionRole
);
if
(
msgBox
.
exec
()
==
QMessageBox
::
Cancel
)
{
_errorMessage
=
tr
(
"Save folder not empty"
);
emit
errorMessageChanged
(
_errorMessage
);
_setErrorMessage
(
tr
(
"Save folder not empty"
));
return
;
}
foreach
(
QString
dirFile
,
imageList
)
{
if
(
!
saveDirectory
.
remove
(
dirFile
))
{
_errorMessage
=
tr
(
"Couldn't replace the existing images"
);
emit
errorMessageChanged
(
_errorMessage
);
_setErrorMessage
(
tr
(
"Couldn't replace the existing images"
));
return
;
}
}
...
...
@@ -144,6 +138,13 @@ void GeoTagController::_workerError(QString errorMessage)
emit
errorMessageChanged
(
errorMessage
);
}
void
GeoTagController
::
_setErrorMessage
(
const
QString
&
error
)
{
_errorMessage
=
error
;
emit
errorMessageChanged
(
error
);
}
GeoTagWorker
::
GeoTagWorker
(
void
)
:
_cancel
(
false
)
,
_logFile
(
""
)
...
...
@@ -210,9 +211,10 @@ void GeoTagWorker::run(void)
// Instantiate appropriate parser
_triggerList
.
clear
();
bool
parseComplete
=
false
;
if
(
isULog
)
{
QString
errorString
;
if
(
isULog
)
{
ULogParser
parser
;
parseComplete
=
parser
.
getTagsFromLog
(
log
,
_triggerList
);
parseComplete
=
parser
.
getTagsFromLog
(
log
,
_triggerList
,
errorString
);
}
else
{
PX4LogParser
parser
;
...
...
@@ -227,7 +229,8 @@ void GeoTagWorker::run(void)
return
;
}
else
{
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
;
}
}
...
...
src/AnalyzeView/GeoTagController.h
View file @
82c0424e
...
...
@@ -117,8 +117,9 @@ signals:
void
errorMessageChanged
(
QString
errorMessage
);
private
slots
:
void
_workerProgressChanged
(
double
progress
);
void
_workerError
(
QString
errorMsg
);
void
_workerProgressChanged
(
double
progress
);
void
_workerError
(
QString
errorMsg
);
void
_setErrorMessage
(
const
QString
&
error
);
private:
QString
_errorMessage
;
...
...
src/AnalyzeView/GeoTagPage.qml
View file @
82c0424e
...
...
@@ -124,8 +124,9 @@ AnalyzePage {
}
QGCButton
{
text
:
geoController
.
inProgress
?
qsTr
(
"
Cancel Tagging
"
)
:
qsTr
(
"
Start Tagging
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
text
:
geoController
.
inProgress
?
qsTr
(
"
Cancel Tagging
"
)
:
qsTr
(
"
Start Tagging
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
onClicked
:
{
if
(
geoController
.
inProgress
)
{
geoController
.
cancelTagging
()
...
...
src/AnalyzeView/ULogParser.cc
View file @
82c0424e
...
...
@@ -86,11 +86,13 @@ bool ULogParser::parseFieldFormat(QString& fields)
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
if
(
!
log
.
contains
(
_ULogMagic
))
{
qWarning
()
<<
"Could not detect ULog file header magic"
;
errorMessage
=
tr
(
"Could not detect ULog file header magic"
)
;
return
false
;
}
...
...
@@ -175,7 +177,7 @@ bool ULogParser::getTagsFromLog(QByteArray& log, QList<GeoTagWorker::cameraFeedb
}
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
;
}
...
...
src/AnalyzeView/ULogParser.h
View file @
82c0424e
...
...
@@ -3,6 +3,7 @@
#include <QGeoCoordinate>
#include <QDebug>
#include <QCoreApplication>
#include "GeoTagController.h"
...
...
@@ -10,10 +11,14 @@
class
ULogParser
{
Q_DECLARE_TR_FUNCTIONS
(
ULogParser
)
public:
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:
...
...
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