123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- import QtQuick 2.12
- import QtQuick.Layouts 1.3
- import QtQuick.Controls 2.5
- import QtQuick.Controls.Material 2.3
- import QtQuick.Dialogs 1.0
- Page {
- width: 1280
- height: 570
- id: settingsForm
- font.capitalization: Font.MixedCase
- Connections {
- target: _qmlHandler
- onCloseWindow: {
- window.close()
- }
- onLoadSettings: {
- settingsSaveIpSwitch.checked = saveIP
- settingsSaveUsernameSwitch.checked = saveUsername
- settingsCliPath.text = "CLI-Path: " + cliPath
- settingsKeyPath.text = " " + keyPath
- }
- onKeyfileStatus: {
- if (success) {
- settingsKeyStatus.text = "Keyfile: OK"
- settingsKeyStatus.color = "#00ad11"
- } else {
- settingsKeyStatus.text = "Keyfile: Error"
- settingsKeyStatus.color = "#df3f3f"
- settingsKeyPath.text = msg
- }
- }
- onKeyfileClosedOK: {
- settingsKeyStatus.text = "Keyfile:"
- settingsKeyStatus.color = "#000000"
- settingsKeyPath.text = " "
- }
- }
- ColumnLayout {
- anchors.fill: parent
- RowLayout {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: parent.width
- Layout.preferredHeight: 400
- Layout.bottomMargin: 20
- ColumnLayout {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 500
- Layout.preferredHeight: parent.height
- Text {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 400
- Layout.preferredHeight: 50
- text: "Autofill default IP on start:"
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
- font.pixelSize: 20
- }
- Text {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 400
- Layout.preferredHeight: 50
- text: "Autofill default username on start:"
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
- font.pixelSize: 20
- }
- Text {
- id: settingsCliPath
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 400
- Layout.preferredHeight: 50
- text: "CLI-Path: "
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
- font.pixelSize: 20
- }
- Text {
- id: settingsKeyStatus
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 400
- Layout.preferredHeight: 50
- text: "Keyfile:"
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
- font.pixelSize: 20
- }
- Text {
- id: settingsKeyPath
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 400
- Layout.preferredHeight: 50
- text: " "
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
- font.pixelSize: 20
- }
- Text {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 400
- Layout.preferredHeight: 50
- text: "Delete my account:"
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
- font.pixelSize: 20
- }
- }
- ColumnLayout {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 500
- Layout.preferredHeight: parent.height
- Switch {
- id: settingsSaveIpSwitch
- Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: 50
- Layout.preferredWidth: 400
- text: ""
- checked: false
- display: AbstractButton.IconOnly
- }
- Switch {
- id: settingsSaveUsernameSwitch
- Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: 50
- Layout.preferredWidth: 400
- text: ""
- checked: false
- display: AbstractButton.IconOnly
- }
- Button {
- id: settingsChangeCliPathButton
- Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: 50
- Layout.preferredWidth: 220
- text: "Change (req. restart)"
- font.pixelSize: 20
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- settingsCliDialog.open()
- }
- }
- ColumnLayout {
- Layout.alignment: Qt.AlignCenter
- Button {
- id: settingsChangeKeyfilePathButton
- Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: 50
- Layout.preferredWidth: 220
- text: "Select"
- font.pixelSize: 20
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- settingsKeyfileDialog.open()
- }
- }
- Button {
- id: settingsDisableKeyfile
- Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: 50
- Layout.preferredWidth: 220
- text: "Close Keyfile"
- font.pixelSize: 20
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- _qmlHandler.onKeyfileClosed()
- }
- }
- }
- Button {
- id: settingsDeleteMeButton
- Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: 50
- Layout.preferredWidth: 150
- text: "Delete Me"
- font.pixelSize: 20
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- deleteMePopup.open()
- }
- }
- }
- }
- Rectangle {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: parent.width
- Layout.preferredHeight: 2
- color: Material.accent
- }
- RowLayout {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: parent.width
- Layout.preferredHeight: 50
- Layout.bottomMargin: 20
- Button {
- id: settingsResetButton
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 200
- Layout.preferredHeight: 50
- text: "Select defaults"
- font.pixelSize: 20
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- _qmlHandler.onSettingsResetButton()
- }
- }
- Button {
- id: settingsSaveButton
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 200
- Layout.preferredHeight: 50
- text: "Save Changes"
- font.pixelSize: 20
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- _qmlHandler.onSettingsSaveButton(
- settingsSaveIpSwitch.checked,
- settingsSaveUsernameSwitch.checked,
- // @disable-check M222
- settingsCliPath.text.replace("CLI-Path: ",
- ""),
- // @disable-check M222
- settingsKeyPath.text.replace(" ", ""))
- }
- }
- Button {
- id: settingsRevertChangesButton
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: 200
- Layout.preferredHeight: 50
- text: "Revert Changes"
- font.pixelSize: 20
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- _qmlHandler.onSettingsRevertChangesButton()
- }
- }
- }
- }
- FileDialog {
- id: settingsCliDialog
- nameFilters: ["CLI file (ccats-cli)"]
- title: "Please select the CLI File"
- folder: shortcuts.home
- // @disable-check M223
- onAccepted: {
- var path = settingsCliDialog.fileUrl.toString()
- // @disable-check M222
- path = path.replace(/^(file:\/{2})/, "")
- settingsCliPath.text = "CLI-Path: " + path
- }
- }
- FileDialog {
- id: settingsKeyfileDialog
- title: "Select keyfile to use"
- folder: shortcuts.home
- // @disable-check M223
- onAccepted: {
- var path = settingsKeyfileDialog.fileUrl.toString()
- // @disable-check M222
- path = path.replace(/^(file:\/{2})/, "")
- settingsKeyPath.text = " " + path
- // @disable-check M222
- _qmlHandler.onKeyfileSelected(path)
- }
- }
- DeleteMePopup {
- id: deleteMePopup
- }
- }
|