Add 2 settings :

- 'show_home_invite_button' : to hide invite button in Home.
- 'default_other_sip_account_domain' : to prefill the domain in other sip account page.

Replace ListModel by JS array because ListModel doesn't support properties.

Fix overlapping with Search bar and keypad.
This commit is contained in:
Julien Wadel 2023-11-06 16:04:21 +01:00
parent 7371b877b3
commit 2839e892e8
7 changed files with 49 additions and 39 deletions

View file

@ -1745,6 +1745,14 @@ bool SettingsModel::getShowHomePage() const {
return !!mConfig->getInt(UiSection, "show_home_page", true);
}
bool SettingsModel::getShowHomeInviteButton() const {
return !!mConfig->getInt(UiSection, "show_home_invite_button", true);
}
QString SettingsModel::getDefaultOtherSipAccountDomain() const {
return Utils::coreStringToAppString(mConfig->getString(UiSection, "default_other_sip_account_domain", ""));
}
bool SettingsModel::isMipmapEnabled() const{
return !!mConfig->getInt(UiSection, "mipmap_enabled", 0);
}

View file

@ -220,6 +220,8 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool showLocalSipAccount READ getShowLocalSipAccount CONSTANT)
Q_PROPERTY(bool showStartChatButton READ getShowStartChatButton CONSTANT)
Q_PROPERTY(bool showStartVideoCallButton READ getShowStartVideoCallButton CONSTANT)
Q_PROPERTY(bool showHomeInviteButton READ getShowHomeInviteButton CONSTANT)
Q_PROPERTY(QString defaultOtherSipAccountDomain READ getDefaultOtherSipAccountDomain CONSTANT)
Q_PROPERTY(bool mipmapEnabled READ isMipmapEnabled WRITE setMipmapEnabled NOTIFY mipmapEnabledChanged)
Q_PROPERTY(bool useMinimalTimelineFilter READ useMinimalTimelineFilter WRITE setUseMinimalTimelineFilter NOTIFY useMinimalTimelineFilterChanged)
@ -628,6 +630,9 @@ public:
Q_INVOKABLE int getShowDefaultPage() const; // -1 : default
Q_INVOKABLE int getShowForcedAssistantPage() const; // -1 : no force
Q_INVOKABLE bool getShowHomePage() const;
Q_INVOKABLE bool getShowHomeInviteButton() const;
Q_INVOKABLE QString getDefaultOtherSipAccountDomain() const;
bool isMipmapEnabled() const;
void setMipmapEnabled(const bool& enabled);

View file

@ -14,7 +14,7 @@ Column {
// ---------------------------------------------------------------------------
spacing: CardBlockStyle.spacing
width: CardBlockStyle.width
width: visible ? CardBlockStyle.width : 0
Icon {
id: icon

View file

@ -23,7 +23,7 @@ QtObject {
property QtObject icon: QtObject {
property int bottomMargin: 20
property int size: 148
property int size: 140
}
property QtObject title: QtObject {

View file

@ -143,6 +143,7 @@ import Common.Styles 1.0
TextField {
id: sipDomain
text: SettingsModel.getDefaultOtherSipAccountDomain()
}
}
}

View file

@ -31,54 +31,49 @@ Rectangle {
spacing: HomeStyle.spacing
height: parent.height
width: {
var width = CardBlockStyle.width * count + (count - 1) * spacing
var itemCount = 0;
for(var i = 0 ; i < count ; ++i)
if(model[i].$visible)
++itemCount;
var width = CardBlockStyle.width * itemCount + (itemCount - 1) * spacing
return parent.width < width ? parent.width : width
}
model: ListModel {
// TODO: Uncomment me when smart tooltip will be available.
// ListElement {
// $component: 'checkBox'
// $componentText: qsTr('showTooltips')
// $description: qsTr('howToDescription')
// $icon: 'home_use_linphone'
// $title: qsTr('howToTitle')
// }
ListElement {
$component: 'button'
$componentText: qsTr('inviteButton')
$description: qsTr('inviteDescription')
$view: 'InviteFriends'
$icon: 'home_invite_friends'
$title: qsTr('inviteTitle')
}
ListElement {
$component: 'button'
$componentText: qsTr('assistantButton')
$description: qsTr('accountAssistantDescription')
$icon: 'home_account_assistant'
$title: qsTr('accountAssistantTitle')
$view: 'Assistant'
}
}
model: [{
$component: 'button',
$componentText: qsTr('inviteButton'),
$description: qsTr('inviteDescription'),
$view: 'InviteFriends',
$icon: 'home_invite_friends',
$title: qsTr('inviteTitle'),
$visible: SettingsModel.getShowHomeInviteButton()
},{
$component: 'button',
$componentText: qsTr('assistantButton'),
$description: qsTr('accountAssistantDescription'),
$icon: 'home_account_assistant',
$title: qsTr('accountAssistantTitle'),
$view: 'Assistant',
$visible: true
}]
delegate: CardBlock {
anchors.verticalCenter: parent.verticalCenter
description: $description.replace('%1', Utils.capitalizeFirstLetter(Qt.application.name))
icon: $icon
title: $title.replace('%1', Qt.application.name.toUpperCase())
description: modelData.$description.replace('%1', Utils.capitalizeFirstLetter(Qt.application.name))
icon: modelData.$icon
title: modelData.$title.replace('%1', Qt.application.name.toUpperCase())
visible: modelData.$visible
Loader {
Component {
id: button
TextButtonB {
text: $componentText
onClicked: window.setView($view)
text: modelData.$componentText
onClicked: window.setView(modelData.$view)
}
}
@ -86,12 +81,12 @@ Rectangle {
id: checkBox
CheckBoxText {
text: $componentText
text: modelData.$componentText
}
}
anchors.horizontalCenter: parent.horizontalCenter
sourceComponent: $component === 'button' ? button : checkBox
sourceComponent: modelData.$component === 'button' ? button : checkBox
}
}
}

View file

@ -192,6 +192,7 @@ ApplicationWindow {
id: smartSearchBar
Layout.fillWidth: true
Layout.maximumWidth: parent.width - telKeypad.width - x
maxMenuHeight: MainWindowStyle.searchBox.maxHeight
placeholderText: qsTr('mainSearchBarPlaceholder')