/usr/share/webcamoid/qml/EffectBar.qml is in webcamoid-data 8.1.0+dfsg-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | /* Webcamoid, webcam capture application.
* Copyright (C) 2011-2017 Gonzalo Exequiel Pedone
*
* Webcamoid 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 3 of the License, or
* (at your option) any later version.
*
* Webcamoid 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 Webcamoid. If not, see <http://www.gnu.org/licenses/>.
*
* Web-Site: http://webcamoid.github.io/
*/
import QtQuick 2.5
import QtQuick.Controls 1.4
Rectangle {
id: recEffectBar
color: Qt.rgba(0, 0, 0, 0)
clip: true
width: 200
height: 400
property string curEffect: ""
property int curEffectIndex: -1
property bool editMode: false
property bool advancedMode: VideoEffects.advancedMode
property bool lock: false
function updateAppliedEffectList() {
var effects = VideoEffects.effects
var option = lsvAppliedEffectList.model.get(lsvAppliedEffectList.currentIndex)
var curEffect = option? option.effect: ""
var currentIndex = -1
lsvAppliedEffectList.model.clear()
for (var effect in effects) {
if (effects[effect] === curEffect)
currentIndex = effect
lsvAppliedEffectList.model.append({
effect: effects[effect],
description: VideoEffects.effectInfo(effects[effect])["MetaData"]["description"]})
}
lsvAppliedEffectList.currentIndex = currentIndex < 0? 0: currentIndex
}
function updateEffectList() {
var effects = VideoEffects.availableEffects
var curEffects = VideoEffects.effects
var curEffect = curEffects.length > 0?
curEffects[curEffects.length - 1]: advancedMode?
effects[0]: ""
var currentIndex = -1
lsvEffectList.model.clear()
for (var effect in effects) {
if (effects[effect] === curEffect)
currentIndex = effect
lsvEffectList.model.append({
effect: effects[effect],
description: VideoEffects.effectInfo(effects[effect])["MetaData"]["description"]})
}
lsvEffectList.currentIndex = currentIndex >= 0 || !advancedMode?
currentIndex: -1
}
onEditModeChanged: {
state = editMode? "showEffects": ""
}
onVisibleChanged: {
if (!visible)
recEffectBar.state = ""
}
Component.onCompleted: {
recEffectBar.updateAppliedEffectList()
recEffectBar.updateEffectList()
}
Connections {
target: VideoEffects
onAvailableEffectsChanged: {
recEffectBar.updateAppliedEffectList()
recEffectBar.updateEffectList()
}
onEffectsChanged: {
if (lock)
return
recEffectBar.updateAppliedEffectList()
recEffectBar.updateEffectList()
recEffectBar.editMode = false
}
onAdvancedModeChanged: {
updateAppliedEffectList()
updateEffectList()
}
}
TextField {
id: txtSearchEffect
anchors.top: parent.top
anchors.topMargin: 8
anchors.rightMargin: 8
anchors.leftMargin: 8
anchors.right: parent.right
anchors.left: parent.left
placeholderText: qsTr("Search effect...")
}
Rectangle {
id: effectResetButton
height: advancedMode? 0: 32
anchors.topMargin: 8
anchors.right: parent.right
anchors.left: parent.left
anchors.top: txtSearchEffect.bottom
visible: advancedMode? false: true
property bool selected: VideoEffects.effects.length < 1
property color gradUp: selected?
Qt.rgba(0.75, 0, 0, 1):
Qt.rgba(0.25, 0, 0, 1)
property color gradLow: selected?
Qt.rgba(1, 0, 0, 1):
Qt.rgba(0.5, 0, 0, 1)
onSelectedChanged: {
gradUp = selected?
Qt.rgba(0.75, 0, 0, 1):
Qt.rgba(0.25, 0, 0, 1)
gradLow = selected?
Qt.rgba(1, 0, 0, 1):
Qt.rgba(0.5, 0, 0, 1)
}
gradient: Gradient {
GradientStop {
position: 0
color: effectResetButton.gradUp
}
GradientStop {
position: 1
color: effectResetButton.gradLow
}
}
Label {
id: txtEffectResetButton
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("None")
color: effectResetButton.selected? Qt.rgba(1, 1, 1, 1): Qt.rgba(0.75, 0.75, 0.75, 1)
}
MouseArea {
id: msaEffectResetButton
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onEntered: {
txtEffectResetButton.font.bold = true
effectResetButton.gradUp = effectResetButton.selected?
Qt.rgba(1, 0.25, 0.25, 1):
Qt.rgba(0.5, 0.25, 0.25, 1)
effectResetButton.gradLow = effectResetButton.selected?
Qt.rgba(1, 0.25, 0.25, 1):
Qt.rgba(0.75, 0.25, 0.25, 1)
}
onExited: {
txtEffectResetButton.font.bold = false
txtEffectResetButton.scale = 1
effectResetButton.gradUp = effectResetButton.selected?
Qt.rgba(0.75, 0, 0, 1):
Qt.rgba(0.25, 0, 0, 1)
effectResetButton.gradLow = effectResetButton.selected?
Qt.rgba(1, 0, 0, 1):
Qt.rgba(0.5, 0, 0, 1)
}
onPressed: txtEffectResetButton.scale = 0.75
onReleased: txtEffectResetButton.scale = 1
onClicked: {
lsvEffectList.currentIndex = -1
VideoEffects.effects = []
recEffectBar.curEffect = ""
recEffectBar.curEffectIndex = -1
}
}
}
OptionList {
id: lsvAppliedEffectList
anchors.bottom: recAddEffect.top
anchors.right: parent.right
anchors.left: parent.left
anchors.top: effectResetButton.bottom
textRole: "description"
filter: txtSearchEffect.text
visible: advancedMode? true: false
onCurrentIndexChanged: {
var option = model.get(currentIndex)
recEffectBar.curEffect = option? option.effect: ""
recEffectBar.curEffectIndex = currentIndex
txtSearchEffect.text = ""
}
onVisibleChanged: {
if (visible) {
var option = model.get(currentIndex)
recEffectBar.curEffect = option? option.effect: ""
recEffectBar.curEffectIndex = currentIndex
txtSearchEffect.text = ""
}
}
}
ScrollView {
id: scrollEffects
visible: advancedMode? false: true
anchors.bottom: recAddEffect.top
anchors.right: parent.right
anchors.left: parent.left
anchors.top: effectResetButton.bottom
onVisibleChanged: {
if (!advancedMode)
return
if (visible) {
var option = lsvEffectList.model.get(lsvEffectList.currentIndex)
var effect = option? option.effect: ""
VideoEffects.showPreview(effect)
recEffectBar.curEffect = effect
recEffectBar.curEffectIndex = 0
} else
VideoEffects.removeAllPreviews()
}
OptionList {
id: lsvEffectList
filter: txtSearchEffect.text
textRole: "description"
onCurrentIndexChanged: {
var option = model.get(currentIndex)
if (!option)
return
recEffectBar.lock = true
var effect = option.effect
if (scrollEffects.visible) {
if (advancedMode)
VideoEffects.showPreview(effect)
else {
VideoEffects.effects = []
VideoEffects.appendEffect(effect, false)
}
}
recEffectBar.curEffect = effect
if (!advancedMode)
recEffectBar.curEffectIndex = 0
txtSearchEffect.text = ""
recEffectBar.lock = false
}
}
}
Rectangle {
id: recAddEffect
height: advancedMode? 48: 0
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
visible: advancedMode? true: false
property color gradUp: Qt.rgba(0, 0.5, 0, 1)
property color gradLow: Qt.rgba(0, 1, 0, 1)
gradient: Gradient {
GradientStop {
position: 0
color: recAddEffect.gradUp
}
GradientStop {
position: 1
color: recAddEffect.gradLow
}
}
Image {
id: imgAddEffect
width: 32
height: 32
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
source: "image://icons/webcamoid-add"
sourceSize: Qt.size(width, height)
}
MouseArea {
id: msaAddEffect
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onEntered: {
recAddEffect.gradUp = Qt.rgba(0, 0.75, 0, 1)
recAddEffect.gradLow = Qt.rgba(0.25, 1, 0.25, 1)
}
onExited: {
imgAddEffect.scale = 1
recAddEffect.gradUp = Qt.rgba(0, 0.5, 0, 1)
recAddEffect.gradLow = Qt.rgba(0, 1, 0, 1)
}
onPressed: imgAddEffect.scale = 0.75
onReleased: imgAddEffect.scale = 1
onClicked: {
recEffectBar.state = (recEffectBar.state == "")?
"showEffects": ""
}
}
}
states: [
State {
name: "showEffects"
PropertyChanges {
target: lsvAppliedEffectList
visible: false
}
PropertyChanges {
target: scrollEffects
visible: true
}
PropertyChanges {
target: imgAddEffect
source: "image://icons/webcamoid-down"
}
PropertyChanges {
target: recEffectBar
editMode: true
}
}
]
}
|