From 804ff2ac1be6ccb0d8b42b164f6107d47934689e Mon Sep 17 00:00:00 2001 From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com> Date: Thu, 12 Aug 2021 15:03:13 -0400 Subject: [PATCH] settingsview: add line edit commits 1. Line edit commits for all SettingsMaterialLineEdit 2. LinkDeviceDialog & NameRegistrationDialog refactor 3. Line edit commits for SettingSpinBox 4. Clean up for SettingsMaterialLineEdit, SettingSpinBox and SettingsComboBox Change-Id: I025735ca8d1241e31655e859ac9ce5431985ce0c --- src/commoncomponents/MaterialLineEdit.qml | 3 +- .../PreferenceItemDelegate.qml | 8 +- src/constant/JamiStrings.qml | 8 + .../components/AccountProfile.qml | 2 + .../components/AdvancedCallSettings.qml | 10 +- .../AdvancedConnectivitySettings.qml | 28 ++- .../AdvancedJamiSecuritySettings.qml | 18 +- .../components/AdvancedNameServerSettings.qml | 2 +- .../components/AdvancedOpenDHTSettings.qml | 6 +- .../AdvancedPublicAddressSettings.qml | 9 +- .../components/AdvancedSDPSettings.qml | 20 +-- .../AdvancedSIPSecuritySettings.qml | 35 ++-- .../components/AdvancedVoiceMailSettings.qml | 2 +- .../components/FileTransferSettings.qml | 3 +- .../components/JamiUserIdentity.qml | 17 +- .../components/LinkDeviceDialog.qml | 162 +++++++++--------- .../components/NameRegistrationDialog.qml | 126 +++++++------- .../components/SIPUserIdentity.qml | 16 +- .../components/SettingMaterialButton.qml | 23 +-- .../components/SettingSpinBox.qml | 57 +++--- .../components/SettingsComboBox.qml | 21 +-- .../components/SettingsMaterialLineEdit.qml | 30 ++-- src/settingsview/components/VideoSettings.qml | 6 +- 23 files changed, 297 insertions(+), 315 deletions(-) diff --git a/src/commoncomponents/MaterialLineEdit.qml b/src/commoncomponents/MaterialLineEdit.qml index ee73f87fa..808a83699 100644 --- a/src/commoncomponents/MaterialLineEdit.qml +++ b/src/commoncomponents/MaterialLineEdit.qml @@ -27,7 +27,6 @@ TextField { property int fieldLayoutWidth: 256 property int fieldLayoutHeight: 48 - property bool layoutFillwidth: false property var backgroundColor: JamiTheme.editBackgroundColor property var borderColor: JamiTheme.greyBorderColor @@ -80,7 +79,7 @@ TextField { if (loseFocusWhenEnterPressed) root.focus = false root.accepted() - event.accepted = true; + event.accepted = true } } } diff --git a/src/commoncomponents/PreferenceItemDelegate.qml b/src/commoncomponents/PreferenceItemDelegate.qml index 1f7df5e88..b36651569 100644 --- a/src/commoncomponents/PreferenceItemDelegate.qml +++ b/src/commoncomponents/PreferenceItemDelegate.qml @@ -189,19 +189,21 @@ ItemDelegate { MaterialLineEdit { id: editTextPreference - visible: preferenceType === PreferenceItemDelegate.EDITTEXT - width: root.width / 2 - 8 Layout.preferredWidth: root.width / 2 - 8 Layout.preferredHeight: 30 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.rightMargin: 4 + visible: preferenceType === PreferenceItemDelegate.EDITTEXT + width: root.width / 2 - 8 + padding: 8 + selectByMouse: true text: preferenceCurrentValue font.pointSize: JamiTheme.settingsFontSize - padding: 8 wrapMode: Text.NoWrap + loseFocusWhenEnterPressed: true onEditingFinished: getNewPreferenceValueSlot(0) opacity: enabled ? 1.0 : 0.5 diff --git a/src/constant/JamiStrings.qml b/src/constant/JamiStrings.qml index 58553511a..b0d371e09 100644 --- a/src/constant/JamiStrings.qml +++ b/src/constant/JamiStrings.qml @@ -315,6 +315,8 @@ Item { property string removeDevice: qsTr("Remove Device") property string sureToRemoveDevice: qsTr("Are you sure you wish to remove this device?") property string linkedDevices: qsTr("Linked Devices") + property string yourPinIs: qsTr("Your PIN is:") + property string linkDeviceNetWorkError: qsTr("Error connecting to the network.\nPlease try again later.") // BannedContacts property string tipBannedContacts: qsTr("Display or hide banned contacts") @@ -351,6 +353,12 @@ Item { property string acceptTransferBelow: qsTr("Accept transfer limit") property string acceptTransferTooltip: qsTr("in MB, 0 = unlimited") + // JamiUserIdentity settings + property string register: qsTr("Register") + property string incorrectPassword: qsTr("Incorrect password") + property string networkError: qsTr("Network error") + property string somethingWentWrong: qsTr("Something went wrong") + // Updates property string betaInstall: qsTr("Install beta version") property string checkForUpdates: qsTr("Check for updates now") diff --git a/src/settingsview/components/AccountProfile.qml b/src/settingsview/components/AccountProfile.qml index c6d7478ce..3dcea71a3 100644 --- a/src/settingsview/components/AccountProfile.qml +++ b/src/settingsview/components/AccountProfile.qml @@ -82,6 +82,8 @@ ColumnLayout { verticalAlignment: Text.AlignVCenter padding: 8 + loseFocusWhenEnterPressed: true + onEditingFinished: AccountAdapter.setCurrAccDisplayName(text) } } diff --git a/src/settingsview/components/AdvancedCallSettings.qml b/src/settingsview/components/AdvancedCallSettings.qml index d974c0087..39bfb3ff6 100644 --- a/src/settingsview/components/AdvancedCallSettings.qml +++ b/src/settingsview/components/AdvancedCallSettings.qml @@ -41,17 +41,17 @@ ColumnLayout { checkBoxCustomRingtone.checked = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled() checkboxAllModerators.checked = SettingsAdapter.isAllModeratorsEnabled(LRCInstance.currentAccountId) - btnRingtone.setEnabled(SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()) - btnRingtone.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())) + btnRingtone.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled() + btnRingtone.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath()) updateAndShowModeratorsSlot() } function changeRingtonePath(url) { if(url.length !== 0) { SettingsAdapter.set_RingtonePath(url) - btnRingtone.setText(UtilsAdapter.toFileInfoName(url)) + btnRingtone.textField = UtilsAdapter.toFileInfoName(url) } else if (SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){ - btnRingtone.setText(JamiStrings.addCustomRingtone) + btnRingtone.textField = JamiStrings.addCustomRingtone } } @@ -130,7 +130,7 @@ ColumnLayout { onSwitchToggled: { SettingsAdapter.setEnableRingtone(checked) - btnRingtone.setEnabled(checked) + btnRingtone.enabled = checked } } diff --git a/src/settingsview/components/AdvancedConnectivitySettings.qml b/src/settingsview/components/AdvancedConnectivitySettings.qml index 5bc23b5dd..c033abf74 100644 --- a/src/settingsview/components/AdvancedConnectivitySettings.qml +++ b/src/settingsview/components/AdvancedConnectivitySettings.qml @@ -33,18 +33,18 @@ ColumnLayout { function updateConnectivityAccountInfos() { autoRegistrationAfterExpired.checked = SettingsAdapter.getAccountConfig_KeepAliveEnabled() - registrationExpireTimeoutSpinBox.setValue(SettingsAdapter.getAccountConfig_Registration_Expire()) - networkInterfaceSpinBox.setValue(SettingsAdapter.getAccountConfig_Localport()) + registrationExpireTimeoutSpinBox.valueField = SettingsAdapter.getAccountConfig_Registration_Expire() + networkInterfaceSpinBox.valueField = SettingsAdapter.getAccountConfig_Localport() checkBoxUPnP.checked = SettingsAdapter.getAccountConfig_UpnpEnabled() checkBoxTurnEnable.checked = SettingsAdapter.getAccountConfig_TURN_Enabled() - lineEditTurnAddress.setText(SettingsAdapter.getAccountConfig_TURN_Server()) - lineEditTurnUsername.setText(SettingsAdapter.getAccountConfig_TURN_Username()) - lineEditTurnPassword.setText(SettingsAdapter.getAccountConfig_TURN_Password()) + lineEditTurnAddress.textField = SettingsAdapter.getAccountConfig_TURN_Server() + lineEditTurnUsername.textField = SettingsAdapter.getAccountConfig_TURN_Username() + lineEditTurnPassword.textField = SettingsAdapter.getAccountConfig_TURN_Password() checkBoxSTUNEnable.checked = SettingsAdapter.getAccountConfig_STUN_Enabled() - lineEditSTUNAddress.setText(SettingsAdapter.getAccountConfig_STUN_Server()) - lineEditTurnRealmSIP.setText(SettingsAdapter.getAccountConfig_TURN_Realm()) - lineEditTurnRealmSIP.setEnabled(SettingsAdapter.getAccountConfig_TURN_Enabled()) - lineEditSTUNAddress.setEnabled(SettingsAdapter.getAccountConfig_STUN_Enabled()) + lineEditSTUNAddress.textField = SettingsAdapter.getAccountConfig_STUN_Server() + lineEditTurnRealmSIP.textField = SettingsAdapter.getAccountConfig_TURN_Realm() + lineEditTurnRealmSIP.enabled = SettingsAdapter.getAccountConfig_TURN_Enabled() + lineEditSTUNAddress.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled() } @@ -81,7 +81,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 7*24*3600 - step: 1 onNewValue: SettingsAdapter.registrationExpirationTimeSpinBoxValueChanged(valueField) } @@ -94,7 +93,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 65535 - step: 1 onNewValue: SettingsAdapter.networkInterfaceSpinBoxValueChanged(valueField) } @@ -121,10 +119,10 @@ ColumnLayout { onSwitchToggled: { SettingsAdapter.setUseTURN(checked) if (isSIP) { - lineEditTurnAddress.setEnabled(checked) - lineEditTurnUsername.setEnabled(checked) - lineEditTurnPassword.setEnabled(checked) - lineEditTurnRealmSIP.setEnabled(checked) + lineEditTurnAddress.enabled = checked + lineEditTurnUsername.enabled = checked + lineEditTurnPassword.enabled = checked + lineEditTurnRealmSIP.enabled = checked } } } diff --git a/src/settingsview/components/AdvancedJamiSecuritySettings.qml b/src/settingsview/components/AdvancedJamiSecuritySettings.qml index 31693f392..049f6c6bd 100644 --- a/src/settingsview/components/AdvancedJamiSecuritySettings.qml +++ b/src/settingsview/components/AdvancedJamiSecuritySettings.qml @@ -31,32 +31,32 @@ ColumnLayout { property int itemWidth function updateSecurityAccountInfos() { - btnCACert.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile())) - btnCACert.setEnabled(SettingsAdapter.getAccountConfig_TLS_Enable()) - btnUserCert.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile())) - btnUserCert.setEnabled(SettingsAdapter.getAccountConfig_TLS_Enable()) - btnPrivateKey.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())) - btnPrivateKey.setEnabled(SettingsAdapter.getAccountConfig_TLS_Enable()) + btnCACert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile()) + btnCACert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable() + btnUserCert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile()) + btnUserCert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable() + btnPrivateKey.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()) + btnPrivateKey.enabled = SettingsAdapter.getAccountConfig_TLS_Enable() } function changeFileCACert(url){ if(url.length !== 0) { SettingsAdapter.set_FileCACert(url) - btnCACert.setText(UtilsAdapter.toFileInfoName(url)) + btnCACert.textField = UtilsAdapter.toFileInfoName(url) } } function changeFileUserCert(url){ if(url.length !== 0) { SettingsAdapter.set_FileUserCert(url) - btnUserCert.setText(UtilsAdapter.toFileInfoName(url)) + btnUserCert.textField = UtilsAdapter.toFileInfoName(url) } } function changeFilePrivateKey(url){ if(url.length !== 0) { SettingsAdapter.set_FilePrivateKey(url) - btnPrivateKey.setText(UtilsAdapter.toFileInfoName(url)) + btnPrivateKey.textField = UtilsAdapter.toFileInfoName(url) } } diff --git a/src/settingsview/components/AdvancedNameServerSettings.qml b/src/settingsview/components/AdvancedNameServerSettings.qml index 4946495ed..02fbfe2fd 100644 --- a/src/settingsview/components/AdvancedNameServerSettings.qml +++ b/src/settingsview/components/AdvancedNameServerSettings.qml @@ -31,7 +31,7 @@ ColumnLayout { property int itemWidth function updateNameServerInfos() { - lineEditNameServer.setText(SettingsAdapter.getAccountConfig_RingNS_Uri()) + lineEditNameServer.textField = SettingsAdapter.getAccountConfig_RingNS_Uri() } Text { diff --git a/src/settingsview/components/AdvancedOpenDHTSettings.qml b/src/settingsview/components/AdvancedOpenDHTSettings.qml index dafa4598f..561896df6 100644 --- a/src/settingsview/components/AdvancedOpenDHTSettings.qml +++ b/src/settingsview/components/AdvancedOpenDHTSettings.qml @@ -33,8 +33,8 @@ ColumnLayout { function updateOpenDHTSettingsInfos() { checkAutoConnectOnLocalNetwork.checked = SettingsAdapter.getAccountConfig_PeerDiscovery() checkBoxEnableProxy.checked = SettingsAdapter.getAccountConfig_ProxyEnabled() - lineEditProxy.setText(SettingsAdapter.getAccountConfig_ProxyServer()) - lineEditBootstrap.setText(SettingsAdapter.getAccountConfig_Hostname()) + lineEditProxy.textField = SettingsAdapter.getAccountConfig_ProxyServer() + lineEditBootstrap.textField = SettingsAdapter.getAccountConfig_Hostname() } Text { @@ -78,7 +78,7 @@ ColumnLayout { onSwitchToggled: { SettingsAdapter.setEnableProxy(checked) - lineEditProxy.setEnabled(checked) + lineEditProxy.enabled = checked } } diff --git a/src/settingsview/components/AdvancedPublicAddressSettings.qml b/src/settingsview/components/AdvancedPublicAddressSettings.qml index 2ed5f8fdf..c0209878b 100644 --- a/src/settingsview/components/AdvancedPublicAddressSettings.qml +++ b/src/settingsview/components/AdvancedPublicAddressSettings.qml @@ -33,8 +33,8 @@ ColumnLayout { function updatePublicAddressAccountInfos() { checkBoxAllowIPAutoRewrite.checked = SettingsAdapter.getAccountConfig_AllowIPAutoRewrite() checkBoxCustomAddressPort.checked = !SettingsAdapter.getAccountConfig_PublishedSameAsLocal() - lineEditSIPCustomAddress.setText(SettingsAdapter.getAccountConfig_PublishedAddress()) - customPortSIPSpinBox.setValue(SettingsAdapter.getAccountConfig_PublishedPort()) + lineEditSIPCustomAddress.textField = SettingsAdapter.getAccountConfig_PublishedAddress() + customPortSIPSpinBox.valueField = SettingsAdapter.getAccountConfig_PublishedPort() if (checkBoxAllowIPAutoRewrite.checked) { checkBoxCustomAddressPort.visible = false @@ -83,8 +83,8 @@ ColumnLayout { onSwitchToggled: { SettingsAdapter.setUseCustomAddressAndPort(!checked) - lineEditSIPCustomAddress.setEnabled(checked) - customPortSIPSpinBox.setEnabled(checked) + lineEditSIPCustomAddress.enabled = checked + customPortSIPSpinBox.enabled = checked } } @@ -106,7 +106,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 65535 - step: 1 onNewValue: SettingsAdapter.customPortSIPSpinBoxValueChanged(valueField) } diff --git a/src/settingsview/components/AdvancedSDPSettings.qml b/src/settingsview/components/AdvancedSDPSettings.qml index 6ea87df1c..ac776617c 100644 --- a/src/settingsview/components/AdvancedSDPSettings.qml +++ b/src/settingsview/components/AdvancedSDPSettings.qml @@ -31,15 +31,15 @@ ColumnLayout { property int itemWidth function updateSDPAccountInfos(){ - audioRTPMinPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Audio_AudioPortMin()) - audioRTPMaxPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Audio_AudioPortMax()) - videoRTPMinPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Video_VideoPortMin()) - videoRTPMaxPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Video_VideoPortMax()) + audioRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMin() + audioRTPMaxPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMax() + videoRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMin() + videoRTPMaxPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMax() } function audioRTPMinPortSpinBoxEditFinished(value) { if (SettingsAdapter.getAccountConfig_Audio_AudioPortMax() < value) { - audioRTPMinPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Audio_AudioPortMin()) + audioRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMin() return } SettingsAdapter.audioRTPMinPortSpinBoxEditFinished(value) @@ -47,7 +47,7 @@ ColumnLayout { function audioRTPMaxPortSpinBoxEditFinished(value) { if (value <SettingsAdapter.getAccountConfig_Audio_AudioPortMin()) { - audioRTPMaxPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Audio_AudioPortMax()) + audioRTPMaxPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMax() return } SettingsAdapter.audioRTPMaxPortSpinBoxEditFinished(value) @@ -55,7 +55,7 @@ ColumnLayout { function videoRTPMinPortSpinBoxEditFinished(value) { if (SettingsAdapter.getAccountConfig_Video_VideoPortMax() < value) { - videoRTPMinPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Video_VideoPortMin()) + videoRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMin() return } SettingsAdapter.videoRTPMinPortSpinBoxEditFinished(value) @@ -63,7 +63,7 @@ ColumnLayout { function videoRTPMaxPortSpinBoxEditFinished(value) { if (value <SettingsAdapter.getAccountConfig_Video_VideoPortMin()) { - videoRTPMinPortSpinBox.setValue(SettingsAdapter.getAccountConfig_Video_VideoPortMin()) + videoRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMin() return } SettingsAdapter.videoRTPMaxPortSpinBoxEditFinished(value) @@ -98,7 +98,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 65535 - step: 1 onNewValue: audioRTPMinPortSpinBoxEditFinished(valueField) } @@ -110,7 +109,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 65535 - step: 1 onNewValue: audioRTPMaxPortSpinBoxEditFinished(valueField) } @@ -122,7 +120,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 65535 - step: 1 onNewValue: videoRTPMinPortSpinBoxEditFinished(valueField) } @@ -134,7 +131,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 65535 - step: 1 onNewValue: videoRTPMaxPortSpinBoxEditFinished(valueField) } diff --git a/src/settingsview/components/AdvancedSIPSecuritySettings.qml b/src/settingsview/components/AdvancedSIPSecuritySettings.qml index 8ee826a9d..2c8bbaa75 100644 --- a/src/settingsview/components/AdvancedSIPSecuritySettings.qml +++ b/src/settingsview/components/AdvancedSIPSecuritySettings.qml @@ -34,15 +34,15 @@ ColumnLayout { function updateSecurityAccountInfos() { enableSDESToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled() fallbackRTPToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled() - btnSIPCACert.setEnabled(SettingsAdapter.getAccountConfig_TLS_Enable()) - btnSIPUserCert.setEnabled(SettingsAdapter.getAccountConfig_TLS_Enable()) - btnSIPPrivateKey.setEnabled(SettingsAdapter.getAccountConfig_TLS_Enable()) - lineEditSIPCertPassword.setEnabled(SettingsAdapter.getAccountConfig_TLS_Enable()) + btnSIPCACert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable() + btnSIPUserCert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable() + btnSIPPrivateKey.enabled = SettingsAdapter.getAccountConfig_TLS_Enable() + lineEditSIPCertPassword.enabled = SettingsAdapter.getAccountConfig_TLS_Enable() - btnSIPCACert.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile())) - btnSIPUserCert.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile())) - btnSIPPrivateKey.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())) - lineEditSIPCertPassword.setText(SettingsAdapter.getAccountConfig_TLS_Password()) + btnSIPCACert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile()) + btnSIPUserCert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile()) + btnSIPPrivateKey.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()) + lineEditSIPCertPassword.textField = SettingsAdapter.getAccountConfig_TLS_Password() encryptMediaStreamsToggle.checked = SettingsAdapter.getAccountConfig_SRTP_Enabled() enableSDESToggle.checked = (SettingsAdapter.getAccountConfig_SRTP_KeyExchange() === Account.KeyExchangeProtocol.SDES) @@ -55,28 +55,28 @@ ColumnLayout { var method = SettingsAdapter.getAccountConfig_TLS_Method_inInt() tlsProtocolComboBox.setCurrentIndex(method) - outgoingTLSServerNameLineEdit.setText(SettingsAdapter.getAccountConfig_TLS_Servername()) - negotiationTimeoutSpinBox.setValue(SettingsAdapter.getAccountConfig_TLS_NegotiationTimeoutSec()) + outgoingTLSServerNameLineEdit.textField = SettingsAdapter.getAccountConfig_TLS_Servername() + negotiationTimeoutSpinBox.valueField = SettingsAdapter.getAccountConfig_TLS_NegotiationTimeoutSec() } function changeFileCACert(url){ if(url.length !== 0) { SettingsAdapter.set_FileCACert(url) - btnSIPCACert.setText(UtilsAdapter.toFileInfoName(url)) + btnSIPCACert.textField = UtilsAdapter.toFileInfoName(url) } } function changeFileUserCert(url){ if(url.length !== 0) { SettingsAdapter.set_FileUserCert(url) - btnSIPUserCert.setText(UtilsAdapter.toFileInfoName(url)) + btnSIPUserCert.textField = UtilsAdapter.toFileInfoName(url) } } function changeFilePrivateKey(url){ if(url.length !== 0) { SettingsAdapter.set_FilePrivateKey(url) - btnSIPPrivateKey.setText(UtilsAdapter.toFileInfoName(url)) + btnSIPPrivateKey.textField = UtilsAdapter.toFileInfoName(url) } } @@ -190,10 +190,10 @@ ColumnLayout { onSwitchToggled: { SettingsAdapter.setUseTLS(checked) - btnSIPCACert.setEnabled(checked) - btnSIPUserCert.setEnabled(checked) - btnSIPPrivateKey.setEnabled(checked) - lineEditSIPCertPassword.setEnabled(checked) + btnSIPCACert.enabled = checked + btnSIPUserCert.enabled = checked + btnSIPPrivateKey.enabled = checked + lineEditSIPCertPassword.enabled = checked } } @@ -318,7 +318,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 3000 - step: 1 onNewValue: SettingsAdapter.negotiationTimeoutSpinBoxValueChanged(valueField) } diff --git a/src/settingsview/components/AdvancedVoiceMailSettings.qml b/src/settingsview/components/AdvancedVoiceMailSettings.qml index c87360e9c..293cd2cb3 100644 --- a/src/settingsview/components/AdvancedVoiceMailSettings.qml +++ b/src/settingsview/components/AdvancedVoiceMailSettings.qml @@ -32,7 +32,7 @@ ColumnLayout { property int itemWidth function updateVoiceMailSettingsInfos() { - lineEditVoiceMailDialCode.setText(SettingsAdapter.getAccountConfig_Mailbox()) + lineEditVoiceMailDialCode.textField = SettingsAdapter.getAccountConfig_Mailbox() } ElidedTextLabel { diff --git a/src/settingsview/components/FileTransferSettings.qml b/src/settingsview/components/FileTransferSettings.qml index 3a1b4bcb3..b1e4cceac 100644 --- a/src/settingsview/components/FileTransferSettings.qml +++ b/src/settingsview/components/FileTransferSettings.qml @@ -30,7 +30,7 @@ ColumnLayout { property int itemWidth function updateValues() { - acceptTransferBelowSpinBox.setValue(SettingsAdapter.getAppValue(Settings.AcceptTransferBelow)) + acceptTransferBelowSpinBox.valueField = SettingsAdapter.getAppValue(Settings.AcceptTransferBelow) allowFromUntrustedCheckbox.checked = SettingsAdapter.getAppValue(Settings.AllowFromUntrusted) autoAcceptFilesCheckbox.checked = SettingsAdapter.getAppValue(Settings.AutoAcceptFiles) } @@ -87,7 +87,6 @@ ColumnLayout { itemWidth: root.itemWidth bottomValue: 0 topValue: 99999999 - step: 1 onNewValue: SettingsAdapter.acceptTransferBelow(valueField) } diff --git a/src/settingsview/components/JamiUserIdentity.qml b/src/settingsview/components/JamiUserIdentity.qml index 5d317b00a..3adcc21ec 100644 --- a/src/settingsview/components/JamiUserIdentity.qml +++ b/src/settingsview/components/JamiUserIdentity.qml @@ -144,6 +144,11 @@ ColumnLayout { fieldLayoutWidth : maximumWidth } + padding: 8 + horizontalAlignment: registeredIdNeedsSet ? + Text.AlignLeft : + Text.AlignRight + verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap placeholderText: registeredIdNeedsSet ? JamiStrings.registerAUsername : "" @@ -155,12 +160,12 @@ ColumnLayout { } readOnly: !registeredIdNeedsSet font.bold: !registeredIdNeedsSet + loseFocusWhenEnterPressed: btnRegisterName.visible - horizontalAlignment: registeredIdNeedsSet ? - Text.AlignLeft : - Text.AlignRight - verticalAlignment: Text.AlignVCenter - padding: 8 + onAccepted: { + if (btnRegisterName.visible) + btnRegisterName.clicked() + } } } @@ -177,7 +182,7 @@ ColumnLayout { currentRegisteredID.nameRegistrationState === UsernameLineEdit.NameRegistrationState.FREE - text: qsTr("Register") + text: JamiStrings.register toolTipText: JamiStrings.registerUsername color: JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedGreyHovered diff --git a/src/settingsview/components/LinkDeviceDialog.qml b/src/settingsview/components/LinkDeviceDialog.qml index 6279f66fe..cecd411ef 100644 --- a/src/settingsview/components/LinkDeviceDialog.qml +++ b/src/settingsview/components/LinkDeviceDialog.qml @@ -30,15 +30,20 @@ import "../../commoncomponents" BaseDialog { id: root + signal accepted + function openLinkDeviceDialog() { infoLabel.text = JamiStrings.pinTimerInfos passwordEdit.clear() + + open() + if(AccountAdapter.hasPassword()) { - stackedWidget.currentIndex = 0 + stackedWidget.currentIndex = enterPasswordPage.pageIndex + passwordEdit.forceActiveFocus() } else { setGeneratingPage() } - open() } function setGeneratingPage() { @@ -47,59 +52,51 @@ BaseDialog { return } - stackedWidget.currentIndex = 1 + stackedWidget.currentIndex = exportingSpinnerPage.pageIndex spinnerMovie.playing = true timerForExport.restart() } - Timer{ - id: timerForExport - - repeat: false - interval: 200 - - onTriggered: { - AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId, - passwordEdit.text) - } - } - function setExportPage(status, pin) { - if (status === NameDirectory.ExportOnRingStatus.SUCCESS) { infoLabel.success = true - yourPinLabel.visible = true - exportedPIN.visible = true + infoLabelsRowLayout.visible = true infoLabel.text = JamiStrings.pinTimerInfos exportedPIN.text = pin } else { infoLabel.success = false - yourPinLabel.visible = false - exportedPIN.visible = false + infoLabelsRowLayout.visible = false switch(status) { case NameDirectory.ExportOnRingStatus.WRONG_PASSWORD: - infoLabel.text = qsTr("Incorrect password") - + infoLabel.text = JamiStrings.incorrectPassword break case NameDirectory.ExportOnRingStatus.NETWORK_ERROR: - infoLabel.text = qsTr("Error connecting to the network.\nPlease try again later.") - + infoLabel.text = JamiStrings.linkDeviceNetWorkError break case NameDirectory.ExportOnRingStatus.INVALID: - infoLabel.text = qsTr("Something went wrong.\n") - + infoLabel.text = JamiStrings.somethingWentWrong break } } - stackedWidget.currentIndex = 2 + stackedWidget.currentIndex = exportingInfoPage.pageIndex } - signal accepted - title: JamiStrings.addDevice + Timer{ + id: timerForExport + + repeat: false + interval: 200 + + onTriggered: { + AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId, + passwordEdit.text) + } + } + Connections { target: NameDirectory @@ -117,22 +114,25 @@ BaseDialog { StackLayout { id: stackedWidget + anchors.centerIn: parent anchors.fill: parent anchors.margins: JamiTheme.preferredMarginSize // Index = 0 - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true - color: JamiTheme.secondaryBackgroundColor + Item { + id: enterPasswordPage + + readonly property int pageIndex: 0 ColumnLayout { - anchors.centerIn: parent + anchors.fill: parent + spacing: 16 Label { Layout.alignment: Qt.AlignHCenter + text: JamiStrings.enterAccountPassword color: JamiTheme.textColor font.pointSize: JamiTheme.textFontSize @@ -157,6 +157,8 @@ BaseDialog { onTextChanged: { btnConfirm.enabled = text.length > 0 } + + onAccepted: btnConfirm.clicked() } RowLayout { @@ -178,11 +180,9 @@ BaseDialog { outlined: true enabled: false - text: qsTr("Register") + text: JamiStrings.exportAccount - onClicked: { - setGeneratingPage() - } + onClicked: setGeneratingPage() } MaterialButton { @@ -199,28 +199,28 @@ BaseDialog { outlined: true enabled: true - text: qsTr("Cancel") + text: JamiStrings.optionCancel - onClicked: { - close() - } + onClicked: close() } } } } // Index = 1 - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true - color: JamiTheme.secondaryBackgroundColor + Item { + id: exportingSpinnerPage + + readonly property int pageIndex: 1 ColumnLayout { - anchors.centerIn: parent + anchors.fill: parent + spacing: 16 Label { Layout.alignment: Qt.AlignCenter + text: JamiStrings.backupAccount color: JamiTheme.textColor font.pointSize: JamiTheme.headerFontSize @@ -229,51 +229,48 @@ BaseDialog { verticalAlignment: Text.AlignVCenter } - Label { - id: exportingSpinner + AnimatedImage { + id: spinnerMovie Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: 96 - Layout.preferredHeight: 96 + Layout.preferredWidth: 30 + Layout.preferredHeight: 30 - background: Rectangle { - color: "transparent" - AnimatedImage { - id: spinnerMovie - anchors.fill: parent - source: JamiResources.jami_eclipse_spinner_gif - playing: exportingSpinner.visible - paused: false - fillMode: Image.PreserveAspectFit - mipmap: true - } - } + source: JamiResources.jami_rolling_spinner_gif + playing: visible + fillMode: Image.PreserveAspectFit + mipmap: true } } } // Index = 2 - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true - color: "transparent" + Item { + id: exportingInfoPage + + readonly property int pageIndex: 2 ColumnLayout { - anchors.centerIn: parent + anchors.fill: parent + spacing: 16 RowLayout { + id: infoLabelsRowLayout + Layout.alignment: Qt.AlignCenter Layout.fillWidth: true Layout.margins: JamiTheme.preferredMarginSize + spacing: 16 Label { id: yourPinLabel Layout.alignment: Qt.AlignHCenter - text: qsTr("Your PIN is:") + + text: JamiStrings.yourPinIs color: JamiTheme.textColor font.pointSize: JamiTheme.headerFontSize font.kerning: true @@ -283,8 +280,10 @@ BaseDialog { Label { id: exportedPIN + Layout.alignment: Qt.AlignHCenter - text: qsTr("PIN") + + text: JamiStrings.pin color: JamiTheme.textColor font.pointSize: JamiTheme.headerFontSize font.kerning: true @@ -301,23 +300,25 @@ BaseDialog { property int borderRadius : success? 15 : 0 property string backgroundColor : success? "whitesmoke" : "transparent" property string borderColor : success? "lightgray" : "transparent" - color: success ? JamiTheme.successLabelColor: JamiTheme.textColor + + Layout.maximumWidth: linkDeviceContentRect.width - + JamiTheme.preferredMarginSize * 2 + + Layout.alignment: Qt.AlignCenter + + color: success ? JamiTheme.successLabelColor : JamiTheme.redColor padding: success ? 8 : 0 wrapMode: Text.Wrap - text: qsTr("This pin and the account password should be entered in your device within 10 minutes.") + text: JamiStrings.pinTimerInfos font.pointSize: JamiTheme.textFontSize font.kerning: true - - Layout.maximumWidth: linkDeviceContentRect.width - JamiTheme.preferredMarginSize * 2 - - Layout.alignment: Qt.AlignCenter horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter background: Rectangle { id: infoLabelBackground - anchors.fill: parent + border.width: infoLabel.borderWidth border.color: infoLabel.borderColor radius: infoLabel.borderRadius @@ -328,12 +329,12 @@ BaseDialog { MaterialButton { id: btnCloseExportDialog - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 preferredHeight: JamiTheme.preferredFieldHeight - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered pressedColor: JamiTheme.buttonTintedBlackPressed outlined: true @@ -342,9 +343,8 @@ BaseDialog { text: JamiStrings.close onClicked: { - if (infoLabel.success) { + if (infoLabel.success) accepted() - } close() } } diff --git a/src/settingsview/components/NameRegistrationDialog.qml b/src/settingsview/components/NameRegistrationDialog.qml index 57840f3a2..c617f73c6 100644 --- a/src/settingsview/components/NameRegistrationDialog.qml +++ b/src/settingsview/components/NameRegistrationDialog.qml @@ -36,31 +36,24 @@ BaseDialog { function openNameRegistrationDialog(registerNameIn) { registerdName = registerNameIn - lblRegistrationError.text = qsTr("Something went wrong") + lblRegistrationError.text = JamiStrings.somethingWentWrong passwordEdit.clear() + + open() + if(AccountAdapter.hasPassword()){ - stackedWidget.currentIndex = 0 + stackedWidget.currentIndex = nameRegisterEnterPasswordPage.pageIndex + passwordEdit.forceActiveFocus() } else { startRegistration() } - open() } function startRegistration() { - startSpinner() - timerForStartRegistration.restart() - } - - function slotStartNameRegistration() { - var password = passwordEdit.text - AccountAdapter.model.registerName(LRCInstance.currentAccountId, - password, registerdName) - } + stackedWidget.currentIndex = nameRegisterSpinnerPage.pageIndex + spinnerMovie.visible = true - function startSpinner() { - stackedWidget.currentIndex = 1 - spinnerLabel.visible = true - spinnerMovie.playing = true + timerForStartRegistration.restart() } Timer { @@ -70,7 +63,8 @@ BaseDialog { repeat: false onTriggered: { - slotStartNameRegistration() + AccountAdapter.model.registerName(LRCInstance.currentAccountId, + passwordEdit.text, registerdName) } } @@ -84,15 +78,16 @@ BaseDialog { close() return case NameDirectory.RegisterNameStatus.WRONG_PASSWORD: - lblRegistrationError.text = qsTr("Incorrect password") + lblRegistrationError.text = JamiStrings.incorrectPassword break case NameDirectory.RegisterNameStatus.NETWORK_ERROR: - lblRegistrationError.text = qsTr("Network error") + lblRegistrationError.text = JamiStrings.networkError break default: break } - stackedWidget.currentIndex = 2 + + stackedWidget.currentIndex = nameRegisterErrorPage.pageIndex } } @@ -104,27 +99,30 @@ BaseDialog { implicitWidth: JamiTheme.preferredDialogWidth implicitHeight: JamiTheme.preferredDialogHeight - color: "transparent" + color: JamiTheme.primaryBackgroundColor StackLayout { id: stackedWidget - anchors.centerIn: parent anchors.fill: parent anchors.margins: JamiTheme.preferredMarginSize // Index = 0 - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true + Item { + id: nameRegisterEnterPasswordPage + + readonly property int pageIndex: 0 ColumnLayout { - anchors.centerIn: parent + anchors.fill: parent + spacing: 16 Label { Layout.alignment: Qt.AlignCenter + text: JamiStrings.enterAccountPassword + color: JamiTheme.textColor font.pointSize: JamiTheme.textFontSize font.kerning: true horizontalAlignment: Text.AlignHCenter @@ -139,10 +137,11 @@ BaseDialog { Layout.preferredHeight: 48 echoMode: TextInput.Password - - placeholderText: qsTr("Password") + placeholderText: JamiStrings.password onTextChanged: btnRegister.enabled = (text.length > 0) + + onAccepted: btnRegister.clicked() } RowLayout { @@ -164,11 +163,9 @@ BaseDialog { outlined: true enabled: false - text: qsTr("Register") + text: JamiStrings.register - onClicked: { - startRegistration() - } + onClicked: startRegistration() } MaterialButton { @@ -184,74 +181,71 @@ BaseDialog { pressedColor: JamiTheme.buttonTintedBlackPressed outlined: true - text: qsTr("Cancel") + text: JamiStrings.optionCancel - onClicked: { - close() - } + onClicked: close() } } } } // Index = 1 - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true + Item { + id: nameRegisterSpinnerPage + + readonly property int pageIndex: 1 ColumnLayout { - anchors.centerIn: parent + anchors.fill: parent + spacing: 16 Label { Layout.alignment: Qt.AlignCenter + text: JamiStrings.registeringName + color: JamiTheme.textColor font.pointSize: JamiTheme.textFontSize font.kerning: true horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - Label { - id: spinnerLabel + AnimatedImage { + id: spinnerMovie - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: 96 - Layout.preferredHeight: 96 - - background: Rectangle { - AnimatedImage { - id: spinnerMovie - anchors.fill: parent - source: JamiResources.jami_eclipse_spinner_gif - playing: spinnerLabel.visible - paused: false - fillMode: Image.PreserveAspectFit - mipmap: true - } - } + Layout.preferredWidth: 30 + Layout.preferredHeight: 30 + + source: JamiResources.jami_rolling_spinner_gif + playing: visible + fillMode: Image.PreserveAspectFit + mipmap: true } } } // Index = 2 - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true + Item { + id: nameRegisterErrorPage + + readonly property int pageIndex: 2 ColumnLayout { - anchors.centerIn: parent + anchors.fill: parent + spacing: 16 Label { id: lblRegistrationError Layout.alignment: Qt.AlignCenter - text: qsTr("Something went wrong") + text: JamiStrings.somethingWentWrong font.pointSize: JamiTheme.textFontSize font.kerning: true - color: "red" + color: JamiTheme.redColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } @@ -259,7 +253,7 @@ BaseDialog { MaterialButton { id: btnClose - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 preferredHeight: JamiTheme.preferredFieldHeight @@ -271,9 +265,7 @@ BaseDialog { text: JamiStrings.close - onClicked: { - close() - } + onClicked: close() } } } diff --git a/src/settingsview/components/SIPUserIdentity.qml b/src/settingsview/components/SIPUserIdentity.qml index ddf6c92fc..64e74d189 100644 --- a/src/settingsview/components/SIPUserIdentity.qml +++ b/src/settingsview/components/SIPUserIdentity.qml @@ -31,10 +31,10 @@ ColumnLayout { property int itemWidth function updateAccountInfo() { - usernameSIP.setText(SettingsAdapter.getAccountConfig_Username()) - hostnameSIP.setText(SettingsAdapter.getAccountConfig_Hostname()) - passSIPlineEdit.setText(SettingsAdapter.getAccountConfig_Password()) - proxySIP.setText(SettingsAdapter.getAccountConfig_RouteSet()) + usernameSIP.textField = SettingsAdapter.getAccountConfig_Username() + hostnameSIP.textField = SettingsAdapter.getAccountConfig_Hostname() + passSIPlineEdit.textField = SettingsAdapter.getAccountConfig_Password() + proxySIP.textField = SettingsAdapter.getAccountConfig_RouteSet() } SettingsMaterialLineEdit { @@ -43,7 +43,7 @@ ColumnLayout { Layout.fillWidth: true Layout.preferredHeight: JamiTheme.preferredFieldHeight - titleField: qsTr("Username") + titleField: JamiStrings.username itemWidth: root.itemWidth onEditFinished: SettingsAdapter.setAccountConfig_Username(textField) } @@ -54,7 +54,7 @@ ColumnLayout { Layout.fillWidth: true Layout.preferredHeight: JamiTheme.preferredFieldHeight - titleField: qsTr("Hostname") + titleField: JamiStrings.server itemWidth: root.itemWidth onEditFinished: SettingsAdapter.setAccountConfig_Hostname(textField) } @@ -65,7 +65,7 @@ ColumnLayout { Layout.fillWidth: true Layout.preferredHeight: JamiTheme.preferredFieldHeight - titleField: qsTr("Proxy") + titleField: JamiStrings.proxy itemWidth: root.itemWidth onEditFinished: SettingsAdapter.setAccountConfig_RouteSet(textField) } @@ -76,7 +76,7 @@ ColumnLayout { Layout.fillWidth: true Layout.preferredHeight: JamiTheme.preferredFieldHeight - titleField: qsTr("Password") + titleField: JamiStrings.password itemWidth: root.itemWidth onEditFinished: SettingsAdapter.setAccountConfig_Password(textField) echoMode: TextInput.Password diff --git a/src/settingsview/components/SettingMaterialButton.qml b/src/settingsview/components/SettingMaterialButton.qml index 527f61292..aed909d1a 100644 --- a/src/settingsview/components/SettingMaterialButton.qml +++ b/src/settingsview/components/SettingMaterialButton.qml @@ -28,22 +28,18 @@ import "../../commoncomponents" RowLayout { id: root - property string titleField: "" - property string textField: "" + property alias titleField: title.text + property alias textField: button.text + property alias enabled: button.enabled + property string source property int itemWidth signal click - function setEnabled(status) { - button.enabled = status - } - function setText(text) { - root.textField = text - button.text = text - } - Text { + id: title + Layout.fillWidth: true Layout.rightMargin: JamiTheme.preferredMarginSize / 2 @@ -53,7 +49,6 @@ RowLayout { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - text: root.titleField color: JamiTheme.textColor elide: Text.ElideRight } @@ -64,15 +59,11 @@ RowLayout { Layout.fillHeight: true preferredWidth: root.itemWidth - text: root.textField iconSource: root.source color: JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedGreyHovered pressedColor: JamiTheme.buttonTintedGreyPressed - onClicked: { - root.textField = text - click() - } + onClicked: click() } } diff --git a/src/settingsview/components/SettingSpinBox.qml b/src/settingsview/components/SettingSpinBox.qml index b296a34a5..b59bee170 100644 --- a/src/settingsview/components/SettingSpinBox.qml +++ b/src/settingsview/components/SettingSpinBox.qml @@ -29,31 +29,25 @@ import "../../commoncomponents" RowLayout { id: root + property alias title: title.text + property alias enabled: textField.enabled + property alias bottomValue: textFieldValidator.bottom + property alias topValue: textFieldValidator.top + property alias valueField: textField.text + property alias tooltipText: toolTip.text + property string borderColor: JamiTheme.greyBorderColor - property string title: "" property int itemWidth - property int bottomValue - property int topValue - property int step - property int valueField - property string tooltipText: "" signal newValue - function setEnabled(status) { - textField.enabled = status - } - - function setValue(value) { - root.valueField = value - textField.text = value - } - Text { + id: title + Layout.fillWidth: true Layout.rightMargin: JamiTheme.preferredMarginSize Layout.preferredHeight: JamiTheme.preferredFieldHeight - text: root.title + color: JamiTheme.textColor elide: Text.ElideRight font.pointSize: JamiTheme.settingsFontSize @@ -72,23 +66,34 @@ RowLayout { font.pointSize: JamiTheme.buttonFontSize font.kerning: true - validator: IntValidator {bottom: root.bottomValue; top: root.topValue} - - onEditingFinished: { - root.valueField = text - newValue() + validator: IntValidator { + id: textFieldValidator } color: JamiTheme.textColor + hoverEnabled: true background: Rectangle { - border.color: enabled? root.borderColor : "transparent" + border.color: enabled ? root.borderColor : "transparent" color: JamiTheme.editBackgroundColor } - hoverEnabled: true - ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval - ToolTip.visible: hovered && (root.tooltipText.length > 0) - ToolTip.text: root.tooltipText + onEditingFinished: newValue() + + Keys.onPressed: { + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return) { + textField.focus = false + event.accepted = true + } + } + + MaterialToolTip { + id: toolTip + + parent: textField + visible: textField.hovered && (root.tooltipText.length > 0) + delay: Qt.styleHints.mousePressAndHoldInterval + } } } diff --git a/src/settingsview/components/SettingsComboBox.qml b/src/settingsview/components/SettingsComboBox.qml index 79f755c2e..d2cb27fed 100644 --- a/src/settingsview/components/SettingsComboBox.qml +++ b/src/settingsview/components/SettingsComboBox.qml @@ -26,16 +26,17 @@ import "../../commoncomponents" RowLayout { id: root - property string labelText: "" - property var comboModel - property int fontPointSize: JamiTheme.headerFontSize + property alias labelText: label.eText + property alias comboModel: comboBoxOfLayout.model + property alias tipText: comboBoxOfLayout.tooltipText + property alias role: comboBoxOfLayout.textRole + property alias placeholderText: comboBoxOfLayout.placeholderText + property alias enabled: comboBoxOfLayout.enabled + property alias fontPointSize: comboBoxOfLayout.font.pointSize + property int heightOfLayout: 30 property int widthOfComboBox: 50 property int modelIndex - property string tipText: "" - property string role: "" - - property alias placeholderText: comboBoxOfLayout.placeholderText signal indexChanged @@ -46,11 +47,6 @@ RowLayout { indexChanged() } - function setEnabled(status) { - comboBoxOfLayout.enabled = status - label.enabled = status - } - ElidedTextLabel { id: label @@ -58,7 +54,6 @@ RowLayout { Layout.preferredHeight: heightOfLayout Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - eText: qsTr(labelText) fontSize: JamiTheme.settingsFontSize maxWidth: widthOfComboBox } diff --git a/src/settingsview/components/SettingsMaterialLineEdit.qml b/src/settingsview/components/SettingsMaterialLineEdit.qml index fb062ecf2..77b0c53f1 100644 --- a/src/settingsview/components/SettingsMaterialLineEdit.qml +++ b/src/settingsview/components/SettingsMaterialLineEdit.qml @@ -28,24 +28,19 @@ import "../../commoncomponents" RowLayout { id: root - property string titleField: "" - property string textField: "" + property alias titleField: title.text + property alias textField: materialLineEdit.text + property alias enabled: materialLineEdit.enabled + property int itemWidth property int wrapMode: Text.NoWrap property int echoMode: TextInput.Normal signal editFinished - function setEnabled(status) { - materialLineEdit.enabled = status - } - - function setText(text) { - root.textField = text - materialLineEdit.text = text - } - Text { + id: title + Layout.fillWidth: true Layout.rightMargin: JamiTheme.preferredMarginSize / 2 @@ -55,30 +50,27 @@ RowLayout { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - text: titleField color: JamiTheme.textColor elide: Text.ElideRight } MaterialLineEdit { id: materialLineEdit + Layout.alignment: Qt.AlignCenter Layout.preferredWidth: itemWidth font.pointSize: JamiTheme.settingsFontSize font.kerning: true - text: textField - + padding: 8 horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter + + loseFocusWhenEnterPressed: true wrapMode: root.wrapMode echoMode: root.echoMode - padding: 8 - onEditingFinished: { - root.textField = text - editFinished() - } + onEditingFinished: editFinished() } } diff --git a/src/settingsview/components/VideoSettings.qml b/src/settingsview/components/VideoSettings.qml index 603b748a8..91966a5c5 100644 --- a/src/settingsview/components/VideoSettings.qml +++ b/src/settingsview/components/VideoSettings.qml @@ -50,9 +50,9 @@ ColumnLayout { var count = deviceComboBoxSetting.comboModel.deviceCount() previewWidget.visible = count > 0 - deviceComboBoxSetting.setEnabled(count > 0) - resolutionComboBoxSetting.setEnabled(count > 0) - fpsComboBoxSetting.setEnabled(count > 0) + deviceComboBoxSetting.enabled = count > 0 + resolutionComboBoxSetting.enabled = count > 0 + fpsComboBoxSetting.enabled = count > 0 if (count === 0) { resolutionComboBoxSetting.comboModel.reset() -- GitLab