Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
b0fc9216
Commit
b0fc9216
authored
May 16, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Common/Menus/DropDownDynamicMenu): use `Popup` component
parent
78de7898
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
107 additions
and
173 deletions
+107
-173
resources.qrc
linphone-desktop/resources.qrc
+1
-2
App.cpp
linphone-desktop/src/app/App.cpp
+4
-3
SearchBox.qml
linphone-desktop/ui/modules/Common/Form/+linux/SearchBox.qml
+3
-5
SearchBox.qml
linphone-desktop/ui/modules/Common/Form/SearchBox.qml
+3
-6
DropDownDynamicMenu.qml
...e-desktop/ui/modules/Common/Menus/DropDownDynamicMenu.qml
+85
-0
AbstractDropDownMenu.qml
...-desktop/ui/modules/Common/Popup/AbstractDropDownMenu.qml
+0
-154
Popup.qml
linphone-desktop/ui/modules/Common/Popup/Popup.qml
+8
-0
qmldir
linphone-desktop/ui/modules/Common/qmldir
+1
-1
utils.js
linphone-desktop/ui/scripts/Utils/utils.js
+1
-1
Assistant.qml
linphone-desktop/ui/views/App/Main/Assistant.qml
+1
-1
No files found.
linphone-desktop/resources.qrc
View file @
b0fc9216
...
...
@@ -223,14 +223,13 @@
<file>
ui/modules/Common/Indicators/VuMeter.qml
</file>
<file>
ui/modules/Common/Menus/ActionMenuEntry.qml
</file>
<file>
ui/modules/Common/Menus/ActionMenu.qml
</file>
<file>
ui/modules/Common/Menus/DropDownDynamicMenu.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/AbstractDropDownMenu.qml
</file>
<file>
ui/modules/Common/Popup/DesktopPopup.qml
</file>
<file>
ui/modules/Common/Popup/DropDownDynamicMenu.qml
</file>
<file>
ui/modules/Common/Popup/Popup.qml
</file>
<file>
ui/modules/Common/Popup/PopupShadow.qml
</file>
<file>
ui/modules/Common/qmldir
</file>
...
...
linphone-desktop/src/app/App.cpp
View file @
b0fc9216
...
...
@@ -28,6 +28,8 @@
#include <QtDebug>
#include <QTimer>
#include "gitversion.h"
#include "../components/Components.hpp"
#include "../Utils.hpp"
...
...
@@ -37,7 +39,6 @@
#include "translator/DefaultTranslator.hpp"
#include "App.hpp"
#include "gitversion.h"
#define DEFAULT_LOCALE "en"
...
...
@@ -51,7 +52,7 @@
#define QML_VIEW_SPLASH_SCREEN "qrc:/ui/views/App/SplashScreen/SplashScreen.qml"
#define SELF_TEST_DELAY
6
0000
#define SELF_TEST_DELAY
30
0000
#ifndef LINPHONE_QT_GIT_VERSION
#define LINPHONE_QT_GIT_VERSION "unknown"
...
...
@@ -153,10 +154,10 @@ void App::initContentApp () {
// Init engine content.
mEngine
=
new
QQmlApplicationEngine
();
qInfo
()
<<
QStringLiteral
(
"Activated selectors:"
)
<<
QQmlFileSelector
::
get
(
mEngine
)
->
selector
()
->
allSelectors
();
// Provide `+custom` folders for custom components.
(
new
QQmlFileSelector
(
mEngine
,
mEngine
))
->
setExtraSelectors
(
QStringList
(
"custom"
));
qInfo
()
<<
QStringLiteral
(
"Activated selectors:"
)
<<
QQmlFileSelector
::
get
(
mEngine
)
->
selector
()
->
allSelectors
();
// Set modules paths.
mEngine
->
addImportPath
(
":/ui/modules"
);
...
...
linphone-desktop/ui/modules/Common/Form/+linux/SearchBox.qml
View file @
b0fc9216
...
...
@@ -89,10 +89,8 @@ Item {
DropDownDynamicMenu
{
id
:
menu
launcher
:
searchField
relativeTo
:
searchField
relativeY
:
searchField
.
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.
...
...
@@ -103,8 +101,8 @@ Item {
ScrollableListView
{
id
:
list
anchors.fill
:
parent
headerPositioning
:
header
?
ListView
.
OverlayHeader
:
ListView
.
InlineFooter
width
:
searchField
.
width
}
}
}
...
...
@@ -123,7 +121,7 @@ Item {
ScriptAction
{
script
:
{
menu
.
show
Menu
()
menu
.
show
()
searchBox
.
menuOpened
()
}
...
...
@@ -136,7 +134,7 @@ Item {
ScriptAction
{
script
:
{
menu
.
hide
Menu
()
menu
.
hide
()
searchField
.
focus
=
false
searchBox
.
menuClosed
()
...
...
linphone-desktop/ui/modules/Common/Form/SearchBox.qml
View file @
b0fc9216
...
...
@@ -123,9 +123,6 @@ Item {
DropDownDynamicMenu
{
id
:
menu
launcher
:
searchField
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
...
...
@@ -135,8 +132,8 @@ Item {
ScrollableListView
{
id
:
list
anchors.fill
:
parent
headerPositioning
:
header
?
ListView
.
OverlayHeader
:
ListView
.
InlineFooter
width
:
searchField
.
width
}
}
}
...
...
@@ -156,7 +153,7 @@ Item {
ScriptAction
{
script
:
{
menu
.
show
Menu
()
menu
.
show
()
desktopPopup
.
show
()
searchBox
.
menuOpened
()
...
...
@@ -170,7 +167,7 @@ Item {
ScriptAction
{
script
:
{
menu
.
hide
Menu
()
menu
.
hide
()
searchField
.
focus
=
false
desktopPopup
.
hide
()
...
...
linphone-desktop/ui/modules/Common/
Popup
/DropDownDynamicMenu.qml
→
linphone-desktop/ui/modules/Common/
Menus
/DropDownDynamicMenu.qml
View file @
b0fc9216
...
...
@@ -4,14 +4,39 @@ import Common 1.0
import
Utils
1.0
// =============================================================================
// Menu which supports `ListView`.
// =============================================================================
AbstractDropDownMenu
{
Item
{
id
:
menu
// ---------------------------------------------------------------------------
property
alias
relativeTo
:
popup
.
relativeTo
property
alias
relativeX
:
popup
.
relativeX
property
alias
relativeY
:
popup
.
relativeY
// Can be computed, but for performance usage, it must be given in attribute.
property
int
entryHeight
property
int
maxMenuHeight
default
property
alias
_content
:
menuContent
.
data
// ---------------------------------------------------------------------------
signal
menuClosed
signal
menuOpened
// ---------------------------------------------------------------------------
function
show
()
{
popup
.
show
()
}
function
hide
()
{
popup
.
hide
()
}
// ---------------------------------------------------------------------------
function
_computeHeight
()
{
Utils
.
assert
(
_content
!=
null
&&
_content
.
length
>
0
,
'
`_content` cannot be null and must exists.
'
)
...
...
@@ -35,4 +60,26 @@ AbstractDropDownMenu {
?
maxMenuHeight
:
height
}
// ---------------------------------------------------------------------------
Popup
{
id
:
popup
onShown
:
menu
.
menuOpened
()
onHidden
:
menu
.
menuClosed
()
Item
{
id
:
menuContent
height
:
menu
.
_computeHeight
()
width
:
menu
.
_content
[
0
].
width
}
}
Binding
{
property
:
'
height
'
target
:
menu
.
_content
[
0
]
value
:
menuContent
.
height
}
}
linphone-desktop/ui/modules/Common/Popup/AbstractDropDownMenu.qml
deleted
100644 → 0
View file @
78de7898
import
QtQuick
2.7
import
Common
1.0
import
Common
.
Styles
1.0
import
Utils
1.0
// =============================================================================
// Low component to display a list/menu in a popup.
// =============================================================================
Item
{
id
:
menu
// ---------------------------------------------------------------------------
// Optionnal parameter, if defined and if a click is detected
// on it, menu is not closed.
property
var
launcher
// Optionnal parameters, set the position of Menu relative
// to this item.
property
var
relativeTo
property
int
relativeX
:
0
property
int
relativeY
:
0
default
property
alias
_content
:
content
.
data
property
bool
_isOpen
:
false
// ---------------------------------------------------------------------------
signal
menuClosed
signal
menuOpened
// ---------------------------------------------------------------------------
function
isOpen
()
{
return
_isOpen
}
function
showMenu
()
{
if
(
_isOpen
)
{
return
}
if
(
relativeTo
!=
null
)
{
this
.
x
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
x
this
.
y
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
y
}
_isOpen
=
true
}
function
hideMenu
()
{
if
(
!
_isOpen
)
{
return
}
_isOpen
=
false
}
function
_computeHeight
()
{
throw
new
Error
(
'
Virtual method must be implemented.
'
)
}
// ---------------------------------------------------------------------------
implicitHeight
:
0
opacity
:
0
visible
:
false
z
:
Constants
.
zPopup
Keys.onEscapePressed
:
hideMenu
()
// Set parent menu to root.
Component.onCompleted
:
{
if
(
relativeTo
!=
null
)
{
parent
=
Utils
.
getTopParent
(
this
)
}
}
// Handle clicks, wheel... below menu.
MouseArea
{
anchors.fill
:
parent
hoverEnabled
:
true
onWheel
:
{}
}
// Menu content.
Rectangle
{
id
:
content
anchors.fill
:
parent
color
:
PopupStyle
.
backgroundColor
layer
{
enabled
:
true
effect
:
PopupShadow
{}
}
}
// Inverted mouse area to detect click outside menu.
InvertedMouseArea
{
anchors.fill
:
parent
enabled
:
parent
.
visible
onPressed
:
{
if
(
launcher
==
null
||
!
pointIsInItem
(
launcher
))
{
hideMenu
()
}
}
}
// ---------------------------------------------------------------------------
states
:
State
{
name
:
'
opened
'
when
:
_isOpen
PropertyChanges
{
focus
:
true
// Necessary to use `Keys.onEscapePressed`.
implicitHeight
:
_computeHeight
()
opacity
:
1.0
target
:
menu
}
}
transitions
:
[
Transition
{
from
:
''
to
:
'
opened
'
ScriptAction
{
script
:
{
menu
.
visible
=
true
menuOpened
()
}
}
},
Transition
{
from
:
'
opened
'
to
:
''
SequentialAnimation
{
ScriptAction
{
script
:
{
menuClosed
()
visible
=
false
}
}
}
}
]
}
linphone-desktop/ui/modules/Common/Popup/Popup.qml
View file @
b0fc9216
...
...
@@ -18,6 +18,11 @@ Item {
// ---------------------------------------------------------------------------
signal
hidden
signal
shown
// ---------------------------------------------------------------------------
visible
:
false
function
show
()
{
...
...
@@ -79,5 +84,8 @@ Item {
padding
:
0
Component.onCompleted
:
parent
=
Utils
.
getTopParent
(
this
)
onClosed
:
wrapper
.
hidden
()
onOpened
:
wrapper
.
shown
()
}
}
linphone-desktop/ui/modules/Common/qmldir
View file @
b0fc9216
...
...
@@ -63,6 +63,7 @@ VuMeter 1.0 Indicators/VuMeter.qml
ActionMenu 1.0 Menus/ActionMenu.qml
ActionMenuEntry 1.0 Menus/ActionMenuEntry.qml
DropDownDynamicMenu 1.0 Menus/DropDownDynamicMenu.qml
Menu 1.0 Menus/Menu.qml
Borders 1.0 Misc/Borders.qml
...
...
@@ -71,7 +72,6 @@ ForceScrollBar 1.0 Misc/ForceScrollBar.qml
Paned 1.0 Misc/Paned.qml
DesktopPopup 1.0 Popup/DesktopPopup.qml
DropDownDynamicMenu 1.0 Popup/DropDownDynamicMenu.qml
Popup 1.0 Popup/Popup.qml
PopupShadow 1.0 Popup/PopupShadow.qml
...
...
linphone-desktop/ui/scripts/Utils/utils.js
View file @
b0fc9216
...
...
@@ -4,7 +4,7 @@
.
pragma
library
.
import
QtQuick
2.
0
as
QtQuick
.
import
QtQuick
2.
7
as
QtQuick
.
import
'
port-tools.js
'
as
PortTools
.
import
'
uri-tools.js
'
as
UriTools
...
...
linphone-desktop/ui/views/App/Main/Assistant.qml
View file @
b0fc9216
import
QtQuick
2.7
import
QtQuick
.
Controls
2.
0
import
QtQuick
.
Controls
2.
1
import
QtQuick
.
Window
2.2
import
Utils
1.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment