Skip to content
Snippets Groups Projects
Commit 48e2a0ee authored by Benjamin Arnaud's avatar Benjamin Arnaud Committed by Pierre Lamot
Browse files

qml: Create PlaylistMediaDelegate


Signed-off-by: default avatarPierre Lamot <pierre@videolabs.io>
parent c25a9c20
No related branches found
No related tags found
No related merge requests found
......@@ -675,6 +675,7 @@ libqt_plugin_la_QML = \
gui/qt/medialibrary/qml/VideoAllDisplay.qml \
gui/qt/medialibrary/qml/PlaylistMediaList.qml \
gui/qt/medialibrary/qml/PlaylistMedia.qml \
gui/qt/medialibrary/qml/PlaylistMediaDelegate.qml \
gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml \
gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml \
gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml \
......
/*****************************************************************************
* Copyright (C) 2021 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ( at your option ) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
import QtQuick 2.11
import "qrc:///widgets/" as Widgets
Widgets.TableViewDelegate {
id: delegate
//---------------------------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------------------------
function _applyPosition(drag)
{
if (root.isDroppable(drag, index) === false) {
root.hideLine(delegate);
return;
}
if (index === _getDropIndex(drag.y))
root.showLine(delegate, true);
else
root.showLine(delegate, false);
}
//---------------------------------------------------------------------------------------------
function _getDropIndex(y)
{
var size = Math.round(height / 2);
if (y < size)
return index;
else
return index + 1;
}
//---------------------------------------------------------------------------------------------
// Childs
//---------------------------------------------------------------------------------------------
// NOTE: We are usng a single DropArea and a single line Rectangle in PlaylistMedia.
DropArea {
anchors.fill: parent
onEntered: _applyPosition(drag)
onPositionChanged: _applyPosition(drag)
onExited: root.hideLine(delegate)
onDropped: {
if (isDroppable(drop, index) === false) {
root.hideLine(delegate);
return;
}
root.applyDrop(drop, _getDropIndex(drag.y));
}
}
}
......@@ -276,6 +276,7 @@
<file alias="VideoAllDisplay.qml">medialibrary/qml/VideoAllDisplay.qml</file>
<file alias="PlaylistMediaList.qml">medialibrary/qml/PlaylistMediaList.qml</file>
<file alias="PlaylistMedia.qml">medialibrary/qml/PlaylistMedia.qml</file>
<file alias="PlaylistMediaDelegate.qml">medialibrary/qml/PlaylistMediaDelegate.qml</file>
<file alias="PlaylistMediaDisplay.qml">medialibrary/qml/PlaylistMediaDisplay.qml</file>
<file alias="VideoPlaylistsDisplay.qml">medialibrary/qml/VideoPlaylistsDisplay.qml</file>
<file alias="MusicAlbumsDisplay.qml">medialibrary/qml/MusicAlbumsDisplay.qml</file>
......
......@@ -831,6 +831,7 @@ modules/gui/qt/medialibrary/qml/VideoAll.qml
modules/gui/qt/medialibrary/qml/VideoAllDisplay.qml
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
modules/gui/qt/medialibrary/qml/PlaylistMediaDelegate.qml
modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
modules/gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml
modules/gui/qt/menus/qml/Menubar.qml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment