diff --git a/advancedSettings.pro b/advancedSettings.pro index 9630f15..45c0691 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -163,4 +163,6 @@ DISTFILES += \ src/res/qml/LineSeparator.qml \ src/res/qml/utilities_page/keyboard_utils/* \ src/res/qml/utilities_page/desktop_size/* \ - src/res/qml/utilities_page/alarm_clock/* + src/res/qml/utilities_page/alarm_clock/* \ + src/res/qml/audio_page/dialog_boxes/* \ + src/res/qml/audio_page/dialog_boxes/AudioDeleteProfileDialog.qml diff --git a/src/res/qml/audio_page/AudioPage.qml b/src/res/qml/audio_page/AudioPage.qml index 8561b21..6a6811c 100644 --- a/src/res/qml/audio_page/AudioPage.qml +++ b/src/res/qml/audio_page/AudioPage.qml @@ -2,7 +2,8 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 import matzman666.advsettings 1.0 -import ".." +import ".." //common imports +import "dialog_boxes" MyStackViewPage { width: 1200 @@ -11,38 +12,16 @@ MyStackViewPage { property bool componentCompleted: false - MyDialogOkPopup { + AudioMessageDialog { id: audioMessageDialog - function showMessage(title, text) { - dialogTitle = title - dialogText = text - open() - } } - MyDialogOkCancelPopup { + PttDeleteProfileDialog { id: pttDeleteProfileDialog - property int profileIndex: -1 - dialogTitle: "Delete Profile" - dialogText: "Do you really want to delete this ptt profile?" - onClosed: { - if (okClicked) { - AudioTabController.deletePttProfile(profileIndex) - } - } } - MyDialogOkCancelPopup { + AudioDeleteProfileDialog { id: audioDeleteProfileDialog - property int profileIndex: -1 - dialogTitle: "Delete Profile" - dialogText: "Do you really want to delete this audio profile?" - onClosed: { - if (okClicked) { - AudioTabController.deleteAudioProfile(profileIndex) - pttProfileComboBox.currentIndex = 0 - } - } } PttControllerConfigDialog { @@ -50,101 +29,12 @@ MyStackViewPage { pttControllerConfigClass: AudioTabController } - MyDialogOkCancelPopup { + PttNewProfileDialog { id: pttNewProfileDialog - dialogTitle: "Create New PTT Profile" - dialogWidth: 600 - dialogHeight: 220 - dialogContentItem: ColumnLayout { - RowLayout { - Layout.topMargin: 16 - Layout.leftMargin: 16 - Layout.rightMargin: 16 - MyText { - text: "Name: " - } - MyTextField { - id: pttNewProfileName - keyBoardUID: 590 - color: "#cccccc" - text: "" - Layout.fillWidth: true - font.pointSize: 20 - function onInputEvent(input) { - pttNewProfileName.text = input - } - } - } - } - onClosed: { - if (okClicked) { - if (pttNewProfileName.text != "") { - AudioTabController.addPttProfile(pttNewProfileName.text) - - } else { - audioMessageDialog.showMessage("Create New Profile", "ERROR: No name given.") - } - } - } - function openPopup() { - pttNewProfileName.text = "" - open() - } } - - MyDialogOkCancelPopup { + AudioNewProfileDialog { id: audioNewProfileDialog - dialogTitle: "Create New Audio Profile" - dialogWidth: 600 - dialogHeight: 300 - dialogContentItem: ColumnLayout { - RowLayout { - Layout.topMargin: 16 - Layout.leftMargin: 16 - Layout.rightMargin: 16 - MyText { - text: "Name: " - } - MyTextField { - id: audioNewProfileName - keyBoardUID: 590 - color: "#cccccc" - text: "" - Layout.fillWidth: true - font.pointSize: 20 - function onInputEvent(input) { - audioNewProfileName.text = input - } - } - } - RowLayout { - Layout.topMargin: 16 - Layout.leftMargin: 16 - Layout.rightMargin: 16 - MyToggleButton { - id: audioDefaultProfileToggle - Layout.preferredWidth: 250 - text: "Make Default" - onCheckedChanged: { - AudioTabController.setAudioProfileDefault(checked, false) - } - } - } - } - onClosed: { - if (okClicked) { - if (audioNewProfileName.text != "") { - AudioTabController.addAudioProfile(audioNewProfileName.text) - } else { - audioMessageDialog.showMessage("Create New Profile", "ERROR: No name given.") - } - } - } - function openPopup() { - audioNewProfileName.text = "" - open() - } } content: ColumnLayout { @@ -572,7 +462,6 @@ MyStackViewPage { audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification audioPttReverseToggle.checked = AudioTabController.micReversePtt - audioDefaultProfileToggle.checked = AudioTabController.audioProfileDefault componentCompleted = true } diff --git a/src/res/qml/audio_page/dialog_boxes/AudioDeleteProfileDialog.qml b/src/res/qml/audio_page/dialog_boxes/AudioDeleteProfileDialog.qml new file mode 100644 index 0000000..32fc49c --- /dev/null +++ b/src/res/qml/audio_page/dialog_boxes/AudioDeleteProfileDialog.qml @@ -0,0 +1,18 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import matzman666.advsettings 1.0 +import "../.." //common imports + +MyDialogOkCancelPopup { + id: audioDeleteProfileDialog + property int profileIndex: -1 + dialogTitle: "Delete Profile" + dialogText: "Do you really want to delete this audio profile?" + onClosed: { + if (okClicked) { + AudioTabController.deleteAudioProfile(profileIndex) + pttProfileComboBox.currentIndex = 0 + } + } +} diff --git a/src/res/qml/audio_page/dialog_boxes/AudioMessageDialog.qml b/src/res/qml/audio_page/dialog_boxes/AudioMessageDialog.qml new file mode 100644 index 0000000..c9cc549 --- /dev/null +++ b/src/res/qml/audio_page/dialog_boxes/AudioMessageDialog.qml @@ -0,0 +1,14 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import matzman666.advsettings 1.0 +import "../.." //common imports + +MyDialogOkPopup { + id: audioMessageDialog + function showMessage(title, text) { + dialogTitle = title + dialogText = text + open() + } +} diff --git a/src/res/qml/audio_page/dialog_boxes/AudioNewProfileDialog.qml b/src/res/qml/audio_page/dialog_boxes/AudioNewProfileDialog.qml new file mode 100644 index 0000000..af227b3 --- /dev/null +++ b/src/res/qml/audio_page/dialog_boxes/AudioNewProfileDialog.qml @@ -0,0 +1,63 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import matzman666.advsettings 1.0 +import "../.." //common imports + +MyDialogOkCancelPopup { + id: audioNewProfileDialog + dialogTitle: "Create New Audio Profile" + dialogWidth: 600 + dialogHeight: 300 + dialogContentItem: ColumnLayout { + RowLayout { + Layout.topMargin: 16 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + MyText { + text: "Name: " + } + MyTextField { + id: audioNewProfileName + keyBoardUID: 590 + color: "#cccccc" + text: "" + Layout.fillWidth: true + font.pointSize: 20 + function onInputEvent(input) { + audioNewProfileName.text = input + } + } + } + RowLayout { + id: test + Layout.topMargin: 16 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + MyToggleButton { + id: audioDefaultProfileToggle + Layout.preferredWidth: 250 + text: "Make Default" + onCheckedChanged: { + AudioTabController.setAudioProfileDefault(checked, false) + } + } + Component.onCompleted: { + audioDefaultProfileToggle.checked = AudioTabController.audioProfileDefault + } + } + } + onClosed: { + if (okClicked) { + if (audioNewProfileName.text != "") { + AudioTabController.addAudioProfile(audioNewProfileName.text) + } else { + audioMessageDialog.showMessage("Create New Profile", "ERROR: No name given.") + } + } + } + function openPopup() { + audioNewProfileName.text = "" + open() + } +} diff --git a/src/res/qml/audio_page/dialog_boxes/PttDeleteProfileDialog.qml b/src/res/qml/audio_page/dialog_boxes/PttDeleteProfileDialog.qml new file mode 100644 index 0000000..9d53ea5 --- /dev/null +++ b/src/res/qml/audio_page/dialog_boxes/PttDeleteProfileDialog.qml @@ -0,0 +1,17 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import matzman666.advsettings 1.0 +import "../.." //common imports + +MyDialogOkCancelPopup { + id: pttDeleteProfileDialog + property int profileIndex: -1 + dialogTitle: "Delete Profile" + dialogText: "Do you really want to delete this ptt profile?" + onClosed: { + if (okClicked) { + AudioTabController.deletePttProfile(profileIndex) + } + } +} diff --git a/src/res/qml/audio_page/dialog_boxes/PttNewProfileDialog.qml b/src/res/qml/audio_page/dialog_boxes/PttNewProfileDialog.qml new file mode 100644 index 0000000..45ef8d3 --- /dev/null +++ b/src/res/qml/audio_page/dialog_boxes/PttNewProfileDialog.qml @@ -0,0 +1,47 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import matzman666.advsettings 1.0 +import "../.." //common imports + +MyDialogOkCancelPopup { + id: pttNewProfileDialog + dialogTitle: "Create New PTT Profile" + dialogWidth: 600 + dialogHeight: 220 + dialogContentItem: ColumnLayout { + RowLayout { + Layout.topMargin: 16 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + MyText { + text: "Name: " + } + MyTextField { + id: pttNewProfileName + keyBoardUID: 590 + color: "#cccccc" + text: "" + Layout.fillWidth: true + font.pointSize: 20 + function onInputEvent(input) { + pttNewProfileName.text = input + } + } + } + } + onClosed: { + if (okClicked) { + if (pttNewProfileName.text != "") { + AudioTabController.addPttProfile(pttNewProfileName.text) + + } else { + audioMessageDialog.showMessage("Create New Profile", "ERROR: No name given.") + } + } + } + function openPopup() { + pttNewProfileName.text = "" + open() + } +}