AbstractColorDialog {
id: root
- property bool _valueSet: true // guard to prevent binding loops
- function _setControlsFromColor() {
- _valueSet = false
+ property bool __valueSet: true // guard to prevent binding loops
+ function __setControlsFromColor() {
+ __valueSet = false
hueSlider.value = root.currentHue
saturationSlider.value = root.currentSaturation
lightnessSlider.value = root.currentLightness
alphaSlider.value = root.currentAlpha
crosshairs.x = root.currentLightness * paletteMap.width
crosshairs.y = (1.0 - root.currentSaturation) * paletteMap.height
- _valueSet = true
+ __valueSet = true
}
- onCurrentColorChanged: _setControlsFromColor()
+ onCurrentColorChanged: __setControlsFromColor()
onSelectionAccepted: root.color = root.currentColor
Rectangle {
id: paletteMap
x: (parent.width - width) / 2
width: height
- onWidthChanged: root._setControlsFromColor()
+ onWidthChanged: root.__setControlsFromColor()
height: parent.height
source: "images/checkers.png"
fillMode: Image.Tile
ColorSlider {
id: hueSlider
value: 0.5
- onValueChanged: if (_valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
text: qsTr("Hue")
trackDelegate: Rectangle {
rotation: -90
id: saturationSlider
visible: !content.usePaletteMap
value: 0.5
- onValueChanged: if (_valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
text: qsTr("Saturation")
trackDelegate: Rectangle {
rotation: -90
id: lightnessSlider
visible: !content.usePaletteMap
value: 0.5
- onValueChanged: if (_valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
text: qsTr("Luminosity")
trackDelegate: Rectangle {
rotation: -90
minimum: 0.0
maximum: 1.0
value: 1.0
- onValueChanged: if (_valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
text: qsTr("Alpha")
visible: root.showAlphaChannel
trackDelegate: Item {
id: root
onVisibleChanged: {
if (visible) {
- selectedIndices = []
- lastClickedIdx = -1
+ __selectedIndices = []
+ __lastClickedIdx = -1
currentPathField.visible = false
}
}
onFolderChanged: view.model.folder = folder
- property bool showFocusHighlight: false
- property real textX: titleBar.height
- property SystemPalette palette
- property var selectedIndices: []
- property int lastClickedIdx: -1
+ property real __textX: titleBar.height
+ property SystemPalette __palette
+ property var __selectedIndices: []
+ property int __lastClickedIdx: -1
- function dirDown(path) {
+ function __dirDown(path) {
view.model.folder = path
- lastClickedIdx = -1
- selectedIndices = []
+ __lastClickedIdx = -1
+ __selectedIndices = []
}
- function dirUp() {
+ function __dirUp() {
view.model.folder = view.model.parentFolder
- lastClickedIdx = -1
- selectedIndices = []
+ __lastClickedIdx = -1
+ __selectedIndices = []
}
- function up(extend) {
+ function __up(extend) {
if (view.currentIndex > 0)
--view.currentIndex
else
view.currentIndex = 0
if (extend) {
- if (selectedIndices.indexOf(view.currentIndex) < 0) {
- var selCopy = selectedIndices
+ if (__selectedIndices.indexOf(view.currentIndex) < 0) {
+ var selCopy = __selectedIndices
selCopy.push(view.currentIndex)
- selectedIndices = selCopy
+ __selectedIndices = selCopy
}
} else
- selectedIndices = [view.currentIndex]
+ __selectedIndices = [view.currentIndex]
}
- function down(extend) {
+ function __down(extend) {
if (view.currentIndex < view.model.count - 1)
++view.currentIndex
else
view.currentIndex = view.model.count - 1
if (extend) {
- if (selectedIndices.indexOf(view.currentIndex) < 0) {
- var selCopy = selectedIndices
+ if (__selectedIndices.indexOf(view.currentIndex) < 0) {
+ var selCopy = __selectedIndices
selCopy.push(view.currentIndex)
- selectedIndices = selCopy
+ __selectedIndices = selCopy
}
} else
- selectedIndices = [view.currentIndex]
+ __selectedIndices = [view.currentIndex]
}
- function acceptSelection() {
+ function __acceptSelection() {
clearSelection()
- if (selectFolder && selectedIndices.length == 0)
+ if (selectFolder && __selectedIndices.length == 0)
addSelection(folder)
- else if (selectedIndices.length > 0) {
- selectedIndices.map(function(idx) {
+ else if (__selectedIndices.length > 0) {
+ __selectedIndices.map(function(idx) {
if (view.model.isFolder(idx)) {
if (selectFolder)
addSelection(view.model.get(idx, "fileURL"))
// TODO: QTBUG-29817 geometry from AbstractFileDialog
implicitWidth: Math.min(maxSize, Screen.pixelDensity * 100)
implicitHeight: Math.min(maxSize, Screen.pixelDensity * 80)
- color: palette.window
+ color: __palette.window
focus: root.visible && !currentPathField.visible
property real spacing: 6
property real outerSpacing: 12
- SystemPalette { id: palette }
+ SystemPalette { id: __palette }
Component {
id: folderDelegate
id: wrapper
function launch() {
if (view.model.isFolder(index)) {
- dirDown(filePath)
+ __dirDown(filePath)
} else {
- root.acceptSelection()
+ root.__acceptSelection()
}
}
width: content.width
color: "transparent"
Rectangle {
id: itemHighlight
- visible: root.selectedIndices.indexOf(index) >= 0
+ visible: root.__selectedIndices.indexOf(index) >= 0
anchors.fill: parent
- color: palette.highlight
+ color: __palette.highlight
}
Image {
id: icon
source: "images/folder.png"
height: wrapper.height - y * 2; width: height
- x: (root.textX - width) / 2
+ x: (root.__textX - width) / 2
y: 2
visible: view.model.isFolder(index)
}
id: nameText
anchors.fill: parent; verticalAlignment: Text.AlignVCenter
text: fileName
- anchors.leftMargin: root.textX
- color: itemHighlight.visible ? palette.highlightedText : palette.windowText
+ anchors.leftMargin: root.__textX
+ color: itemHighlight.visible ? __palette.highlightedText : __palette.windowText
elide: Text.ElideRight
}
MouseArea {
id: mouseRegion
anchors.fill: parent
onDoubleClicked: {
- selectedIndices = [index]
- root.lastClickedIdx = index
+ __selectedIndices = [index]
+ root.__lastClickedIdx = index
launch()
}
onClicked: {
view.currentIndex = index
if (mouse.modifiers & Qt.ControlModifier && root.selectMultiple) {
- // modifying the contents of selectedIndices doesn't notify,
+ // modifying the contents of __selectedIndices doesn't notify,
// so we have to re-assign the variable
- var selCopy = selectedIndices
+ var selCopy = __selectedIndices
var existingIdx = selCopy.indexOf(index)
if (existingIdx >= 0)
selCopy.splice(existingIdx, 1)
else
selCopy.push(index)
- selectedIndices = selCopy
+ __selectedIndices = selCopy
} else if (mouse.modifiers & Qt.ShiftModifier && root.selectMultiple) {
- if (root.lastClickedIdx >= 0) {
+ if (root.__lastClickedIdx >= 0) {
var sel = []
- if (index > lastClickedIdx) {
- for (var i = root.lastClickedIdx; i <= index; i++)
+ if (index > __lastClickedIdx) {
+ for (var i = root.__lastClickedIdx; i <= index; i++)
sel.push(i)
} else {
- for (var i = root.lastClickedIdx; i >= index; i--)
+ for (var i = root.__lastClickedIdx; i >= index; i--)
sel.push(i)
}
- selectedIndices = sel
+ __selectedIndices = sel
}
} else {
- selectedIndices = [index]
- root.lastClickedIdx = index
+ __selectedIndices = [index]
+ root.__lastClickedIdx = index
}
}
}
event.accepted = true
switch (event.key) {
case Qt.Key_Up:
- root.up(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
+ root.__up(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
break
case Qt.Key_Down:
- root.down(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
+ root.__down(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
break
case Qt.Key_Left:
- root.dirUp()
+ root.__dirUp()
break
case Qt.Key_Return:
case Qt.Key_Select:
if (view.currentItem)
view.currentItem.launch()
else
- root.acceptSelection()
+ root.__acceptSelection()
break
case Qt.Key_Back:
case Qt.Key_Escape:
delegate: folderDelegate
highlight: Rectangle {
color: "transparent"
- border.color: Qt.darker(palette.window, 1.3)
+ border.color: Qt.darker(__palette.window, 1.3)
}
highlightMoveDuration: 0
highlightMoveVelocity: -1
height: currentPathField.height * 1.5
Rectangle {
anchors.fill: parent
- color: Qt.darker(palette.window, 1.1)
- border.color: Qt.darker(palette.window, 1.3)
+ color: Qt.darker(__palette.window, 1.1)
+ border.color: Qt.darker(__palette.window, 1.3)
}
Rectangle {
id: upButton
- width: root.textX
+ width: root.__textX
height: titleBar.height
color: "transparent"
MouseArea { id: upRegion; anchors.centerIn: parent
width: 56
height: parent.height
- onClicked: if (view.model.parentFolder != "") dirUp()
+ onClicked: if (view.model.parentFolder !== "") __dirUp()
}
states: [
State {
name: "pressed"
when: upRegion.pressed
- PropertyChanges { target: upButton; color: palette.highlight }
+ PropertyChanges { target: upButton; color: __palette.highlight }
}
]
}
Text {
id: currentPathText
anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
- anchors.leftMargin: textX; anchors.rightMargin: content.spacing
+ anchors.leftMargin: __textX; anchors.rightMargin: content.spacing
text: root.urlToPath(view.model.folder)
- color: palette.text
+ color: __palette.text
elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter
MouseArea {
anchors.fill: parent
TextField {
id: currentPathField
anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
- anchors.leftMargin: textX; anchors.rightMargin: content.spacing
+ anchors.leftMargin: __textX; anchors.rightMargin: content.spacing
visible: false
focus: visible
onAccepted: {
width: parent.width
height: buttonRow.height + buttonRow.spacing * 2
anchors.bottom: parent.bottom
- color: Qt.darker(palette.window, 1.1)
- border.color: Qt.darker(palette.window, 1.3)
+ color: Qt.darker(__palette.window, 1.1)
+ border.color: Qt.darker(__palette.window, 1.3)
Row {
id: buttonRow
text: "OK"
onClicked: {
if (view.model.isFolder(view.currentIndex) && !selectFolder)
- dirDown(view.model.get(view.currentIndex, "filePath"))
+ __dirDown(view.model.get(view.currentIndex, "filePath"))
else
- root.acceptSelection()
+ root.__acceptSelection()
}
}
}