Refactor PTT buttons into separate file

The PttControllerConfigDialog was not used by anything else, hence it
makes sense to move it into a more limited scope.

The PttControllerConfigDialog file itself is only used by AudioPage and
AccessibilityPage. Since the AccessibilityPage is going to be removed
the PttControllerConfigDialog should be moved into the audio_page
folder.
This commit is contained in:
Vasily
2019-02-01 19:28:18 +01:00
parent 394482e63a
commit b810be3eb8
2 changed files with 70 additions and 55 deletions
+2 -55
View File
@@ -6,6 +6,7 @@ import ".." //common imports
import "dialog_boxes"
import "device_selector"
import "proximity"
import "push_to_talk"
MyStackViewPage {
width: 1200
@@ -23,11 +24,6 @@ MyStackViewPage {
id: audioDeleteProfileDialog
}
PttControllerConfigDialog {
id: pttControllerConfigDialog
pttControllerConfigClass: AudioTabController
}
PttNewProfileDialog {
id: pttNewProfileDialog
}
@@ -51,44 +47,7 @@ MyStackViewPage {
spacing: 18
ProximityToggle {
}
RowLayout {
MyToggleButton {
id: audioPttEnabledToggle
Layout.preferredWidth: 260
text: "Push-to-Talk:"
onClicked: {
AudioTabController.pttEnabled = checked
}
}
MyToggleButton {
id: audioPttLeftControllerToggle
text: "Left Controller"
onClicked: {
AudioTabController.setPttLeftControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(0)
}
}
Item {
Layout.fillWidth: true
}
MyToggleButton {
id: audioPttRightControllerToggle
text: "Right Controller"
onClicked: {
AudioTabController.setPttRightControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(1)
}
}
PttButtons {
}
RowLayout {
@@ -227,9 +186,6 @@ MyStackViewPage {
Component.onCompleted: {
reloadPttProfiles()
reloadAudioProfiles()
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification
audioPttReverseToggle.checked = AudioTabController.micReversePtt
}
@@ -239,18 +195,9 @@ MyStackViewPage {
onMicReversePttChanged: {
audioPttReverseToggle.checked = AudioTabController.micReversePtt
}
onPttEnabledChanged: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
}
onPttShowNotificationChanged: {
audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification
}
onPttLeftControllerEnabledChanged: {
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
}
onPttRightControllerEnabledChanged: {
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
}
onPttProfilesUpdated: {
reloadPttProfiles()
}
@@ -0,0 +1,68 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import matzman666.advsettings 1.0
import "../.." //common imports
RowLayout {
PttControllerConfigDialog {
id: pttControllerConfigDialog
pttControllerConfigClass: AudioTabController
}
MyToggleButton {
id: audioPttEnabledToggle
Layout.preferredWidth: 260
text: "Push-to-Talk:"
onClicked: {
AudioTabController.pttEnabled = checked
}
}
MyToggleButton {
id: audioPttLeftControllerToggle
text: "Left Controller"
onClicked: {
AudioTabController.setPttLeftControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(0)
}
}
Item {
Layout.fillWidth: true
}
MyToggleButton {
id: audioPttRightControllerToggle
text: "Right Controller"
onClicked: {
AudioTabController.setPttRightControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(1)
}
}
Component.onCompleted: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
}
Connections {
target: AudioTabController
onPttEnabledChanged: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
}
onPttLeftControllerEnabledChanged: {
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
}
onPttRightControllerEnabledChanged: {
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
}
}
}