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
530bfe26
Commit
530bfe26
authored
Aug 25, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
f28c7003
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
88 additions
and
120 deletions
+88
-120
HackAndroidFileDialog.qrc
HackAndroidFileDialog.qrc
+0
-5
HackFileDialog.qrc
HackFileDialog.qrc
+0
-5
qgroundcontrol.pro
qgroundcontrol.pro
+0
-9
QGCMapPolylineVisuals.qml
src/MissionManager/QGCMapPolylineVisuals.qml
+0
-1
PlanView.qml
src/PlanView/PlanView.qml
+0
-6
AppMessages.qml
src/QmlControls/AppMessages.qml
+0
-1
HackFileDialog.qml
src/QmlControls/HackFileDialog.qml
+0
-9
KMLOrSHPFileDialog.qml
src/QmlControls/KMLOrSHPFileDialog.qml
+0
-2
LogReplayStatusBar.qml
src/QmlControls/LogReplayStatusBar.qml
+1
-2
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+0
-1
QGCFileDialog.qml
src/QmlControls/QGCFileDialog.qml
+47
-42
QGCFileDialogController.cc
src/QmlControls/QGCFileDialogController.cc
+36
-30
QGCFileDialogController.h
src/QmlControls/QGCFileDialogController.h
+4
-6
OfflineMap.qml
src/QtLocationPlugin/QMLControl/OfflineMap.qml
+0
-1
No files found.
HackAndroidFileDialog.qrc
deleted
100644 → 0
View file @
f28c7003
<RCC>
<qresource prefix="/qml">
<file alias="QGroundControl/Controls/HackFileDialog.qml">src/QmlControls/HackAndroidFileDialog.qml</file>
</qresource>
</RCC>
HackFileDialog.qrc
deleted
100644 → 0
View file @
f28c7003
<RCC>
<qresource prefix="/qml">
<file alias="QGroundControl/Controls/HackFileDialog.qml">src/QmlControls/HackFileDialog.qml</file>
</qresource>
</RCC>
qgroundcontrol.pro
View file @
530bfe26
...
...
@@ -362,15 +362,6 @@ CustomBuild {
$$
PWD
/
resources
/
InstrumentValueIcons
/
InstrumentValueIcons
.
qrc
\
}
#
On
Qt
5.9
android
versions
there
is
the
following
bug
:
https
://
bugreports
.
qt
.
io
/
browse
/
QTBUG
-
61424
#
This
prevents
FileDialog
from
being
used
.
So
we
have
a
temp
hack
workaround
for
it
which
just
no
-
ops
#
the
FileDialog
fallback
mechanism
on
android
5.9
builds
.
equals
(
QT_MAJOR_VERSION
,
5
)
:
equals
(
QT_MINOR_VERSION
,
9
)
:
AndroidBuild
{
RESOURCES
+=
$$
PWD
/
HackAndroidFileDialog
.
qrc
}
else
{
RESOURCES
+=
$$
PWD
/
HackFileDialog
.
qrc
}
#
#
Main
QGroundControl
portion
of
project
file
#
...
...
src/MissionManager/QGCMapPolylineVisuals.qml
View file @
530bfe26
...
...
@@ -128,7 +128,6 @@ Item {
title
:
qsTr
(
"
Select KML File
"
)
selectExisting
:
true
nameFilters
:
ShapeFileHelper
.
fileDialogKMLFilters
fileExtension
:
QGroundControl
.
settingsManager
.
appSettings
.
kmlFileExtension
onAcceptedForLoad
:
{
mapPolyline
.
loadKMLFile
(
file
)
...
...
src/PlanView/PlanView.qml
View file @
530bfe26
...
...
@@ -271,8 +271,6 @@ Item {
fileDialog
.
planFiles
=
true
fileDialog
.
selectExisting
=
true
fileDialog
.
nameFilters
=
_planMasterController
.
loadNameFilters
fileDialog
.
fileExtension
=
_appSettings
.
planFileExtension
fileDialog
.
fileExtension2
=
_appSettings
.
missionFileExtension
fileDialog
.
openForLoad
()
}
...
...
@@ -284,8 +282,6 @@ Item {
fileDialog
.
planFiles
=
true
fileDialog
.
selectExisting
=
false
fileDialog
.
nameFilters
=
_planMasterController
.
saveNameFilters
fileDialog
.
fileExtension
=
_appSettings
.
planFileExtension
fileDialog
.
fileExtension2
=
_appSettings
.
missionFileExtension
fileDialog
.
openForSave
()
}
...
...
@@ -301,8 +297,6 @@ Item {
fileDialog
.
planFiles
=
false
fileDialog
.
selectExisting
=
false
fileDialog
.
nameFilters
=
ShapeFileHelper
.
fileDialogKMLFilters
fileDialog
.
fileExtension
=
_appSettings
.
kmlFileExtension
fileDialog
.
fileExtension2
=
""
fileDialog
.
openForSave
()
}
}
...
...
src/QmlControls/AppMessages.qml
View file @
530bfe26
...
...
@@ -162,7 +162,6 @@ Item {
id
:
writeDialog
folder
:
QGroundControl
.
settingsManager
.
appSettings
.
logSavePath
nameFilters
:
[
qsTr
(
"
Log files (*.txt)
"
),
qsTr
(
"
All Files (*)
"
)]
fileExtension
:
qsTr
(
"
txt
"
)
selectExisting
:
false
title
:
qsTr
(
"
Select log save file
"
)
onAcceptedForSave
:
{
...
...
src/QmlControls/HackFileDialog.qml
deleted
100644 → 0
View file @
f28c7003
import
QtQuick
2.3
import
QtQuick
.
Dialogs
1.2
// On Qt 5.9 android versions there is the following bug: https://bugreports.qt.io/browse/QTBUG-61424
// This prevents FileDialog from being used. So we have a temp hack workaround for it which just no-ops
// the FileDialog fallback mechanism on android 5.9 builds.
FileDialog
{
}
src/QmlControls/KMLOrSHPFileDialog.qml
View file @
530bfe26
...
...
@@ -19,6 +19,4 @@ QGCFileDialog {
title
:
qsTr
(
"
Select Polygon File
"
)
selectExisting
:
true
nameFilters
:
ShapeFileHelper
.
fileDialogKMLOrSHPFilters
fileExtension
:
QGroundControl
.
settingsManager
.
appSettings
.
kmlFileExtension
fileExtension2
:
QGroundControl
.
settingsManager
.
appSettings
.
shpFileExtension
}
src/QmlControls/LogReplayStatusBar.qml
View file @
530bfe26
...
...
@@ -28,8 +28,7 @@ Rectangle {
QGCFileDialog
{
id
:
filePicker
title
:
qsTr
(
"
Select Telemetery Log
"
)
nameFilters
:
[
qsTr
(
"
Telemetry Logs (*.%1)
"
).
arg
(
_logFileExtension
),
qsTr
(
"
All Files (*)
"
)]
fileExtension
:
_logFileExtension
nameFilters
:
[
qsTr
(
"
Telemetry Logs (*.%1)
"
).
arg
(
_logFileExtension
),
qsTr
(
"
All Files (*)
"
)
]
selectExisting
:
true
folder
:
QGroundControl
.
settingsManager
.
appSettings
.
telemetrySavePath
onAcceptedForLoad
:
{
...
...
src/QmlControls/ParameterEditor.qml
View file @
530bfe26
...
...
@@ -287,7 +287,6 @@ Item {
QGCFileDialog
{
id
:
fileDialog
folder
:
_appSettings
.
parameterSavePath
fileExtension
:
_appSettings
.
parameterFileExtension
nameFilters
:
[
qsTr
(
"
Parameter Files (*.%1)
"
).
arg
(
_appSettings
.
parameterFileExtension
)
,
qsTr
(
"
All Files (*.*)
"
)
]
onAcceptedForSave
:
{
...
...
src/QmlControls/QGCFileDialog.qml
View file @
530bfe26
...
...
@@ -15,41 +15,14 @@ Item {
visible
:
false
property
string
folder
// Due to Qt bug with file url parsing this must be an absolute path
property
var
nameFilters
property
string
fileExtension
// Primary file extension to search for
property
string
fileExtension2
:
""
// Secondary file extension to search for
property
var
nameFilters
:
[]
// Important: Only name filters with simple wildcarding like *.foo are supported.
property
string
title
property
bool
selectExisting
property
bool
selectFolder
property
bool
_openForLoad
:
true
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
property
bool
_mobileDlg
:
QGroundControl
.
corePlugin
.
options
.
useMobileFileDialog
property
var
_rgExtensions
property
string
_mobileShortPath
Component.onCompleted
:
{
setupFileExtensions
()
_updateMobileShortPath
()
}
onFileExtensionChanged
:
setupFileExtensions
()
onFileExtension2Changed
:
setupFileExtensions
()
onFolderChanged
:
_updateMobileShortPath
()
function
_updateMobileShortPath
()
{
if
(
ScreenTools
.
isMobile
)
{
_mobileShortPath
=
controller
.
fullFolderPathToShortMobilePath
(
folder
);
}
}
function
setupFileExtensions
()
{
if
(
fileExtension2
==
""
)
{
_rgExtensions
=
[
fileExtension
]
}
else
{
_rgExtensions
=
[
fileExtension
,
fileExtension2
]
}
}
signal
acceptedForLoad
(
string
file
)
signal
acceptedForSave
(
string
file
)
signal
rejected
function
openForLoad
()
{
_openForLoad
=
true
...
...
@@ -73,17 +46,48 @@ Item {
fullFileDialog
.
close
()
}
signal
acceptedForLoad
(
string
file
)
signal
acceptedForSave
(
string
file
)
signal
rejected
property
bool
_openForLoad
:
true
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
property
bool
_mobileDlg
:
QGroundControl
.
corePlugin
.
options
.
useMobileFileDialog
property
var
_rgExtensions
property
string
_mobileShortPath
Component.onCompleted
:
{
_setupFileExtensions
()
_updateMobileShortPath
()
}
onFolderChanged
:
_updateMobileShortPath
()
onNameFiltersChanged
:
_setupFileExtensions
()
function
_updateMobileShortPath
()
{
if
(
ScreenTools
.
isMobile
)
{
_mobileShortPath
=
controller
.
fullFolderPathToShortMobilePath
(
folder
);
}
}
function
_setupFileExtensions
()
{
_rgExtensions
=
[
]
for
(
var
i
=
0
;
i
<
_root
.
nameFilters
.
length
;
i
++
)
{
var
filter
=
_root
.
nameFilters
[
i
]
var
regExp
=
/^.*
\((
.*
)\)
$/
var
result
=
regExp
.
exec
(
filter
)
if
(
result
.
length
===
2
)
{
filter
=
result
[
1
]
}
var
rgFilters
=
filter
.
split
(
"
"
)
for
(
var
j
=
0
;
j
<
rgFilters
.
length
;
j
++
)
{
if
(
!
_mobileDlg
||
(
rgFilters
[
j
]
!==
"
*
"
&&
rgFilters
[
j
]
!==
"
*.*
"
))
{
_rgExtensions
.
push
(
rgFilters
[
j
])
}
}
}
}
QGCFileDialogController
{
id
:
controller
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
// On Qt 5.9 android versions there is the following bug: https://bugreports.qt.io/browse/QTBUG-61424
// This prevents FileDialog from being used. So we have a temp hack workaround for it which just no-ops
// the FileDialog fallback mechanism on android 5.9 builds.
HackFileDialog
{
FileDialog
{
id
:
fullFileDialog
folder
:
"
file:///
"
+
_root
.
folder
nameFilters
:
_root
.
nameFilters
?
_root
.
nameFilters
:
[]
...
...
@@ -130,12 +134,12 @@ Item {
onClicked
:
{
hideDialog
()
_root
.
acceptedForLoad
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
))
_root
.
acceptedForLoad
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
))
}
onHamburgerClicked
:
{
highlight
=
true
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
)
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
)
hamburgerMenu
.
popup
()
}
...
...
@@ -149,6 +153,7 @@ Item {
QGCMenuItem
{
text
:
qsTr
(
"
Delete
"
)
onTriggered
:
{
console
.
log
(
"
hamburgerMenu.fileToDelete
"
,
hamburgerMenu
.
fileToDelete
)
controller
.
deleteFile
(
hamburgerMenu
.
fileToDelete
)
fileRepeater
.
model
=
controller
.
getFiles
(
folder
,
_rgExtensions
)
}
...
...
@@ -243,12 +248,12 @@ Item {
onClicked
:
{
hideDialog
()
_root
.
acceptedForSave
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
))
_root
.
acceptedForSave
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
))
}
onHamburgerClicked
:
{
highlight
=
true
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
)
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
)
hamburgerMenu
.
popup
()
}
...
...
src/QmlControls/QGCFileDialogController.cc
View file @
530bfe26
...
...
@@ -19,19 +19,14 @@
QGC_LOGGING_CATEGORY
(
QGCFileDialogControllerLog
,
"QGCFileDialogControllerLog"
)
QStringList
QGCFileDialogController
::
getFiles
(
const
QString
&
directoryPath
,
const
QStringList
&
fileExtension
s
)
QStringList
QGCFileDialogController
::
getFiles
(
const
QString
&
directoryPath
,
const
QStringList
&
nameFilter
s
)
{
qCDebug
(
QGCFileDialogControllerLog
)
<<
"getFiles"
<<
directoryPath
<<
fileExtension
s
;
qCDebug
(
QGCFileDialogControllerLog
)
<<
"getFiles"
<<
directoryPath
<<
nameFilter
s
;
QStringList
files
;
QDir
fileDir
(
directoryPath
);
QStringList
infoListExtensions
;
for
(
const
QString
&
extension
:
fileExtensions
)
{
infoListExtensions
.
append
(
QStringLiteral
(
"*.%1"
).
arg
(
extension
));
}
QFileInfoList
fileInfoList
=
fileDir
.
entryInfoList
(
infoListExtensions
,
QDir
::
Files
,
QDir
::
Name
);
QFileInfoList
fileInfoList
=
fileDir
.
entryInfoList
(
nameFilters
,
QDir
::
Files
,
QDir
::
Name
);
for
(
const
QFileInfo
&
fileInfo
:
fileInfoList
)
{
qCDebug
(
QGCFileDialogControllerLog
)
<<
"getFiles found"
<<
fileInfo
.
fileName
();
...
...
@@ -41,34 +36,45 @@ QStringList QGCFileDialogController::getFiles(const QString& directoryPath, cons
return
files
;
}
QString
QGCFileDialogController
::
filenameWithExtension
(
const
QString
&
filename
,
const
QStringList
&
rgFileExtensions
)
{
QString
filenameWithExtension
(
filename
);
bool
matchFound
=
false
;
for
(
const
QString
&
extension
:
rgFileExtensions
)
{
QString
dotExtension
=
QStringLiteral
(
".%1"
).
arg
(
extension
);
matchFound
=
filenameWithExtension
.
endsWith
(
dotExtension
);
if
(
matchFound
)
{
break
;
}
}
if
(
!
matchFound
)
{
filenameWithExtension
+=
QStringLiteral
(
".%1"
).
arg
(
rgFileExtensions
[
0
]);
}
return
filenameWithExtension
;
}
bool
QGCFileDialogController
::
fileExists
(
const
QString
&
filename
)
{
return
QFile
(
filename
).
exists
();
}
QString
QGCFileDialogController
::
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QStringList
&
rgFileExtension
s
)
QString
QGCFileDialogController
::
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QStringList
&
nameFilter
s
)
{
return
directoryPath
+
QStringLiteral
(
"/"
)
+
filenameWithExtension
(
filename
,
rgFileExtensions
);
QString
firstFileExtention
;
// Check that the filename has one of the specified file extensions
bool
extensionFound
=
true
;
if
(
nameFilters
.
count
())
{
extensionFound
=
false
;
for
(
const
QString
&
nameFilter
:
nameFilters
)
{
if
(
nameFilter
.
startsWith
(
"*."
))
{
QString
fileExtension
=
nameFilter
.
right
(
nameFilter
.
length
()
-
2
);
if
(
fileExtension
!=
"*"
)
{
if
(
firstFileExtention
.
isEmpty
())
{
firstFileExtention
=
fileExtension
;
}
if
(
filename
.
endsWith
(
fileExtension
))
{
extensionFound
=
true
;
break
;
}
}
}
else
if
(
nameFilter
!=
"*"
)
{
qCWarning
(
QGCFileDialogControllerLog
)
<<
"unsupported name filter format"
<<
nameFilter
;
}
}
}
// Add the extension if it is missing
QString
filenameWithExtension
=
filename
;
if
(
!
extensionFound
)
{
filenameWithExtension
=
QStringLiteral
(
"%1.%2"
).
arg
(
filename
).
arg
(
firstFileExtention
);
}
return
directoryPath
+
QStringLiteral
(
"/"
)
+
filenameWithExtension
;
}
void
QGCFileDialogController
::
deleteFile
(
const
QString
&
filename
)
...
...
src/QmlControls/QGCFileDialogController.h
View file @
530bfe26
...
...
@@ -24,13 +24,11 @@ class QGCFileDialogController : public QObject
public:
/// Return all file in the specified path which match the specified extension
Q_INVOKABLE
QStringList
getFiles
(
const
QString
&
directoryPath
,
const
QStringList
&
fileExtension
s
);
Q_INVOKABLE
QStringList
getFiles
(
const
QString
&
directoryPath
,
const
QStringList
&
nameFilter
s
);
/// Returns the specified file name with the extension added it needed
Q_INVOKABLE
QString
filenameWithExtension
(
const
QString
&
filename
,
const
QStringList
&
rgFileExtensions
);
/// Returns the fully qualified file name from the specified parts
Q_INVOKABLE
QString
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QStringList
&
rgFileExtensions
);
/// Returns the fully qualified file name from the specified parts.
/// If filename has no file extension the first file extension is nameFilters is added to the filename.
Q_INVOKABLE
QString
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QStringList
&
nameFilters
=
QStringList
());
/// Check for file existence of specified fully qualified file name
Q_INVOKABLE
bool
fileExists
(
const
QString
&
filename
);
...
...
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
530bfe26
...
...
@@ -210,7 +210,6 @@ Item {
id
:
fileDialog
folder
:
QGroundControl
.
settingsManager
.
appSettings
.
missionSavePath
nameFilters
:
[
"
Tile Sets (*.qgctiledb)
"
]
fileExtension
:
"
qgctiledb
"
onAcceptedForSave
:
{
if
(
QGroundControl
.
mapEngineManager
.
exportSets
(
file
))
{
...
...
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