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
505220e0
Commit
505220e0
authored
Dec 05, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change to use QGCTemporaryFile
parent
7127f648
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
36 deletions
+32
-36
qgroundcontrol.pro
qgroundcontrol.pro
+5
-2
GAudioOutput.cc
src/GAudioOutput.cc
+0
-1
LogCompressor.cc
src/LogCompressor.cc
+0
-1
QGCApplication.cc
src/QGCApplication.cc
+5
-1
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+1
-3
MAVLinkProtocol.h
src/comm/MAVLinkProtocol.h
+4
-4
MavlinkLogTest.cc
src/qgcunittest/MavlinkLogTest.cc
+15
-24
MavlinkLogTest.h
src/qgcunittest/MavlinkLogTest.h
+2
-0
No files found.
qgroundcontrol.pro
View file @
505220e0
...
...
@@ -478,7 +478,8 @@ HEADERS += \
src
/
uas
/
QGXPX4UAS
.
h
\
src
/
QGCFileDialog
.
h
\
src
/
QGCMessageBox
.
h
\
src
/
QGCComboBox
.
h
src
/
QGCComboBox
.
h
\
src
/
QGCTemporaryFile
.
h
SOURCES
+=
\
src
/
main
.
cc
\
...
...
@@ -616,7 +617,9 @@ SOURCES += \
src
/
CmdLineOptParser
.
cc
\
src
/
uas
/
QGXPX4UAS
.
cc
\
src
/
QGCFileDialog
.
cc
\
src
/
QGCComboBox
.
cc
src
/
QGCComboBox
.
cc
\
src
/
QGCTemporaryFile
.
cc
#
#
Unit
Test
specific
configuration
goes
here
...
...
src/GAudioOutput.cc
View file @
505220e0
...
...
@@ -32,7 +32,6 @@ This file is part of the QGROUNDCONTROL project
#include <QApplication>
#include <QSettings>
#include <QTemporaryFile>
#include "GAudioOutput.h"
#include "MG.h"
...
...
src/LogCompressor.cc
View file @
505220e0
...
...
@@ -30,7 +30,6 @@ This file is part of the QGROUNDCONTROL project
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QTemporaryFile>
#include <QTextStream>
#include <QStringList>
#include <QFileInfo>
...
...
src/QGCApplication.cc
View file @
505220e0
...
...
@@ -56,6 +56,7 @@
#include "LinkManager.h"
#include "UASManager.h"
#include "AutoPilotPluginManager.h"
#include "QGCTemporaryFile.h"
#ifdef QGC_RTLAB_ENABLED
#include "OpalLink.h"
...
...
@@ -309,12 +310,15 @@ void QGCApplication::setSavedFilesLocation(QString& location)
bool
QGCApplication
::
validatePossibleSavedFilesLocation
(
QString
&
location
)
{
// Make sure we can write to the directory
QString
filename
=
QDir
(
location
).
filePath
(
"QGCTempXXXXXXXX.tmp"
);
QTemporaryFile
tempFile
(
filename
);
Q
GC
TemporaryFile
tempFile
(
filename
);
if
(
!
tempFile
.
open
())
{
return
false
;
}
tempFile
.
remove
();
return
true
;
}
...
...
src/comm/MAVLinkProtocol.cc
View file @
505220e0
...
...
@@ -56,15 +56,13 @@ MAVLinkProtocol::MAVLinkProtocol() :
_should_exit
(
false
),
_logSuspendError
(
false
),
_logSuspendReplay
(
false
),
_tempLogFile
(
QString
(
"%2.%3"
).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
)),
_protocolStatusMessageConnected
(
false
),
_saveTempFlightDataLogConnected
(
false
)
{
qRegisterMetaType
<
mavlink_message_t
>
(
"mavlink_message_t"
);
_tempLogFile
.
setFileTemplate
(
QString
(
"%1/%2.%3"
).
arg
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
TempLocation
)).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
));
_tempLogFile
.
setAutoRemove
(
false
);
m_authKey
=
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
;
loadSettings
();
moveToThread
(
this
);
...
...
src/comm/MAVLinkProtocol.h
View file @
505220e0
...
...
@@ -37,12 +37,12 @@ This file is part of the QGROUNDCONTROL project
#include <QFile>
#include <QMap>
#include <QByteArray>
#include <QTemporaryFile>
#include "ProtocolInterface.h"
#include "LinkInterface.h"
#include "QGCMAVLink.h"
#include "QGC.h"
#include "QGCTemporaryFile.h"
/**
* @brief MAVLink micro air vehicle protocol reference implementation.
...
...
@@ -282,9 +282,9 @@ private:
bool
_logSuspendError
;
///< true: Logging suspended due to error
bool
_logSuspendReplay
;
///< true: Logging suspended due to replay
Q
TemporaryFile
_tempLogFile
;
///< File to log to
static
const
char
*
_tempLogFileTemplate
;
///< Template for temporary log file
static
const
char
*
_logFileExtension
;
///< Extension for log files
Q
GCTemporaryFile
_tempLogFile
;
///< File to log to
static
const
char
*
_tempLogFileTemplate
;
///< Template for temporary log file
static
const
char
*
_logFileExtension
;
///< Extension for log files
bool
_protocolStatusMessageConnected
;
///< true: protocolStatusMessage signal has been connected
bool
_saveTempFlightDataLogConnected
;
///< true: saveTempFlightDataLog signal has been connected
...
...
src/qgcunittest/MavlinkLogTest.cc
View file @
505220e0
...
...
@@ -29,6 +29,7 @@
#include "MavlinkLogTest.h"
#include "MainWindow.h"
#include "MockLink.h"
#include "QGCTemporaryFile.h"
UT_REGISTER_TEST
(
MavlinkLogTest
)
...
...
@@ -66,17 +67,21 @@ void MavlinkLogTest::cleanup(void)
QCOMPARE
(
logFiles
.
count
(),
0
);
}
void
MavlinkLogTest
::
_
bootLogDetectionCancel_test
(
void
)
void
MavlinkLogTest
::
_
createTempLogFile
(
bool
zeroLength
)
{
// Create a fake mavlink log
QTemporaryFile
tempLogFile
;
tempLogFile
.
setFileTemplate
(
QString
(
"%1/%2.%3"
).
arg
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
TempLocation
)).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
));
tempLogFile
.
setAutoRemove
(
false
);
QGCTemporaryFile
tempLogFile
(
QString
(
"%1.%2"
).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
));
tempLogFile
.
open
();
tempLogFile
.
write
(
"foo"
);
if
(
!
zeroLength
)
{
tempLogFile
.
write
(
"foo"
);
}
tempLogFile
.
close
();
}
void
MavlinkLogTest
::
_bootLogDetectionCancel_test
(
void
)
{
// Create a fake mavlink log
_createTempLogFile
(
false
);
// We should get a message box, followed by a getSaveFileName dialog.
setExpectedMessageBox
(
QMessageBox
::
Ok
);
...
...
@@ -96,14 +101,7 @@ void MavlinkLogTest::_bootLogDetectionCancel_test(void)
void
MavlinkLogTest
::
_bootLogDetectionSave_test
(
void
)
{
// Create a fake mavlink log
QTemporaryFile
tempLogFile
;
tempLogFile
.
setFileTemplate
(
QString
(
"%1/%2.%3"
).
arg
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
TempLocation
)).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
));
tempLogFile
.
setAutoRemove
(
false
);
tempLogFile
.
open
();
tempLogFile
.
write
(
"foo"
);
tempLogFile
.
close
();
_createTempLogFile
(
false
);
// We should get a message box, followed by a getSaveFileName dialog.
setExpectedMessageBox
(
QMessageBox
::
Ok
);
...
...
@@ -127,15 +125,8 @@ void MavlinkLogTest::_bootLogDetectionSave_test(void)
void
MavlinkLogTest
::
_bootLogDetectionZeroLength_test
(
void
)
{
// Create a fake mavlink log
QTemporaryFile
tempLogFile
;
tempLogFile
.
setFileTemplate
(
QString
(
"%1/%2.%3"
).
arg
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
TempLocation
)).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
));
tempLogFile
.
setAutoRemove
(
false
);
// Zero length file
tempLogFile
.
open
();
tempLogFile
.
close
();
// Create a fake eempty mavlink log
_createTempLogFile
(
true
);
// Zero length log files should not generate any additional UI pop-ups. It should just be deleted silently.
MainWindow
*
mainWindow
=
MainWindow
::
_create
(
NULL
,
MainWindow
::
CUSTOM_MODE_PX4
);
...
...
src/qgcunittest/MavlinkLogTest.h
View file @
505220e0
...
...
@@ -49,6 +49,8 @@ private slots:
void
_connectLogWindowClose_test
(
void
);
private:
void
_createTempLogFile
(
bool
zeroLength
);
static
const
char
*
_tempLogFileTemplate
;
///< Template for temporary log file
static
const
char
*
_logFileExtension
;
///< Extension for log files
static
const
char
*
_saveLogFilename
;
///< Filename to save log files to
...
...
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