mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-19 20:48:09 +00:00
feat(Settings): add an developer option to disable contacts
This commit is contained in:
parent
c319b58c72
commit
9c3615e15c
19 changed files with 250 additions and 99 deletions
|
|
@ -1218,6 +1218,14 @@ Klicken Sie hier: <a href="%1">%1</a>
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1220,6 +1220,14 @@ your friend's SIP address or username.</translation>
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation>Enable conference</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation>Contacts</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation>Enable contacts</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1218,6 +1218,14 @@ Cliquez ici : <a href="%1">%1</a>
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation>Activer la conférence</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation>Contacts</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation>Activer les contacts</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1215,6 +1215,14 @@
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1220,6 +1220,14 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą.</translation>
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1220,6 +1220,14 @@ o endereço SIP ou nome de usuário do seu amigo.</translation>
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1218,6 +1218,14 @@
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1217,6 +1217,14 @@ Klicka här: <a href="%1">%1</a>
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -1220,6 +1220,14 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin.</translation>
|
|||
<source>conferenceEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>contactsEnabledLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsNetwork</name>
|
||||
|
|
|
|||
|
|
@ -248,6 +248,7 @@
|
|||
<file>ui/modules/Common/Image/Icon.qml</file>
|
||||
<file>ui/modules/Common/Image/RoundedImage.qml</file>
|
||||
<file>ui/modules/Common/Indicators/VuMeter.qml</file>
|
||||
<file>ui/modules/Common/Menus/ApplicationMenuEntry.qml</file>
|
||||
<file>ui/modules/Common/Menus/ApplicationMenu.qml</file>
|
||||
<file>ui/modules/Common/Menus/DropDownDynamicMenu.qml</file>
|
||||
<file>ui/modules/Common/Menus/DropDownStaticMenuEntry.qml</file>
|
||||
|
|
|
|||
|
|
@ -423,6 +423,17 @@ void SettingsModel::setLimeState (LimeState state) {
|
|||
emit limeStateChanged(state);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool SettingsModel::getContactsEnabled () const {
|
||||
return !!mConfig->getInt(UiSection, "contacts_enabled", 1);
|
||||
}
|
||||
|
||||
void SettingsModel::setContactsEnabled (bool status) {
|
||||
mConfig->setInt(UiSection, "contacts_enabled", status);
|
||||
emit contactsEnabledChanged(status);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Network.
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ class SettingsModel : public QObject {
|
|||
Q_PROPERTY(MediaEncryption mediaEncryption READ getMediaEncryption WRITE setMediaEncryption NOTIFY mediaEncryptionChanged);
|
||||
Q_PROPERTY(LimeState limeState READ getLimeState WRITE setLimeState NOTIFY limeStateChanged);
|
||||
|
||||
Q_PROPERTY(bool contactsEnabled READ getContactsEnabled WRITE setContactsEnabled NOTIFY contactsEnabledChanged);
|
||||
|
||||
// Network. ------------------------------------------------------------------
|
||||
|
||||
Q_PROPERTY(bool useSipInfoForDtmfs READ getUseSipInfoForDtmfs WRITE setUseSipInfoForDtmfs NOTIFY dtmfsProtocolChanged);
|
||||
|
|
@ -243,6 +245,9 @@ public:
|
|||
LimeState getLimeState () const;
|
||||
void setLimeState (LimeState state);
|
||||
|
||||
bool getContactsEnabled () const;
|
||||
void setContactsEnabled (bool status);
|
||||
|
||||
// Network. ------------------------------------------------------------------
|
||||
|
||||
bool getUseSipInfoForDtmfs () const;
|
||||
|
|
@ -395,6 +400,8 @@ signals:
|
|||
void mediaEncryptionChanged (MediaEncryption encryption);
|
||||
void limeStateChanged (LimeState state);
|
||||
|
||||
void contactsEnabledChanged (bool status);
|
||||
|
||||
// Network. ------------------------------------------------------------------
|
||||
|
||||
void dtmfsProtocolChanged ();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -13,24 +12,19 @@ Rectangle {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
property var defaultSelectedEntry: null
|
||||
|
||||
property int entryHeight
|
||||
property int entryWidth
|
||||
property var entries
|
||||
|
||||
property int _selectedEntry: 0
|
||||
property var _selected: defaultSelectedEntry
|
||||
|
||||
default property alias _content: content.data
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
signal entrySelected (int entry)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setSelectedEntry (entry) {
|
||||
_selectedEntry = entry
|
||||
}
|
||||
|
||||
function resetSelectedEntry () {
|
||||
_selectedEntry = -1
|
||||
_selected = null
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -39,84 +33,10 @@ Rectangle {
|
|||
implicitHeight: content.height
|
||||
width: entryWidth
|
||||
|
||||
ColumnLayout {
|
||||
Column {
|
||||
id: content
|
||||
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
spacing: ApplicationMenuStyle.spacing
|
||||
|
||||
Repeater {
|
||||
model: entries
|
||||
|
||||
Rectangle {
|
||||
color: mouseArea.pressed
|
||||
? ApplicationMenuStyle.entry.color.pressed
|
||||
: (_selectedEntry === index
|
||||
? ApplicationMenuStyle.entry.color.selected
|
||||
: (mouseArea.containsMouse
|
||||
? ApplicationMenuStyle.entry.color.hovered
|
||||
: ApplicationMenuStyle.entry.color.normal
|
||||
)
|
||||
)
|
||||
height: menu.entryHeight
|
||||
width: menu.entryWidth
|
||||
|
||||
RowLayout {
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: ApplicationMenuStyle.entry.leftMargin
|
||||
right: parent.right
|
||||
rightMargin: ApplicationMenuStyle.entry.rightMargin
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
spacing: ApplicationMenuStyle.entry.spacing
|
||||
|
||||
Icon {
|
||||
icon: modelData.icon + (
|
||||
_selectedEntry === index
|
||||
? '_selected'
|
||||
: '_normal'
|
||||
)
|
||||
iconSize: ApplicationMenuStyle.entry.iconSize
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
color: _selectedEntry === index
|
||||
? ApplicationMenuStyle.entry.text.color.selected
|
||||
: ApplicationMenuStyle.entry.text.color.normal
|
||||
font.pointSize: ApplicationMenuStyle.entry.text.pointSize
|
||||
height: parent.height
|
||||
text: modelData.entryName
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
height: parent.height
|
||||
color: _selectedEntry === index
|
||||
? ApplicationMenuStyle.entry.indicator.color
|
||||
: 'transparent'
|
||||
width: ApplicationMenuStyle.entry.indicator.width
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: {
|
||||
_selectedEntry = index
|
||||
entrySelected(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
101
ui/modules/Common/Menus/ApplicationMenuEntry.qml
Normal file
101
ui/modules/Common/Menus/ApplicationMenuEntry.qml
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Rectangle {
|
||||
id: entry
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
property string icon
|
||||
property alias name: text.text
|
||||
|
||||
readonly property bool isSelected: parent.parent._selected === this
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
signal selected
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function select () {
|
||||
var menu = parent.parent
|
||||
if (menu._selected !== this) {
|
||||
menu._selected = this
|
||||
selected()
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
color: mouseArea.pressed
|
||||
? ApplicationMenuStyle.entry.color.pressed
|
||||
: (isSelected
|
||||
? ApplicationMenuStyle.entry.color.selected
|
||||
: (mouseArea.containsMouse
|
||||
? ApplicationMenuStyle.entry.color.hovered
|
||||
: ApplicationMenuStyle.entry.color.normal
|
||||
)
|
||||
)
|
||||
height: parent.parent.entryHeight
|
||||
width: parent.parent.entryWidth
|
||||
|
||||
RowLayout {
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: ApplicationMenuStyle.entry.leftMargin
|
||||
right: parent.right
|
||||
rightMargin: ApplicationMenuStyle.entry.rightMargin
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
spacing: ApplicationMenuStyle.entry.spacing
|
||||
|
||||
Icon {
|
||||
icon: entry.icon + (
|
||||
entry.isSelected
|
||||
? '_selected'
|
||||
: '_normal'
|
||||
)
|
||||
iconSize: ApplicationMenuStyle.entry.iconSize
|
||||
}
|
||||
|
||||
Text {
|
||||
id: text
|
||||
|
||||
Layout.fillWidth: true
|
||||
color: entry.isSelected
|
||||
? ApplicationMenuStyle.entry.text.color.selected
|
||||
: ApplicationMenuStyle.entry.text.color.normal
|
||||
font.pointSize: ApplicationMenuStyle.entry.text.pointSize
|
||||
height: parent.height
|
||||
text: entry.name
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
height: parent.height
|
||||
color: entry.isSelected
|
||||
? ApplicationMenuStyle.entry.indicator.color
|
||||
: 'transparent'
|
||||
width: ApplicationMenuStyle.entry.indicator.width
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: entry.select()
|
||||
}
|
||||
}
|
||||
|
|
@ -62,6 +62,7 @@ RoundedImage 1.0 Image/RoundedImage.qml
|
|||
VuMeter 1.0 Indicators/VuMeter.qml
|
||||
|
||||
ApplicationMenu 1.0 Menus/ApplicationMenu.qml
|
||||
ApplicationMenuEntry 1.0 Menus/ApplicationMenuEntry.qml
|
||||
DropDownDynamicMenu 1.0 Menus/DropDownDynamicMenu.qml
|
||||
DropDownStaticMenu 1.0 Menus/DropDownStaticMenu.qml
|
||||
DropDownStaticMenuEntry 1.0 Menus/DropDownStaticMenuEntry.qml
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ ColumnLayout {
|
|||
ActionButton {
|
||||
icon: Logic.getEditIcon()
|
||||
iconSize: ConversationStyle.bar.actions.edit.iconSize
|
||||
visible: SettingsModel.contactsEnabled
|
||||
|
||||
onClicked: window.setView('ContactEdit', {
|
||||
sipAddress: conversation.sipAddress
|
||||
|
|
|
|||
|
|
@ -90,8 +90,11 @@ function updateSelectedEntry (view, props) {
|
|||
var menu = item.menu
|
||||
var timeline = item.timeline
|
||||
|
||||
if (view === 'Home' || view === 'Contacts') {
|
||||
menu.setSelectedEntry(view === 'Home' ? 0 : 1)
|
||||
if (view === 'Home') {
|
||||
item.homeEntry.select()
|
||||
timeline.resetSelectedEntry()
|
||||
} else if (view === 'Contacts') {
|
||||
item.contactsEntry.select()
|
||||
timeline.resetSelectedEntry()
|
||||
} else if (view === 'Conversation') {
|
||||
menu.resetSelectedEntry()
|
||||
|
|
|
|||
|
|
@ -68,8 +68,11 @@ ApplicationWindow {
|
|||
|
||||
sourceComponent: ColumnLayout {
|
||||
// Workaround to get these properties in `MainWindow.js`.
|
||||
readonly property alias contactsEntry: contactsEntry
|
||||
readonly property alias contentLoader: contentLoader
|
||||
readonly property alias homeEntry: homeEntry
|
||||
readonly property alias menu: menu
|
||||
|
||||
readonly property alias timeline: timeline
|
||||
|
||||
spacing: 0
|
||||
|
|
@ -143,7 +146,9 @@ ApplicationWindow {
|
|||
sipAddress: sipAddress
|
||||
})
|
||||
|
||||
onEntryClicked: window.setView(entry.contact ? 'ContactEdit' : 'Conversation', {
|
||||
onEntryClicked: window.setView(entry.contact && SettingsModel.contactsEnabled
|
||||
? 'ContactEdit'
|
||||
: 'Conversation', {
|
||||
sipAddress: entry.sipAddress
|
||||
})
|
||||
|
||||
|
|
@ -201,18 +206,29 @@ ApplicationWindow {
|
|||
ApplicationMenu {
|
||||
id: menu
|
||||
|
||||
defaultSelectedEntry: homeEntry
|
||||
|
||||
entryHeight: MainWindowStyle.menu.height
|
||||
entryWidth: MainWindowStyle.menu.width
|
||||
|
||||
entries: [{
|
||||
entryName: qsTr('homeEntry'),
|
||||
icon: 'home'
|
||||
}, {
|
||||
entryName: qsTr('contactsEntry'),
|
||||
icon: 'contact'
|
||||
}]
|
||||
ApplicationMenuEntry {
|
||||
id: homeEntry
|
||||
|
||||
onEntrySelected: !entry ? setView('Home') : setView('Contacts')
|
||||
icon: 'home'
|
||||
name: qsTr('homeEntry')
|
||||
|
||||
onSelected: setView('Home')
|
||||
}
|
||||
|
||||
ApplicationMenuEntry {
|
||||
id: contactsEntry
|
||||
|
||||
icon: 'contact'
|
||||
name: qsTr('contactsEntry')
|
||||
visible: SettingsModel.contactsEnabled
|
||||
|
||||
onSelected: setView('Contacts')
|
||||
}
|
||||
}
|
||||
|
||||
// History.
|
||||
|
|
|
|||
|
|
@ -219,5 +219,23 @@ TabContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Form {
|
||||
title: qsTr('contactsTitle')
|
||||
visible: SettingsModel.developerSettingsEnabled
|
||||
width: parent.width
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('contactsEnabledLabel')
|
||||
|
||||
Switch {
|
||||
checked: SettingsModel.contactsEnabled
|
||||
|
||||
onClicked: SettingsModel.contactsEnabled = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue