1/* Webcamoid, webcam capture application.
2 * Copyright (C) 2016  Gonzalo Exequiel Pedone
3 *
4 * Webcamoid is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Webcamoid is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Webcamoid. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Web-Site: http://webcamoid.github.io/
18 */
19
20import QtQuick 2.7
21import QtQuick.Controls 2.0
22import QtQuick.Layouts 1.3
23
24GridLayout {
25    id: configs
26    columns: 2
27
28    function modeIndex(mode)
29    {
30        var index = -1
31
32        for (var i = 0; i < cbxMode.model.count; i++)
33            if (cbxMode.model.get(i).mode === mode) {
34                index = i
35                break
36            }
37
38        return index
39    }
40
41    Label {
42        text: qsTr("Grab mode")
43    }
44    ComboBox {
45        id: cbxMode
46        textRole: "text"
47        currentIndex: modeIndex(DelayGrab.mode)
48        Layout.fillWidth: true
49
50        model: ListModel {
51            ListElement {
52                text: qsTr("Random square")
53                mode: "RandomSquare"
54            }
55            ListElement {
56                text: qsTr("Vertical increase")
57                mode: "VerticalIncrease"
58            }
59            ListElement {
60                text: qsTr("Horizontal increase")
61                mode: "HorizontalIncrease"
62            }
63            ListElement {
64                text: qsTr("Rings increase")
65                mode: "RingsIncrease"
66            }
67        }
68
69        onCurrentIndexChanged: DelayGrab.mode = cbxMode.model.get(currentIndex).mode
70    }
71
72    Label {
73        text: qsTr("Block size")
74    }
75    TextField {
76        text: DelayGrab.blockSize
77        validator: RegExpValidator {
78            regExp: /\d+/
79        }
80        Layout.fillWidth: true
81
82        onTextChanged: DelayGrab.blockSize = text
83    }
84
85    Label {
86        text: qsTr("N° of frames")
87    }
88    TextField {
89        text: DelayGrab.nFrames
90        validator: RegExpValidator {
91            regExp: /\d+/
92        }
93        Layout.fillWidth: true
94
95        onTextChanged: DelayGrab.nFrames = text
96    }
97}
98