mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-27 16:59:21 +00:00
feat(app):
- many fixes - method `setView` of `MainWindow` update the menus/buttons of the interface. - ...
This commit is contained in:
parent
05b99bf111
commit
01ba4d78eb
6 changed files with 60 additions and 33 deletions
|
|
@ -3,9 +3,9 @@ import QtQuick 2.7
|
|||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
// A simple component to build collapsed item.
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
Item {
|
||||
id: collapse
|
||||
|
|
@ -17,13 +17,13 @@ Item {
|
|||
|
||||
signal collapsed (bool collapsed)
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function isCollapsed () {
|
||||
return _collapsed
|
||||
function setCollapsed (status) {
|
||||
_collapsed = status
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
implicitHeight: button.iconSize
|
||||
implicitWidth: button.iconSize
|
||||
|
|
@ -39,7 +39,7 @@ Item {
|
|||
onClicked: _collapsed = !_collapsed
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
states: State {
|
||||
when: _collapsed
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import QtQuick.Layouts 1.3
|
|||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
// Responsive flat menu with visual indicators.
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
Rectangle {
|
||||
id: menu
|
||||
|
|
@ -19,13 +19,17 @@ Rectangle {
|
|||
|
||||
signal entrySelected (int entry)
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setSelectedEntry (entry) {
|
||||
_selectedEntry = entry
|
||||
}
|
||||
|
||||
function resetSelectedEntry () {
|
||||
_selectedEntry = -1
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
color: MenuStyle.backgroundColor
|
||||
implicitHeight: content.height
|
||||
|
|
|
|||
|
|
@ -13,9 +13,8 @@ SearchBox {
|
|||
delegate: Rectangle {
|
||||
id: searchBoxEntry
|
||||
|
||||
width: parent.width
|
||||
height: searchBox.entryHeight
|
||||
color: '#FFFFFF'
|
||||
width: parent.width
|
||||
|
||||
Rectangle {
|
||||
id: indicator
|
||||
|
|
@ -85,9 +84,13 @@ SearchBox {
|
|||
|
||||
ActionButton {
|
||||
icon: 'chat'
|
||||
onClicked: window.setView('Conversation', {
|
||||
sipAddress: $entry.sipAddress || $entry.vcard.sipAddresses[0] // FIXME: Display menu if many addresses.
|
||||
})
|
||||
onClicked: {
|
||||
searchBox.hideMenu()
|
||||
window.ensureCollapsed()
|
||||
window.setView('Conversation', {
|
||||
sipAddress: $entry.sipAddress || $entry.vcard.sipAddresses[0] // FIXME: Display menu if many addresses.
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,18 @@ ColumnLayout {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function resetSelectedItem () {
|
||||
function setSelectedEntry (sipAddress) {
|
||||
var n = model.rowCount()
|
||||
|
||||
for (var i = 0; i < n; i++) {
|
||||
if (sipAddress === model.data(model.index(i, 0)).sipAddress) {
|
||||
view.currentIndex = i
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resetSelectedEntry () {
|
||||
view.currentIndex = -1
|
||||
}
|
||||
|
||||
|
|
@ -25,12 +36,15 @@ ColumnLayout {
|
|||
|
||||
spacing: 0
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Legend.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: TimelineStyle.legend.height
|
||||
color: TimelineStyle.legend.backgroundColor
|
||||
|
||||
// Legend.
|
||||
Row {
|
||||
anchors {
|
||||
fill: parent
|
||||
|
|
@ -55,7 +69,10 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// History.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ScrollableListView {
|
||||
id: view
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ ColumnLayout {
|
|||
|
||||
Layout.preferredHeight: ConversationStyle.bar.avatarSize
|
||||
Layout.preferredWidth: ConversationStyle.bar.avatarSize
|
||||
image: _contact.avatar
|
||||
presenceLevel: _contact.presenceLevel || Presence.White
|
||||
image: _contact.vcard.avatar
|
||||
presenceLevel: _contact.presenceLevel || -1
|
||||
username: LinphoneUtils.getContactUsername(_contact)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,21 @@ ApplicationWindow {
|
|||
id: window
|
||||
|
||||
function setView (view, props) {
|
||||
if (view === 'Home' || view === 'Contacts') {
|
||||
menu.setSelectedEntry(view === 'Home' ? 0 : 1)
|
||||
timeline.resetSelectedEntry()
|
||||
} else if (view === 'Conversation') {
|
||||
menu.resetSelectedEntry()
|
||||
timeline.setSelectedEntry(props.sipAddress)
|
||||
}
|
||||
|
||||
contentLoader.setSource(view + '.qml', props || {})
|
||||
}
|
||||
|
||||
function ensureCollapsed () {
|
||||
collapse.setCollapsed(true)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Window properties.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -46,6 +58,8 @@ ApplicationWindow {
|
|||
spacing: MainWindowStyle.toolBar.spacing
|
||||
|
||||
Collapse {
|
||||
id: collapse
|
||||
|
||||
Layout.fillHeight: parent.height
|
||||
target: window
|
||||
targetHeight: MainWindowStyle.minimumHeight
|
||||
|
|
@ -123,15 +137,7 @@ ApplicationWindow {
|
|||
icon: 'contact'
|
||||
}]
|
||||
|
||||
onEntrySelected: {
|
||||
timeline.resetSelectedItem()
|
||||
|
||||
if (entry === 0) {
|
||||
setView('Home')
|
||||
} else if (entry === 1) {
|
||||
setView('Contacts')
|
||||
}
|
||||
}
|
||||
onEntrySelected: !entry ? setView('Home') : setView('Contacts')
|
||||
}
|
||||
|
||||
// History.
|
||||
|
|
@ -142,10 +148,7 @@ ApplicationWindow {
|
|||
Layout.fillWidth: true
|
||||
model: TimelineModel
|
||||
|
||||
onEntrySelected: {
|
||||
menu.resetSelectedEntry()
|
||||
setView('Conversation', { sipAddress: entry })
|
||||
}
|
||||
onEntrySelected: setView('Conversation', { sipAddress: entry })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue