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
35c61df6
Commit
35c61df6
authored
Dec 27, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MobileFileDialog bug fixes
parent
944d7224
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
136 deletions
+21
-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
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+2
-1
No files found.
qgroundcontrol.qrc
View file @
35c61df6
...
...
@@ -67,7 +67,8 @@
<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/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/QGCPipable.qml">src/QmlControls/QGCPipable.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
...
...
src/MissionEditor/MissionEditor.qml
View file @
35c61df6
...
...
@@ -207,7 +207,7 @@ QGCView {
function
loadFromSelectedFile
()
{
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
{
missionController
.
loadFromFilePicker
()
fitMapViewportToMissionItems
()
...
...
@@ -366,9 +366,8 @@ QGCView {
Component
{
id
:
mobileFilePicker
QGCMobileFileDialog
{
openDialog
:
true
fileExtension
:
_syncDropDownController
.
fileExtension
QGCMobileFileOpenDialog
{
fileExtension
:
_syncDropDownController
.
fileExtension
onFilenameReturned
:
{
_syncDropDownController
.
loadFromFile
(
filename
)
_syncDropDownController
.
fitViewportToItems
()
...
...
@@ -379,8 +378,7 @@ QGCView {
Component
{
id
:
mobileFileSaver
QGCMobileFileDialog
{
openDialog
:
false
QGCMobileFileSaveDialog
{
fileExtension
:
_syncDropDownController
.
fileExtension
onFilenameReturned
:
_syncDropDownController
.
saveToFile
(
filename
)
}
...
...
src/QGCMobileFileDialogController.cc
View file @
35c61df6
...
...
@@ -33,6 +33,7 @@ QStringList QGCMobileFileDialogController::getFiles(const QString& fileExtension
QString
QGCMobileFileDialogController
::
fullPath
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
{
qDebug
()
<<
"QGCMobileFileDialogController::fullPath"
<<
filename
<<
fileExtension
;
QString
saveLocation
(
_getSaveLocation
());
if
(
saveLocation
.
isEmpty
())
{
return
filename
;
...
...
@@ -52,6 +53,7 @@ QString QGCMobileFileDialogController::fullPath(const QString& filename, const Q
bool
QGCMobileFileDialogController
::
fileExists
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
{
QFile
file
(
fullPath
(
filename
,
fileExtension
));
qDebug
()
<<
"QGCMobileFileDialogController::fileExists"
<<
file
.
fileName
();
return
file
.
exists
();
}
...
...
@@ -59,10 +61,15 @@ QString QGCMobileFileDialogController::_getSaveLocation(void)
{
QStringList
docDirs
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DocumentsLocation
);
if
(
docDirs
.
count
()
<=
0
)
{
qCWarning
(
QGCMobileFileDialogControllerLog
)
<<
"No
Documents
location"
;
qCWarning
(
QGCMobileFileDialogControllerLog
)
<<
"No
save
location"
;
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 @
35c61df6
...
...
@@ -96,7 +96,7 @@ QGCView {
text
:
qsTr
(
"
Load from file...
"
)
onTriggered
:
{
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
{
controller
.
loadFromFilePicker
()
}
...
...
@@ -263,7 +263,7 @@ QGCView {
Component
{
id
:
mobileFilePicker
QGCMobileFileDialog
{
QGCMobileFile
Open
Dialog
{
fileExtension
:
QGroundControl
.
parameterFileExtension
onFilenameReturned
:
controller
.
loadFromFile
(
filename
)
}
...
...
@@ -272,8 +272,7 @@ QGCView {
Component
{
id
:
mobileFileSaver
QGCMobileFileDialog
{
openDialog
:
false
QGCMobileFileSaveDialog
{
fileExtension
:
QGroundControl
.
parameterFileExtension
onFilenameReturned
:
controller
.
saveToFile
(
filename
)
}
...
...
src/QmlControls/QGCMobileFileDialog.qml
deleted
100644 → 0
View file @
944d7224
/****************************************************************************
*
* (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/QGroundControl.Controls.qmldir
View file @
35c61df6
...
...
@@ -28,7 +28,8 @@ QGCComboBox 1.0 QGCComboBox.qml
QGCFlickable 1.0 QGCFlickable.qml
QGCLabel 1.0 QGCLabel.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
QGCPipable 1.0 QGCPipable.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