mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-26 00:08:13 +00:00
fix(app): remove usage of Collapse in V1
This commit is contained in:
parent
97ba2e3b16
commit
68ccd50f2f
9 changed files with 12 additions and 332 deletions
|
|
@ -216,7 +216,6 @@
|
|||
<file>ui/modules/Common/Form/Fields/ScrollableListViewField.qml</file>
|
||||
<file>ui/modules/Common/Form/Fields/TextAreaField.qml</file>
|
||||
<file>ui/modules/Common/Form/Fields/TextField.qml</file>
|
||||
<file>ui/modules/Common/Form/+linux/SearchBox.qml</file>
|
||||
<file>ui/modules/Common/Form/ListForm.js</file>
|
||||
<file>ui/modules/Common/Form/ListForm.qml</file>
|
||||
<file>ui/modules/Common/Form/Placements/FormEmptyLine.qml</file>
|
||||
|
|
@ -247,7 +246,6 @@
|
|||
<file>ui/modules/Common/Menus/MenuItem.qml</file>
|
||||
<file>ui/modules/Common/Menus/Menu.qml</file>
|
||||
<file>ui/modules/Common/Misc/Borders.qml</file>
|
||||
<file>ui/modules/Common/Misc/Collapse.qml</file>
|
||||
<file>ui/modules/Common/Misc/ForceScrollBar.qml</file>
|
||||
<file>ui/modules/Common/Misc/Paned.qml</file>
|
||||
<file>ui/modules/Common/Popup/DesktopPopup.qml</file>
|
||||
|
|
@ -286,7 +284,6 @@
|
|||
<file>ui/modules/Common/Styles/Menus/DropDownStaticMenuStyle.qml</file>
|
||||
<file>ui/modules/Common/Styles/Menus/MenuItemStyle.qml</file>
|
||||
<file>ui/modules/Common/Styles/Menus/MenuStyle.qml</file>
|
||||
<file>ui/modules/Common/Styles/Misc/CollapseStyle.qml</file>
|
||||
<file>ui/modules/Common/Styles/Misc/ForceScrollBarStyle.qml</file>
|
||||
<file>ui/modules/Common/Styles/Misc/PanedStyle.qml</file>
|
||||
<file>ui/modules/Common/Styles/Popup/PopupStyle.qml</file>
|
||||
|
|
@ -324,8 +321,8 @@
|
|||
<file>ui/modules/Linphone/Contact/Contact.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/MessagesCounter.qml</file>
|
||||
<file>ui/modules/Linphone/Menus/SipAddressesMenu.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/Notification.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/NotificationNewVersionAvailable.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/Notification.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/NotificationReceivedCall.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml</file>
|
||||
|
|
|
|||
|
|
@ -1,151 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Utils 1.0
|
||||
|
||||
// =============================================================================
|
||||
// Specific GNU/Linux version of `SearchBox` component.
|
||||
// =============================================================================
|
||||
|
||||
Item {
|
||||
id: searchBox
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
readonly property alias filter: searchField.text
|
||||
readonly property alias isOpen: searchBox._isOpen
|
||||
readonly property var view: _content[0]
|
||||
|
||||
property alias entryHeight: menu.entryHeight
|
||||
property alias maxMenuHeight: menu.maxMenuHeight
|
||||
property alias placeholderText: searchField.placeholderText
|
||||
|
||||
default property alias _content: menu._content
|
||||
|
||||
property bool _isOpen: false
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
signal menuClosed
|
||||
signal menuOpened
|
||||
signal menuRequested
|
||||
signal enterPressed
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function closeMenu () {
|
||||
if (!_isOpen) {
|
||||
return
|
||||
}
|
||||
|
||||
_isOpen = false
|
||||
}
|
||||
|
||||
function openMenu () {
|
||||
if (_isOpen) {
|
||||
return
|
||||
}
|
||||
|
||||
_isOpen = true
|
||||
}
|
||||
|
||||
function _filter (text) {
|
||||
var model = searchBox.view.model
|
||||
Utils.assert(model.setFilter != null, '`model.setFilter` must be defined.')
|
||||
model.setFilter(text)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
implicitHeight: searchField.height
|
||||
|
||||
Item {
|
||||
implicitHeight: searchField.height + menu.height
|
||||
width: parent.width
|
||||
|
||||
TextField {
|
||||
id: searchField
|
||||
|
||||
icon: 'search'
|
||||
width: parent.width
|
||||
|
||||
Keys.onEscapePressed: searchBox.closeMenu()
|
||||
Keys.onReturnPressed: {
|
||||
searchBox.closeMenu()
|
||||
searchBox.enterPressed()
|
||||
}
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (activeFocus && !_isOpen) {
|
||||
searchBox.menuRequested()
|
||||
searchBox.openMenu()
|
||||
}
|
||||
}
|
||||
|
||||
onTextChanged: _filter(text)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
DropDownDynamicMenu {
|
||||
id: menu
|
||||
|
||||
relativeTo: searchField
|
||||
relativeY: searchField.height
|
||||
|
||||
// If the menu is focused, the main window loses the active status.
|
||||
// So It's necessary to map the keys events.
|
||||
Keys.forwardTo: searchField
|
||||
|
||||
onClosed: searchBox.closeMenu()
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: searchBox.view
|
||||
property: 'width'
|
||||
value: searchField.width
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: searchBox.view
|
||||
property: 'headerPositioning'
|
||||
value: searchBox.view.header ? ListView.OverlayHeader : ListView.InlineFooter
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
states: State {
|
||||
name: 'opened'
|
||||
when: _isOpen
|
||||
}
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: ''
|
||||
to: 'opened'
|
||||
|
||||
ScriptAction {
|
||||
script: {
|
||||
menu.open()
|
||||
|
||||
searchBox.menuOpened()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Transition {
|
||||
from: 'opened'
|
||||
to: ''
|
||||
|
||||
ScriptAction {
|
||||
script: {
|
||||
menu.close()
|
||||
searchField.focus = false
|
||||
|
||||
searchBox.menuClosed()
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Window 2.2
|
||||
|
||||
import Common 1.0
|
||||
import Utils 1.0
|
||||
|
||||
// =============================================================================
|
||||
// A reusable search input which display a entries model in a menu.
|
||||
// Each entry can be filtered with the search input.
|
||||
// Specific GNU/Linux version of `SearchBox` component.
|
||||
// =============================================================================
|
||||
|
||||
Item {
|
||||
|
|
@ -57,21 +55,12 @@ Item {
|
|||
model.setFilter(text)
|
||||
}
|
||||
|
||||
function _handleCoords () {
|
||||
searchBox.closeMenu()
|
||||
|
||||
var point = searchBox.mapToItem(null, 0, searchBox.height)
|
||||
|
||||
desktopPopup.popupX = window.x + point.x
|
||||
desktopPopup.popupY = window.y + point.y
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
implicitHeight: searchField.height
|
||||
|
||||
Item {
|
||||
implicitHeight: searchField.height
|
||||
implicitHeight: searchField.height + menu.height
|
||||
width: parent.width
|
||||
|
||||
TextField {
|
||||
|
|
@ -94,49 +83,21 @@ Item {
|
|||
}
|
||||
|
||||
onTextChanged: _filter(text)
|
||||
|
||||
InvertedMouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: searchBox._isOpen
|
||||
|
||||
onPressed: searchBox.closeMenu()
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Connections {
|
||||
target: searchBox.Window.window
|
||||
DropDownDynamicMenu {
|
||||
id: menu
|
||||
|
||||
onHeightChanged: _handleCoords()
|
||||
onWidthChanged: _handleCoords()
|
||||
relativeTo: searchField
|
||||
relativeY: searchField.height
|
||||
|
||||
onXChanged: _handleCoords()
|
||||
onYChanged: _handleCoords()
|
||||
// If the menu is focused, the main window loses the active status.
|
||||
// So It's necessary to map the keys events.
|
||||
Keys.forwardTo: searchField
|
||||
|
||||
onVisibilityChanged: _handleCoords()
|
||||
}
|
||||
|
||||
// Wrap the search box menu in a window.
|
||||
DesktopPopup {
|
||||
id: desktopPopup
|
||||
|
||||
requestActivate: true
|
||||
|
||||
onVisibleChanged: !visible && searchBox.closeMenu()
|
||||
|
||||
DropDownDynamicMenu {
|
||||
id: menu
|
||||
|
||||
implicitHeight: searchBox.view.height
|
||||
width: searchField.width
|
||||
|
||||
// If the menu is focused, the main window loses the active status.
|
||||
// So It's necessary to map the keys events.
|
||||
Keys.forwardTo: searchField
|
||||
|
||||
onClosed: searchBox.closeMenu()
|
||||
}
|
||||
onClosed: searchBox.closeMenu()
|
||||
}
|
||||
|
||||
Binding {
|
||||
|
|
@ -167,7 +128,6 @@ Item {
|
|||
ScriptAction {
|
||||
script: {
|
||||
menu.open()
|
||||
desktopPopup.open()
|
||||
|
||||
searchBox.menuOpened()
|
||||
}
|
||||
|
|
@ -182,7 +142,6 @@ Item {
|
|||
script: {
|
||||
menu.close()
|
||||
searchField.focus = false
|
||||
desktopPopup.close()
|
||||
|
||||
searchBox.menuClosed()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,98 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
import Utils 1.0
|
||||
|
||||
// =============================================================================
|
||||
// A simple component to build collapsed item.
|
||||
// =============================================================================
|
||||
|
||||
Item {
|
||||
id: collapse
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
property var target
|
||||
property int targetHeight
|
||||
readonly property alias isCollapsed: collapse._collapsed
|
||||
|
||||
property bool _collapsed: false
|
||||
property var _savedHeight
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
signal collapsed (bool collapsed)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setCollapsed (status) {
|
||||
if (_collapsed === status) {
|
||||
return
|
||||
}
|
||||
|
||||
_collapsed = status
|
||||
|
||||
// Warning: Unable to use `PropertyChanges` because the change order is unknown.
|
||||
// It exists a bug on Ubuntu if the `height` property is changed before `minimumHeight`.
|
||||
if (_collapsed) {
|
||||
_savedHeight = Utils.extractProperties(target, [
|
||||
'height',
|
||||
'maximumHeight',
|
||||
'minimumHeight'
|
||||
])
|
||||
|
||||
target.minimumHeight = collapse.targetHeight
|
||||
target.maximumHeight = Constants.sizeMax
|
||||
target.height = collapse.targetHeight
|
||||
} else {
|
||||
target.minimumHeight = _savedHeight.minimumHeight
|
||||
target.maximumHeight = _savedHeight.maximumHeight
|
||||
target.height = _savedHeight.height
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
implicitHeight: button.iconSize
|
||||
implicitWidth: button.iconSize
|
||||
|
||||
property int savedHeight
|
||||
|
||||
ActionButton {
|
||||
id: button
|
||||
|
||||
anchors.centerIn: parent
|
||||
icon: 'collapse'
|
||||
iconSize: CollapseStyle.iconSize
|
||||
useStates: false
|
||||
|
||||
onClicked: setCollapsed(!_collapsed)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
states: State {
|
||||
when: _collapsed
|
||||
|
||||
PropertyChanges {
|
||||
rotation: 180
|
||||
target: button
|
||||
}
|
||||
}
|
||||
|
||||
transitions: Transition {
|
||||
SequentialAnimation {
|
||||
RotationAnimation {
|
||||
direction: RotationAnimation.Clockwise
|
||||
duration: CollapseStyle.animationDuration
|
||||
property: 'rotation'
|
||||
target: button
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: collapsed(_collapsed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
pragma Singleton
|
||||
import QtQuick 2.7
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property int animationDuration: 200
|
||||
property int iconSize: 14
|
||||
}
|
||||
|
|
@ -45,7 +45,6 @@ singleton DropDownStaticMenuStyle 1.0 Menus/DropDownStaticMenuStyle.qml
|
|||
singleton MenuItemStyle 1.0 Menus/MenuItemStyle.qml
|
||||
singleton MenuStyle 1.0 Menus/MenuStyle.qml
|
||||
|
||||
singleton CollapseStyle 1.0 Misc/CollapseStyle.qml
|
||||
singleton ForceScrollBarStyle 1.0 Misc/ForceScrollBarStyle.qml
|
||||
singleton PanedStyle 1.0 Misc/PanedStyle.qml
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ Menu 1.0 Menus/Menu.qml
|
|||
MenuItem 1.0 Menus/MenuItem.qml
|
||||
|
||||
Borders 1.0 Misc/Borders.qml
|
||||
Collapse 1.0 Misc/Collapse.qml
|
||||
ForceScrollBar 1.0 Misc/ForceScrollBar.qml
|
||||
Paned 1.0 Misc/Paned.qml
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ function setView (view, props) {
|
|||
|
||||
var item = mainLoader.item
|
||||
|
||||
item.collapse.setCollapsed(true)
|
||||
updateSelectedEntry(view, props)
|
||||
window._currentView = view
|
||||
item.contentLoader.setSource(view + '.qml', props || {})
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ ApplicationWindow {
|
|||
// Window properties.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
maximumHeight: MainWindowStyle.toolBar.height
|
||||
minimumHeight: MainWindowStyle.toolBar.height
|
||||
minimumHeight: MainWindowStyle.minimumHeight
|
||||
minimumWidth: MainWindowStyle.minimumWidth
|
||||
width: MainWindowStyle.width
|
||||
|
||||
|
|
@ -70,7 +69,6 @@ ApplicationWindow {
|
|||
|
||||
sourceComponent: ColumnLayout {
|
||||
// Workaround to get these properties in `MainWindow.js`.
|
||||
readonly property alias collapse: collapse
|
||||
readonly property alias contentLoader: contentLoader
|
||||
readonly property alias menu: menu
|
||||
readonly property alias timeline: timeline
|
||||
|
|
@ -101,17 +99,6 @@ ApplicationWindow {
|
|||
}
|
||||
spacing: MainWindowStyle.toolBar.spacing
|
||||
|
||||
Collapse {
|
||||
id: collapse
|
||||
|
||||
Layout.fillHeight: parent.height
|
||||
target: window
|
||||
targetHeight: MainWindowStyle.minimumHeight
|
||||
visible: Qt.platform.os !== 'linux'
|
||||
|
||||
Component.onCompleted: setCollapsed(true)
|
||||
}
|
||||
|
||||
AccountStatus {
|
||||
id: accountStatus
|
||||
|
||||
|
|
@ -251,8 +238,6 @@ ApplicationWindow {
|
|||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
visible: collapse.collapsed ? 1.0 : 0
|
||||
|
||||
source: 'Home.qml'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue