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
07422b0d
Unverified
Commit
07422b0d
authored
Apr 07, 2020
by
Don Gagne
Committed by
GitHub
Apr 07, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8636 from DonLakeFlyer/MobileDirLocation
Mobile QGCFileDialog: Show dir location
parents
6a0f7679
ae6d413c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
3 deletions
+38
-3
QGCFileDialog.qml
src/QmlControls/QGCFileDialog.qml
+14
-3
QGCFileDialogController.cc
src/QmlControls/QGCFileDialogController.cc
+19
-0
QGCFileDialogController.h
src/QmlControls/QGCFileDialogController.h
+5
-0
No files found.
src/QmlControls/QGCFileDialog.qml
View file @
07422b0d
...
...
@@ -26,11 +26,20 @@ Item {
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
property
bool
_mobileDlg
:
QGroundControl
.
corePlugin
.
options
.
useMobileFileDialog
property
var
_rgExtensions
property
string
_mobileShortPath
Component.onCompleted
:
setupFileExtensions
()
Component.onCompleted
:
{
setupFileExtensions
()
_updateMobileShortPath
()
}
onFileExtensionChanged
:
setupFileExtensions
()
onFileExtension2Changed
:
setupFileExtensions
()
onFolderChanged
:
_updateMobileShortPath
()
onFileExtensionChanged
:
setupFileExtensions
()
onFileExtension2Changed
:
setupFileExtensions
()
function
_updateMobileShortPath
()
{
_mobileShortPath
=
controller
.
fullFolderPathToShortMobilePath
(
folder
);
}
function
setupFileExtensions
()
{
if
(
fileExtension2
==
""
)
{
...
...
@@ -105,6 +114,8 @@ Item {
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
text
:
qsTr
(
"
Path: %1
"
).
arg
(
_mobileShortPath
)
}
Repeater
{
id
:
fileRepeater
model
:
controller
.
getFiles
(
folder
,
_rgExtensions
)
...
...
src/QmlControls/QGCFileDialogController.cc
View file @
07422b0d
...
...
@@ -9,6 +9,9 @@
#include "QGCFileDialogController.h"
#include "QGCApplication.h"
#include "SettingsManager.h"
#include "AppSettings.h"
#include <QStandardPaths>
#include <QDebug>
...
...
@@ -72,3 +75,19 @@ void QGCFileDialogController::deleteFile(const QString& filename)
{
QFile
::
remove
(
filename
);
}
QString
QGCFileDialogController
::
fullFolderPathToShortMobilePath
(
const
QString
&
fullFolderPath
)
{
#ifdef __mobile__
QString
defaultSavePath
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
savePath
()
->
rawValueString
();
if
(
fullFolderPath
.
startsWith
(
defaultSavePath
))
{
int
lastDirSepIndex
=
fullFolderPath
.
lastIndexOf
(
QStringLiteral
(
"/"
));
return
qgcApp
()
->
applicationName
()
+
QStringLiteral
(
"/"
)
+
fullFolderPath
.
right
(
fullFolderPath
.
length
()
-
lastDirSepIndex
);
}
else
{
return
fullFolderPath
;
}
#else
qWarning
()
<<
"QGCFileDialogController::fullFolderPathToShortMobilePath should only be used in mobile builds"
;
return
fullFolderPath
;
#endif
}
src/QmlControls/QGCFileDialogController.h
View file @
07422b0d
...
...
@@ -39,6 +39,11 @@ public:
Q_INVOKABLE
void
deleteFile
(
const
QString
&
filename
);
Q_INVOKABLE
QString
urlToLocalFile
(
QUrl
url
)
{
return
url
.
toLocalFile
();
}
/// Important: Should only be used in mobile builds where default save location cannot be changed.
/// Returns the standard QGC location portion of a fully qualified folder path.
/// Example: "/Users/Don/Document/QGroundControl/Missions" returns "QGroundControl/Missions"
Q_INVOKABLE
QString
fullFolderPathToShortMobilePath
(
const
QString
&
fullFolderPath
);
};
#endif
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