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
b1a9d302
Commit
b1a9d302
authored
Feb 19, 2015
by
Don Gagne
Browse files
Merge pull request #1242 from basil-huber/Fix1241
Repaired overwriting current files for flight data log (fix #1241)
parents
64e8919c
9134bd06
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/QGCApplication.cc
View file @
b1a9d302
...
...
@@ -490,15 +490,29 @@ void QGCApplication::criticalMessageBoxOnMainThread(const QString& title, const
void
QGCApplication
::
saveTempFlightDataLogOnMainThread
(
QString
tempLogfile
)
{
QString
saveFilename
=
QGCFileDialog
::
getSaveFileName
(
MainWindow
::
instance
(),
tr
(
"Save Flight Data Log"
),
qgcApp
()
->
mavlinkLogFilesLocation
(),
tr
(
"Flight Data Log Files (*.mavlink)"
),
"mavlink"
);
if
(
!
saveFilename
.
isEmpty
())
{
QFile
::
copy
(
tempLogfile
,
saveFilename
);
}
bool
saveError
;
do
{
saveError
=
false
;
QString
saveFilename
=
QGCFileDialog
::
getSaveFileName
(
MainWindow
::
instance
(),
tr
(
"Save Flight Data Log"
),
qgcApp
()
->
mavlinkLogFilesLocation
(),
tr
(
"Flight Data Log Files (*.mavlink)"
),
"mavlink"
);
if
(
!
saveFilename
.
isEmpty
())
{
// if file exsits already, try to remove it first to overwrite it
if
(
QFile
::
exists
(
saveFilename
)
&&
!
QFile
::
remove
(
saveFilename
)){
// if the file cannot be removed, prompt user and ask new path
saveError
=
true
;
QGCMessageBox
::
warning
(
"File Error"
,
"Could not overwrite existing file.
\n
Please provide a different file name to save to."
);
}
else
if
(
!
QFile
::
copy
(
tempLogfile
,
saveFilename
))
{
// if file could not be copied, prompt user and ask new path
saveError
=
true
;
QGCMessageBox
::
warning
(
"File Error"
,
"Could not create file.
\n
Please provide a different file name to save to."
);
}
}
}
while
(
saveError
);
// if the file could not be overwritten, ask for new file
QFile
::
remove
(
tempLogfile
);
}
...
...
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