This file is indexed.

/usr/share/webcamoid/qml/main.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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
/* 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.Dialogs 1.2
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import AkQml 1.0
import Webcamoid 1.0
import WebcamoidUpdates 1.0

ApplicationWindow {
    id: wdgMainWidget
    title: Webcamoid.applicationName()
           + " "
           + Webcamoid.applicationVersion()
           + " - "
           + MediaSource.description(MediaSource.stream)
    visible: true
    x: (Screen.desktopAvailableWidth - width) / 2
    y: (Screen.desktopAvailableHeight - height) / 2
    width: Webcamoid.windowWidth
    height: Webcamoid.windowHeight
    color: palette.window

    property bool showEffectBar: false

    function rgbChangeAlpha(color, alpha)
    {
        return Qt.rgba(color.r, color.g, color.b, alpha);
    }

    function togglePlay() {
        if (MediaSource.state === AkElement.ElementStatePlaying) {
            Webcamoid.virtualCameraState = AkElement.ElementStateNull;
            Recording.state = AkElement.ElementStateNull;
            MediaSource.state = AkElement.ElementStateNull;

            if (splitView.state == "showRecordPanels")
                splitView.state = "";
        } else {
            MediaSource.state = AkElement.ElementStatePlaying;

            if (Webcamoid.enableVirtualCamera)
                Webcamoid.virtualCameraState = AkElement.ElementStatePlaying;
        }
    }

    function notifyUpdate(versionType)
    {
        if (Updates.notifyNewVersion
            && versionType == UpdatesT.VersionTypeOld) {
            trayIcon.show();
            trayIcon.showMessage(qsTr("New version available!"),
                                 qsTr("Download %1 %2 NOW!")
                                    .arg(Webcamoid.applicationName())
                                    .arg(Updates.latestVersion));
            notifyTimer.start();
        }
    }

    SystemPalette {
        id: palette
    }
    Timer {
        id: notifyTimer
        repeat: false
        triggeredOnStart: false
        interval: 10000

        onTriggered: trayIcon.hide()
    }

    onWidthChanged: Webcamoid.windowWidth = width
    onHeightChanged: Webcamoid.windowHeight = height
    onClosing: trayIcon.hide()

    Component.onCompleted: {
        if (MediaSource.playOnStart)
            togglePlay();

        notifyUpdate(Updates.versionType);
    }

    Connections {
        target: MediaSource

        onStateChanged: {
            if (state === AkElement.ElementStatePlaying) {
                itmPlayStopButton.text = qsTr("Stop")
                itmPlayStopButton.icon = "image://icons/webcamoid-stop"
                videoDisplay.visible = true
            } else {
                itmPlayStopButton.text = qsTr("Play")
                itmPlayStopButton.icon = "image://icons/webcamoid-play"
                videoDisplay.visible = false
            }
        }
    }
    Connections {
        target: Recording

        onStateChanged: recordingNotice.visible = state === AkElement.ElementStatePlaying
    }
    Connections {
        target: Updates

        onVersionTypeChanged: notifyUpdate(versionType);
    }
    Connections {
        target: trayIcon

        onMessageClicked: Qt.openUrlExternally(Webcamoid.projectDownloadsUrl())
    }

    VideoDisplay {
        id: videoDisplay
        objectName: "videoDisplay"
        visible: false
        smooth: true
        anchors.fill: parent
    }

    Rectangle {
        id: recordingNotice
        color: "black"
        width: 128
        height: 60
        radius: 4
        anchors.top: parent.top
        anchors.topMargin: 16
        anchors.horizontalCenter: parent.horizontalCenter
        visible: false

        onVisibleChanged: {
            if (visible) {
                recordingTimer.startTime = new Date().getTime()
                recordingTimer.start()
            } else
                recordingTimer.stop()
        }

        Image {
            id: recordingIcon
            source: "image://icons/webcamoid-recording"
            sourceSize: Qt.size(width, height)
            width: height
            anchors.left: parent.left
            anchors.leftMargin: 8
            anchors.top: parent.top
            anchors.topMargin: 8
            anchors.bottom: recordingTime.top
        }
        Label {
            text: qsTr("Recording")
            color: "white"
            font.bold: true
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors.left: recordingIcon.right
            anchors.leftMargin: 8
            anchors.right: parent.right
            anchors.rightMargin: 8
            anchors.top: parent.top
            anchors.topMargin: 8
            anchors.bottom: recordingTime.top
        }
        Label {
            id: recordingTime
            color: "white"
            font.bold: true
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors.right: parent.right
            anchors.rightMargin: 8
            anchors.left: parent.left
            anchors.leftMargin: 8
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 8
        }

        Timer {
            id: recordingTimer
            interval: 500
            repeat: true

            property double startTime: new Date().getTime()

            function pad(x)
            {
                return x < 10? "0" + x: x
            }

            onTriggered: {
                var diffTime = (new Date().getTime() - startTime) / 1000
                diffTime = parseInt(diffTime, 10)

                var ss = diffTime % 60;
                diffTime = (diffTime - ss) / 60;
                var mm = diffTime % 60;
                var hh = (diffTime - mm) / 60;

                recordingTime.text = pad(hh) + ":" + pad(mm) + ":" + pad(ss)
            }
        }

        SequentialAnimation on opacity {
            loops: Animation.Infinite
            running: recordingNotice.visible

            PropertyAnimation {
                easing.type: Easing.OutSine
                to: 0
                duration: 1000
            }
            PropertyAnimation {
                easing.type: Easing.InSine
                to: 1
                duration: 1000
            }
        }
    }

    PhotoWidget {
        id: photoWidget
        anchors.bottom: iconBarRect.top
        anchors.bottomMargin: 16
        anchors.horizontalCenter: parent.horizontalCenter
        visible: false

        function savePhoto()
        {
            Recording.takePhoto()
            var suffix = "png";
            var fileName = qsTr("Picture %1.%2")
                                .arg(Webcamoid.currentTime())
                                .arg(suffix)

            var filters = ["PNG file (*.png)",
                           "JPEG file (*.jpg)",
                           "BMP file (*.bmp)",
                           "GIF file (*.gif)"]

            var fileUrl = Webcamoid.saveFileDialog(qsTr("Save photo as..."),
                                     fileName,
                                     Webcamoid.standardLocations("pictures")[0],
                                     "." + suffix,
                                     filters.join(";;"))

            if (fileUrl !== "")
                Recording.savePhoto(fileUrl)
        }

        onTakePhoto: {
            if (useFlash)
                flash.show()
            else
                savePhoto()
        }
    }

    SplitView {
        id: splitView
        anchors.fill: parent
        orientation: Qt.Horizontal
        Layout.minimumWidth: 600

        RowLayout {
            id: leftPanel
            width: 200
            visible: false

            Rectangle {
                color: rgbChangeAlpha(palette.window, 0.9)
                Layout.fillWidth: true
                Layout.fillHeight: true

                MediaBar {
                    id: mdbMediaBar
                    visible: false
                    anchors.fill: parent
                }
                AudioConfig {
                    id: audioConfig
                    visible: false
                    anchors.fill: parent
                }
                EffectBar {
                    id: effectBar
                    visible: false
                    anchors.fill: parent
                    onCurEffectChanged: effectConfig.curEffect = curEffect
                    onCurEffectIndexChanged: effectConfig.curEffectIndex = curEffectIndex
                }
                RecordBar {
                    id: recordBar
                    visible: false
                    anchors.fill: parent
                }
                ConfigBar {
                    id: configBar
                    visible: false
                    anchors.fill: parent

                    onOptionChanged: {
                        if (generalConfig.children[0])
                            generalConfig.children[0].destroy()

                        var options = {
                            "output": "OutputConfig.qml",
                            "general": "GeneralConfig.qml",
                            "plugins": "PluginConfig.qml",
                            "updates": "UpdatesConfig.qml",
                        }

                        if (options[option]) {
                            var component = Qt.createComponent(options[option]);

                            if (component.status === Component.Ready)
                                component.createObject(generalConfig);
                        }
                    }
                }
            }
        }

        Item {
            Layout.fillWidth: true
        }

        RowLayout {
            id: rightPanel
            visible: false
            width: 400

            Rectangle {
                color: rgbChangeAlpha(palette.window, 0.9)
                Layout.fillWidth: true
                Layout.fillHeight: true

                MediaConfig {
                    id: mediaConfig
                    visible: false
                    anchors.fill: parent
                }
                AudioInfo {
                    id: audioInfo
                    visible: false
                    anchors.fill: parent
                    state: audioConfig.state
                }
                EffectConfig {
                    id: effectConfig
                    curEffect: effectBar.curEffect
                    curEffectIndex: effectBar.curEffectIndex
                    editMode: !effectBar.editMode
                    visible: false
                    anchors.fill: parent
                }
                RecordConfig {
                    id: recordConfig
                    anchors.fill: parent
                    visible: false
                }
                ColumnLayout {
                    id: generalConfig
                    anchors.fill: parent
                    visible: false
                }
            }
        }

        states: [
            State {
                name: "showMediaPanels"
                PropertyChanges {
                    target: leftPanel
                    visible: true
                }
                PropertyChanges {
                    target: rightPanel
                    visible: true
                }
                PropertyChanges {
                    target: mdbMediaBar
                    visible: true
                }
                PropertyChanges {
                    target: mediaConfig
                    visible: true
                }
            },
            State {
                name: "showAudioPanels"
                PropertyChanges {
                    target: leftPanel
                    visible: true
                }
                PropertyChanges {
                    target: rightPanel
                    visible: true
                }
                PropertyChanges {
                    target: audioConfig
                    visible: true
                }
                PropertyChanges {
                    target: audioInfo
                    visible: true
                }
            },
            State {
                name: "showPhotoWidget"
                PropertyChanges {
                    target: photoWidget
                    visible: true
                }
            },
            State {
                name: "showEffectPanels"
                PropertyChanges {
                    target: leftPanel
                    visible: true
                }
                PropertyChanges {
                    target: rightPanel
                    visible: true
                }
                PropertyChanges {
                    target: effectBar
                    visible: true
                }
                PropertyChanges {
                    target: effectConfig
                    visible: true
                }
            },
            State {
                name: "showRecordPanels"
                PropertyChanges {
                    target: leftPanel
                    visible: true
                }
                PropertyChanges {
                    target: rightPanel
                    visible: true
                }
                PropertyChanges {
                    target: recordBar
                    visible: true
                }
                PropertyChanges {
                    target: recordConfig
                    visible: true
                }
            },
            State {
                name: "showConfigPanels"
                PropertyChanges {
                    target: leftPanel
                    visible: true
                }
                PropertyChanges {
                    target: rightPanel
                    visible: true
                }
                PropertyChanges {
                    target: configBar
                    visible: true
                }
                PropertyChanges {
                    target: generalConfig
                    visible: true
                }
            }
        ]
    }

    Rectangle {
        id: iconBarRect
        width: height * nIcons
        height: 48
        radius: height / 2
        anchors.bottom: parent.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        opacity: 0.5

        property real nIcons: 8

        gradient: Gradient {
            GradientStop {
                position: 0
                color: Qt.rgba(0.25, 0.25, 0.25, 1)
            }
            GradientStop {
                position: 1
                color: Qt.rgba(0, 0, 0, 1)
            }
        }

        MouseArea {
            id: mouseArea
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.left: parent.left
            anchors.bottom: parent.bottom
            anchors.top: parent.top
            hoverEnabled: true
            onEntered: iconBarRect.opacity = 1
            onExited: iconBarRect.opacity = 0.5

            Rectangle {
                id: btnGoBack
                height: parent.height
                width: height
                color: "#00000000"
                visible: false

                property int margins: 8

                Component.onCompleted: {
                    btnGoBack.width = imgGoBack.width + txtGoBack.width + 3 * btnGoBack.margins
                }

                Rectangle {
                    id: highlighter
                    radius: iconBarRect.radius
                    anchors.fill: parent
                    visible: false
                    gradient: Gradient {
                        GradientStop {
                            position: 0
                            color: Qt.rgba(0.67, 0.5, 1, 0.5)
                        }

                        GradientStop {
                            position: 1
                            color: Qt.rgba(0.5, 0.25, 1, 1)
                        }
                    }
                }
                Image {
                    id: imgGoBack
                    height: parent.height - 2 * btnGoBack.margins
                    anchors.left: parent.left
                    anchors.leftMargin: btnGoBack.margins
                    anchors.verticalCenter: parent.verticalCenter
                    width: height
                    source: "image://icons/webcamoid-go-back"
                    sourceSize: Qt.size(width, height)
                }
                Label {
                    id: txtGoBack
                    text: qsTr("Go back")
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: imgGoBack.right
                    anchors.leftMargin: btnGoBack.margins
                    color: "white"
                }
                MouseArea {
                    anchors.fill: parent
                    hoverEnabled: true
                    cursorShape: Qt.PointingHandCursor

                    onClicked: {
                        iconBarRect.state = ""
                        splitView.state = ""
                    }
                    onPressed: {
                        imgGoBack.scale = 0.75
                        txtGoBack.scale = 0.75
                    }
                    onReleased: {
                        imgGoBack.scale = 1
                        txtGoBack.scale = 1
                    }
                    onEntered: {
                        highlighter.visible = true
                    }
                    onExited: {
                        imgGoBack.scale = 1
                        txtGoBack.scale = 1
                        highlighter.visible = false
                    }
                }
            }

            Row {
                id: iconBar
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.left: parent.left
                anchors.bottom: parent.bottom
                anchors.top: parent.top
                objectName: "IconBar"

                IconBarItem {
                    id: itmPlayStopButton
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("Play")
                    icon: "image://icons/webcamoid-play"

                    onClicked: togglePlay()
                }
                IconBarItem {
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("Configure sources")
                    icon: "image://icons/webcamoid-camera-web"

                    onClicked: {
                        if (splitView.state == "showMediaPanels")
                            splitView.state = ""
                        else
                            splitView.state = "showMediaPanels"
                    }
                }
                IconBarItem {
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("Configure audio")
                    icon: "image://icons/webcamoid-sound"

                    onClicked: {
                        if (splitView.state == "showAudioPanels")
                            splitView.state = ""
                        else
                            splitView.state = "showAudioPanels"
                    }
                }
                IconBarItem {
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("Take a photo")
                    icon: "image://icons/webcamoid-picture"
                    enabled: MediaSource.state === AkElement.ElementStatePlaying

                    onClicked: {
                        if (splitView.state == "showPhotoWidget")
                            splitView.state = ""
                        else
                            splitView.state = "showPhotoWidget"
                    }
                }
                IconBarItem {
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("Record video")
                    icon: "image://icons/webcamoid-video"
                    enabled: MediaSource.state === AkElement.ElementStatePlaying

                    onClicked: {
                        if (splitView.state == "showRecordPanels")
                            splitView.state = ""
                        else
                            splitView.state = "showRecordPanels"
                    }
                }
                IconBarItem {
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("Configure Effects")
                    icon: "image://icons/webcamoid-effects"

                    onClicked: {
                        if (splitView.state == "showEffectPanels")
                            splitView.state = ""
                        else
                            splitView.state = "showEffectPanels"
                    }
                }
                IconBarItem {
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("Preferences")
                    icon: "image://icons/webcamoid-setup"

                    onClicked: {
                        if (splitView.state == "showConfigPanels")
                            splitView.state = ""
                        else
                            splitView.state = "showConfigPanels"
                    }
                }
                IconBarItem {
                    width: iconBarRect.height
                    height: iconBarRect.height
                    text: qsTr("About")
                    icon: "image://icons/webcamoid-help-about"

                    onClicked: about.show()
                }
            }
        }

        states: [
            State {
                name: "showOptions"
                PropertyChanges {
                    target: iconBarRect
                    width: btnGoBack.width
                    radius: 4
                }
                PropertyChanges {
                    target: iconBar
                    visible: false
                }
                PropertyChanges {
                    target: btnGoBack
                    visible: true
                }
            }
        ]
    }

    Flash {
        id: flash

        onTriggered: photoWidget.savePhoto()
    }
    About {
        id: about
    }
}