fix(app): remove useless loaders

This commit is contained in:
Ronan Abhamon 2018-04-17 15:36:07 +02:00
parent eb15c571a2
commit e046daae33
11 changed files with 69 additions and 103 deletions

View file

@ -72,7 +72,7 @@ function handleTextChanged () {
}
function sendMessage (text) {
textArea.item.text = ''
textArea.text = ''
chat.bindToEnd = true
container.proxyModel.sendMessage(text)
}

View file

@ -203,33 +203,26 @@ Rectangle {
// Send area.
// -------------------------------------------------------------------------
Loader {
id: textArea
Borders {
Layout.fillWidth: true
Layout.preferredHeight: active ? ChatStyle.sendArea.height + ChatStyle.sendArea.border.width : 0
Layout.preferredHeight: ChatStyle.sendArea.height + ChatStyle.sendArea.border.width
active: SettingsModel.chatEnabled
sourceComponent: Borders {
property alias text: textArea.text
borderColor: ChatStyle.sendArea.border.color
topWidth: ChatStyle.sendArea.border.width
visible: SettingsModel.chatEnabled
DroppableTextArea {
id: textArea
anchors.fill: parent
borderColor: ChatStyle.sendArea.border.color
topWidth: ChatStyle.sendArea.border.width
DroppableTextArea {
id: textArea
dropEnabled: SettingsModel.fileTransferUrl.length > 0
dropDisabledReason: qsTr('noFileTransferUrl')
placeholderText: qsTr('newMessagePlaceholder')
anchors.fill: parent
dropEnabled: SettingsModel.fileTransferUrl.length > 0
dropDisabledReason: qsTr('noFileTransferUrl')
placeholderText: qsTr('newMessagePlaceholder')
onDropped: Logic.handleFilesDropped(files)
onTextChanged: Logic.handleTextChanged(text)
onValidText: Logic.sendMessage(text)
}
onDropped: Logic.handleFilesDropped(files)
onTextChanged: Logic.handleTextChanged(text)
onValidText: Logic.sendMessage(text)
}
}
}

View file

@ -54,14 +54,11 @@ Notification {
anchors.centerIn: parent
iconSize: NotificationReceivedCallStyle.actionArea.iconSize
Loader {
active: SettingsModel.videoSupported
sourceComponent: ActionButton {
icon: 'video_call_accept'
iconSize: acceptActionBar.iconSize
ActionButton {
icon: 'video_call_accept'
visible: SettingsModel.videoSupported
onClicked: notification._close(notification.call.acceptWithVideo)
}
onClicked: notification._close(notification.call.acceptWithVideo)
}
ActionButton {

View file

@ -38,12 +38,12 @@ SearchBox {
id: view
actions: [{
active: SettingsModel.videoSupported,
icon: 'video_call',
handler: function (entry) {
searchBox.closeMenu()
searchBox.launchVideoCall(entry.sipAddress)
}
},
visible: SettingsModel.videoSupported
}, {
icon: 'call',
handler: function (entry) {

View file

@ -240,17 +240,14 @@ ScrollableListView {
Repeater {
model: sipAddressesView.actions
Loader {
active: {
var active = sipAddressesView.actions[index].active
return active === undefined || active
ActionButton {
icon: modelData.icon
visible: {
var visible = sipAddressesView.actions[index].visible
return visible === undefined || visible
}
sourceComponent: ActionButton {
icon: modelData.icon
iconSize: actionBar.iconSize
onClicked: sipAddressesView.actions[index].handler($sipAddress)
}
onClicked: sipAddressesView.actions[index].handler($sipAddress)
}
}
}

View file

@ -59,12 +59,12 @@ DialogPlus {
anchors.fill: parent
actions: [{
active: SettingsModel.videoSupported,
icon: 'video_call',
handler: function (entry) {
CallsListModel.launchVideoCall(entry.sipAddress)
exit(1)
}
},
visible: SettingsModel.videoSupported
}, {
icon: 'call',
handler: function (entry) {

View file

@ -343,20 +343,17 @@ Rectangle {
}
}
Loader {
active: SettingsModel.videoSupported
sourceComponent: ActionSwitch {
enabled: incall.call.videoEnabled
icon: 'camera'
iconSize: CallStyle.actionArea.iconSize
updating: incall.call.updating
ActionSwitch {
enabled: incall.call.videoEnabled
icon: 'camera'
updating: incall.call.updating
visible: SettingsModel.videoSupported
onClicked: incall.call.videoEnabled = !enabled
onClicked: incall.call.videoEnabled = !enabled
TooltipArea {
text: qsTr('pendingRequestLabel')
visible: parent.updating
}
TooltipArea {
text: qsTr('pendingRequestLabel')
visible: parent.updating
}
}

View file

@ -14,19 +14,15 @@ AbstractStartingCall {
anchors.centerIn: parent
iconSize: CallStyle.actionArea.iconSize
Loader {
active: SettingsModel.videoSupported
sourceComponent: ActionButton {
icon: 'video_call_accept'
iconSize: actionBar.iconSize
ActionButton {
icon: 'video_call_accept'
visible: SettingsModel.videoSupported
onClicked: call.acceptWithVideo()
}
onClicked: call.acceptWithVideo()
}
ActionButton {
icon: 'call_accept'
onClicked: call.accept()
}
}

View file

@ -124,22 +124,17 @@ ColumnLayout {
Item {
ActionBar {
id: actionBar
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
iconSize: ContactsStyle.contact.actionButtonsSize
Loader {
active: SettingsModel.videoSupported
sourceComponent: ActionButton {
icon: 'video_call'
iconSize: actionBar.iconSize
ActionButton {
icon: 'video_call'
visible: SettingsModel.videoSupported
onClicked: actions.itemAt(0).open()
}
onClicked: actions.itemAt(0).open()
}
ActionButton {

View file

@ -70,19 +70,14 @@ ColumnLayout {
spacing: ConversationStyle.bar.actions.spacing
ActionBar {
id: actionBar
anchors.verticalCenter: parent.verticalCenter
iconSize: ConversationStyle.bar.actions.call.iconSize
Loader {
active: SettingsModel.videoSupported
sourceComponent: ActionButton {
icon: 'video_call'
iconSize: actionBar.iconSize
ActionButton {
icon: 'video_call'
visible: SettingsModel.videoSupported
onClicked: CallsListModel.launchVideoCall(conversation.sipAddress)
}
onClicked: CallsListModel.launchVideoCall(conversation.sipAddress)
}
ActionButton {
@ -118,33 +113,30 @@ ColumnLayout {
// Messages/Calls filters.
// ---------------------------------------------------------------------------
Loader {
Borders {
Layout.fillWidth: true
Layout.preferredHeight: active ? ConversationStyle.filters.height : 0
active: SettingsModel.chatEnabled
sourceComponent: Borders {
anchors.fill: parent
borderColor: ConversationStyle.filters.border.color
bottomWidth: ConversationStyle.filters.border.bottomWidth
color: ConversationStyle.filters.backgroundColor
topWidth: ConversationStyle.filters.border.topWidth
borderColor: ConversationStyle.filters.border.color
bottomWidth: ConversationStyle.filters.border.bottomWidth
color: ConversationStyle.filters.backgroundColor
topWidth: ConversationStyle.filters.border.topWidth
visible: SettingsModel.chatEnabled
ExclusiveButtons {
anchors {
left: parent.left
leftMargin: ConversationStyle.filters.leftMargin
verticalCenter: parent.verticalCenter
}
texts: [
qsTr('displayCallsAndMessages'),
qsTr('displayCalls'),
qsTr('displayMessages')
]
onClicked: Logic.updateChatFilter(button)
ExclusiveButtons {
anchors {
left: parent.left
leftMargin: ConversationStyle.filters.leftMargin
verticalCenter: parent.verticalCenter
}
texts: [
qsTr('displayCallsAndMessages'),
qsTr('displayCalls'),
qsTr('displayMessages')
]
onClicked: Logic.updateChatFilter(button)
}
}

View file

@ -62,7 +62,6 @@ ApplicationWindow {
TabButton {
enabled: SettingsModel.videoSupported
iconName: 'settings_video'
text: qsTr('videoTab')
width: implicitWidth