Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
ce7d3d14
Commit
ce7d3d14
authored
Jul 13, 2020
by
Jean-Baptiste Mardelle
Browse files
Use Windows compatible methods when dropping a folder in bin.
Related to
#287
parent
7da3201e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/clipcreator.cpp
View file @
ce7d3d14
...
...
@@ -29,6 +29,7 @@
#include "mainwindow.h"
#include "projectitemmodel.h"
#include "titler/titledocument.h"
#include "dialogs/clipcreationdialog.h"
#include "utils/devices.hpp"
#include "xml/xml.hpp"
#include <KMessageBox>
...
...
@@ -229,34 +230,21 @@ const QString ClipCreator::createClipsFromList(const QList<QUrl> &list, bool che
if
(
!
QFile
::
exists
(
file
.
toLocalFile
()))
{
continue
;
}
QFileInfo
info
(
file
.
toLocalFile
());
QMimeType
mType
=
db
.
mimeTypeForUrl
(
file
);
if
(
mType
.
inherits
(
QLatin1String
(
"inode/directory"
)
))
{
if
(
info
.
isDir
(
))
{
// user dropped a folder, import its files
QDir
dir
(
file
.
path
());
QDir
dir
(
file
.
toLocalFile
());
QString
folderId
;
Fun
local_undo
=
[]()
{
return
true
;
};
Fun
local_redo
=
[]()
{
return
true
;
};
QStringList
result
=
dir
.
entryList
(
QDir
::
Files
);
QStringList
subfolders
=
dir
.
entryList
(
QDir
::
Dirs
|
QDir
::
NoDotAndDotDot
);
dir
.
setNameFilters
(
ClipCreationDialog
::
getExtensions
());
QStringList
result
=
dir
.
entryList
(
QDir
::
Files
);
QList
<
QUrl
>
folderFiles
;
for
(
const
QString
&
path
:
result
)
{
QUrl
url
=
QUrl
::
fromLocalFile
(
dir
.
absoluteFilePath
(
path
));
// Check file is of a supported type
mType
=
db
.
mimeTypeForUrl
(
url
);
QString
mimeAliases
=
mType
.
name
();
bool
isValid
=
mimeAliases
.
contains
(
QLatin1String
(
"video/"
));
if
(
!
isValid
)
{
isValid
=
mimeAliases
.
contains
(
QLatin1String
(
"audio/"
));
}
if
(
!
isValid
)
{
isValid
=
mimeAliases
.
contains
(
QLatin1String
(
"image/"
));
}
if
(
!
isValid
&&
(
mType
.
inherits
(
QLatin1String
(
"video/mlt-playlist"
))
||
mType
.
inherits
(
QLatin1String
(
"application/x-kdenlivetitle"
))))
{
isValid
=
true
;
}
if
(
isValid
)
{
folderFiles
.
append
(
url
);
}
folderFiles
.
append
(
url
);
}
if
(
folderFiles
.
isEmpty
())
{
QList
<
QUrl
>
sublist
;
...
...
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