Commit c4f10480 authored by Ronan's avatar Ronan

feat(Settings): add an developer option to disable phone numbers in assistant

parent e6dfc17b
......@@ -1421,6 +1421,10 @@ Server URL ist nicht konfiguriert.</translation>
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1426,6 +1426,10 @@ your friend&apos;s SIP address or username.</translation>
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation>Enable configuration fetch</translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation>Supports phone numbers</translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1424,6 +1424,10 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation>Activer le téléchargement de conf.</translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation>Supporter les numéros de tél.</translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1421,6 +1421,10 @@
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1423,6 +1423,10 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą.</translation>
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1426,6 +1426,10 @@ o endereço SIP ou nome de usuário do seu amigo.</translation>
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1421,6 +1421,10 @@
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1423,6 +1423,10 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -1423,6 +1423,10 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin.</translation>
<source>fetchRemoteConfigurationEnabledLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>assistantSupportsPhoneNumbersLabel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsSipAccountsEdit</name>
......
......@@ -85,6 +85,17 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
emit fetchRemoteConfigurationEnabledChanged(status);
}
// ---------------------------------------------------------------------------
bool SettingsModel::getAssistantSupportsPhoneNumbers () const {
return !!mConfig->getInt(UiSection, "assistant_supports_phone_numbers", 1);
}
void SettingsModel::setAssistantSupportsPhoneNumbers (bool status) {
mConfig->setInt(UiSection, "assistant_supports_phone_numbers", status);
emit assistantSupportsPhoneNumbersChanged(status);
}
// =============================================================================
// Audio.
// =============================================================================
......
......@@ -42,6 +42,8 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool useAppSipAccountEnabled READ getUseAppSipAccountEnabled WRITE setUseAppSipAccountEnabled NOTIFY useAppSipAccountEnabledChanged);
Q_PROPERTY(bool useOtherSipAccountEnabled READ getUseOtherSipAccountEnabled WRITE setUseOtherSipAccountEnabled NOTIFY useOtherSipAccountEnabledChanged);
Q_PROPERTY(bool assistantSupportsPhoneNumbers READ getAssistantSupportsPhoneNumbers WRITE setAssistantSupportsPhoneNumbers NOTIFY assistantSupportsPhoneNumbersChanged);
// Audio. --------------------------------------------------------------------
Q_PROPERTY(QStringList captureDevices READ getCaptureDevices CONSTANT);
......@@ -192,6 +194,9 @@ public:
bool getUseOtherSipAccountEnabled () const;
void setUseOtherSipAccountEnabled (bool status);
bool getAssistantSupportsPhoneNumbers () const;
void setAssistantSupportsPhoneNumbers (bool status);
// Audio. --------------------------------------------------------------------
QStringList getCaptureDevices () const;
......@@ -399,6 +404,8 @@ signals:
void useAppSipAccountEnabledChanged (bool status);
void useOtherSipAccountEnabledChanged (bool status);
void assistantSupportsPhoneNumbersChanged (bool status);
// Audio. --------------------------------------------------------------------
void captureDeviceChanged (const QString &device);
......
......@@ -90,35 +90,54 @@ ColumnLayout {
margins: AssistantHomeStyle.buttons.spacing
}
enabled: SettingsModel[$viewType.charAt(0).toLowerCase() + $viewType.slice(1) + "Enabled"]
text: $text.replace('%1', Qt.application.name.toUpperCase())
enabled: SettingsModel[$view.charAt(0).toLowerCase() + $view.slice(1) + "Enabled"];
onClicked: assistant.pushView($view)
}
}
model: ListModel {
ListElement {
$text: qsTr('createAppSipAccount')
$view: 'CreateAppSipAccount'
Component.onCompleted: {
insert(0, {
$text: qsTr('createAppSipAccount'),
$view: SettingsModel.assistantSupportsPhoneNumbers
? 'CreateAppSipAccount'
: 'CreateAppSipAccountWithEmail',
$viewType: 'CreateAppSipAccount'
})
}
ListElement {
$text: qsTr('useAppSipAccount')
$view: 'UseAppSipAccount'
$viewType: 'UseAppSipAccount'
}
ListElement {
$text: qsTr('useOtherSipAccount')
$view: 'UseOtherSipAccount'
$viewType: 'UseOtherSipAccount'
}
ListElement {
$text: qsTr('fetchRemoteConfiguration')
$view: 'FetchRemoteConfiguration'
$viewType: 'FetchRemoteConfiguration'
}
}
interactive: false
Connections {
target: SettingsModel
onAssistantSupportsPhoneNumbersChanged: buttons.model.setProperty(
0,
'$view',
SettingsModel.assistantSupportsPhoneNumbers ?
'CreateAppSipAccount' :
'CreateAppSipAccountWithEmail'
);
}
}
}
......@@ -27,7 +27,9 @@ AssistantAbstractView {
id: loader
source: 'UseAppSipAccountWith' + (
checkBox.checked ? 'Username' : 'PhoneNumber'
!SettingsModel.assistantSupportsPhoneNumbers || checkBox.checked
? 'Username'
: 'PhoneNumber'
) + '.qml'
width: parent.width
}
......@@ -36,6 +38,7 @@ AssistantAbstractView {
id: checkBox
text: qsTr('useUsernameToLogin')
visible: SettingsModel.assistantSupportsPhoneNumbers
width: UseAppSipAccountStyle.checkBox.width
onClicked: {
......
......@@ -175,6 +175,18 @@ TabContainer {
}
}
}
FormLine {
FormGroup {
label: qsTr('assistantSupportsPhoneNumbersLabel')
Switch {
checked: SettingsModel.assistantSupportsPhoneNumbers
onClicked: SettingsModel.assistantSupportsPhoneNumbers = !checked
}
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment