[vlc-commits] indent gridItems.qml
Abel Tesfaye
git at videolan.org
Tue Jul 30 17:57:12 CEST 2019
vlc | branch: master | Abel Tesfaye <Abeltesfaye45 at gmail.com> | Tue Jun 25 09:50:14 2019 +0300| [552869f57b684378268aed8153d41f79d534e1c0] | committer: Jean-Baptiste Kempf
indent gridItems.qml
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=552869f57b684378268aed8153d41f79d534e1c0
---
modules/gui/qt/qml/utils/GridItem.qml | 439 +++++++++++++++++++---------------
1 file changed, 245 insertions(+), 194 deletions(-)
diff --git a/modules/gui/qt/qml/utils/GridItem.qml b/modules/gui/qt/qml/utils/GridItem.qml
index 69098b6145..ab3f5aacd1 100644
--- a/modules/gui/qt/qml/utils/GridItem.qml
+++ b/modules/gui/qt/qml/utils/GridItem.qml
@@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
@@ -23,7 +22,6 @@ import QtQml.Models 2.2
import QtGraphicalEffects 1.0
import org.videolan.medialib 0.1
-
import "qrc:///utils/" as Utils
import "qrc:///style/"
@@ -63,145 +61,160 @@ Rectangle {
id: mouseArea
hoverEnabled: true
onClicked: root.itemClicked(mouse.button, mouse.modifiers)
- onDoubleClicked: root.itemDoubleClicked(mouse.buttons, mouse.modifiers);
+ onDoubleClicked: root.itemDoubleClicked(mouse.buttons,
+ mouse.modifiers)
width: childrenRect.width
height: childrenRect.height
acceptedButtons: Qt.RightButton | Qt.LeftButton
Keys.onMenuPressed: root.contextMenuButtonClicked(cover_bg)
- Item {
- id: picture
+ Item {
+ id: picture
width: isVideo ? VLCStyle.video_normal_width : VLCStyle.cover_small
height: isVideo ? VLCStyle.video_normal_height : VLCStyle.cover_small
- anchors.top:mouseArea.top
- property bool highlighted: selected || root.activeFocus
+ anchors.top: mouseArea.top
+ property bool highlighted: selected || root.activeFocus
Rectangle {
id: cover_bg
width: picture.width
height: picture.height
- color: (cover.status !== Image.Ready ) ? VLCStyle.colors.banner : "transparent"
+ color: (cover.status !== Image.Ready) ? VLCStyle.colors.banner : "transparent"
RectangularGlow {
visible: picture.highlighted || mouseArea.containsMouse
anchors.fill: cover
spread: 0.1
glowRadius: VLCStyle.margin_xxsmall
- color: VLCStyle.colors.getBgColor( selected, mouseArea.containsMouse, root.activeFocus )
+ color: VLCStyle.colors.getBgColor(
+ selected, mouseArea.containsMouse,
+ root.activeFocus)
}
- Image {
- id: cover
- anchors.fill: parent
+ Image {
+ id: cover
+ anchors.fill: parent
anchors.margins: VLCStyle.margin_normal
- source: image
- fillMode: Image.PreserveAspectCrop
- sourceSize: Qt.size(width, height)
- layer.enabled: true
- layer.effect: OpacityMask{
- maskSource: Rectangle{
+ source: image
+ fillMode: Image.PreserveAspectCrop
+ sourceSize: Qt.size(width, height)
+ layer.enabled: true
+ layer.effect: OpacityMask {
+ maskSource: Rectangle {
radius: 3
- width: cover.width
- height: cover.height
- visible: false
- }
+ width: cover.width
+ height: cover.height
+ visible: false
}
- Behavior on anchors.margins { SmoothedAnimation { velocity: 100 } }
- Rectangle {
- id: overlay
- anchors.fill: parent
- color: "black" //darken the image below
+ }
+ Behavior on anchors.margins {
+ SmoothedAnimation {
+ velocity: 100
+ }
+ }
+ Rectangle {
+ id: overlay
+ anchors.fill: parent
+ color: "black" //darken the image below
- RowLayout {
- anchors.fill: parent
- visible: !noActionButtons
- Item {
+ RowLayout {
+ anchors.fill: parent
+ visible: !noActionButtons
+ Item {
id: plusItem
- Layout.fillHeight: true
- Layout.fillWidth: true
- /* A addToPlaylist button visible when hovered */
- Text {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ /* A addToPlaylist button visible when hovered */
+ Text {
id: plusIcon
- property int iconSize: VLCStyle.icon_large
- Behavior on iconSize { SmoothedAnimation { velocity: 100 } }
- Binding on iconSize {
- value: VLCStyle.icon_large * 1.2
- when: mouseAreaAdd.containsMouse
+ property int iconSize: VLCStyle.icon_large
+ Behavior on iconSize {
+ SmoothedAnimation {
+ velocity: 100
}
+ }
+ Binding on iconSize {
+ value: VLCStyle.icon_large * 1.2
+ when: mouseAreaAdd.containsMouse
+ }
- //Layout.alignment: Qt.AlignCenter
- anchors.centerIn: parent
- text: VLCIcons.add
- font.family: VLCIcons.fontFamily
- horizontalAlignment: Text.AlignHCenter
- color: mouseAreaAdd.containsMouse ? "white" : "lightgray"
- font.pixelSize: iconSize
-
- MouseArea {
- id: mouseAreaAdd
- anchors.fill: parent
- hoverEnabled: true
- propagateComposedEvents: true
- onClicked: root.addToPlaylistClicked()
- }
+ //Layout.alignment: Qt.AlignCenter
+ anchors.centerIn: parent
+ text: VLCIcons.add
+ font.family: VLCIcons.fontFamily
+ horizontalAlignment: Text.AlignHCenter
+ color: mouseAreaAdd.containsMouse ? "white" : "lightgray"
+ font.pixelSize: iconSize
+
+ MouseArea {
+ id: mouseAreaAdd
+ anchors.fill: parent
+ hoverEnabled: true
+ propagateComposedEvents: true
+ onClicked: root.addToPlaylistClicked()
}
+ }
Text {
- anchors{
+ anchors {
top: plusIcon.bottom
}
- anchors.horizontalCenter:plusItem.horizontalCenter
+ anchors.horizontalCenter: plusItem.horizontalCenter
font.pixelSize: root.isVideo ? VLCStyle.fontSize_normal : VLCStyle.fontSize_small
text: qsTr("Enqueue")
color: "white"
}
+ }
- /* A play button visible when hovered */
- Item {
+ /* A play button visible when hovered */
+ Item {
id: playItem
- Layout.fillHeight: true
- Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.fillWidth: true
- Text {
+ Text {
id: playIcon
- property int iconSize: VLCStyle.icon_large
- Behavior on iconSize {
- SmoothedAnimation { velocity: 100 }
- }
- Binding on iconSize {
- value: VLCStyle.icon_large * 1.2
- when: mouseAreaPlay.containsMouse
+ property int iconSize: VLCStyle.icon_large
+ Behavior on iconSize {
+ SmoothedAnimation {
+ velocity: 100
}
+ }
+ Binding on iconSize {
+ value: VLCStyle.icon_large * 1.2
+ when: mouseAreaPlay.containsMouse
+ }
- anchors.centerIn: parent
- text: VLCIcons.play
- font.family: VLCIcons.fontFamily
- horizontalAlignment: Text.AlignHCenter
- color: mouseAreaPlay.containsMouse ? "white" : "lightgray"
- font.pixelSize: iconSize
-
- MouseArea {
- id: mouseAreaPlay
- anchors.fill: parent
- hoverEnabled: true
- onClicked: root.playClicked()
- }
+ anchors.centerIn: parent
+ text: VLCIcons.play
+ font.family: VLCIcons.fontFamily
+ horizontalAlignment: Text.AlignHCenter
+ color: mouseAreaPlay.containsMouse ? "white" : "lightgray"
+ font.pixelSize: iconSize
+
+ MouseArea {
+ id: mouseAreaPlay
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: root.playClicked()
}
+ }
Text {
- anchors{
+ anchors {
top: playIcon.bottom
}
- anchors.horizontalCenter:playItem.horizontalCenter
+ anchors.horizontalCenter: playItem.horizontalCenter
font.pixelSize: root.isVideo ? VLCStyle.fontSize_normal : VLCStyle.fontSize_small
text: qsTr("Play")
color: "white"
}
}
}
+ }
ProgressBar {
id: progressBar
value: root.progress
visible: isVideo
- anchors{
+ anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
@@ -218,48 +231,46 @@ Rectangle {
}
}
}
-
+ }
+ Button {
+ id: contextButton
+ visible: isVideo
+ anchors {
+ top: cover.top
+ right: cover.right
}
- Button {
- id: contextButton
- visible: isVideo
- anchors {
- top:cover.top
- right:cover.right
- }
- width: VLCStyle.icon_normal
- height: VLCStyle.icon_normal
- text: "\u22ef" //ellipsis icon
- font.pointSize: VLCStyle.fontMetrics_normal
+ width: VLCStyle.icon_normal
+ height: VLCStyle.icon_normal
+ text: "\u22ef" //ellipsis icon
+ font.pointSize: VLCStyle.fontMetrics_normal
- hoverEnabled: true
- onClicked: root.contextMenuButtonClicked(cover_bg)
- background: Rectangle {
- id: contextButtonRect
- anchors.fill: contextButton
- color: "transparent"
- }
- contentItem: Text {
- id: btnTxt
- text: contextButton.text
- font: contextButton.font
+ hoverEnabled: true
+ onClicked: root.contextMenuButtonClicked(cover_bg)
+ background: Rectangle {
+ id: contextButtonRect
+ anchors.fill: contextButton
+ color: "transparent"
+ }
+ contentItem: Text {
+ id: btnTxt
+ text: contextButton.text
+ font: contextButton.font
color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- // layer.enabled: true
- // layer.effect: DropShadow {
- // color: VLCStyle.colors.text
- // }
-
- }
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ // layer.enabled: true
+ // layer.effect: DropShadow {
+ // color: VLCStyle.colors.text
+ // }
}
+ }
Label {
id: resolutionLabel
visible: root.isVideo
anchors {
- top:cover.top
- left:cover.left
+ top: cover.top
+ left: cover.left
topMargin: VLCStyle.margin_xxsmall
leftMargin: VLCStyle.margin_xxsmall
}
@@ -277,13 +288,12 @@ Rectangle {
opacity: 0.5
radius: 3
}
-
}
Label {
id: audioChannelLabel
anchors {
- top:cover.top
- left:resolutionLabel.right
+ top: cover.top
+ left: resolutionLabel.right
topMargin: VLCStyle.margin_xxsmall
leftMargin: VLCStyle.margin_xxxsmall
}
@@ -301,38 +311,77 @@ Rectangle {
color: "black"
opacity: 0.5
radius: 3
- }
}
- states: [
- State {
+ }
+ states: [
+ State {
name: "visiblebig"
- PropertyChanges { target: overlay; visible: true; }
- PropertyChanges { target: cover; anchors.margins: VLCStyle.margin_xxsmall; }
- when: mouseArea.containsMouse
- },
- State {
+ PropertyChanges {
+ target: overlay
+ visible: true
+ }
+ PropertyChanges {
+ target: cover
+ anchors.margins: VLCStyle.margin_xxsmall
+ }
+ when: mouseArea.containsMouse
+ },
+ State {
name: "hiddenbig"
- PropertyChanges { target: overlay; visible: false;}
- PropertyChanges { target: cover; anchors.margins: VLCStyle.margin_xxsmall; }
- when: !mouseArea.containsMouse && picture.highlighted
+ PropertyChanges {
+ target: overlay
+ visible: false
+ }
+ PropertyChanges {
+ target: cover
+ anchors.margins: VLCStyle.margin_xxsmall
+ }
+ when: !mouseArea.containsMouse
+ && picture.highlighted
},
State {
name: "hiddensmall"
- PropertyChanges { target: overlay; visible: false;}
- PropertyChanges { target: cover; anchors.margins: VLCStyle.margin_xsmall; }
- when: !mouseArea.containsMouse && !picture.highlighted
+ PropertyChanges {
+ target: overlay
+ visible: false
}
- ]
- transitions: [
- Transition {from: "hiddenbig"; to: "visiblebig";NumberAnimation {target: overlay;properties: "opacity";from: 0; to: 0.8; duration: 300}},
- Transition {from: "hiddensmall"; to: "visiblebig";NumberAnimation {target: overlay;properties: "opacity";from: 0; to: 0.8; duration: 300}}
- ]
-
- }
+ PropertyChanges {
+ target: cover
+ anchors.margins: VLCStyle.margin_xsmall
+ }
+ when: !mouseArea.containsMouse
+ && !picture.highlighted
+ }
+ ]
+ transitions: [
+ Transition {
+ from: "hiddenbig"
+ to: "visiblebig"
+ NumberAnimation {
+ target: overlay
+ properties: "opacity"
+ from: 0
+ to: 0.8
+ duration: 300
+ }
+ },
+ Transition {
+ from: "hiddensmall"
+ to: "visiblebig"
+ NumberAnimation {
+ target: overlay
+ properties: "opacity"
+ from: 0
+ to: 0.8
+ duration: 300
+ }
+ }
+ ]
}
+ }
- Rectangle {
- id: textHolderRect
+ Rectangle {
+ id: textHolderRect
width: picture.width
height: childrenRect.height
anchors.top: picture.bottom
@@ -357,60 +406,66 @@ Rectangle {
text: root.title
}
- Text{
- id:textTitle
- text:root.title
+ Text {
+ id: textTitle
+ text: root.title
color: VLCStyle.colors.text
font.pixelSize: VLCStyle.fontSize_normal
property bool _needsToScroll: (textTitleRect.width < textTitle.width)
- state: ((mouseArea.containsMouse || contextButton.activeFocus || picture.highlighted) && textTitle._needsToScroll ) ? "HOVERED": "RELEASED"
-
- states: [
- State {
- name: "HOVERED"
- PropertyChanges {
- target: textTitle
- x: textTitleRect.width - textTitle.width - VLCStyle.margin_small
- }
- },
- State {
- name: "RELEASED"
- PropertyChanges {
- target: textTitle
- x: 0
- }
+ state: ((mouseArea.containsMouse
+ || contextButton.activeFocus || picture.highlighted)
+ && textTitle._needsToScroll) ? "HOVERED" : "RELEASED"
+ states: [
+ State {
+ name: "HOVERED"
+ PropertyChanges {
+ target: textTitle
+ x: textTitleRect.width - textTitle.width - VLCStyle.margin_small
+ }
+ },
+ State {
+ name: "RELEASED"
+ PropertyChanges {
+ target: textTitle
+ x: 0
}
- ]
- transitions: [
- Transition {
- from: "RELEASED"
- to: "HOVERED"
+ }
+ ]
+ transitions: [
+ Transition {
+ from: "RELEASED"
+ to: "HOVERED"
- SequentialAnimation {
- PauseAnimation { duration: 1000 }
- SmoothedAnimation{
- property: "x"
- maximumEasingTime: 0
- velocity: 25
- }
- PauseAnimation { duration: 2000 }
- ScriptAction { script: textTitle.state = "RELEASED"; }
+ SequentialAnimation {
+ PauseAnimation {
+ duration: 1000
+ }
+ SmoothedAnimation {
+ property: "x"
+ maximumEasingTime: 0
+ velocity: 25
+ }
+ PauseAnimation {
+ duration: 2000
+ }
+ ScriptAction {
+ script: textTitle.state = "RELEASED"
}
}
- ]
-
- }
+ }
+ ]
}
+ }
- MouseArea {
- id: titleMouseArea
- anchors.fill: parent
- hoverEnabled: true
- onClicked: textTitleRect.showTooltip = true
- onExited: textTitleRect.showTooltip = false
- }
+ MouseArea {
+ id: titleMouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: textTitleRect.showTooltip = true
+ onExited: textTitleRect.showTooltip = false
+ }
Text {
id: subtitleTxt
@@ -422,7 +477,7 @@ Rectangle {
leftMargin: VLCStyle.margin_small
}
text: root.subtitle
- font.weight:Font.Light
+ font.weight: Font.Light
elide: Text.ElideRight
font.pixelSize: VLCStyle.fontSize_small
color: VLCStyle.colors.lightText
@@ -431,7 +486,7 @@ Rectangle {
RowLayout {
visible: isVideo
anchors {
- top:subtitleTxt.top
+ top: subtitleTxt.top
left: parent.left
right: parent.right
rightMargin: VLCStyle.margin_small
@@ -453,11 +508,7 @@ Rectangle {
font.bold: true
}
}
-
-
}
}
}
-}
-}
-}
+}
\ No newline at end of file
More information about the vlc-commits
mailing list