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
97251f4d
Commit
97251f4d
authored
Dec 27, 2016
by
Don Gagne
Committed by
GitHub
Dec 27, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4356 from DonLakeFlyer/MobileFileDialog
MobileFileDialog bug fixes
parents
ea066b49
a19e0d60
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
156 additions
and
136 deletions
+156
-136
qgroundcontrol.qrc
qgroundcontrol.qrc
+2
-1
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+4
-6
QGCMobileFileDialogController.cc
src/QGCMobileFileDialogController.cc
+10
-3
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+3
-4
QGCMobileFileDialog.qml
src/QmlControls/QGCMobileFileDialog.qml
+0
-121
QGCMobileFileOpenDialog.qml
src/QmlControls/QGCMobileFileOpenDialog.qml
+56
-0
QGCMobileFileSaveDialog.qml
src/QmlControls/QGCMobileFileSaveDialog.qml
+79
-0
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+2
-1
No files found.
qgroundcontrol.qrc
View file @
97251f4d
...
@@ -67,7 +67,8 @@
...
@@ -67,7 +67,8 @@
<file alias="QGroundControl/Controls/QGCFlickableVerticalIndicator.qml">src/QmlControls/QGCFlickableVerticalIndicator.qml</file>
<file alias="QGroundControl/Controls/QGCFlickableVerticalIndicator.qml">src/QmlControls/QGCFlickableVerticalIndicator.qml</file>
<file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file>
<file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file>
<file alias="QGroundControl/Controls/QGCListView.qml">src/QmlControls/QGCListView.qml</file>
<file alias="QGroundControl/Controls/QGCListView.qml">src/QmlControls/QGCListView.qml</file>
<file alias="QGroundControl/Controls/QGCMobileFileDialog.qml">src/QmlControls/QGCMobileFileDialog.qml</file>
<file alias="QGroundControl/Controls/QGCMobileFileOpenDialog.qml">src/QmlControls/QGCMobileFileOpenDialog.qml</file>
<file alias="QGroundControl/Controls/QGCMobileFileSaveDialog.qml">src/QmlControls/QGCMobileFileSaveDialog.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/Controls/QGCPipable.qml">src/QmlControls/QGCPipable.qml</file>
<file alias="QGroundControl/Controls/QGCPipable.qml">src/QmlControls/QGCPipable.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
...
...
src/MissionEditor/MissionEditor.qml
View file @
97251f4d
...
@@ -207,7 +207,7 @@ QGCView {
...
@@ -207,7 +207,7 @@ QGCView {
function
loadFromSelectedFile
()
{
function
loadFromSelectedFile
()
{
if
(
ScreenTools
.
isMobile
)
{
if
(
ScreenTools
.
isMobile
)
{
qgcView
.
showDialog
(
mobileFilePicker
,
qsTr
(
"
Select Mission File
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
Cancel
)
qgcView
.
showDialog
(
mobileFilePicker
,
qsTr
(
"
Select Mission File
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
)
}
else
{
}
else
{
missionController
.
loadFromFilePicker
()
missionController
.
loadFromFilePicker
()
fitMapViewportToMissionItems
()
fitMapViewportToMissionItems
()
...
@@ -366,9 +366,8 @@ QGCView {
...
@@ -366,9 +366,8 @@ QGCView {
Component
{
Component
{
id
:
mobileFilePicker
id
:
mobileFilePicker
QGCMobileFileDialog
{
QGCMobileFileOpenDialog
{
openDialog
:
true
fileExtension
:
_syncDropDownController
.
fileExtension
fileExtension
:
_syncDropDownController
.
fileExtension
onFilenameReturned
:
{
onFilenameReturned
:
{
_syncDropDownController
.
loadFromFile
(
filename
)
_syncDropDownController
.
loadFromFile
(
filename
)
_syncDropDownController
.
fitViewportToItems
()
_syncDropDownController
.
fitViewportToItems
()
...
@@ -379,8 +378,7 @@ QGCView {
...
@@ -379,8 +378,7 @@ QGCView {
Component
{
Component
{
id
:
mobileFileSaver
id
:
mobileFileSaver
QGCMobileFileDialog
{
QGCMobileFileSaveDialog
{
openDialog
:
false
fileExtension
:
_syncDropDownController
.
fileExtension
fileExtension
:
_syncDropDownController
.
fileExtension
onFilenameReturned
:
_syncDropDownController
.
saveToFile
(
filename
)
onFilenameReturned
:
_syncDropDownController
.
saveToFile
(
filename
)
}
}
...
...
src/QGCMobileFileDialogController.cc
View file @
97251f4d
...
@@ -33,6 +33,7 @@ QStringList QGCMobileFileDialogController::getFiles(const QString& fileExtension
...
@@ -33,6 +33,7 @@ QStringList QGCMobileFileDialogController::getFiles(const QString& fileExtension
QString
QGCMobileFileDialogController
::
fullPath
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
QString
QGCMobileFileDialogController
::
fullPath
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
{
{
qDebug
()
<<
"QGCMobileFileDialogController::fullPath"
<<
filename
<<
fileExtension
;
QString
saveLocation
(
_getSaveLocation
());
QString
saveLocation
(
_getSaveLocation
());
if
(
saveLocation
.
isEmpty
())
{
if
(
saveLocation
.
isEmpty
())
{
return
filename
;
return
filename
;
...
@@ -52,6 +53,7 @@ QString QGCMobileFileDialogController::fullPath(const QString& filename, const Q
...
@@ -52,6 +53,7 @@ QString QGCMobileFileDialogController::fullPath(const QString& filename, const Q
bool
QGCMobileFileDialogController
::
fileExists
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
bool
QGCMobileFileDialogController
::
fileExists
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
{
{
QFile
file
(
fullPath
(
filename
,
fileExtension
));
QFile
file
(
fullPath
(
filename
,
fileExtension
));
qDebug
()
<<
"QGCMobileFileDialogController::fileExists"
<<
file
.
fileName
();
return
file
.
exists
();
return
file
.
exists
();
}
}
...
@@ -59,10 +61,15 @@ QString QGCMobileFileDialogController::_getSaveLocation(void)
...
@@ -59,10 +61,15 @@ QString QGCMobileFileDialogController::_getSaveLocation(void)
{
{
QStringList
docDirs
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DocumentsLocation
);
QStringList
docDirs
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DocumentsLocation
);
if
(
docDirs
.
count
()
<=
0
)
{
if
(
docDirs
.
count
()
<=
0
)
{
qCWarning
(
QGCMobileFileDialogControllerLog
)
<<
"No
Documents
location"
;
qCWarning
(
QGCMobileFileDialogControllerLog
)
<<
"No
save
location"
;
return
QString
();
return
QString
();
}
}
qCDebug
(
QGCMobileFileDialogControllerLog
)
<<
"Save directory"
<<
docDirs
.
at
(
0
);
QString
saveDirectory
=
docDirs
[
0
];
if
(
!
QDir
(
saveDirectory
).
exists
())
{
QDir
().
mkdir
(
saveDirectory
);
}
qCDebug
(
QGCMobileFileDialogControllerLog
)
<<
"Save directory"
<<
saveDirectory
;
return
docDirs
.
at
(
0
)
;
return
saveDirectory
;
}
}
src/QmlControls/ParameterEditor.qml
View file @
97251f4d
...
@@ -96,7 +96,7 @@ QGCView {
...
@@ -96,7 +96,7 @@ QGCView {
text
:
qsTr
(
"
Load from file...
"
)
text
:
qsTr
(
"
Load from file...
"
)
onTriggered
:
{
onTriggered
:
{
if
(
ScreenTools
.
isMobile
)
{
if
(
ScreenTools
.
isMobile
)
{
qgcView
.
showDialog
(
mobileFilePicker
,
qsTr
(
"
Select Parameter File
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
Cancel
)
qgcView
.
showDialog
(
mobileFilePicker
,
qsTr
(
"
Select Parameter File
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
)
}
else
{
}
else
{
controller
.
loadFromFilePicker
()
controller
.
loadFromFilePicker
()
}
}
...
@@ -263,7 +263,7 @@ QGCView {
...
@@ -263,7 +263,7 @@ QGCView {
Component
{
Component
{
id
:
mobileFilePicker
id
:
mobileFilePicker
QGCMobileFileDialog
{
QGCMobileFile
Open
Dialog
{
fileExtension
:
QGroundControl
.
parameterFileExtension
fileExtension
:
QGroundControl
.
parameterFileExtension
onFilenameReturned
:
controller
.
loadFromFile
(
filename
)
onFilenameReturned
:
controller
.
loadFromFile
(
filename
)
}
}
...
@@ -272,8 +272,7 @@ QGCView {
...
@@ -272,8 +272,7 @@ QGCView {
Component
{
Component
{
id
:
mobileFileSaver
id
:
mobileFileSaver
QGCMobileFileDialog
{
QGCMobileFileSaveDialog
{
openDialog
:
false
fileExtension
:
QGroundControl
.
parameterFileExtension
fileExtension
:
QGroundControl
.
parameterFileExtension
onFilenameReturned
:
controller
.
saveToFile
(
filename
)
onFilenameReturned
:
controller
.
saveToFile
(
filename
)
}
}
...
...
src/QmlControls/QGCMobileFileDialog.qml
deleted
100644 → 0
View file @
ea066b49
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.5
import
QtQuick
.
Controls
1.3
import
QtQuick
.
Dialogs
1.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
Palette
1.0
/// Simple file picker for mobile
QGCViewDialog
{
property
bool
openDialog
:
true
///< true: Show file open dialog, false: show file save dialog
property
string
fileExtension
///< File extension for file listing
signal
filenameReturned
(
string
filename
)
readonly
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
function
accept
()
{
if
(
!
openDialog
)
{
console
.
log
(
"
filename
"
,
dialogLoader
.
item
.
filename
)
if
(
!
dialogLoader
.
item
.
replaceMessageShown
)
{
if
(
controller
.
fileExists
(
dialogLoader
.
item
.
filename
,
fileExtension
))
{
dialogLoader
.
item
.
replaceMessageShown
=
true
return
}
}
filenameReturned
(
controller
.
fullPath
(
dialogLoader
.
item
.
filename
,
fileExtension
))
}
hideDialog
()
}
QGCMobileFileDialogController
{
id
:
controller
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
Loader
{
id
:
dialogLoader
anchors.fill
:
parent
sourceComponent
:
openDialog
?
openDialogComponent
:
saveDialogComponent
}
Component
{
id
:
saveDialogComponent
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
property
alias
filename
:
filenameTextField
.
text
property
alias
replaceMessageShown
:
replaceMessage
.
visible
QGCLabel
{
text
:
qsTr
(
"
File name:
"
)
}
QGCTextField
{
id
:
filenameTextField
onTextChanged
:
replaceMessage
.
visible
=
false
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
File names must end with .%1 file extension. If missing it will be added.
"
).
arg
(
fileExtension
)
}
QGCLabel
{
id
:
replaceMessage
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
The file %1 exists. Click Save again to replace it.
"
).
arg
(
filename
)
visible
:
false
color
:
qgcPal
.
warningText
}
}
}
Component
{
id
:
openDialogComponent
Item
{
anchors.margins
:
_margins
anchors.fill
:
parent
QGCListView
{
anchors.fill
:
parent
spacing
:
_margins
/
2
orientation
:
ListView
.
Vertical
model
:
controller
.
getFiles
(
fileExtension
)
delegate
:
QGCButton
{
text
:
modelData
onClicked
:
{
hideDialog
()
filenameReturned
(
controller
.
fullPath
(
modelData
,
fileExtension
))
}
}
}
QGCLabel
{
text
:
qsTr
(
"
No files
"
)
visible
:
controller
.
getFiles
(
fileExtension
).
length
==
0
}
}
}
}
src/QmlControls/QGCMobileFileOpenDialog.qml
0 → 100644
View file @
97251f4d
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.5
import
QtQuick
.
Controls
1.3
import
QtQuick
.
Dialogs
1.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
Palette
1.0
/// Simple file open dialog for mobile
QGCViewDialog
{
property
string
fileExtension
///< File extension for file listing
signal
filenameReturned
(
string
filename
)
readonly
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCMobileFileDialogController
{
id
:
controller
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
Item
{
anchors.margins
:
_margins
anchors.fill
:
parent
QGCListView
{
anchors.fill
:
parent
spacing
:
_margins
/
2
orientation
:
ListView
.
Vertical
model
:
controller
.
getFiles
(
fileExtension
)
delegate
:
QGCButton
{
text
:
modelData
onClicked
:
{
hideDialog
()
filenameReturned
(
controller
.
fullPath
(
modelData
,
fileExtension
))
}
}
}
QGCLabel
{
text
:
qsTr
(
"
No files
"
)
visible
:
controller
.
getFiles
(
fileExtension
).
length
==
0
}
}
}
src/QmlControls/QGCMobileFileSaveDialog.qml
0 → 100644
View file @
97251f4d
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.5
import
QtQuick
.
Controls
1.3
import
QtQuick
.
Dialogs
1.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
Palette
1.0
/// Simple file picker for mobile
QGCViewDialog
{
property
string
fileExtension
///< File extension for file listing
signal
filenameReturned
(
string
filename
)
readonly
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
function
accept
()
{
if
(
filenameTextField
.
text
==
""
)
{
return
}
if
(
!
replaceMessage
.
visible
)
{
if
(
controller
.
fileExists
(
filenameTextField
.
text
,
fileExtension
))
{
console
.
log
(
"
File exists
"
)
replaceMessage
.
visible
=
true
return
}
}
filenameReturned
(
controller
.
fullPath
(
filenameTextField
.
text
,
fileExtension
))
hideDialog
()
}
QGCMobileFileDialogController
{
id
:
controller
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
text
:
qsTr
(
"
File name:
"
)
}
QGCTextField
{
id
:
filenameTextField
onTextChanged
:
replaceMessage
.
visible
=
false
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
File names must end with .%1 file extension. If missing it will be added.
"
).
arg
(
fileExtension
)
}
QGCLabel
{
id
:
replaceMessage
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
The file %1 exists. Click Save again to replace it.
"
).
arg
(
filenameTextField
.
text
)
visible
:
false
color
:
qgcPal
.
warningText
}
}
}
src/QmlControls/QGroundControl.Controls.qmldir
View file @
97251f4d
...
@@ -28,7 +28,8 @@ QGCComboBox 1.0 QGCComboBox.qml
...
@@ -28,7 +28,8 @@ QGCComboBox 1.0 QGCComboBox.qml
QGCFlickable 1.0 QGCFlickable.qml
QGCFlickable 1.0 QGCFlickable.qml
QGCLabel 1.0 QGCLabel.qml
QGCLabel 1.0 QGCLabel.qml
QGCListView 1.0 QGCListView.qml
QGCListView 1.0 QGCListView.qml
QGCMobileFileDialog 1.0 QGCMobileFileDialog.qml
QGCMobileFileOpenDialog 1.0 QGCMobileFileOpenDialog.qml
QGCMobileFileSaveDialog 1.0 QGCMobileFileSaveDialog.qml
QGCMovableItem 1.0 QGCMovableItem.qml
QGCMovableItem 1.0 QGCMovableItem.qml
QGCPipable 1.0 QGCPipable.qml
QGCPipable 1.0 QGCPipable.qml
QGCRadioButton 1.0 QGCRadioButton.qml
QGCRadioButton 1.0 QGCRadioButton.qml
...
...
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