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
db268315
Commit
db268315
authored
Jun 14, 2016
by
Don Gagne
Browse files
Add logging
parent
727c55fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/QGCMobileFileDialogController.cc
View file @
db268315
...
...
@@ -14,16 +14,13 @@
#include
<QDebug>
#include
<QDir>
QGC_LOGGING_CATEGORY
(
QGCMobileFileDialogControllerLog
,
"QGCMobileFileDialogControllerLog"
)
QStringList
QGCMobileFileDialogController
::
getFiles
(
const
QString
&
fileExtension
)
{
QStringList
files
;
QStringList
docDirs
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DocumentsLocation
);
if
(
docDirs
.
count
()
<=
0
)
{
qWarning
()
<<
"No Documents location"
;
return
QStringList
();
}
QDir
fileDir
=
docDirs
.
at
(
0
);
QDir
fileDir
(
_getSaveLocation
());
QFileInfoList
fileInfoList
=
fileDir
.
entryInfoList
(
QStringList
(
QString
(
"*.%1"
).
arg
(
fileExtension
)),
QDir
::
Files
,
QDir
::
Name
);
...
...
@@ -36,9 +33,8 @@ QStringList QGCMobileFileDialogController::getFiles(const QString& fileExtension
QString
QGCMobileFileDialogController
::
fullPath
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
{
QStringList
docDirs
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DocumentsLocation
);
if
(
docDirs
.
count
()
<=
0
)
{
qWarning
()
<<
"No Documents location"
;
QString
saveLocation
(
_getSaveLocation
());
if
(
saveLocation
.
isEmpty
())
{
return
filename
;
}
...
...
@@ -48,8 +44,8 @@ QString QGCMobileFileDialogController::fullPath(const QString& filename, const Q
fixedFilename
+=
correctExtension
;
}
QString
fullPath
=
docDirs
.
at
(
0
)
+
QDir
::
separator
()
+
fixedFilename
;
qDebug
(
)
<<
fullPath
;
QString
fullPath
=
saveLocation
+
QDir
::
separator
()
+
fixedFilename
;
q
C
Debug
(
QGCMobileFileDialogControllerLog
)
<<
"Full path"
<<
fullPath
;
return
fullPath
;
}
...
...
@@ -58,3 +54,15 @@ bool QGCMobileFileDialogController::fileExists(const QString& filename, const QS
QFile
file
(
fullPath
(
filename
,
fileExtension
));
return
file
.
exists
();
}
QString
QGCMobileFileDialogController
::
_getSaveLocation
(
void
)
{
QStringList
docDirs
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DocumentsLocation
);
if
(
docDirs
.
count
()
<=
0
)
{
qCWarning
(
QGCMobileFileDialogControllerLog
)
<<
"No Documents location"
;
return
QString
();
}
qCDebug
(
QGCMobileFileDialogControllerLog
)
<<
"Save directory"
<<
docDirs
.
at
(
0
);
return
docDirs
.
at
(
0
);
}
src/QGCMobileFileDialogController.h
View file @
db268315
...
...
@@ -13,6 +13,10 @@
#include
<QObject>
#include
"QGCLoggingCategory.h"
Q_DECLARE_LOGGING_CATEGORY
(
QGCMobileFileDialogControllerLog
)
class
QGCMobileFileDialogController
:
public
QObject
{
Q_OBJECT
...
...
@@ -31,6 +35,9 @@ public:
/// @param fileExtension Expected file extension, added if needed
/// @return true: File exists at Documents location
Q_INVOKABLE
bool
fileExists
(
const
QString
&
filename
,
const
QString
&
fileExtension
);
private:
QString
_getSaveLocation
(
void
);
};
#endif
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