Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • Thrillseekr/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
400 results
Show changes
Commits on Source (32)
......@@ -17,6 +17,7 @@
*****************************************************************************/
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQml.Models 2.11
import org.videolan.vlc 0.1
......@@ -25,177 +26,150 @@ import "qrc:///player/"
import "qrc:///widgets/" as Widgets
import "qrc:///style/"
MouseArea {
id: dragArea
Control {
id: control
property int controlId: model.id
property bool held: false
property bool dropVisible: false
padding: background.border.width
readonly property int controlId: model.id
property var dndView: null
anchors.verticalCenter: (!!parent) ? parent.verticalCenter : undefined
cursorShape: Qt.OpenHandCursor
drag.target: held ? content : undefined
width: buttonloader.width
height: VLCStyle.icon_medium
hoverEnabled: true
property alias containsDrag: dropArea.containsDrag
onHeldChanged: {
if (held) {
removeInfoRectVisible = true
}
else {
removeInfoRectVisible = false
}
}
Rectangle {
z: -1
readonly property bool dragActive: loader.Drag.active
property alias dropArea: dropArea
property alias containsMouse: mouseArea.containsMouse
property alias pressed: mouseArea.pressed
ListView.delayRemove: dragActive
MouseArea {
id: mouseArea
anchors.fill: parent
visible: dragArea.containsMouse && !held
color: VLCStyle.colors.bgHover
}
cursorShape: (pressed || root.dragActive) ? Qt.DragMoveCursor
: Qt.OpenHandCursor
Rectangle {
z: 1
width: VLCStyle.dp(2, VLCStyle.scale)
height: parent.height
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: index === 0 ? 0 : -width
drag.target: loader
hoverEnabled: true
drag.onActiveChanged: {
if (drag.active) {
root.dragStarted(controlId)
removeInfoRectVisible = true
drag.target.Drag.start()
} else {
drag.target.Drag.drop()
removeInfoRectVisible = false
root.dragStopped(controlId)
}
}
antialiasing: true
visible: dropVisible
color: VLCStyle.colors.accent
}
onPressed: {
held = true
root._held = true
onPositionChanged: {
if (drag.active) {
// FIXME: There must be a better way of this
var pos = mapToItem(loader.parent, mouseX, mouseY)
// y should be set first, because the automatic scroll is
// triggered by change on X
loader.y = pos.y
loader.x = pos.x
}
}
}
onEntered: playerBtnDND.currentIndex = index
DropArea {
id: dropArea
anchors.fill: parent
onEntered: {
if ((drag.source === null ||
(drag.source.dndView === dndView &&
(parent.DelegateModel.itemsIndex === drag.source.DelegateModel.itemsIndex + 1))) ||
pressed)
drag.accepted = false
}
onWheel: {
playerBtnDND.wheelScroll(wheel.angleDelta.y)
}
onDropped: {
var destIndex = parent.DelegateModel.itemsIndex
onReleased: {
drag.target.Drag.drop()
held = false
root._held = false
}
if((drag.source.dndView === dndView)
&& (drag.source.DelegateModel.itemsIndex < destIndex))
--destIndex
onPositionChanged: {
var pos = this.mapToGlobal(mouseX, mouseY)
updatePos(pos.x, pos.y)
dropEvent(drag, destIndex)
}
}
function updatePos(x, y) {
var pos = root.mapFromGlobal(x, y)
content.x = pos.x
content.y = pos.y
Binding {
when: dragActive
value: true
target: root
property: "dragActive"
}
Rectangle {
id: content
Drag.active: dragArea.held
Drag.source: dragArea
anchors {
horizontalCenter: parent.horizontalCenter
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: index === 0 ? 0 : -width
}
opacity: held ? 0.75 : 1.0
Loader{
id: buttonloader
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
source: PlayerControlbarControls.control(model.id).source
onLoaded: {
buttonloader.item.paintOnly = true
buttonloader.item.enabled = false
}
z: 1
}
implicitWidth: VLCStyle.dp(2, VLCStyle.scale)
implicitHeight: VLCStyle.icon_medium
states: State {
when: dragArea.held
visible: dropArea.containsDrag
color: VLCStyle.colors.accent
}
ParentChange { target: content; parent: root }
AnchorChanges {
target: content
anchors { horizontalCenter: undefined; verticalCenter: undefined }
}
background: Rectangle {
opacity: Drag.active ? 0.75 : 1.0
PropertyChanges {
target: dragArea
ListView.delayRemove: true
}
}
color: "transparent"
onXChanged: {
if (content.Drag.active)
root.handleScroll(this)
}
border.width: VLCStyle.dp(1, VLCStyle.scale)
border.color: containsMouse && !pressed ? VLCStyle.colors.buttonBorder
: "transparent"
}
DropArea {
id: dropArea
anchors.fill: parent
onEntered: {
if ((drag.source === null ||
(drag.source.dndView === playerBtnDND &&
(parent.DelegateModel.itemsIndex === drag.source.DelegateModel.itemsIndex + 1))))
return
if (held)
return
contentItem: Item {
id: wrapper
dropVisible = true
}
implicitHeight: loader.implicitHeight
implicitWidth: loader.implicitWidth
onExited: {
if (held)
return
Loader {
id: loader
dropVisible = false
}
parent: Drag.active ? root : wrapper
onDropped: {
if (!dropVisible)
return
anchors.horizontalCenter: Drag.active ? undefined : parent.horizontalCenter
anchors.verticalCenter: Drag.active ? undefined : parent.verticalCenter
if (held)
return
source: PlayerControlbarControls.control(model.id).source
if (drag.source.dndView === playerBtnDND) {
// moving from same section
var srcIndex = drag.source.DelegateModel.itemsIndex
var destIndex = parent.DelegateModel.itemsIndex
Drag.source: control
if(srcIndex < destIndex)
destIndex -= 1
playerBtnDND.model.move(srcIndex,destIndex)
}
else if (drag.source.objectName == "buttonsList"){
// moving from buttonsList
dndView.model.insert(parent.DelegateModel.itemsIndex, {"id" : drag.source.mIndex})
}
else {
// moving between sections
dndView.model.insert(parent.DelegateModel.itemsIndex, {"id" : drag.source.controlId})
drag.source.dndView.model.remove(drag.source.DelegateModel.itemsIndex)
onXChanged: {
if (Drag.active)
root.handleScroll(this)
}
dropVisible = false
onLoaded: {
item.paintOnly = true
item.enabled = false
if (item.extraWidth !== undefined) {
if (extraWidthAvailable)
item.extraWidth = Number.MAX_VALUE
else
item.extraWidth = 0
}
}
}
}
}
......@@ -25,28 +25,28 @@ import "qrc:///style/"
ListView {
id: playerBtnDND
spacing: VLCStyle.margin_xsmall
orientation: Qt.Horizontal
clip: true
currentIndex: -1
highlightFollowsCurrentItem: false
boundsBehavior: Flickable.StopAtBounds
boundsMovement: Flickable.StopAtBounds
property bool containsDrag: footerItem.dropVisible
property alias scrollBar: scrollBar
property bool extraWidthAvailable: true
ScrollBar.horizontal: ScrollBar {
id: scrollBar
policy: playerBtnDND.contentWidth > playerBtnDND.width ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
}
function wheelScroll(delta) {
if (delta > 0)
scrollBar.decrease()
else
scrollBar.increase()
}
remove: Transition {
NumberAnimation {
property: "opacity"; from: 1.0; to: 0
......@@ -55,6 +55,10 @@ ListView {
}
}
// FIXME: Animations are disabled because they are incompatible
// with the delegate loader which sets extra width after the
// control gets loaded.
/*
add: Transition {
NumberAnimation {
property: "opacity"; from: 0; to: 1.0
......@@ -73,85 +77,102 @@ ListView {
NumberAnimation { property: "opacity"; to: 1.0 }
}
*/
function dropEvent(drag, destIndex) {
if (drag.source.dndView === playerBtnDND) {
// moving from same section
playerBtnDND.model.move(drag.source.DelegateModel.itemsIndex,
destIndex)
} else if (drag.source.objectName === "buttonsList") {
// moving from buttonsList
playerBtnDND.model.insert(destIndex, {"id" : drag.source.mIndex})
} else {
// moving between sections or views
playerBtnDND.model.insert(destIndex, {"id" : drag.source.controlId})
drag.source.dndView.model.remove(drag.source.DelegateModel.itemsIndex)
}
}
MouseArea {
anchors.fill: parent
z: 1
visible: root._held
acceptedButtons: Qt.NoButton
z: -1
cursorShape: root.dragActive ? Qt.DragMoveCursor : Qt.ArrowCursor
cursorShape: visible ? Qt.DragMoveCursor : Qt.ArrowCursor
onWheel: {
// scrolling based on angleDelta.x is handled by the listview itself
var y = wheel.angleDelta.y
if (y > 0) {
scrollBar.decrease()
wheel.accepted = true
} else if (y < 0) {
scrollBar.increase()
wheel.accepted = true
} else {
wheel.accepted = false
}
}
}
footer: MouseArea {
height: VLCStyle.icon_medium
width: Math.max(height, playerBtnDND.width - x)
footer: Item {
anchors.verticalCenter: parent.verticalCenter
property bool dropVisible: false
onWheel: {
wheelScroll(wheel.angleDelta.y)
}
implicitHeight: VLCStyle.icon_medium
implicitWidth: Math.max(implicitHeight, playerBtnDND.width - x)
property alias dropVisible: footerDropArea.containsDrag
Rectangle {
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
z: 2
width: VLCStyle.dp(2, VLCStyle.scale)
height: parent.height
anchors {
left: parent.left
}
antialiasing: true
implicitWidth: VLCStyle.dp(2, VLCStyle.scale)
visible: dropVisible
color: VLCStyle.colors.accent
}
DropArea {
id: footerDropArea
anchors.fill: parent
onEntered: {
if (drag.source.dndView === playerBtnDND && drag.source.DelegateModel.itemsIndex === playerBtnDND.count - 1)
return
dropVisible = true
}
onExited: {
dropVisible = false
if (drag.source.dndView === playerBtnDND &&
drag.source.DelegateModel.itemsIndex === playerBtnDND.count - 1) {
drag.accepted = false
}
}
onDropped: {
if (!dropVisible)
return
var destIndex = playerBtnDND.count
if (drag.source.dndView === playerBtnDND) {
// moving from same section
playerBtnDND.model.move(drag.source.DelegateModel.itemsIndex, playerBtnDND.count - 1)
}
else if (drag.source.objectName == "buttonsList"){
// moving from buttonsList
playerBtnDND.model.insert(playerBtnDND.count, {"id" : drag.source.mIndex})
}
else {
// moving between sections
playerBtnDND.model.insert(playerBtnDND.count, {"id" : drag.source.controlId})
drag.source.dndView.model.remove(drag.source.DelegateModel.itemsIndex)
}
if (drag.source.dndView === playerBtnDND)
--destIndex
dropVisible = false
dropEvent(drag, destIndex)
}
}
}
delegate: EditorDNDDelegate {
anchors.verticalCenter: (!!parent) ? parent.verticalCenter : undefined
dndView: playerBtnDND
onContainsDragChanged: {
for(var child in playerBtnDND.contentItem.children) {
if (playerBtnDND.contentItem.children[child].containsDrag === true) {
playerBtnDND.containsDrag = true
return
}
}
playerBtnDND.containsDrag = Qt.binding(function() { return footerItem.dropVisible; } )
Binding {
when: dropArea.containsDrag
value: true
target: playerBtnDND
property: "containsDrag"
}
}
}
......@@ -24,7 +24,7 @@ import "qrc:///widgets/" as Widgets
TabButton {
id: mainPlayerControl
property bool active: index == bar.currentIndex
readonly property bool active: index === bar.currentIndex
implicitWidth: VLCStyle.button_width_large
......@@ -62,4 +62,12 @@ TabButton {
height: parent.border.width * 2
}
}
DropArea {
anchors.fill: parent
onEntered: {
bar.currentIndex = index
}
}
}
......@@ -29,20 +29,14 @@ Rectangle{
id: root
color: VLCStyle.colors.bg
property bool _held: false
property bool dragActive: !!_viewThatContainsDrag || buttonDragItem.Drag.active
property alias removeInfoRectVisible: buttonList.removeInfoRectVisible
property var _viewThatContainsDrag: undefined
MouseArea {
anchors.fill: parent
z: -1
visible: _held
cursorShape: visible ? Qt.ForbiddenCursor : Qt.ArrowCursor
}
signal dragStarted(int controlId)
signal dragStopped(int controlId)
ColumnLayout{
anchors.fill: parent
......@@ -54,6 +48,8 @@ Rectangle{
background: Item { }
readonly property int currentIdentifier: currentItem.identifier
Repeater {
model: PlayerListModel.model
......@@ -96,109 +92,141 @@ Rectangle{
font.pixelSize: VLCStyle.fontSize_xxlarge
}
StackLayout{
anchors.fill: parent
currentIndex: bar.currentIndex
Repeater {
model: PlayerListModel.model
Repeater {
model: PlayerListModel.model
delegate: RowLayout {
id: layout
delegate: RowLayout {
id: layout
readonly property int identifier: modelData.identifier
readonly property var model: {
if (!!mainInterface.controlbarProfileModel.currentModel)
return mainInterface.controlbarProfileModel.currentModel.getModel(identifier)
else
return undefined
}
// can't use StackLayout or change visibility
// because there is a bug with the dragging
// that it doesn't work when the visibility
// is set to false, so instead use stacking
// and width/height to show the current view
clip: true
z: bar.currentIdentifier === identifier ? 0 : -1
width: bar.currentIdentifier === identifier ? parent.width : 0
height: bar.currentIdentifier === identifier ? parent.height : 0
visible: root.dragActive || (bar.currentIdentifier === identifier)
spacing: VLCStyle.margin_small
readonly property int identifier: modelData.identifier
readonly property var model: {
if (!!mainInterface.controlbarProfileModel.currentModel)
return mainInterface.controlbarProfileModel.currentModel.getModel(identifier)
else
return undefined
}
Repeater {
id: repeater
spacing: VLCStyle.margin_small
model: 3 // left, center, and right
Repeater {
id: repeater
function getModel(index) {
if (!!layout.model) {
switch (index) {
case 0:
return layout.model.left
case 1:
return layout.model.center
case 2:
return layout.model.right
default:
return undefined
}
} else {
return undefined
}
}
model: 3 // left, center, and right
function getMetric(index) {
function getModel(index) {
if (!!layout.model) {
switch (index) {
case 0:
return leftMetric
return layout.model.left
case 1:
return centerMetric
return layout.model.center
case 2:
return rightMetric
return layout.model.right
default:
return undefined
}
} else {
return undefined
}
}
Loader {
id : playerBtnDND
active: !!repeater.getModel(index)
Layout.fillHeight: true
Layout.fillWidth: count > 0 ||
(repeater.itemAt(0).count === 0 &&
repeater.itemAt(1).count === 0 &&
repeater.itemAt(2).count === 0)
Layout.minimumWidth: Math.max(leftMetric.width,
centerMetric.width,
rightMetric.width) * 1.25
Layout.margins: parentRectangle.border.width
readonly property int count: {
if (status === Loader.Ready)
return item.count
else
return 0
function getMetric(index) {
switch (index) {
case 0:
return leftMetric
case 1:
return centerMetric
case 2:
return rightMetric
}
}
Loader {
id : playerBtnDND
active: !!repeater.getModel(index)
Layout.fillHeight: true
Layout.fillWidth: {
if (count === 0) {
for (var i = 0; i < repeater.count; ++i) {
var item = repeater.itemAt(i)
if (!!item && item.count > 0)
return false
}
}
sourceComponent: Rectangle {
color: VLCStyle.colors.bgAlt
return true
}
Layout.minimumWidth: !!item && item.visible ? Math.max(leftMetric.width,
centerMetric.width,
rightMetric.width) * 1.25
: 0
Layout.margins: parentRectangle.border.width
property alias count: dndView.count
readonly property int count: !!item ? item.count : 0
EditorDNDView {
id: dndView
sourceComponent: Rectangle {
color: VLCStyle.colors.bgAlt
property alias count: dndView.count
Connections {
target: root
enabled: dndView.model === layout.model.center
onDragStarted: {
// extending spacer widget should not be placed in the
// central alignment view
if (controlId === ControlListModel.WIDGET_SPACER_EXTEND)
visible = false
}
onDragStopped: {
if (controlId === ControlListModel.WIDGET_SPACER_EXTEND)
visible = true
}
}
EditorDNDView {
id: dndView
anchors.fill: parent
anchors.leftMargin: spacing
anchors.rightMargin: spacing
model: repeater.getModel(index)
// controls in the center view can not have
// extra width
extraWidthAvailable: model !== layout.model.center
onContainsDragChanged: {
if (containsDrag)
_viewThatContainsDrag = this
else if (_viewThatContainsDrag === this)
_viewThatContainsDrag = null
}
Text {
anchors.fill: parent
model: repeater.getModel(index)
onContainsDragChanged: {
if (containsDrag)
_viewThatContainsDrag = this
else if (_viewThatContainsDrag === this)
_viewThatContainsDrag = null
}
Text {
anchors.fill: parent
text: repeater.getMetric(index).text
verticalAlignment: Text.AlignVCenter
font.pixelSize: VLCStyle.fontSize_xxlarge
color: VLCStyle.colors.menuCaption
horizontalAlignment: Text.AlignHCenter
visible: (playerBtnDND.count === 0)
}
text: repeater.getMetric(index).text
verticalAlignment: Text.AlignVCenter
font.pixelSize: VLCStyle.fontSize_xxlarge
color: VLCStyle.colors.menuCaption
horizontalAlignment: Text.AlignHCenter
visible: (count === 0)
}
}
}
......@@ -208,14 +236,14 @@ Rectangle{
}
}
Rectangle{
id : allBtnsGrid
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
Layout.margins: VLCStyle.margin_xxsmall
color: VLCStyle.colors.bgAlt
ColumnLayout{
ColumnLayout {
anchors.fill: parent
Widgets.MenuCaption {
......@@ -234,22 +262,15 @@ Rectangle{
}
}
EditorDummyButton{
EditorDummyButton {
id: buttonDragItem
visible: false
Drag.active: visible
color: VLCStyle.colors.buttonText
visible: Drag.active
color: VLCStyle.colors.buttonText
opacity: 0.75
function updatePos(x, y) {
var pos = root.mapFromGlobal(x, y)
this.x = pos.x
this.y = pos.y
}
onXChanged: {
if (buttonDragItem.Drag.active)
if (Drag.active)
handleScroll(this)
}
}
......@@ -265,20 +286,26 @@ Rectangle{
}
var dragItemX = dragItem.x
var viewX = view.mapToItem(root, view.x, view.y).x
var viewPos = view.mapToItem(root, view.x, view.y)
var leftMark = (viewX + VLCStyle.dp(20, VLCStyle.scale))
var rightMark = (viewX + view.width - VLCStyle.dp(20, VLCStyle.scale))
var margin = VLCStyle.dp(25, VLCStyle.scale)
var leftMark = (viewPos.x + margin)
var rightMark = (viewPos.x + view.width - margin)
scrollAnimation.target = view
scrollAnimation.dragItem = dragItem
if (!view.atXBeginning && dragItemX <= leftMark) {
scrollAnimation.direction = -1
} else if (!view.atXEnd && dragItemX >= rightMark) {
scrollAnimation.direction = 1
} else {
if (!view.contains(view.mapFromItem(root, dragItemX, dragItem.y))) {
scrollAnimation.direction = 0
} else {
if (!view.atXBeginning && dragItemX <= leftMark) {
scrollAnimation.direction = -1
} else if (!view.atXEnd && dragItemX >= rightMark) {
scrollAnimation.direction = 1
} else {
scrollAnimation.direction = 0
}
}
}
......@@ -288,6 +315,11 @@ Rectangle{
property var dragItem
property int direction: 0 // -1: left, 0: stop, 1: right
onDirectionChanged: {
if (direction === 0)
stop()
}
to: {
if (direction === -1)
0
......
......@@ -26,18 +26,21 @@ import "qrc:///player/"
import "qrc:///style/"
import "qrc:///widgets/" as Widgets
GridView{
id: allButtonsView
GridView {
clip: true
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AlwaysOn }
model: PlayerControlbarControls.controlList.length
currentIndex: -1
highlightFollowsCurrentItem: false
cellWidth: VLCStyle.cover_small
cellHeight: cellWidth
boundsBehavior: Flickable.StopAtBounds
boundsMovement: Flickable.StopAtBounds
property alias removeInfoRectVisible: removeInfoRect.visible
DropArea {
......@@ -98,82 +101,88 @@ GridView{
anchors.fill: parent
z: 1
visible: root._held
visible: buttonDragItem.Drag.active
cursorShape: visible ? Qt.DragMoveCursor : Qt.ArrowCursor
}
delegate: MouseArea {
id:dragArea
objectName: "buttonsList"
hoverEnabled: true
width: cellWidth
height: cellHeight
property bool held: false
property int mIndex: PlayerControlbarControls.controlList[model.index].id
drag.target: held ? buttonDragItem : undefined
hoverEnabled: true
cursorShape: Qt.OpenHandCursor
onPressed: {
buttonDragItem.visible = true
buttonDragItem.text = PlayerControlbarControls.controlList[model.index].label
buttonDragItem.Drag.source = dragArea
held = true
root._held = true
objectName: "buttonsList"
dragArea.ListView.delayRemove = true
}
drag.target: buttonDragItem
onReleased: {
drag.target.Drag.drop()
buttonDragItem.visible = false
held = false
root._held = false
readonly property int mIndex: PlayerControlbarControls.controlList[model.index].id
dragArea.ListView.delayRemove = false
}
drag.onActiveChanged: {
if (drag.active) {
root.dragStarted(mIndex)
onPositionChanged: {
var pos = this.mapToGlobal(mouseX, mouseY)
buttonDragItem.updatePos(pos.x, pos.y)
}
buttonDragItem.text = PlayerControlbarControls.controlList[model.index].label
buttonDragItem.Drag.source = this
buttonDragItem.Drag.start()
onEntered: allButtonsView.currentIndex = index
GridView.delayRemove = true
} else {
buttonDragItem.Drag.drop()
Loader {
active: allButtonsView.currentIndex === index
anchors.fill: parent
root.dragStopped(mIndex)
GridView.delayRemove = false
}
}
sourceComponent: Rectangle {
color: VLCStyle.colors.bgHover
onPositionChanged: {
if (drag.active) {
// FIXME: There must be a better way of this
var pos = mapToItem(buttonDragItem.parent, mouseX, mouseY)
// y should be set first, because the automatic scroll is
// triggered by change on X
buttonDragItem.y = pos.y
buttonDragItem.x = pos.x
}
}
ColumnLayout{
id: listelemlayout
Rectangle {
anchors.fill: parent
anchors.margins: 10
EditorDummyButton {
Layout.preferredWidth: VLCStyle.icon_medium
Layout.preferredHeight: VLCStyle.icon_medium
Layout.alignment: Qt.AlignHCenter
text: PlayerControlbarControls.controlList[model.index].label
}
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
color: "transparent"
border.width: VLCStyle.dp(1, VLCStyle.scale)
border.color: containsMouse && !buttonDragItem.Drag.active ? VLCStyle.colors.buttonBorder
: "transparent"
Widgets.ListSubtitleLabel {
id: buttonName
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
anchors.fill: parent
anchors.margins: 10
elide: Text.ElideNone
text: PlayerControlbarControls.controlList[model.index].text
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
EditorDummyButton {
Layout.preferredWidth: VLCStyle.icon_medium
Layout.preferredHeight: VLCStyle.icon_medium
Layout.alignment: Qt.AlignHCenter
text: PlayerControlbarControls.controlList[model.index].label
}
Widgets.ListSubtitleLabel {
Layout.fillWidth: true
Layout.fillHeight: true
elide: Text.ElideNone
text: PlayerControlbarControls.controlList[model.index].text
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
}
}
}
}
}
......@@ -27,9 +27,12 @@ import org.videolan.vlc 0.1
WindowDialog {
id: root
width: 800
width: minimumWidth
height: 600
minimumWidth: 825
minimumHeight: 400
modal: true
title: i18n.qtr("Toolbar Editor")
......@@ -56,6 +59,12 @@ WindowDialog {
}
contentComponent: Item {
MouseArea {
anchors.fill: parent
cursorShape: toolbarEditor.dragActive ? Qt.ForbiddenCursor : Qt.ArrowCursor
}
ColumnLayout {
anchors.fill: parent
......@@ -68,6 +77,9 @@ WindowDialog {
Widgets.ComboBoxExt {
id: comboBox
Layout.maximumWidth: (root.width / 2)
font.pixelSize: VLCStyle.fontSize_normal
width: VLCStyle.combobox_width_large
......
......@@ -120,7 +120,7 @@ FocusScope {
}
onActiveFocusChanged: {
if (activeFocus && !item.focus) {
if (activeFocus && (!!item && !item.focus)) {
recoverFocus()
}
}
......
......@@ -134,8 +134,8 @@ Control {
anchors.verticalCenter: parent.verticalCenter
readonly property real preferredWidth: Math.max(titleLabel.implicitWidth, artistLabel.implicitWidth, progressIndicator.implicitWidth)
width: ((extraWidth > preferredWidth) || (paintOnly)) ? preferredWidth
: extraWidth
width: ((extraWidth > preferredWidth)) ? preferredWidth
: extraWidth
visible: width > VLCStyle.dp(15, VLCStyle.scale)
......