1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
import QtQuick 2.7
import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import ConstantsCpp 1.0
import App.Styles 1.0
// =============================================================================
ColumnLayout {
spacing: 0
// ---------------------------------------------------------------------------
// 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
height: AssistantHomeStyle.info.height
width: parent.width
Icon {
//anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
icon: 'home_account_assistant'
iconSize: AssistantHomeStyle.info.iconSize
}
Text {
height: AssistantHomeStyle.info.title.height
Layout.fillWidth: true
color: AssistantHomeStyle.info.title.colorModel.color
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font {
bold: true
pointSize: AssistantHomeStyle.info.title.pointSize
}
text: qsTr('homeTitle')
}
Text {
height: AssistantHomeStyle.info.description.height
Layout.fillWidth: true
//width: parent.width
color: AssistantHomeStyle.info.description.colorModel.color
elide: Text.ElideRight
font.pointSize: AssistantHomeStyle.info.description.pointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr('homeDescription')
}
}
}
// ---------------------------------------------------------------------------
// Buttons.
// ---------------------------------------------------------------------------
CheckBoxText{
id: cguCheckBox
Layout.bottomMargin: 10
Layout.maximumWidth: infoItem.width
Layout.alignment: Qt.AlignHCenter
visible: applicationVendor != '' && ConstantsCpp.CguUrl != '' && ConstantsCpp.PrivatePolicyUrl != '' && parent.isVisible
checked: SettingsModel.cguAccepted
onCheckedChanged: SettingsModel.cguAccepted = checked
//: 'I accept %1's %2terms of use%3 and %4privacy policy%5' : where %1 is the vendor name and other %n are internal keywords that encapsulate links.
text: qsTr('homeCgu').arg(applicationVendor).arg('< a href="'+ConstantsCpp.CguUrl+'">').arg('</a>').arg('<a href="'+ConstantsCpp.PrivatePolicyUrl+'">').arg('</a>')
}
GridView {
id: buttons
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.maximumWidth: AssistantHomeStyle.buttons.maxWidth
Layout.preferredHeight: AssistantHomeStyle.buttons.height
Layout.leftMargin: AssistantStyle.leftMargin
Layout.rightMargin: AssistantStyle.rightMargin
Layout.bottomMargin: AssistantStyle.bottomMargin
cellHeight: height / 2
cellWidth: width / 2
visible: parent.isVisible
delegate: Item {
height: buttons.cellHeight
width: buttons.cellWidth
TextButtonA {
anchors {
fill: parent
margins: AssistantHomeStyle.buttons.spacing
}
enabled: $viewType=='UseOtherSipAccount' || (cguCheckBox.checked && SettingsModel[$viewType.charAt(0).toLowerCase() + $viewType.slice(1) + "Enabled"])
text: $text.replace('%1', Qt.application.name.toUpperCase())
onClicked:{ assistant.pushView($view, $props) }
Component.onCompleted: {
if (SettingsModel.getShowForcedAssistantPage() == index) {
assistant.pushView($view, $props)
}
}
}
}
Connections{
target: SettingsModel
onAssistantSupportsPhoneNumbersChanged: {
if(!SettingsModel.useWebview()){
buttonsModel.get(0).$view = !SettingsModel.assistantSupportsPhoneNumbers ? 'CreateAppSipAccountWithEmail' : 'CreateAppSipAccount'
}
}
}
model: ListModel {
id: buttonsModel
Component.onCompleted: {
insert(0, {
$text: qsTr('createAppSipAccount'),
$view: SettingsModel.useWebview()
? 'CreateAppSipAccountWithWebView'
: !SettingsModel.assistantSupportsPhoneNumbers
? 'CreateAppSipAccountWithEmail'
: 'CreateAppSipAccount',
$viewType: 'CreateAppSipAccount',
$props: SettingsModel.useWebview() ? {defaultUrl: SettingsModel.assistantRegistrationUrl, defaultLogoutUrl:SettingsModel.assistantLogoutUrl, configFilename: 'create-app-sip-account.rc'}
: {}
})
append({
$text: qsTr('useAppSipAccount'),
$view: SettingsModel.useWebview() ? 'CreateAppSipAccountWithWebView' : 'UseAppSipAccount',
$viewType: 'UseAppSipAccount',
$props: SettingsModel.useWebview() ? {defaultUrl: SettingsModel.assistantLoginUrl, defaultLogoutUrl:SettingsModel.assistantLogoutUrl, configFilename: 'use-app-sip-account.rc'}
: {}
})
append({
$text: qsTr('useOtherSipAccount'),
$view: 'UseOtherSipAccount',
$viewType: 'UseOtherSipAccount',
$props: {}
})
append( {
$text: qsTr('fetchRemoteConfiguration'),
$view: 'FetchRemoteConfiguration',
$viewType: 'FetchRemoteConfiguration',
$props: {}
})
}
}
interactive: false
}
}
|