Aufgrund einer Wartung wird GitLab am 29.10. zwischen 9:00 und 10:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 29.10. between 9:00 and 10:00 am.

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

Pane{
    GridLayout{
        anchors.left: parent.left
        anchors.right: parent.right
14
        rowSpacing: 10
15 16 17 18
        columns: 2
        Label{
            text: "Settings file path:"
        }
19 20
        RowLayout{
            id: root
21
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_SETTINGS_FILE_PATH)
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
            Item{
                Layout.fillWidth: true
                Layout.preferredWidth: inputSettingsPath.implicitWidth
                Layout.preferredHeight: inputSettingsPath.implicitHeight
                Layout.topMargin: 4
                clip: true
                id: wrapper
                TextInputField{
                    id: inputSettingsPath
                    readOnly: true
                    anchors.fill: parent
                    anchors.bottomMargin: 2
                    text: Settings.jsonSettingsFilePath
                }
            }
            Button{
                Layout.minimumWidth: implicitWidth
                Layout.leftMargin: 5
                Layout.preferredHeight: implicitHeight - 15
                text: "Save as"
                onClicked: {
                    fileDialog.openAt(Settings.jsonSettingsFilePath, false, false);
                    fileDialog.callback = function(file){
                        Settings.setJsonSettingsFilePath(file, false);
                    };
                }
            }
            Button{
                Layout.minimumWidth: implicitWidth
                Layout.leftMargin: 5
                Layout.preferredHeight: implicitHeight - 15
                text: "Load from"
                onClicked: {
                    fileDialog.openAt(Settings.jsonSettingsFilePath, false);
                    fileDialog.callback = function(file){
                        if(Settings.setJsonSettingsFilePath(file, true)){
                            popupChangedSettingsFile.visible = true;
                        }else{
                            ErrorNotifier.errorMessage += "You can not load the current opened settings file.";
                        }
                    };
                }
            }
65
        }
Leander Schulten's avatar
Leander Schulten committed
66

67 68 69 70
        Label{
            Layout.fillWidth: true
            text: "Driver file path:"
        }
Leander Schulten's avatar
Leander Schulten committed
71
        TextFieldFileChooser{
72
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_DMX_DRIVER_LIB)
73
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
74 75 76 77
            folder: false
            path: Settings.driverFilePath
            onPathChanged: {Settings.driverFilePath = path;path = Settings.driverFilePath;}
            fileChooser: fileDialog
78
        }
Leander Schulten's avatar
Leander Schulten committed
79

Leander Schulten's avatar
Leander Schulten committed
80 81 82 83
        Label{
            text: "Update pause for dmx in ms:"
        }
        TextInputField{
84
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_DMX_UPDATE_RATE)
Leander Schulten's avatar
Leander Schulten committed
85 86 87 88 89 90 91
            validator: IntValidator{
                bottom: 10
                top: 10000
            }
            text: Settings.updatePauseInMs;
            onAccepted: Settings.updatePauseInMs = text;
        }
Leander Schulten's avatar
Leander Schulten committed
92

93 94 95 96
        Label{
            Layout.fillWidth: true
            text: "Module Directory:"
        }
Leander Schulten's avatar
Leander Schulten committed
97
        TextFieldFileChooser{
98
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
99
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
100 101 102 103
            folder: true
            path: Settings.moduleDirPath
            onPathChanged: {Settings.moduleDirPath = path;path = Settings.moduleDirPath;}
            fileChooser: fileDialog
104
        }
Leander Schulten's avatar
Leander Schulten committed
105

Leander Schulten's avatar
Leander Schulten committed
106 107 108 109
        Label{
            Layout.fillWidth: true
            text: "Compiler File Path:"
        }
Leander Schulten's avatar
Leander Schulten committed
110
        TextFieldFileChooser{
111
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
Leander Schulten's avatar
Leander Schulten committed
112
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
113 114 115 116
            folder: true
            path: Settings.compilerPath
            onPathChanged: {Settings.compilerPath = path;path = Settings.compilerPath;}
            fileChooser: fileDialog
Leander Schulten's avatar
Leander Schulten committed
117
        }
118 119 120 121 122

        Label{
            Layout.fillWidth: true
            text: "Include Path:"
        }
Leander Schulten's avatar
Leander Schulten committed
123
        TextFieldFileChooser{
124
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
125
            Layout.fillWidth: true
Leander Schulten's avatar
Leander Schulten committed
126 127 128 129
            folder: true
            path: Settings.includePath
            onPathChanged: {Settings.includePath = path;path = Settings.includePath;}
            fileChooser: fileDialog
130
        }
Leander Schulten's avatar
Leander Schulten committed
131

132 133 134 135 136
        Label{
            Layout.fillWidth: true
            text: "Compiler Flags:"
        }
        TextInputField{
137
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
138 139 140 141
            Layout.fillWidth: true
            text: Settings.compilerFlags
            onAccepted: Settings.compilerFlags = text;
        }
Leander Schulten's avatar
Leander Schulten committed
142

143 144 145 146 147
        Label{
            Layout.fillWidth: true
            text: "Compiler Library Flags:"
        }
        TextInputField{
148
            enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
149 150 151 152
            Layout.fillWidth: true
            text: Settings.compilerLibraryFlags
            onAccepted: Settings.compilerLibraryFlags = text;
        }
153

154 155 156 157 158 159 160 161 162 163 164
        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()
        }
165 166 167 168 169
        Label{
            Layout.fillWidth: true
            text: "Theme:"
        }
        Button{
170
            enabled: UserManagment.currentUser.havePermission(Permission.MODIFY_THEME)
171 172 173
            text: "Modify Theme and appearance"
            onClicked: modifyThemeWindow.show()
        }
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

        Label{
            Layout.fillWidth: true
            text: "SlideShow:"
        }
        RowLayout{
            Button{
                enabled: SlideShow.hasImages
                text: SlideShow.windowVisibility !== Window.Hidden ? "Hide" : "Show"
                onClicked: {
                    if (SlideShow.windowVisibility === Window.Hidden){
                        SlideShow.windowVisibility = Window.Maximized;
                    } else {
                        SlideShow.windowVisibility = Window.Minimized;
                    }
                }
                ToolTip.visible: hovered
                ToolTip.text: text + "s the slideshow window"
            }

            TextInputField{
                text: SlideShow.showTimeInSeconds
                onEditingFinished: SlideShow.showTimeInSeconds = text;
                Layout.minimumWidth: 20
                Layout.rightMargin: 8
                validator: IntValidator{
                    bottom: 1
                }
                MouseArea{
                    anchors.fill: parent
                    acceptedButtons: Qt.NoButton
                    hoverEnabled: true
                    ToolTip.visible: containsMouse
                    ToolTip.text: "How long a image should be displayed (in seconds)"
                }
            }
            ComboBox{
                Layout.preferredWidth: implicitWidth + 20
                model: ["Random", "Oldest first", "Newest first", "Name A-Z", "Name Z-A"]
                currentIndex: SlideShow.showOrder
                onCurrentIndexChanged: SlideShow.showOrder = currentIndex;
                ToolTip.visible: hovered
                ToolTip.text: "The order in which the images are displayed"
            }

            TextFieldFileChooser{
                Layout.fillWidth: true
                folder: true
                path: SlideShow.path
                onPathChanged: SlideShow.path = path;
                fileChooser: fileDialog
                MouseArea{
                    anchors.fill: parent
                    acceptedButtons: Qt.NoButton
                    hoverEnabled: true
                    ToolTip.visible: containsMouse
                    ToolTip.text: "The path to the folder with the images"
                }
            }
        }

235
    }
236
    SystemDialog.FileDialog{
237
        property var callback;
238 239 240
        selectExisting: false
        defaultSuffix: ".json"
        function openAt(path, isFolder, selectExisting_ = true){
241 242
            selectFolder = isFolder;
            folder = pathToUrl(path);
243
            selectExisting = selectExisting_;
244 245
            open();
        }
246
        id: fileDialog
247 248
        title: "Please choose a file"
        onAccepted: {
249 250 251 252 253 254
            if(callback){
                callback(urlToPath(fileDialog.fileUrl));
            }else{
                console.error("Error in File Dialog in SettingsView: No callback provided!")
            }
        }
255
    }
256 257 258 259 260 261 262 263 264 265 266 267 268
    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
        }
    }
269 270 271 272 273 274 275 276 277 278 279 280
    Dialog{
        id: popupChangedSettingsFile
        modal: true
        margins: 50
        x: (parent.width - width) / 2
        y: 0
        closePolicy: Popup.NoAutoClose
        title: "Do you want to restart the light control now to load the settings file?"
        standardButtons: Dialog.No | Dialog.Yes
        onAccepted: Qt.quit();
    }

281
}