Refactor profile buttons and popups
The popups have been moved inside the scope of the ProfileButtons. Since the popups open based on the location of their parents, they are currently opening underneath where they used to open. Since the profiles and ptt settings do not work anyway, this is seen as acceptable.
This commit is contained in:
@@ -166,3 +166,6 @@ DISTFILES += \
|
|||||||
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/* \
|
||||||
src/res/qml/audio_page/device_selector/*
|
src/res/qml/audio_page/device_selector/*
|
||||||
|
src/res/qml/audio_page/proximity/*
|
||||||
|
src/res/qml/audio_page/push_to_talk/*
|
||||||
|
src/res/qml/audio_page/profiles/*
|
||||||
|
|||||||
@@ -3,35 +3,15 @@ import QtQuick.Controls 2.0
|
|||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import matzman666.advsettings 1.0
|
import matzman666.advsettings 1.0
|
||||||
import ".." //common imports
|
import ".." //common imports
|
||||||
import "dialog_boxes"
|
|
||||||
import "device_selector"
|
import "device_selector"
|
||||||
import "proximity"
|
import "proximity"
|
||||||
import "push_to_talk"
|
import "push_to_talk"
|
||||||
|
import "profiles"
|
||||||
|
|
||||||
MyStackViewPage {
|
MyStackViewPage {
|
||||||
width: 1200
|
width: 1200
|
||||||
headerText: "Audio Settings"
|
headerText: "Audio Settings"
|
||||||
|
|
||||||
AudioMessageDialog {
|
|
||||||
id: audioMessageDialog
|
|
||||||
}
|
|
||||||
|
|
||||||
PttDeleteProfileDialog {
|
|
||||||
id: pttDeleteProfileDialog
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioDeleteProfileDialog {
|
|
||||||
id: audioDeleteProfileDialog
|
|
||||||
}
|
|
||||||
|
|
||||||
PttNewProfileDialog {
|
|
||||||
id: pttNewProfileDialog
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioNewProfileDialog {
|
|
||||||
id: audioNewProfileDialog
|
|
||||||
}
|
|
||||||
|
|
||||||
content: ColumnLayout {
|
content: ColumnLayout {
|
||||||
spacing: 24
|
spacing: 24
|
||||||
|
|
||||||
@@ -49,164 +29,8 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
PttButtons {
|
PttButtons {
|
||||||
}
|
}
|
||||||
|
ProfileButtons {
|
||||||
RowLayout {
|
|
||||||
spacing: 10
|
|
||||||
|
|
||||||
MyText {
|
|
||||||
Layout.preferredWidth: 150
|
|
||||||
text: "Audio Profile:"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
MyComboBox {
|
|
||||||
id: audioProfileComboBox
|
|
||||||
Layout.preferredWidth: 250
|
|
||||||
model: [""]
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
if (currentIndex > 0) {
|
|
||||||
audioApplyProfileButton.enabled = true
|
|
||||||
audioDeleteProfileButton.enabled = true
|
|
||||||
} else {
|
|
||||||
audioApplyProfileButton.enabled = false
|
|
||||||
audioDeleteProfileButton.enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPushButton {
|
|
||||||
id: audioApplyProfileButton
|
|
||||||
enabled: true
|
|
||||||
Layout.preferredWidth: 150
|
|
||||||
text: "Apply"
|
|
||||||
onClicked: {
|
|
||||||
if (audioProfileComboBox.currentIndex > 0) {
|
|
||||||
AudioTabController.applyAudioProfile(audioProfileComboBox.currentIndex - 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyText {
|
|
||||||
text: "PTT Profile:"
|
|
||||||
Layout.preferredWidth: 150
|
|
||||||
}
|
|
||||||
|
|
||||||
MyComboBox {
|
|
||||||
id: pttProfileComboBox
|
|
||||||
Layout.preferredWidth: 250
|
|
||||||
model: [""]
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
if (currentIndex > 0) {
|
|
||||||
pttApplyProfileButton.enabled = true
|
|
||||||
pttDeleteProfileButton.enabled = true
|
|
||||||
} else {
|
|
||||||
pttApplyProfileButton.enabled = false
|
|
||||||
pttDeleteProfileButton.enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPushButton {
|
|
||||||
id: pttApplyProfileButton
|
|
||||||
enabled: true
|
|
||||||
Layout.preferredWidth: 150
|
|
||||||
text: "Apply"
|
|
||||||
onClicked: {
|
|
||||||
if (pttProfileComboBox.currentIndex > 0) {
|
|
||||||
AudioTabController.applyPttProfile(pttProfileComboBox.currentIndex - 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RowLayout {
|
|
||||||
spacing: 18
|
|
||||||
|
|
||||||
MyPushButton {
|
|
||||||
id: audioDeleteProfileButton
|
|
||||||
enabled: true
|
|
||||||
Layout.preferredWidth: 200
|
|
||||||
text: "Delete Profile"
|
|
||||||
onClicked: {
|
|
||||||
if (audioProfileComboBox.currentIndex > 0) {
|
|
||||||
audioDeleteProfileDialog.profileIndex = audioProfileComboBox.currentIndex - 1
|
|
||||||
audioDeleteProfileDialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MyPushButton {
|
|
||||||
Layout.preferredWidth: 200
|
|
||||||
text: "New Profile"
|
|
||||||
onClicked: {
|
|
||||||
audioNewProfileDialog.openPopup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
MyPushButton {
|
|
||||||
id: pttDeleteProfileButton
|
|
||||||
enabled: true
|
|
||||||
Layout.preferredWidth: 200
|
|
||||||
text: "Delete Profile"
|
|
||||||
onClicked: {
|
|
||||||
if (pttProfileComboBox.currentIndex > 0) {
|
|
||||||
pttDeleteProfileDialog.profileIndex = pttProfileComboBox.currentIndex - 1
|
|
||||||
pttDeleteProfileDialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MyPushButton {
|
|
||||||
Layout.preferredWidth: 200
|
|
||||||
text: "New Profile"
|
|
||||||
onClicked: {
|
|
||||||
pttNewProfileDialog.openPopup()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
reloadPttProfiles()
|
|
||||||
reloadAudioProfiles()
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: AudioTabController
|
|
||||||
onPttProfilesUpdated: {
|
|
||||||
reloadPttProfiles()
|
|
||||||
}
|
|
||||||
onAudioProfilesUpdated: {
|
|
||||||
reloadAudioProfiles()
|
|
||||||
}
|
|
||||||
onAudioProfileAdded:{
|
|
||||||
audioProfileComboBox.currentIndex = AudioTabController.getAudioProfileCount()
|
|
||||||
}
|
|
||||||
onPttProfileAdded:{
|
|
||||||
pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
|
|
||||||
}
|
|
||||||
onDefaultProfileDisplay:{
|
|
||||||
audioProfileComboBox.currentIndex = AudioTabController.getDefaultAudioProfileIndex() + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadPttProfiles() {
|
|
||||||
var profiles = [""]
|
|
||||||
var profileCount = AudioTabController.getPttProfileCount()
|
|
||||||
for (var i = 0; i < profileCount; i++) {
|
|
||||||
profiles.push(AudioTabController.getPttProfileName(i))
|
|
||||||
}
|
|
||||||
pttProfileComboBox.currentIndex = 0
|
|
||||||
pttProfileComboBox.model = profiles
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadAudioProfiles(){
|
|
||||||
var profiles = [""]
|
|
||||||
var profileCount = AudioTabController.getAudioProfileCount()
|
|
||||||
for (var i = 0; i < profileCount; i++) {
|
|
||||||
profiles.push(AudioTabController.getAudioProfileName(i))
|
|
||||||
}
|
|
||||||
audioProfileComboBox.currentIndex = 0;
|
|
||||||
audioProfileComboBox.model = profiles
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,185 @@
|
|||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
import matzman666.advsettings 1.0
|
||||||
|
import "../.." //common imports
|
||||||
|
import "../dialog_boxes"
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
AudioMessageDialog {
|
||||||
|
id: audioMessageDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
PttDeleteProfileDialog {
|
||||||
|
id: pttDeleteProfileDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioDeleteProfileDialog {
|
||||||
|
id: audioDeleteProfileDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
PttNewProfileDialog {
|
||||||
|
id: pttNewProfileDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioNewProfileDialog {
|
||||||
|
id: audioNewProfileDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
MyText {
|
||||||
|
Layout.preferredWidth: 150
|
||||||
|
text: "Audio Profile:"
|
||||||
|
}
|
||||||
|
|
||||||
|
MyComboBox {
|
||||||
|
id: audioProfileComboBox
|
||||||
|
Layout.preferredWidth: 250
|
||||||
|
model: [""]
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
if (currentIndex > 0) {
|
||||||
|
audioApplyProfileButton.enabled = true
|
||||||
|
audioDeleteProfileButton.enabled = true
|
||||||
|
} else {
|
||||||
|
audioApplyProfileButton.enabled = false
|
||||||
|
audioDeleteProfileButton.enabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyPushButton {
|
||||||
|
id: audioApplyProfileButton
|
||||||
|
enabled: true
|
||||||
|
Layout.preferredWidth: 150
|
||||||
|
text: "Apply"
|
||||||
|
onClicked: {
|
||||||
|
if (audioProfileComboBox.currentIndex > 0) {
|
||||||
|
AudioTabController.applyAudioProfile(
|
||||||
|
audioProfileComboBox.currentIndex - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyText {
|
||||||
|
text: "PTT Profile:"
|
||||||
|
Layout.preferredWidth: 150
|
||||||
|
}
|
||||||
|
|
||||||
|
MyComboBox {
|
||||||
|
id: pttProfileComboBox
|
||||||
|
Layout.preferredWidth: 250
|
||||||
|
model: [""]
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
if (currentIndex > 0) {
|
||||||
|
pttApplyProfileButton.enabled = true
|
||||||
|
pttDeleteProfileButton.enabled = true
|
||||||
|
} else {
|
||||||
|
pttApplyProfileButton.enabled = false
|
||||||
|
pttDeleteProfileButton.enabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyPushButton {
|
||||||
|
id: pttApplyProfileButton
|
||||||
|
enabled: true
|
||||||
|
Layout.preferredWidth: 150
|
||||||
|
text: "Apply"
|
||||||
|
onClicked: {
|
||||||
|
if (pttProfileComboBox.currentIndex > 0) {
|
||||||
|
AudioTabController.applyPttProfile(
|
||||||
|
pttProfileComboBox.currentIndex - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RowLayout {
|
||||||
|
spacing: 18
|
||||||
|
|
||||||
|
MyPushButton {
|
||||||
|
id: audioDeleteProfileButton
|
||||||
|
enabled: true
|
||||||
|
Layout.preferredWidth: 200
|
||||||
|
text: "Delete Profile"
|
||||||
|
onClicked: {
|
||||||
|
if (audioProfileComboBox.currentIndex > 0) {
|
||||||
|
audioDeleteProfileDialog.profileIndex = audioProfileComboBox.currentIndex - 1
|
||||||
|
audioDeleteProfileDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MyPushButton {
|
||||||
|
Layout.preferredWidth: 200
|
||||||
|
text: "New Profile"
|
||||||
|
onClicked: {
|
||||||
|
audioNewProfileDialog.openPopup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
MyPushButton {
|
||||||
|
id: pttDeleteProfileButton
|
||||||
|
enabled: true
|
||||||
|
Layout.preferredWidth: 200
|
||||||
|
text: "Delete Profile"
|
||||||
|
onClicked: {
|
||||||
|
if (pttProfileComboBox.currentIndex > 0) {
|
||||||
|
pttDeleteProfileDialog.profileIndex = pttProfileComboBox.currentIndex - 1
|
||||||
|
pttDeleteProfileDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MyPushButton {
|
||||||
|
Layout.preferredWidth: 200
|
||||||
|
text: "New Profile"
|
||||||
|
onClicked: {
|
||||||
|
pttNewProfileDialog.openPopup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
reloadPttProfiles()
|
||||||
|
reloadAudioProfiles()
|
||||||
|
}
|
||||||
|
Connections {
|
||||||
|
target: AudioTabController
|
||||||
|
onPttProfilesUpdated: {
|
||||||
|
reloadPttProfiles()
|
||||||
|
}
|
||||||
|
onAudioProfilesUpdated: {
|
||||||
|
reloadAudioProfiles()
|
||||||
|
}
|
||||||
|
onAudioProfileAdded: {
|
||||||
|
audioProfileComboBox.currentIndex = AudioTabController.getAudioProfileCount()
|
||||||
|
}
|
||||||
|
onPttProfileAdded: {
|
||||||
|
pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
|
||||||
|
}
|
||||||
|
onDefaultProfileDisplay: {
|
||||||
|
audioProfileComboBox.currentIndex = AudioTabController.getDefaultAudioProfileIndex(
|
||||||
|
) + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function reloadPttProfiles() {
|
||||||
|
var profiles = [""]
|
||||||
|
var profileCount = AudioTabController.getPttProfileCount()
|
||||||
|
for (var i = 0; i < profileCount; i++) {
|
||||||
|
profiles.push(AudioTabController.getPttProfileName(i))
|
||||||
|
}
|
||||||
|
pttProfileComboBox.currentIndex = 0
|
||||||
|
pttProfileComboBox.model = profiles
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadAudioProfiles() {
|
||||||
|
var profiles = [""]
|
||||||
|
var profileCount = AudioTabController.getAudioProfileCount()
|
||||||
|
for (var i = 0; i < profileCount; i++) {
|
||||||
|
profiles.push(AudioTabController.getAudioProfileName(i))
|
||||||
|
}
|
||||||
|
audioProfileComboBox.currentIndex = 0
|
||||||
|
audioProfileComboBox.model = profiles
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user