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
  • djain/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
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (14)
......@@ -230,7 +230,7 @@ Widgets.NavigableFocusScope {
topMargin: VLCStyle.dp(10, VLCStyle.scale)
bottomMargin: VLCStyle.dp(10, VLCStyle.scale)
}
active: !!medialib
active: !!medialib && !medialib.idle
source: "qrc:///widgets/ScanProgressBar.qml"
}
}
......
......@@ -41,8 +41,8 @@ NavigableFocusScope {
readonly property int _effectiveCellWidth: cellWidth + horizontalSpacing
readonly property int _effectiveCellHeight: cellHeight + verticalSpacing
property variant delegateModel
property variant model
property var delegateModel
property var model
property int currentIndex: 0
property alias contentHeight: flickable.contentHeight
......@@ -84,8 +84,9 @@ NavigableFocusScope {
signal selectAll()
signal actionAtIndex(int index)
property variant _idChildrenMap: ({})
property variant _unusedItemList: []
property var _idChildrenList: []
property var _unusedItemList: []
property var _currentRange: [0,0]
Accessible.role: Accessible.Table
......@@ -172,7 +173,13 @@ NavigableFocusScope {
function leftClickOnItem(modifier, index) {
delegateModel.updateSelection( modifier , currentIndex, index)
currentIndex = index
if (delegateModel.isSelected(model.index(index, 0)))
currentIndex = index
else if (currentIndex === index) {
if (root._containsItem(currentIndex))
root._getItem(currentIndex).focus = false
currentIndex = -1
}
root.forceActiveFocus()
}
......@@ -182,13 +189,6 @@ NavigableFocusScope {
}
}
function _updateSelected() {
for (var id in _idChildrenMap) {
var item = _idChildrenMap[id]
item.selected = delegateModel.isSelected(model.index(id, 0))
}
}
function _initialize() {
if (root._isInitialised)
return;
......@@ -200,7 +200,7 @@ NavigableFocusScope {
root._isInitialised = true;
}
function _getFirstAndLastInstanciatedItemIds() {
function _calculateCurrentRange() {
var myContentY = flickable.contentY - root.headerHeight - topMargin
var contentYWithoutExpand = myContentY
......@@ -227,70 +227,91 @@ NavigableFocusScope {
return [firstId, lastId]
}
function _setupChild(id, ydelta) {
var item
var pos = root.getItemPos(id)
function _getItem(id) {
var i = id - root._currentRange[0]
return root._idChildrenList[i]
}
if (id in _idChildrenMap) {
// re-position
function _setItem(id, item) {
var i = id - root._currentRange[0]
root._idChildrenList[i] = item
}
item = _idChildrenMap[id]
if (item === undefined)
throw "wrong child: " + id
//theses properties are always defined in Item
item.focus = (id === root.currentIndex) && (root.expandIndex === -1)
item.x = pos[0]
item.y = pos[1] + ydelta
function _containsItem(id) {
var i = id - root._currentRange[0]
return i >= 0 && i < root._idChildrenList.length && typeof root._idChildrenList[i] !== "undefined"
}
} else if (_unusedItemList.length > 0) {
//recyle
function _repositionItem(id, x, y) {
var item = root._getItem(id)
if (item === undefined)
throw "wrong child: " + id
item = _unusedItemList.pop()
if (item === undefined)
throw "wrong toRecycle child " + id + ", len " + toUse.length
//theses properties are always defined in Item
item.focus = (id === root.currentIndex) && (root.expandIndex === -1)
item.x = x
item.y = y
item.selected = delegateModel.isSelected(model.index(id, 0))
}
item.index = id
item.model = model.getDataAt(id)
function _recycleItem(id, x, y) {
var item = _unusedItemList.pop()
if (item === undefined)
throw "wrong toRecycle child " + id + ", len " + toUse.length
item.focus = (id === root.currentIndex) && (root.expandIndex === -1)
item.x = pos[0]
item.y = pos[1] + ydelta
item.visible = true
item.index = id
item.model = model.getDataAt(id)
item.selected = delegateModel.isSelected(model.index(id, 0))
item.focus = (id === root.currentIndex) && (root.expandIndex === -1)
item.x = x
item.y = y
item.visible = true
_idChildrenMap[id] = item
root._setItem(id, item)
}
function _createItem(id, x, y) {
var item = root.delegate.createObject( flickable.contentItem, {
selected: delegateModel.isSelected(model.index(id, 0)),
index: id,
model: model.getDataAt(id),
focus: (id === root.currentIndex) && (root.expandIndex === -1),
x: x,
y: y,
visible: true
});
if (item === undefined)
throw "wrong unable to instantiate child " + id
root._setItem(id, item)
}
function _setupChild(id, ydelta) {
var pos = root.getItemPos(id)
if (root._containsItem(id)) {
_repositionItem(id, pos[0], pos[1] + ydelta)
} else if (_unusedItemList.length > 0) {
_recycleItem(id, pos[0], pos[1] + ydelta)
} else {
//instanciate a new item
item = root.delegate.createObject( flickable.contentItem, {
index: id,
model: model.getDataAt(id),
focus: (id === root.currentIndex) && (root.expandIndex === -1),
x: pos[0],
y: pos[1] + ydelta,
visible: true
});
if (item === undefined)
throw "wrong unable to instantiate child " + id
_idChildrenMap[id] = item
}
return item
_createItem(id, pos[0], pos[1] + ydelta)
}
}
function _refreshData( iMin, iMax ) {
var f_l = _getFirstAndLastInstanciatedItemIds()
var f_l = root._currentRange
if (!iMin || iMin < f_l[0])
iMin = f_l[0]
if (!iMax || iMax > f_l[1])
iMax= f_l[1]
for (var id = iMin; id <= iMax; id++) {
var item = _idChildrenMap[id]
if (!item) {
continue
}
for (var id = iMin; id < iMax; id++) {
var item = root._getItem(id)
item.model = model.getDataAt(id)
}
if (root.expandIndex >= iMin && root.expandIndex < iMax) {
expandItem.model = model.getDataAt(root.expandIndex)
}
}
function _onModelCountChanged() {
......@@ -311,10 +332,9 @@ NavigableFocusScope {
target: model
onDataChanged: {
var iMin = topLeft.row
var iMax = bottomRight.row
var f_l = _getFirstAndLastInstanciatedItemIds()
if (iMin <= f_l[1] && f_l[0] <= iMax) {
flickable.layout(true)
var iMax = bottomRight.row + 1 // [] => [)
var f_l = root._currentRange
if (iMin < f_l[1] && f_l[0] < iMax) {
_refreshData(iMin, iMax)
}
}
......@@ -323,6 +343,35 @@ NavigableFocusScope {
onModelReset: _onModelCountChanged()
}
Connections {
target: delegateModel
onSelectionChanged: {
var i
for (i = 0; i < selected.length; ++i) {
_updateSelectedRange(selected[i].topLeft, selected[i].bottomRight, true)
}
for (i = 0; i < deselected.length; ++i) {
_updateSelectedRange(deselected[i].topLeft, deselected[i].bottomRight, false)
}
}
function _updateSelectedRange(topLeft, bottomRight, select) {
var iMin = topLeft.row
var iMax = bottomRight.row + 1 // [] => [)
if (iMin < root._currentRange[1] && root._currentRange[0] < iMax) {
iMin = Math.max(iMin, root._currentRange[0])
iMax = Math.min(iMax, root._currentRange[1])
for (var j = iMin; j < iMax; j++) {
var item = root._getItem(j)
console.assert(item)
item.selected = select
}
}
}
}
onModelChanged: _onModelCountChanged()
Connections {
......@@ -335,8 +384,10 @@ NavigableFocusScope {
id: flickable
clip: true
flickableDirection: Flickable.VerticalFlick
boundsBehavior: Flickable.StopAtBounds
boundsMovement :Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {
id: flickableScrollBar
}
......@@ -397,7 +448,17 @@ NavigableFocusScope {
anchors.fill: parent
onWidthChanged: { layout(true) }
onHeightChanged: { layout(false) }
onContentYChanged: { layout(false) }
onContentYChanged: { scrollLayoutTimer.start() }
Timer {
id: scrollLayoutTimer
interval: 1
running: false
repeat: false
triggeredOnStart: false
onTriggered: flickable.layout(false)
}
function getExpandItemGridId() {
var ret
......@@ -411,6 +472,52 @@ NavigableFocusScope {
return ret
}
function _setupIndexes(force, range, yDelta) {
for (var i = range[0]; i < range[1]; i++) {
if (!force && root._containsItem(i))
continue
_setupChild(i, yDelta)
}
}
function _overlappedInterval(i1, i2) {
if (i1[0] > i2[0]) return _overlappedInterval(i2, i1)
if (i1[1] > i2[0]) return [i2[0], Math.min(i1[1], i2[1])]
return [0, 0]
}
function _updateChildrenMap(first, last) {
if (first >= last) {
root._idChildrenList.forEach(function(item) { item.visible = false; })
root._unusedItemList = root._idChildrenList
root._idChildrenList = []
root._currentRange = [0, 0]
return
}
var overlapped = _overlappedInterval([first, last], root._currentRange)
var i
var newList = new Array(last - first)
for (i = overlapped[0]; i < overlapped[1]; ++i) {
newList[i - first] = root._getItem(i)
root._setItem(i, undefined)
}
for (i = _currentRange[0]; i < _currentRange[1]; ++i) {
var item = root._getItem(i)
if (typeof item !== "undefined") {
item.visible = false
_unusedItemList.push(item)
// root._setItem(i, undefined) // not needed the list will be reset following this loop
}
}
_idChildrenList = newList
root._currentRange = [first, last]
}
function layout(forceRelayout) {
if (flickable.width === 0 || flickable.height === 0)
return
......@@ -422,37 +529,22 @@ NavigableFocusScope {
var i
var expandItemGridId = getExpandItemGridId()
var f_l = _getFirstAndLastInstanciatedItemIds()
var f_l = _calculateCurrentRange()
var nbItems = f_l[1] - f_l[0]
var firstId = f_l[0]
var lastId = f_l[1]
var topGridEndId = Math.max(Math.min(expandItemGridId, lastId), firstId)
// Clean the no longer used ids
var toKeep = {}
for (var id in _idChildrenMap) {
var val = _idChildrenMap[id]
if (id >= firstId && id < lastId) {
toKeep[id] = val
} else {
_unusedItemList.push(val)
val.visible = false
}
}
_idChildrenMap = toKeep
if (!forceRelayout && root._currentRange[0] === firstId && root._currentRange[1] === lastId)
return;
_updateChildrenMap(firstId, lastId)
var item
var pos
// Place the delegates before the expandItem
for (i = firstId; i < topGridEndId; ++i) {
if (!forceRelayout && i in _idChildrenMap)
continue
_setupChild(i, 0)
}
_setupIndexes(forceRelayout, [firstId, topGridEndId], 0)
if (root.expandIndex !== -1) {
var expandItemPos = root.getItemPos(expandItemGridId)
......@@ -460,19 +552,13 @@ NavigableFocusScope {
}
// Place the delegates after the expandItem
for (i = topGridEndId; i < lastId; ++i) {
if (!forceRelayout && i in _idChildrenMap)
continue
_setupChild(i, _expandItemVerticalSpace)
}
_setupIndexes(forceRelayout, [topGridEndId, lastId], _expandItemVerticalSpace)
// Calculate and set the contentHeight
var newContentHeight = root.getItemPos(_count - 1)[1] + root._effectiveCellHeight + _expandItemVerticalSpace
contentHeight = newContentHeight + root.bottomMargin // topMargin is included from root.getItemPos
contentHeight += footerItemLoader.item ? footerItemLoader.item.height : 0
contentWidth = root._effectiveCellWidth * root.getNbItemsPerRow() - root.horizontalSpacing
_updateSelected()
}
Connections {
......@@ -549,8 +635,8 @@ NavigableFocusScope {
if (expandIndex !== -1)
return
var child
if (currentIndex in _idChildrenMap)
child = _idChildrenMap[currentIndex]
if (root._containsItem(currentIndex))
child = root._getItem(currentIndex)
if (child !== undefined)
child.focus = true
}
......@@ -573,7 +659,6 @@ NavigableFocusScope {
if (expandIndex !== -1)
retract()
flickable.setCurrentItemFocus()
_updateSelected()
positionViewAtIndex(root.currentIndex, ItemView.Contain)
}
......@@ -615,8 +700,6 @@ NavigableFocusScope {
if (!event.accepted)
defaultKeyAction(event, currentIndex)
_updateSelected()
}
Keys.onReleased: {
......@@ -627,7 +710,5 @@ NavigableFocusScope {
event.accepted = true
root.actionAtIndex(currentIndex)
}
_updateSelected()
}
}
......@@ -25,7 +25,7 @@ import org.videolan.vlc 0.1
import "qrc:///widgets/" as Widgets
import "qrc:///style/"
FocusScope {
MouseArea {
id: root
property alias image: picture.source
......@@ -42,7 +42,12 @@ FocusScope {
property real pictureWidth: VLCStyle.colWidth(1)
property real pictureHeight: pictureWidth
property int titleMargin: VLCStyle.margin_xsmall
property Item dragItem
property Item dragItem: null
readonly property bool highlighted: root.containsMouse || root.activeFocus
readonly property int selectedBorderWidth: VLCStyle.gridItemSelectedBorder
property int _modifiersOnLastPress: Qt.NoModifier
// if true, texts are horizontally centered, provided it can fit in pictureWidth
property bool textAlignHCenter: false
......@@ -56,20 +61,15 @@ FocusScope {
signal itemDoubleClicked(Item menuParent, int keys, int modifier)
signal contextMenuButtonClicked(Item menuParent, var globalMousePos)
acceptedButtons: Qt.RightButton | Qt.LeftButton
hoverEnabled: true
implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
Keys.onMenuPressed: root.contextMenuButtonClicked(picture, root.mapToGlobal(0,0))
Accessible.role: Accessible.Cell
Accessible.name: title
implicitWidth: mouseArea.implicitWidth
implicitHeight: mouseArea.implicitHeight
readonly property bool highlighted: mouseArea.containsMouse || root.activeFocus
readonly property int selectedBorderWidth: VLCStyle.gridItemSelectedBorder
property int _modifiersOnLastPress: Qt.NoModifier
state: highlighted ? "selected" : "unselected"
states: [
State {
......@@ -165,130 +165,119 @@ FocusScope {
}
]
MouseArea {
id: mouseArea
hoverEnabled: true
anchors.fill: parent
implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
drag.target: root.dragItem
drag.axis: Drag.XAndYAxis
drag.onActiveChanged: {
// perform the "click" action because the click action is only executed on mouse release (we are in the pressed state)
// but we will need the updated list on drop
if (drag.active && !selected) {
root.itemClicked(picture, Qt.LeftButton, root._modifiersOnLastPress)
} else if (root.dragItem) {
root.dragItem.Drag.drop()
}
root.dragItem.Drag.active = drag.active
drag.target: root.dragItem
drag.axis: Drag.XAndYAxis
drag.onActiveChanged: {
// perform the "click" action because the click action is only executed on mouse release (we are in the pressed state)
// but we will need the updated list on drop
if (drag.active && !selected) {
root.itemClicked(picture, Qt.LeftButton, root._modifiersOnLastPress)
} else if (root.dragItem) {
root.dragItem.Drag.drop()
}
root.dragItem.Drag.active = drag.active
}
acceptedButtons: Qt.RightButton | Qt.LeftButton
Keys.onMenuPressed: root.contextMenuButtonClicked(picture, root.mapToGlobal(0,0))
onClicked: {
if (mouse.button === Qt.RightButton)
contextMenuButtonClicked(picture, mouseArea.mapToGlobal(mouse.x,mouse.y));
else {
root.itemClicked(picture, mouse.button, mouse.modifiers);
}
onClicked: {
if (mouse.button === Qt.RightButton)
contextMenuButtonClicked(picture, root.mapToGlobal(mouse.x,mouse.y));
else {
root.itemClicked(picture, mouse.button, mouse.modifiers);
}
}
onDoubleClicked: {
if (mouse.button === Qt.LeftButton)
root.itemDoubleClicked(picture,mouse.buttons, mouse.modifiers)
}
onDoubleClicked: {
if (mouse.button === Qt.LeftButton)
root.itemDoubleClicked(picture,mouse.buttons, mouse.modifiers)
}
onPressed: _modifiersOnLastPress = mouse.modifiers
onPressed: _modifiersOnLastPress = mouse.modifiers
onPositionChanged: {
if (drag.active) {
var pos = drag.target.parent.mapFromItem(mouseArea, mouseX, mouseY)
drag.target.x = pos.x + 12
drag.target.y = pos.y + 12
}
onPositionChanged: {
if (drag.active) {
var pos = drag.target.parent.mapFromItem(root, mouseX, mouseY)
drag.target.x = pos.x + 12
drag.target.y = pos.y + 12
}
}
/* background visible when selected */
Rectangle {
id: selectionRect
/* background visible when selected */
Rectangle {
id: selectionRect
x: - root.selectedBorderWidth
y: - root.selectedBorderWidth
width: root.width + ( root.selectedBorderWidth * 2 )
height: root.height + ( root.selectedBorderWidth * 2 )
color: VLCStyle.colors.bgHover
visible: root.selected || root.highlighted
}
x: - root.selectedBorderWidth
y: - root.selectedBorderWidth
width: root.width + ( root.selectedBorderWidth * 2 )
height: root.height + ( root.selectedBorderWidth * 2 )
color: VLCStyle.colors.bgHover
visible: root.selected || root.highlighted
}
Loader {
id: unselectedUnderlayLoader
Loader {
id: unselectedUnderlayLoader
asynchronous: true
}
asynchronous: true
}
Loader {
id: selectedUnderlayLoader
Loader {
id: selectedUnderlayLoader
asynchronous: true
active: false
visible: false
onVisibleChanged: {
if (visible && !active)
active = true
}
asynchronous: true
active: false
visible: false
onVisibleChanged: {
if (visible && !active)
active = true
}
}
Column {
id: layout
anchors.centerIn: parent
Widgets.MediaCover {
id: picture
Column {
id: layout
width: pictureWidth
height: pictureHeight
playCoverVisible: root.highlighted
onPlayIconClicked: root.playClicked()
radius: VLCStyle.gridCover_radius
}
anchors.centerIn: parent
Widgets.ScrollingText {
id: titleTextRect
Widgets.MediaCover {
id: picture
label: titleLabel
scroll: highlighted
height: titleLabel.height
width: titleLabel.width
visible: root.title !== ""
width: pictureWidth
height: pictureHeight
playCoverVisible: root.highlighted
onPlayIconClicked: root.playClicked()
radius: VLCStyle.gridCover_radius
}
Widgets.ListLabel {
id: titleLabel
Widgets.ScrollingText {
id: titleTextRect
elide: titleTextRect.scroll ? Text.ElideNone : Text.ElideRight
width: pictureWidth
horizontalAlignment: root.textAlignHCenter && titleLabel.contentWidth <= titleLabel.width ? Text.AlignHCenter : Text.AlignLeft
topPadding: root.titleMargin
color: selectionRect.visible ? VLCStyle.colors.bgHoverText : VLCStyle.colors.text
}
}
label: titleLabel
scroll: highlighted
height: titleLabel.height
width: titleLabel.width
visible: root.title !== ""
Widgets.MenuCaption {
id: subtitleTxt
Widgets.ListLabel {
id: titleLabel
visible: text !== ""
text: root.subtitle
elide: titleTextRect.scroll ? Text.ElideNone : Text.ElideRight
width: pictureWidth
topPadding: VLCStyle.margin_xsmall
elide: Text.ElideRight
horizontalAlignment: root.textAlignHCenter && subtitleTxt.contentWidth <= subtitleTxt.width ? Text.AlignHCenter : Text.AlignLeft
color: selectionRect.visible
? VLCStyle.colors.setColorAlpha(VLCStyle.colors.bgHoverText, .6)
: VLCStyle.colors.menuCaption
horizontalAlignment: root.textAlignHCenter && titleLabel.contentWidth <= titleLabel.width ? Text.AlignHCenter : Text.AlignLeft
topPadding: root.titleMargin
color: selectionRect.visible ? VLCStyle.colors.bgHoverText : VLCStyle.colors.text
}
}
Widgets.MenuCaption {
id: subtitleTxt
visible: text !== ""
text: root.subtitle
width: pictureWidth
topPadding: VLCStyle.margin_xsmall
elide: Text.ElideRight
horizontalAlignment: root.textAlignHCenter && subtitleTxt.contentWidth <= subtitleTxt.width ? Text.AlignHCenter : Text.AlignLeft
color: selectionRect.visible
? VLCStyle.colors.setColorAlpha(VLCStyle.colors.bgHoverText, .6)
: VLCStyle.colors.menuCaption
}
}
}
......@@ -145,6 +145,9 @@ NavigableFocusScope {
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
boundsBehavior: Flickable.StopAtBounds
boundsMovement :Flickable.StopAtBounds
Connections {
target: view.currentItem
ignoreUnknownSignals: true
......
......@@ -89,6 +89,7 @@ T.ProgressBar {
id: loadingAnim
loops: Animation.Infinite
running: control.indeterminate
NumberAnimation {
from: - 1
......