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
329e0ded
Commit
329e0ded
authored
Mar 06, 2020
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
f3072b2a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
QGCFileDialog.qml
src/QmlControls/QGCFileDialog.qml
+6
-6
QGCFileDialogController.cc
src/QmlControls/QGCFileDialogController.cc
+15
-7
QGCFileDialogController.h
src/QmlControls/QGCFileDialogController.h
+2
-2
No files found.
src/QmlControls/QGCFileDialog.qml
View file @
329e0ded
...
...
@@ -117,12 +117,12 @@ Item {
onClicked
:
{
hideDialog
()
_root
.
acceptedForLoad
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
fileExtension
))
_root
.
acceptedForLoad
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
))
}
onHamburgerClicked
:
{
highlight
=
true
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
fileExtension
)
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
)
hamburgerMenu
.
popup
()
}
...
...
@@ -162,12 +162,12 @@ Item {
return
}
if
(
!
replaceMessage
.
visible
)
{
if
(
controller
.
fileExists
(
controller
.
fullyQualifiedFilename
(
folder
,
filenameTextField
.
text
,
fileExtension
)))
{
if
(
controller
.
fileExists
(
controller
.
fullyQualifiedFilename
(
folder
,
filenameTextField
.
text
,
_rgExtensions
)))
{
replaceMessage
.
visible
=
true
return
}
}
_root
.
acceptedForSave
(
controller
.
fullyQualifiedFilename
(
folder
,
filenameTextField
.
text
,
fileExtension
))
_root
.
acceptedForSave
(
controller
.
fullyQualifiedFilename
(
folder
,
filenameTextField
.
text
,
_rgExtensions
))
hideDialog
()
}
...
...
@@ -230,12 +230,12 @@ Item {
onClicked
:
{
hideDialog
()
_root
.
acceptedForSave
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
fileExtension
))
_root
.
acceptedForSave
(
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
))
}
onHamburgerClicked
:
{
highlight
=
true
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
fileExtension
)
hamburgerMenu
.
fileToDelete
=
controller
.
fullyQualifiedFilename
(
folder
,
modelData
,
_rgExtensions
)
hamburgerMenu
.
popup
()
}
...
...
src/QmlControls/QGCFileDialogController.cc
View file @
329e0ded
...
...
@@ -38,16 +38,24 @@ QStringList QGCFileDialogController::getFiles(const QString& directoryPath, cons
return
files
;
}
QString
QGCFileDialogController
::
filenameWithExtension
(
const
QString
&
filename
,
const
QString
&
fileExtension
)
QString
QGCFileDialogController
::
filenameWithExtension
(
const
QString
&
filename
,
const
QString
List
&
rgFileExtensions
)
{
QString
filenameWithExtension
(
filename
);
QString
correctExtension
=
QString
(
".%1"
).
arg
(
fileExtension
);
if
(
!
filenameWithExtension
.
endsWith
(
correctExtension
))
{
filenameWithExtension
+=
correctExtension
;
bool
matchFound
=
false
;
for
(
const
QString
&
extension
:
rgFileExtensions
)
{
QString
dotExtension
=
QString
(
".%1"
).
arg
(
extension
);
matchFound
=
filenameWithExtension
.
endsWith
(
dotExtension
);
if
(
matchFound
)
{
break
;
}
}
return
filenameWithExtension
;
if
(
!
matchFound
)
{
filenameWithExtension
+=
rgFileExtensions
[
0
];
}
return
filenameWithExtension
;
}
bool
QGCFileDialogController
::
fileExists
(
const
QString
&
filename
)
...
...
@@ -55,9 +63,9 @@ bool QGCFileDialogController::fileExists(const QString& filename)
return
QFile
(
filename
).
exists
();
}
QString
QGCFileDialogController
::
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QString
&
fileExtension
)
QString
QGCFileDialogController
::
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QString
List
&
rgFileExtensions
)
{
return
directoryPath
+
QStringLiteral
(
"/"
)
+
filenameWithExtension
(
filename
,
fileExtension
);
return
directoryPath
+
QStringLiteral
(
"/"
)
+
filenameWithExtension
(
filename
,
rgFileExtensions
);
}
void
QGCFileDialogController
::
deleteFile
(
const
QString
&
filename
)
...
...
src/QmlControls/QGCFileDialogController.h
View file @
329e0ded
...
...
@@ -27,10 +27,10 @@ public:
Q_INVOKABLE
QStringList
getFiles
(
const
QString
&
directoryPath
,
const
QStringList
&
fileExtensions
);
/// Returns the specified file name with the extension added it needed
Q_INVOKABLE
QString
filenameWithExtension
(
const
QString
&
filename
,
const
QString
&
fileExtension
);
Q_INVOKABLE
QString
filenameWithExtension
(
const
QString
&
filename
,
const
QString
List
&
rgFileExtensions
);
/// Returns the fully qualified file name from the specified parts
Q_INVOKABLE
QString
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QString
&
fileExtension
);
Q_INVOKABLE
QString
fullyQualifiedFilename
(
const
QString
&
directoryPath
,
const
QString
&
filename
,
const
QString
List
&
rgFileExtensions
);
/// Check for file existence of specified fully qualified file name
Q_INVOKABLE
bool
fileExists
(
const
QString
&
filename
);
...
...
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