SettingsView.qml 4.41 KB
Newer Older
1
2
3
4
5
6
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.12
import QtQuick.Dialogs 1.3
import QtQuick.Window 2.12
Leander Schulten's avatar
Leander Schulten committed
7
import "components"
8
9
10
11
12

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

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

Leander Schulten's avatar
Leander Schulten committed
38
39
40
41
42
43
44
45
46
47
48
        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
49

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

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

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

86
87
88
89
90
91
92
93
94
        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
95

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

106
107
108
109
110
111
112
113
114
115
116
        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()
        }
117
118
119
120
121
122
123
124
        Label{
            Layout.fillWidth: true
            text: "Theme:"
        }
        Button{
            text: "Modify Theme and appearance"
            onClicked: modifyThemeWindow.show()
        }
125
126
    }
    FileDialog{
127
        property var callback;
128
129
130
131
132
        function openAt(path, isFolder){
            selectFolder = isFolder;
            folder = pathToUrl(path);
            open();
        }
133
        id: fileDialog
134
135
        title: "Please choose a file"
        onAccepted: {
136
137
138
139
140
141
            if(callback){
                callback(urlToPath(fileDialog.fileUrl));
            }else{
                console.error("Error in File Dialog in SettingsView: No callback provided!")
            }
        }
142
    }
143
144
145
146
147
148
149
150
151
152
153
154
155
    Window{
        id: modifyThemeWindow
        flags: Qt.WindowStaysOnTopHint | Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
        title: "Modify Theme"
        color: pane.Material.background
        width: 350
        height: 350
        Material.theme: Settings.theme
        ModifyThemePane{
            id: pane
            anchors.fill: parent
        }
    }
156
}