SettingsView.qml 3.76 KB
Newer Older
1
import QtQuick 2.9
2
import QtQuick.Controls 2.2
3
import QtQuick.Layouts 1.3
4
import QtQuick.Dialogs 1.2
Leander Schulten's avatar
Leander Schulten committed
5
import "components"
6
7
8
9
10

Pane{
    GridLayout{
        anchors.left: parent.left
        anchors.right: parent.right
11
        rowSpacing: 16
12
13
14
15
        columns: 2
        Label{
            text: "Settings file path:"
        }
Leander Schulten's avatar
Leander Schulten committed
16
17
18
19
20
21
        TextFieldFileChooser{
            Layout.fillWidth: true
            folder: false
            path: Settings.jsonSettingsFilePath
            onPathChanged: {Settings.jsonSettingsFilePath = path;path = Settings.jsonSettingsFilePath;}
            fileChooser: fileDialog
22
        }
Leander Schulten's avatar
Leander Schulten committed
23

24
25
26
27
        Label{
            Layout.fillWidth: true
            text: "Driver file path:"
        }
Leander Schulten's avatar
Leander Schulten committed
28
        TextFieldFileChooser{
29
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
30
31
32
33
            folder: false
            path: Settings.driverFilePath
            onPathChanged: {Settings.driverFilePath = path;path = Settings.driverFilePath;}
            fileChooser: fileDialog
34
        }
Leander Schulten's avatar
Leander Schulten committed
35

Leander Schulten's avatar
Leander Schulten committed
36
37
38
39
40
41
42
43
44
45
46
        Label{
            text: "Update pause for dmx in ms:"
        }
        TextInputField{
            validator: IntValidator{
                bottom: 10
                top: 10000
            }
            text: Settings.updatePauseInMs;
            onAccepted: Settings.updatePauseInMs = text;
        }
Leander Schulten's avatar
Leander Schulten committed
47

48
49
50
51
        Label{
            Layout.fillWidth: true
            text: "Module Directory:"
        }
Leander Schulten's avatar
Leander Schulten committed
52
        TextFieldFileChooser{
53
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
54
55
56
57
            folder: true
            path: Settings.moduleDirPath
            onPathChanged: {Settings.moduleDirPath = path;path = Settings.moduleDirPath;}
            fileChooser: fileDialog
58
        }
Leander Schulten's avatar
Leander Schulten committed
59

Leander Schulten's avatar
Leander Schulten committed
60
61
62
63
        Label{
            Layout.fillWidth: true
            text: "Compiler File Path:"
        }
Leander Schulten's avatar
Leander Schulten committed
64
        TextFieldFileChooser{
Leander Schulten's avatar
Leander Schulten committed
65
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
66
67
68
69
            folder: true
            path: Settings.compilerPath
            onPathChanged: {Settings.compilerPath = path;path = Settings.compilerPath;}
            fileChooser: fileDialog
Leander Schulten's avatar
Leander Schulten committed
70
        }
71
72
73
74
75

        Label{
            Layout.fillWidth: true
            text: "Include Path:"
        }
Leander Schulten's avatar
Leander Schulten committed
76
        TextFieldFileChooser{
77
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
78
79
80
81
            folder: true
            path: Settings.includePath
            onPathChanged: {Settings.includePath = path;path = Settings.includePath;}
            fileChooser: fileDialog
82
        }
Leander Schulten's avatar
Leander Schulten committed
83

84
85
86
87
88
89
90
91
92
        Label{
            Layout.fillWidth: true
            text: "Compiler Flags:"
        }
        TextInputField{
            Layout.fillWidth: true
            text: Settings.compilerFlags
            onAccepted: Settings.compilerFlags = text;
        }
Leander Schulten's avatar
Leander Schulten committed
93

94
95
96
97
98
99
100
101
102
        Label{
            Layout.fillWidth: true
            text: "Compiler Library Flags:"
        }
        TextInputField{
            Layout.fillWidth: true
            text: Settings.compilerLibraryFlags
            onAccepted: Settings.compilerLibraryFlags = text;
        }
103

104
105
106
107
108
109
110
111
112
113
114
        Label{
            Layout.fillWidth: true
            text: "Audio Capture Device:"
        }
        ComboBox{
            model: AudioManager.captureDeviceNames
            Layout.fillWidth: true
            onActivated: AudioManager.currentCaptureDevice = index
            currentIndex: AudioManager.currentCaptureDevice
            onDownChanged: if(down)AudioManager.updateCaptureDeviceList()
        }
115
116
    }
    FileDialog{
117
        property var callback;
118
119
120
121
122
        function openAt(path, isFolder){
            selectFolder = isFolder;
            folder = pathToUrl(path);
            open();
        }
123
        id: fileDialog
124
125
        title: "Please choose a file"
        onAccepted: {
126
127
128
129
130
131
            if(callback){
                callback(urlToPath(fileDialog.fileUrl));
            }else{
                console.error("Error in File Dialog in SettingsView: No callback provided!")
            }
        }
132
133
    }
}