Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Elisa
Commits
b2a43a35
Commit
b2a43a35
authored
Nov 30, 2021
by
Bharadwaj Raju
Committed by
Nate Graham
Nov 30, 2021
Browse files
Implement dropping music files from file manager onto Playlist
BUG: 404712
FIXED-IN: 22.04
parent
12877b62
Pipeline
#103634
passed with stage
in 3 minutes and 55 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/elisaapplication.cpp
View file @
b2a43a35
...
...
@@ -55,6 +55,8 @@
#include
<QKeyEvent>
#include
<QDebug>
#include
<QFileSystemWatcher>
#include
<QMimeDatabase>
#include
<QMimeType>
#include
<memory>
...
...
@@ -238,6 +240,24 @@ void ElisaApplication::setArguments(const DataTypes::EntryDataList &newArguments
}
}
void
ElisaApplication
::
openFiles
(
const
QList
<
QUrl
>
&
files
)
{
auto
newArguments
=
DataTypes
::
EntryDataList
{};
const
QMimeDatabase
mimeDB
;
for
(
const
auto
&
file
:
files
)
{
const
QMimeType
mime
=
mimeDB
.
mimeTypeForUrl
(
file
);
if
(
mime
.
inherits
(
QStringLiteral
(
"audio/x-mpegurl"
)))
{
d
->
mMediaPlayListProxyModel
->
loadPlayList
(
file
);
}
else
if
(
mime
.
name
().
startsWith
(
QStringLiteral
(
"audio/"
)))
{
newArguments
.
push_back
(
DataTypes
::
EntryData
{{{
DataTypes
::
ElementTypeRole
,
ElisaUtils
::
FileName
},
{
DataTypes
::
ResourceRole
,
file
}},
{},
{}});
}
}
setArguments
(
newArguments
);
// so that adding the same file more than once works
setArguments
({});
}
void
ElisaApplication
::
activateActionRequested
(
const
QString
&
actionName
,
const
QVariant
&
parameter
)
{
Q_UNUSED
(
actionName
)
...
...
src/elisaapplication.h
View file @
b2a43a35
...
...
@@ -197,6 +197,8 @@ public Q_SLOTS:
void
setArguments
(
const
DataTypes
::
EntryDataList
&
newArguments
);
void
openFiles
(
const
QList
<
QUrl
>
&
files
);
void
activateActionRequested
(
const
QString
&
actionName
,
const
QVariant
&
parameter
);
void
activateRequested
(
const
QStringList
&
arguments
,
const
QString
&
workingDirectory
);
...
...
src/qml/ElisaMainWindow.qml
View file @
b2a43a35
...
...
@@ -38,6 +38,15 @@ Kirigami.ApplicationWindow {
}
}
DropArea
{
anchors.fill
:
parent
onDropped
:
{
if
(
drop
.
hasUrls
)
{
ElisaApplication
.
openFiles
(
drop
.
urls
);
}
}
}
// HACK: since elisa's main view hasn't been ported to a page, but page layers are used for mobile settings
// lower the main view and mobile footer's z to be behind the layer when there are layers added (normally it is in front)
property
bool
layerOnTop
:
pageStack
.
layers
.
depth
>
1
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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