Add 3 configs :

- show_default_page : at start : open the page.
- show_forced_assistant_page : on 'home' click : display the specified page of assistant.
- show_home_page: if false, Home page should be never displayedµ. Assistant page is show instead.
This commit is contained in:
Julien Wadel 2023-10-12 16:17:13 +02:00
parent 991d83a501
commit dd5e85df13
7 changed files with 44 additions and 27 deletions

View file

@ -1723,6 +1723,18 @@ bool SettingsModel::getShowStartVideoCallButton ()const{
return !!mConfig->getInt(UiSection, "show_start_video_button", 1);
}
int SettingsModel::getShowDefaultPage() const {
return mConfig->getInt(UiSection, "show_default_page", -1);
}
int SettingsModel::getShowForcedAssistantPage() const {
return mConfig->getInt(UiSection, "show_forced_assistant_page", -1);
}
bool SettingsModel::getShowHomePage() const {
return !!mConfig->getInt(UiSection, "show_home_page", true);
}
bool SettingsModel::isMipmapEnabled() const{
return !!mConfig->getInt(UiSection, "mipmap_enabled", 0);
}

View file

@ -622,6 +622,9 @@ public:
Q_INVOKABLE bool getShowLocalSipAccount () const;
Q_INVOKABLE bool getShowStartChatButton () const;
Q_INVOKABLE bool getShowStartVideoCallButton () const;
Q_INVOKABLE int getShowDefaultPage() const; // -1 : default
Q_INVOKABLE int getShowForcedAssistantPage() const; // -1 : no force
Q_INVOKABLE bool getShowHomePage() const;
bool isMipmapEnabled() const;
void setMipmapEnabled(const bool& enabled);

View file

@ -2,6 +2,7 @@ import QtQuick 2.7
import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import App.Styles 1.0
@ -19,7 +20,7 @@ Item {
property alias description: description.text
property alias title: title.text
property bool backEnabled: true
property bool backEnabled: SettingsModel.getShowForcedAssistantPage() < 0
property bool maximized: false // Used to stretch content to fit all the view (the title will be set to top)
default property alias _content: content.data

View file

@ -15,12 +15,12 @@ ColumnLayout {
// ---------------------------------------------------------------------------
// Info.
// ---------------------------------------------------------------------------
property bool isVisible: SettingsModel.getShowForcedAssistantPage() < 0
Item {
id: infoItem
Layout.fillHeight: true
Layout.fillWidth: true
visible: parent.isVisible
ColumnLayout {
anchors.verticalCenter: parent.verticalCenter
spacing: 0
@ -80,7 +80,7 @@ ColumnLayout {
Layout.bottomMargin: 10
Layout.maximumWidth: infoItem.width
Layout.alignment: Qt.AlignHCenter
visible: applicationVendor != '' && ConstantsCpp.CguUrl != '' && ConstantsCpp.PrivatePolicyUrl != ''
visible: applicationVendor != '' && ConstantsCpp.CguUrl != '' && ConstantsCpp.PrivatePolicyUrl != '' && parent.isVisible
checked: SettingsModel.cguAccepted
onCheckedChanged: SettingsModel.cguAccepted = checked
@ -101,6 +101,7 @@ ColumnLayout {
cellHeight: height / 2
cellWidth: width / 2
enabled: cguCheckBox.checked
visible: parent.isVisible
delegate: Item {
height: buttons.cellHeight
@ -116,6 +117,11 @@ ColumnLayout {
text: $text.replace('%1', Qt.application.name.toUpperCase())
onClicked:{ assistant.pushView($view, $props) }
Component.onCompleted: {
if (SettingsModel.getShowForcedAssistantPage() == index) {
assistant.pushView($view, $props)
}
}
}
}
Connections{

View file

@ -23,14 +23,14 @@ import Common.Styles 1.0
title: qsTr('useOtherSipAccountTitle')
property bool showWarning : true
property bool showWarning : SettingsModel.getShowForcedAssistantPage() < 0
// ---------------------------------------------------------------------------
StackView {
id: mainStack
width: currentItem.implicitWidth>0 ? currentItem.implicitWidth : currentItem.width
height: currentItem.implicitHeight>0 ? currentItem.implicitHeight : currentItem.height
initialItem: warningComponent
initialItem: showWarning ? warningComponent : formComponent
anchors.horizontalCenter: parent.horizontalCenter
}
Component{

View file

@ -55,6 +55,7 @@ function unlockView () {
}
function setView (view, props, callback) {
if(view == 'Home' && !Linphone.SettingsModel.getShowHomePage()) view = 'Assistant';
function apply (view, props, showWindow, callback) {
if(showWindow)
Linphone.App.smartShowWindow(window)
@ -102,24 +103,6 @@ function manageAccounts () {
// -----------------------------------------------------------------------------
function updateSelectedEntry (view, props) {
var item = mainLoader.item
var mainMenu = item.mainMenu
var timeline = item.timeline
if (view === 'Home') {
mainMenu.currentMenu = 0
} else if (view === 'Calls') {
mainMenu.currentMenu = 1
} else if (view === 'Conversations') {
mainMenu.currentMenu = 2
} else if (view === 'Contacts') {
mainMenu.currentMenu = 3
} else if (view === 'Conferences') {
mainMenu.currentMenu = 4
}else{
mainMenu.currentMenu = -1
}
}
// -----------------------------------------------------------------------------

View file

@ -70,6 +70,14 @@ ApplicationWindow {
active: false
anchors.fill: parent
onLoaded: switch(SettingsModel.getShowDefaultPage()) {
case 1 : window.setView('Calls'); break;
case 2 : window.setView('Conversations'); break;
case 3 : ContactsListModel.update(); window.setView('Contacts'); break;
case 4 : window.setView('Conferences'); break;
default:{}
}
sourceComponent: ColumnLayout {
// Workaround to get these properties in `MainWindow.js`.
readonly property alias contentLoader: contentLoader
@ -266,8 +274,12 @@ ApplicationWindow {
// Main menu.
Rectangle{
id: mainMenu
property int currentMenu: 0
property int currentMenu: contentLoader.source == 'qrc:/ui/views/App/Main/Home.qml' || contentLoader.source == 'qrc:/ui/views/App/Main/Assistant.qml' ? 0
: contentLoader.source == 'qrc:/ui/views/App/Main/Calls.qml' ? 1
: contentLoader.source == 'qrc:/ui/views/App/Main/Conversations.qml' ? 2
: contentLoader.source == 'qrc:/ui/views/App/Main/Contacts.qml' ? 3
: contentLoader.source == 'qrc:/ui/views/App/Main/Conferences.qml' ? 4
: -1
Layout.fillHeight: true
Layout.preferredWidth: MainWindowStyle.menu.leftMargin + MainWindowStyle.menu.rightMargin + MainWindowStyle.menu.buttonSize
color: '#F3F3F3'
@ -382,7 +394,7 @@ ApplicationWindow {
anchors.fill: parent
source: 'Home.qml'
source: SettingsModel.getShowHomePage() ? 'Home.qml' : 'Assistant.qml'
Component.onCompleted: if(accountStatus.noAccountConfigured) source= 'Assistant.qml' // default proxy = 1. Do not use this set diretly in source because of bindings that will override next setSource
}
TelKeypad {