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)
Showing
with 487 additions and 329 deletions
......@@ -339,7 +339,8 @@ libqt_plugin_la_SOURCES = \
widgets/native/qvlcframe.hpp \
widgets/native/roundimage.cpp widgets/native/roundimage.hpp widgets/native/roundimage_p.hpp \
widgets/native/searchlineedit.cpp widgets/native/searchlineedit.hpp \
widgets/native/viewblockingrectangle.cpp widgets/native/viewblockingrectangle.hpp
widgets/native/viewblockingrectangle.cpp widgets/native/viewblockingrectangle.hpp \
widgets/native/doubleclickignoringitem.hpp
# Meta-object compilation
......
......@@ -62,6 +62,13 @@
#include "widgets/native/roundimage.hpp"
#include "widgets/native/navigation_attached.hpp"
#include "widgets/native/viewblockingrectangle.hpp"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "widgets/native/doubleclickignoringitem.hpp"
#else
// QQuickItem already ignores double click, starting
// with Qt 6.4.0:
#define DoubleClickIgnoringItem QQuickItem
#endif
#include "videosurface.hpp"
#include "mainctx.hpp"
......@@ -307,6 +314,8 @@ void MainUI::registerQMLTypes()
qmlRegisterType<ListSelectionModel>( uri, versionMajor, versionMinor, "ListSelectionModel" );
qmlRegisterType<DoubleClickIgnoringItem>( uri, versionMajor, versionMinor, "DoubleClickIgnoringItem" );
qmlProtectModule(uri, versionMajor);
}
......
......@@ -64,6 +64,8 @@ T.ItemDelegate {
verticalPadding: VLCStyle.margin_xsmall
horizontalPadding: VLCStyle.margin_normal
hoverEnabled: true
Accessible.onPressAction: root.itemClicked()
// Childs
......@@ -77,62 +79,77 @@ T.ItemDelegate {
enabled: root.enabled
}
background: Widgets.AnimatedBackground {
enabled: theme.initialized
color: (root.isCurrent || root.selected) ? theme.bg.highlight : theme.bg.primary
border.color: visualFocus ? theme.visualFocus : "transparent"
// TODO: Qt bug 6.2: QTBUG-103604
DoubleClickIgnoringItem {
anchors.fill: parent
Widgets.CurrentIndicator {
anchors {
left: parent.left
leftMargin: VLCStyle.margin_xxxsmall
verticalCenter: parent.verticalCenter
TapHandler {
gesturePolicy: TapHandler.ReleaseWithinBounds // TODO: Qt 6.2 bug: Use TapHandler.DragThreshold
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
// We need this for extra information such as modifiers
Component.onCompleted: {
canceled.connect(initialAction) // DragHandler stole the event
}
implicitHeight: parent.height * 3 / 4
onSingleTapped: (eventPoint, button) => {
initialAction()
visible: isCurrent
if (!(root.selected && button === Qt.RightButton)) {
view.selectionModel.updateSelection(point.modifiers, view.currentIndex, index)
view.currentIndex = index
}
}
onDoubleTapped: (eventPoint, button) => {
if (button !== Qt.RightButton)
MediaLib.addAndPlay(model.id);
}
function initialAction() {
root.forceActiveFocus(Qt.MouseFocusReason)
}
}
}
MouseArea {
anchors.fill: parent
DragHandler {
target: null
drag.axis: Drag.XAndYAxis
drag.smoothed: false
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything
drag.target: root.dragTarget
onActiveChanged: {
const target = root.dragTarget
if (target) {
if (active) {
if (!selected) {
view.selectionModel.select(index, ItemSelectionModel.ClearAndSelect)
view.currentIndex = index
}
drag.onActiveChanged: {
if (drag.target) {
const target = drag.target
if (drag.active) {
if (!selected) {
view.selectionModel.select(index, ItemSelectionModel.ClearAndSelect)
view.currentIndex = index
target.Drag.active = true
} else {
target.Drag.drop()
}
target.Drag.active = true
} else {
target.Drag.drop()
}
}
}
}
background: Widgets.AnimatedBackground {
enabled: theme.initialized
color: (root.isCurrent || root.selected) ? theme.bg.highlight : theme.bg.primary
border.color: visualFocus ? theme.visualFocus : "transparent"
onClicked: (mouse) => {
if (!(root.selected && mouse.button === Qt.RightButton)) {
view.selectionModel.updateSelection(mouse.modifiers, view.currentIndex, index)
view.currentIndex = index
Widgets.CurrentIndicator {
anchors {
left: parent.left
leftMargin: VLCStyle.margin_xxxsmall
verticalCenter: parent.verticalCenter
}
}
onDoubleClicked: (mouse) => {
if (mouse.button !== Qt.RightButton)
MediaLib.addAndPlay(model.id);
}
implicitHeight: parent.height * 3 / 4
onPressed: (mouse) => {
root.forceActiveFocus(Qt.MouseFocusReason)
visible: isCurrent
}
}
......
......@@ -497,6 +497,7 @@ some_sources = files(
'widgets/native/searchlineedit.hpp',
'widgets/native/viewblockingrectangle.cpp',
'widgets/native/viewblockingrectangle.hpp',
'widgets/native/doubleclickignoringitem.hpp',
)
if host_system == 'windows'
......
......@@ -115,7 +115,7 @@ Widgets.TableRowDelegate {
visible: root._showPlayCover
onClicked: playClicked(root.index)
onTapped: playClicked(root.index)
}
}
}
......
......@@ -136,9 +136,10 @@ T.Pane {
anchors.right: (parent === pseudoRow) ? parent.right : undefined
anchors.verticalCenter: (parent === pseudoRow) ? parent.verticalCenter : undefined
MouseArea {
anchors.fill: parent
onClicked: MainCtx.showRemainingTime = !MainCtx.showRemainingTime
TapHandler {
onTapped: (eventPoint, button) => {
MainCtx.showRemainingTime = !MainCtx.showRemainingTime
}
}
},
SliderBar {
......
......@@ -229,6 +229,10 @@ T.ProgressBar {
TapHandler {
acceptedButtons: Qt.LeftButton
grabPermissions: TapHandler.CanTakeOverFromAnything
gesturePolicy: TapHandler.WithinBounds
//clicked but not dragged
onTapped: (point, button) => {
fsm.pressControl(point.position.x / control.width, point.modifiers === Qt.ShiftModifier)
......@@ -242,6 +246,7 @@ T.ProgressBar {
target: null
dragThreshold: 0
grabPermissions: PointerHandler.CanTakeOverFromAnything
function moveControl() {
fsm.moveControl(dragHandler.centroid.position.x / control.width,
......
......@@ -55,54 +55,56 @@ PopupIconToolButton {
color: root.color
}
// TODO: Qt 5.15 Use WheelHandler & TapHandler
MouseArea {
// TODO: Qt bug 6.2: QTBUG-103604
DoubleClickIgnoringItem {
anchors.fill: parent
acceptedButtons: Qt.RightButton
z: -1
onWheel: function(wheel) {
if (!root.popup.contentItem || !root.popup.contentItem.slider) {
wheel.accepted = false
return
}
WheelHandler {
onWheel: (event) => {
if (!root.popup.contentItem || !root.popup.contentItem.slider) {
event.accepted = false
return
}
let delta = 0
let delta = 0
if (wheel.angleDelta.x)
delta = wheel.angleDelta.x
else if (wheel.angleDelta.y)
delta = wheel.angleDelta.y
else {
wheel.accepted = false
return
}
if (event.angleDelta.x)
delta = event.angleDelta.x
else if (event.angleDelta.y)
delta = event.angleDelta.y
else {
event.accepted = false
return
}
if (wheel.inverted)
delta = -delta
if (event.inverted)
delta = -delta
wheel.accepted = true
event.accepted = true
delta = delta / 8 / 15
delta = delta / 8 / 15
let func
if (delta > 0)
func = root.popup.contentItem.slider.increase
else
func = root.popup.contentItem.slider.decrease
let func
if (delta > 0)
func = root.popup.contentItem.slider.increase
else
func = root.popup.contentItem.slider.decrease
for (let i = 0; i < Math.ceil(Math.abs(delta)); ++i)
func()
for (let i = 0; i < Math.ceil(Math.abs(delta)); ++i)
func()
}
}
onClicked: function(mouse) {
if (!root.popup.contentItem || !root.popup.contentItem.slider) {
mouse.accepted = false
return
}
TapHandler {
acceptedButtons: Qt.RightButton
enabled: root.popup.contentItem && root.popup.contentItem.slider
mouse.accepted = true
root.popup.contentItem.slider.value = 0
onTapped: (eventPoint, button) => {
root.popup.contentItem.slider.value = 0
}
}
}
}
......@@ -27,7 +27,7 @@ import org.videolan.vlc 0.1
import "qrc:///widgets/" as Widgets
import "qrc:///style/"
T.ItemDelegate {
T.Control {
id: delegate
// Properties
......@@ -68,6 +68,8 @@ T.ItemDelegate {
// Settings
hoverEnabled: true
verticalPadding: VLCStyle.playlistDelegate_verticalPadding
leftPadding: VLCStyle.margin_normal
......@@ -79,7 +81,7 @@ T.ItemDelegate {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
ListView.delayRemove: mouseArea.drag.active
ListView.delayRemove: dragHandler.active
T.ToolTip.visible: ( visible && (visualFocus || hovered) &&
(textInfoColumn.implicitWidth > textInfoColumn.width) )
......@@ -236,60 +238,76 @@ T.ItemDelegate {
}
}
MouseArea {
id: mouseArea
// TODO: Qt bug 6.2: QTBUG-103604
DoubleClickIgnoringItem {
anchors.fill: parent
hoverEnabled: true
TapHandler {
acceptedDevices: PointerDevice.AllDevices & ~(PointerDevice.TouchScreen)
acceptedButtons: Qt.LeftButton | Qt.RightButton
gesturePolicy: TapHandler.ReleaseWithinBounds // TODO: Qt 6.2 bug: Use TapHandler.DragThreshold
acceptedButtons: Qt.LeftButton | Qt.RightButton
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
onClicked: (mouse) => {
/* to receive keys events */
if (!(delegate.selected && mouse.button === Qt.RightButton)) {
view.selectionModel.updateSelection(mouse.modifiers, view.currentIndex, index)
view.currentIndex = index
onSingleTapped: (eventPoint, button) => {
initialAction()
if (!(delegate.selected && button === Qt.RightButton)) {
view.selectionModel.updateSelection(point.modifiers, view.currentIndex, index)
view.currentIndex = index
}
if (contextMenu && button === Qt.RightButton)
contextMenu.popup(index, parent.mapToGlobal(eventPoint.position.x, eventPoint.position.y))
}
if (contextMenu && mouse.button === Qt.RightButton)
contextMenu.popup(index, mapToGlobal(mouse.x, mouse.y))
}
onDoubleTapped: (eventPoint, button) => {
if (button !== Qt.RightButton)
MainPlaylistController.goTo(index, true)
}
onDoubleClicked: (mouse) => {
if (mouse.button !== Qt.RightButton)
MainPlaylistController.goTo(index, true)
}
Component.onCompleted: {
canceled.connect(initialAction)
}
onPressed: (mouse) => {
delegate.forceActiveFocus(Qt.MouseFocusReason)
function initialAction() {
delegate.forceActiveFocus(Qt.MouseFocusReason)
}
}
drag.target: dragItem
DragHandler {
id: dragHandler
drag.smoothed: false
target: null
drag.onActiveChanged: {
if (dragItem) {
if (drag.active) {
if (!selected) {
/* the dragged item is not in the selection, replace the selection */
view.selectionModel.select(index, ItemSelectionModel.ClearAndSelect)
}
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything
dragItem.indexes = view.selectionModel.selectedIndexesFlat
dragItem.indexesFlat = true
dragItem.Drag.active = true
} else {
dragItem.Drag.drop()
onActiveChanged: {
if (dragItem) {
if (active) {
if (!selected) {
/* the dragged item is not in the selection, replace the selection */
view.selectionModel.select(index, ItemSelectionModel.ClearAndSelect)
}
dragItem.indexes = view.selectionModel.selectedIndexesFlat
dragItem.indexesFlat = true
dragItem.Drag.active = true
} else {
dragItem.Drag.drop()
}
}
}
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onTapped: {
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
onTapped: (eventPoint, button) => {
MainPlaylistController.goTo(index, true)
}
......
/*****************************************************************************
* Copyright (C) 2024 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.
*****************************************************************************/
#ifndef DOUBLECLICKIGNORINGITEM_HPP
#define DOUBLECLICKIGNORINGITEM_HPP
#include <QQuickItem>
// TODO: Remove Qt >= 6.4
// 413522: QQuickItem: ignore double-clicks by default; remove allowDoubleClick
class DoubleClickIgnoringItem : public QQuickItem
{
// Q_OBJECT
public:
DoubleClickIgnoringItem(QQuickItem *parent = nullptr) : QQuickItem(parent) { }
protected:
void mouseDoubleClickEvent(QMouseEvent *ev) override
{
ev->ignore();
}
};
#endif // DOUBLECLICKIGNORINGITEM_HPP
......@@ -735,25 +735,33 @@ FocusScope {
id: flickableScrollBar
}
MouseArea {
anchors.fill: parent
z: -1
TapHandler {
acceptedDevices: PointerDevice.Mouse
preventStealing: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: (mouse) => {
Helpers.enforceFocus(flickable, Qt.MouseFocusReason)
grabPermissions: PointerHandler.TakeOverForbidden
gesturePolicy: TapHandler.ReleaseWithinBounds
if (!(mouse.modifiers & (Qt.ShiftModifier | Qt.ControlModifier))) {
if (selectionModel)
selectionModel.clearSelection()
onTapped: (eventPoint, button) => {
initialAction()
if (button === Qt.RightButton) {
root.showContextMenu(parent.mapToGlobal(eventPoint.position.x, eventPoint.position.y))
}
}
onReleased: (mouse) => {
if (mouse.button & Qt.RightButton) {
root.showContextMenu(mapToGlobal(mouse.x, mouse.y))
Component.onCompleted: {
canceled.connect(initialAction)
}
function initialAction() {
Helpers.enforceFocus(flickable, Qt.MouseFocusReason)
if (!(point.modifiers & (Qt.ShiftModifier | Qt.ControlModifier))) {
if (root.selectionModel)
root.selectionModel.clearSelection()
}
}
}
......
......@@ -78,7 +78,7 @@ T.ItemDelegate {
implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
highlighted: (mouseHoverHandler.hovered || visualFocus)
highlighted: (hovered || visualFocus)
Accessible.role: Accessible.Cell
Accessible.name: title
......@@ -162,187 +162,206 @@ T.ItemDelegate {
hovered: root.hovered
}
background: AnimatedBackground {
width: root.width + (selectedBorderWidth * 2)
height: root.height + (selectedBorderWidth * 2)
// TODO: Qt bug 6.2: QTBUG-103604
DoubleClickIgnoringItem {
anchors.fill: parent
x: - selectedBorderWidth
y: - selectedBorderWidth
DragHandler {
id: dragHandler
enabled: theme.initialized
target: null
//don't show the backgroud unless selected
color: root.selected ? theme.bg.highlight : theme.bg.primary
border.color: visualFocus ? theme.visualFocus : "transparent"
}
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything
contentItem: MouseArea {
implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
onActiveChanged: {
if (dragItem) {
if (active && !selected) {
root.itemClicked(root._modifiersOnLastPress)
}
acceptedButtons: Qt.RightButton | Qt.LeftButton
if (active)
dragItem.Drag.active = true
else
dragItem.Drag.drop()
}
}
}
drag.target: root.dragItem
TapHandler {
acceptedDevices: PointerDevice.AllDevices & ~(PointerDevice.TouchScreen)
drag.axis: Drag.XAndYAxis
acceptedButtons: Qt.RightButton | Qt.LeftButton
drag.smoothed: false
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
onClicked: (mouse) => {
if (mouse.button === Qt.RightButton)
contextMenuButtonClicked(picture, root.mapToGlobal(mouse.x,mouse.y));
else if (mouse.button === Qt.LeftButton) {
root.itemClicked(mouse.modifiers);
gesturePolicy: TapHandler.ReleaseWithinBounds // TODO: Qt 6.2 bug: Use TapHandler.DragThreshold
onSingleTapped: (eventPoint, button) => {
initialAction()
// FIXME: The signals are messed up in this item.
// Right click does not fire itemClicked?
if (button === Qt.RightButton)
contextMenuButtonClicked(picture, parent.mapToGlobal(eventPoint.position.x, eventPoint.position.y));
else
root.itemClicked(point.modifiers);
}
}
onDoubleClicked: (mouse) => {
if (mouse.button === Qt.LeftButton)
root.itemDoubleClicked(mouse.modifiers)
}
onDoubleTapped: (eventPoint, button) => {
if (button === Qt.LeftButton)
root.itemDoubleClicked(point.modifiers)
}
onPressed: (mouse) => {
_modifiersOnLastPress = mouse.modifiers
}
Component.onCompleted: {
canceled.connect(initialAction)
}
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(root._modifiersOnLastPress)
} else if (root.dragItem) {
root.dragItem.Drag.drop()
function initialAction() {
_modifiersOnLastPress = point.modifiers
root.forceActiveFocus(Qt.MouseFocusReason)
}
root.dragItem.Drag.active = drag.active
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
onTapped: (eventPoint, button) => {
root.itemClicked(Qt.NoModifier)
root.itemDoubleClicked(Qt.NoModifier)
}
onLongPressed: {
contextMenuButtonClicked(picture, point.scenePosition);
contextMenuButtonClicked(picture, parent.mapToGlobal(point.position.x, point.position.y));
}
}
}
HoverHandler {
id: mouseHoverHandler
acceptedDevices: PointerDevice.Mouse
}
ColumnLayout {
id: layout
background: AnimatedBackground {
width: root.width + (selectedBorderWidth * 2)
height: root.height + (selectedBorderWidth * 2)
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
spacing: 0
x: - selectedBorderWidth
y: - selectedBorderWidth
Widgets.MediaCover {
id: picture
enabled: theme.initialized
playCoverVisible: false
playCoverOpacity: 0
radius: VLCStyle.gridCover_radius
color: theme.bg.secondary
//don't show the backgroud unless selected
color: root.selected ? theme.bg.highlight : theme.bg.primary
border.color: visualFocus ? theme.visualFocus : "transparent"
}
Layout.preferredWidth: pictureWidth
Layout.preferredHeight: pictureHeight
contentItem: ColumnLayout {
id: layout
onPlayIconClicked: (mouse) => {
// emulate a mouse click before delivering the play signal as to select the item
// this helps in updating the selection and restore of initial index in the parent views
root.itemClicked(mouse.modifiers)
root.playClicked()
}
z: 1
DefaultShadow {
id: unselectedShadow
spacing: 0
anchors.centerIn: parent
Widgets.MediaCover {
id: picture
visible: opacity > 0
playCoverVisible: false
playCoverOpacity: 0
radius: VLCStyle.gridCover_radius
color: theme.bg.secondary
sourceItem: parent
Layout.preferredWidth: pictureWidth
Layout.preferredHeight: pictureHeight
Layout.alignment: Qt.AlignCenter
width: viewportWidth
height: viewportHeight
sourceSize: Qt.size(128, 128)
}
onPlayIconClicked: (point) => {
// emulate a mouse click before delivering the play signal as to select the item
// this helps in updating the selection and restore of initial index in the parent views
root.itemClicked(point.modifiers)
root.playClicked()
}
DoubleShadow {
id: selectedShadow
DefaultShadow {
id: unselectedShadow
anchors.centerIn: parent
anchors.centerIn: parent
visible: opacity > 0
opacity: 0
visible: opacity > 0
sourceItem: parent
sourceItem: parent
width: viewportWidth
height: viewportHeight
width: viewportWidth
height: viewportHeight
sourceSize: Qt.size(128, 128)
}
sourceSize: Qt.size(128, 128)
DoubleShadow {
id: selectedShadow
primaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
primaryBlurRadius: VLCStyle.dp(18, VLCStyle.scale)
anchors.centerIn: parent
secondaryVerticalOffset: VLCStyle.dp(32, VLCStyle.scale)
secondaryBlurRadius: VLCStyle.dp(72, VLCStyle.scale)
}
}
visible: opacity > 0
opacity: 0
Widgets.TextAutoScroller {
id: titleTextRect
sourceItem: parent
label: titleLabel
forceScroll: highlighted
visible: root.title !== ""
clip: scrolling
width: viewportWidth
height: viewportHeight
Layout.preferredWidth: Math.min(titleLabel.implicitWidth, pictureWidth)
Layout.preferredHeight: titleLabel.height
Layout.topMargin: root.titleMargin
Layout.alignment: root.textAlignHCenter ? Qt.AlignCenter : Qt.AlignLeft
sourceSize: Qt.size(128, 128)
Widgets.ListLabel {
id: titleLabel
primaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
primaryBlurRadius: VLCStyle.dp(18, VLCStyle.scale)
height: implicitHeight
color: root.selected
? theme.fg.highlight
: theme.fg.primary
textFormat: Text.PlainText
}
secondaryVerticalOffset: VLCStyle.dp(32, VLCStyle.scale)
secondaryBlurRadius: VLCStyle.dp(72, VLCStyle.scale)
}
}
Widgets.TextAutoScroller {
id: titleTextRect
label: titleLabel
forceScroll: highlighted
visible: root.title !== ""
clip: scrolling
Widgets.MenuCaption {
id: subtitleTxt
Layout.preferredWidth: Math.min(titleLabel.implicitWidth, pictureWidth)
Layout.preferredHeight: titleLabel.height
Layout.topMargin: root.titleMargin
Layout.alignment: root.textAlignHCenter ? Qt.AlignCenter : Qt.AlignLeft
visible: text !== ""
text: root.subtitle
elide: Text.ElideRight
Widgets.ListLabel {
id: titleLabel
height: implicitHeight
color: root.selected
? theme.fg.highlight
: theme.fg.secondary
: theme.fg.primary
textFormat: Text.PlainText
}
}
Layout.preferredWidth: Math.min(pictureWidth, implicitWidth)
Layout.alignment: root.textAlignHCenter ? Qt.AlignCenter : Qt.AlignLeft
Layout.topMargin: VLCStyle.margin_xsmall
Widgets.MenuCaption {
id: subtitleTxt
ToolTip.delay: VLCStyle.delayToolTipAppear
ToolTip.text: subtitleTxt.text
ToolTip.visible: subtitleTxtMouseHandler.hovered
visible: text !== ""
text: root.subtitle
elide: Text.ElideRight
color: root.selected
? theme.fg.highlight
: theme.fg.secondary
textFormat: Text.PlainText
HoverHandler {
id: subtitleTxtMouseHandler
acceptedDevices: PointerDevice.Mouse
}
Layout.preferredWidth: Math.min(pictureWidth, implicitWidth)
Layout.alignment: root.textAlignHCenter ? Qt.AlignCenter : Qt.AlignLeft
Layout.topMargin: VLCStyle.margin_xsmall
ToolTip.delay: VLCStyle.delayToolTipAppear
ToolTip.text: subtitleTxt.text
ToolTip.visible: subtitleTxtMouseHandler.hovered
HoverHandler {
id: subtitleTxtMouseHandler
acceptedDevices: PointerDevice.Mouse
}
}
}
......
......@@ -41,6 +41,7 @@ MouseArea {
cursorShape: Qt.SplitHCursor
width: VLCStyle.resizeHandleWidth
acceptedButtons: Qt.LeftButton
preventStealing: true
onPressed: (mouse) => {
MainCtx.setCursor(cursorShape)
......
......@@ -298,30 +298,35 @@ ListView {
}
}
MouseArea {
anchors.fill: parent
TapHandler {
acceptedDevices: PointerDevice.Mouse
z: -1
acceptedButtons: Qt.LeftButton | Qt.RightButton
preventStealing: true
grabPermissions: PointerHandler.TakeOverForbidden
acceptedButtons: Qt.LeftButton | Qt.RightButton
gesturePolicy: TapHandler.ReleaseWithinBounds
onPressed: (mouse) => {
focus = true // Grab the focus from delegate
root.forceActiveFocus(Qt.MouseFocusReason) // Re-focus the list
onTapped: (eventPoint, button) => {
initialAction()
if (!(mouse.modifiers & (Qt.ShiftModifier | Qt.ControlModifier))) {
if (selectionModel)
selectionModel.clearSelection()
if (button === Qt.RightButton) {
root.showContextMenu(parent.mapToGlobal(eventPoint.position.x, eventPoint.position.y))
}
}
mouse.accepted = true
Component.onCompleted: {
canceled.connect(initialAction)
}
onReleased: (mouse) => {
if (mouse.button & Qt.RightButton) {
root.showContextMenu(mapToGlobal(mouse.x, mouse.y))
function initialAction() {
if (root.currentItem)
root.currentItem.focus = false // Grab the focus from delegate
root.forceActiveFocus(Qt.MouseFocusReason) // Re-focus the list
if (!(point.modifiers & (Qt.ShiftModifier | Qt.ControlModifier))) {
if (selectionModel)
selectionModel.clearSelection()
}
}
}
......
......@@ -301,7 +301,7 @@ FocusScope {
Repeater {
model: sortModel
MouseArea {
Item {
id: headerCell
required property var modelData
......@@ -338,13 +338,16 @@ FocusScope {
rightMargin: VLCStyle.margin_xsmall
}
}
onClicked: {
if (!(modelData.model.isSortable ?? true))
return
else if (root.model.sortCriteria !== modelData.model.criteria)
root.model.sortCriteria = modelData.model.criteria
else
root.model.sortOrder = (root.model.sortOrder === Qt.AscendingOrder) ? Qt.DescendingOrder : Qt.AscendingOrder
TapHandler {
onTapped: (eventPoint, button) => {
if (!(modelData.model.isSortable ?? true))
return
else if (root.model.sortCriteria !== modelData.model.criteria)
root.model.sortCriteria = modelData.model.criteria
else
root.model.sortOrder = (root.model.sortOrder === Qt.AscendingOrder) ? Qt.DescendingOrder : Qt.AscendingOrder
}
}
}
}
......
......@@ -57,7 +57,7 @@ Rectangle {
// Signals
signal playIconClicked(var /* MouseEvent */ mouse)
signal playIconClicked(var point)
// Settings
......@@ -113,7 +113,9 @@ Rectangle {
sourceComponent: Widgets.PlayCover {
width: playIconSize
onClicked: (mouse) => playIconClicked(mouse)
Component.onCompleted: {
tapped.connect(root.playIconClicked)
}
}
asynchronous: true
......
......@@ -19,13 +19,14 @@
*****************************************************************************/
import QtQuick
import QtQuick.Controls
import org.videolan.vlc 0.1
import "qrc:///style/"
import "qrc:///widgets/" as Widgets
MouseArea {
Item {
id: root
// Settings
width: VLCStyle.play_cover_normal
......@@ -33,11 +34,13 @@ MouseArea {
// NOTE: This is the same scaling than the PlayButton, except we make it bigger.
// Maybe we could crank this to 1.1.
scale: (containsMouse && pressed === false) ? 1.05 : 1.0
scale: (hoverHandler.hovered && !tapHandler.pressed) ? 1.05 : 1.0
opacity: (visible) ? 1.0 : 0.0
hoverEnabled: true
activeFocusOnTab: false
signal tapped(var point)
readonly property ColorContext colorContext: ColorContext {
id: theme
......@@ -48,7 +51,7 @@ MouseArea {
Behavior on scale {
// NOTE: We disable the animation while pressing to make it more impactful.
enabled: (pressed === false)
enabled: (!tapHandler.pressed)
NumberAnimation {
duration: VLCStyle.duration_short
......@@ -67,6 +70,22 @@ MouseArea {
// Children
TapHandler {
id: tapHandler
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
onSingleTapped: (eventPoint, button) => {
root.tapped(point)
}
}
HoverHandler {
id: hoverHandler
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything
}
ScaledImage {
anchors.centerIn: parent
......@@ -92,8 +111,7 @@ MouseArea {
text: VLCIcons.play_filled
color: (containsMouse) ? theme.accent
: "black"
color: (root.hovered) ? theme.accent : "black"
font.pixelSize: Math.round(parent.width / 2)
}
......
......@@ -36,7 +36,7 @@ T.Control {
required property Widgets.DragItem dragItem
required property bool acceptDrop
readonly property bool dragActive: hoverArea.drag.active
readonly property bool dragActive: dragHandler.active
property int _modifiersOnLastPress: Qt.NoModifier
......@@ -93,76 +93,85 @@ T.Control {
hovered: delegate.hovered
}
background: AnimatedBackground {
animationDuration: VLCStyle.duration_short
enabled: theme.initialized
color: delegate.selected ? theme.bg.highlight : theme.bg.primary
border.color: visualFocus ? theme.visualFocus : "transparent"
MouseArea {
id: hoverArea
// TODO: Qt bug 6.2: QTBUG-103604
DoubleClickIgnoringItem {
anchors.fill: parent
// Settings
z: -1
anchors.fill: parent
DragHandler {
id: dragHandler
hoverEnabled: false
target: null
acceptedButtons: Qt.RightButton | Qt.LeftButton
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything
drag.target: delegate.dragItem
onActiveChanged: {
if (dragItem) {
if (active) {
dragItem.Drag.active = true
} else {
dragItem.Drag.drop()
}
}
}
}
drag.axis: Drag.XAndYAxis
TapHandler {
acceptedDevices: PointerDevice.AllDevices & ~(PointerDevice.TouchScreen)
drag.smoothed: false
acceptedButtons: Qt.LeftButton | Qt.RightButton
// Events
gesturePolicy: TapHandler.ReleaseWithinBounds // TODO: Qt 6.2 bug: Use TapHandler.DragThreshold
onPressed: (mouse) => {
_modifiersOnLastPress = mouse.modifiers
}
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
onClicked: (mouse) => {
if ((mouse.button === Qt.LeftButton) || !delegate.selected) {
delegate.selectAndFocus(mouse.modifiers, Qt.MouseFocusReason)
}
onSingleTapped: (point, button) => {
initialAction()
if (mouse.button === Qt.RightButton)
delegate.rightClick(delegate, delegate.rowModel, hoverArea.mapToGlobal(mouse.x, mouse.y))
if (button === Qt.RightButton)
delegate.rightClick(delegate, delegate.rowModel, parent.mapToGlobal(point.position.x, point.position.y))
}
onDoubleClicked: (mouse) => {
if (mouse.button === Qt.LeftButton)
onDoubleTapped: (point, button) => {
if (button === Qt.LeftButton)
delegate.itemDoubleClicked(delegate.index, delegate.rowModel)
}
drag.onActiveChanged: {
// NOTE: 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 && !delegate.selected) {
delegate.selectAndFocus(_modifiersOnLastPress, index)
} else if (delegate.dragItem) {
delegate.dragItem.Drag.drop()
}
Component.onCompleted: {
canceled.connect(initialAction)
}
delegate.dragItem.Drag.active = drag.active
function initialAction() {
if ((point.pressedButtons === Qt.LeftButton) || !delegate.selected) {
delegate.selectAndFocus(point.modifiers, Qt.MouseFocusReason)
}
}
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onTapped: {
delegate.selectAndFocus(Qt.NoModifier, Qt.MouseFocusReason)
delegate.itemDoubleClicked(delegate.index, delegate.rowModel)
}
grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
onLongPressed: {
delegate.rightClick(delegate, delegate.rowModel, point.scenePosition)
}
onTapped: (eventPoint, button) => {
delegate.selectAndFocus(Qt.NoModifier, Qt.MouseFocusReason)
delegate.itemDoubleClicked(delegate.index, delegate.rowModel)
}
onLongPressed: {
delegate.rightClick(delegate, delegate.rowModel, parent.mapToGlobal(point.position.x, point.position.y))
}
}
}
background: AnimatedBackground {
animationDuration: VLCStyle.duration_short
enabled: theme.initialized
color: delegate.selected ? theme.bg.highlight : theme.bg.primary
border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: Row {
leftPadding: VLCStyle.margin_xxxsmall
rightPadding: VLCStyle.margin_xxxsmall
......@@ -190,7 +199,7 @@ T.Control {
index: Qt.binding(() => delegate.index),
currentlyFocused: Qt.binding(() => delegate.visualFocus),
selected: Qt.binding(() => delegate.selected),
containsMouse: Qt.binding(() => hoverArea.containsMouse),
containsMouse: Qt.binding(() => delegate.hovered),
colorContext: Qt.binding(() => theme),
}
)
......