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
05d701fa
Commit
05d701fa
authored
Sep 15, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(scripts/utils): supports window creation and returned status
parent
057ef4d5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
147 additions
and
13 deletions
+147
-13
en.ts
tests/languages/en.ts
+19
-0
fr.ts
tests/languages/fr.ts
+19
-0
resources.qrc
tests/resources.qrc
+1
-0
ConfirmDialog.qml
tests/ui/components/dialog/ConfirmDialog.qml
+24
-0
DialogPlus.qml
tests/ui/components/dialog/DialogPlus.qml
+16
-0
utils.js
tests/ui/scripts/utils.js
+58
-11
contacts.qml
tests/ui/views/mainWindow/contacts.qml
+10
-2
No files found.
tests/languages/en.ts
View file @
05d701fa
<
?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?
>
<!
DOCTYPE
TS
>
<
TS
version
=
"
2.1
"
>
<
context
>
<
name
>
ConfirmDialog
<
/name
>
<
message
>
<
source
>
cancel
<
/source
>
<
translation
>
CANCEL
<
/translation
>
<
/message
>
<
message
>
<
source
>
confirm
<
/source
>
<
translation
>
CONFIRM
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
DropZone
<
/name
>
<
message
>
...
...
@@ -33,6 +44,14 @@
<
source
>
addContact
<
/source
>
<
translation
>
ADD
CONTACT
<
/translation
>
<
/message
>
<
message
>
<
source
>
removeContactDescription
<
/source
>
<
translation
>
Do
you
really
want
remove
this
contact
from
your
book
?
<
/translation
>
<
/message
>
<
message
>
<
source
>
removeContactTitle
<
/source
>
<
translation
>
Delete
confirmation
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
conversation
<
/name
>
...
...
tests/languages/fr.ts
View file @
05d701fa
<
?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?
>
<!
DOCTYPE
TS
>
<
TS
version
=
"
2.1
"
>
<
context
>
<
name
>
ConfirmDialog
<
/name
>
<
message
>
<
source
>
cancel
<
/source
>
<
translation
>
ANNULER
<
/translation
>
<
/message
>
<
message
>
<
source
>
confirm
<
/source
>
<
translation
>
CONFIRMER
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
DropZone
<
/name
>
<
message
>
...
...
@@ -33,6 +44,14 @@
<
source
>
addContact
<
/source
>
<
translation
>
AJOUTER
CONTACT
<
/translation
>
<
/message
>
<
message
>
<
source
>
removeContactDescription
<
/source
>
<
translation
>
Voulez
-
vous
vraiment
supprimer
ce
contact
de
votre
carnet
?
<
/translation
>
<
/message
>
<
message
>
<
source
>
removeContactTitle
<
/source
>
<
translation
>
Confirmation
de
la
suppression
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
conversation
<
/name
>
...
...
tests/resources.qrc
View file @
05d701fa
...
...
@@ -9,6 +9,7 @@
<file>
ui/components/contact/Contact.qml
</file>
<file>
ui/components/contact/ShortContactDescription.qml
</file>
<file>
ui/components/contact/Avatar.qml
</file>
<file>
ui/components/dialog/ConfirmDialog.qml
</file>
<file>
ui/components/dialog/DialogDescription.qml
</file>
<file>
ui/components/dialog/DialogPlus.qml
</file>
<file>
ui/components/form/CheckBoxText.qml
</file>
...
...
tests/ui/components/dialog/ConfirmDialog.qml
0 → 100644
View file @
05d701fa
import
QtQuick
2.7
import
'
qrc:/ui/components/form
'
// ===================================================================
DialogPlus
{
buttons
:
[
DarkButton
{
onClicked
:
exit
(
0
)
text
:
qsTr
(
'
cancel
'
)
},
DarkButton
{
onClicked
:
exit
(
1
)
text
:
qsTr
(
'
confirm
'
)
}
]
centeredButtons
:
true
id
:
dialog
maximumWidth
:
370
maximumHeight
:
150
minimumWidth
:
370
minimumHeight
:
150
}
tests/ui/components/dialog/DialogPlus.qml
View file @
05d701fa
...
...
@@ -12,8 +12,24 @@ Window {
property
alias
descriptionText
:
description
.
text
// Optionnal.
property
bool
centeredButtons
// Optionnal.
property
bool
disableExitStatus
// Internal property.
signal
exitStatus
(
int
status
)
modality
:
Qt
.
WindowModal
// Handle normal windows close.
onClosing
:
!
disableExitStatus
&&
exitStatus
(
0
)
// Derived class must use this function instead of close.
function
exit
(
status
)
{
if
(
!
disableExitStatus
)
{
disableExitStatus
=
true
exitStatus
(
status
)
close
()
}
}
ColumnLayout
{
anchors.fill
:
parent
spacing
:
0
...
...
tests/ui/scripts/utils.js
View file @
05d701fa
...
...
@@ -2,17 +2,64 @@
// Contains many common helpers.
// ===================================================================
function
openWindow
(
windowName
,
parent
)
{
var
component
=
Qt
.
createComponent
(
'
qrc:/ui/views/
'
+
windowName
+
'
.qml
'
);
if
(
component
.
status
!==
Component
.
Ready
)
{
console
.
debug
(
'
Window
'
+
windowName
+
'
not ready.
'
)
if
(
component
.
status
===
Component
.
Error
)
{
console
.
debug
(
'
Error:
'
+
component
.
errorString
())
}
// Load by default a window in the ui/views folder.
// If options.isString is equals to true, a marshalling component can
// be used.
//
// Supported options: isString, exitHandler.
//
// If exitHandler is used, window must implement returnedValue
// signal.
function
openWindow
(
window
,
parent
,
options
)
{
var
object
if
(
options
&&
options
.
isString
)
{
object
=
Qt
.
createQmlObject
(
window
,
parent
)
}
else
{
component
.
createObject
(
parent
).
show
()
var
component
=
Qt
.
createComponent
(
'
qrc:/ui/views/
'
+
window
+
'
.qml
'
)
if
(
component
.
status
!==
Component
.
Ready
)
{
console
.
debug
(
'
Window not ready.
'
)
if
(
component
.
status
===
Component
.
Error
)
{
console
.
debug
(
'
Error:
'
+
component
.
errorString
())
}
return
// Error.
}
object
=
component
.
createObject
(
parent
)
}
console
.
debug
(
'
Open window.
'
)
object
.
closing
.
connect
(
function
()
{
console
.
debug
(
'
Destroy window.
'
)
object
.
destroy
()
})
if
(
options
&&
options
.
exitHandler
)
{
object
.
exitStatus
.
connect
(
// Bind to access parent properties.
options
.
exitHandler
.
bind
(
parent
)
)
}
object
.
show
()
}
// -------------------------------------------------------------------
// Display a simple ConfirmDialog component. Wrap the openWindow function.
function
openConfirmDialog
(
parent
,
options
)
{
openWindow
(
'
import QtQuick 2.7;
'
+
'
import
\'
qrc:/ui/components/dialog
\'
;
'
+
'
ConfirmDialog {
'
+
'
descriptionText:
\'
'
+
options
.
descriptionText
+
'
\'
;
'
+
'
title:
\'
'
+
options
.
title
+
'
\'
'
+
'
}
'
,
parent
,
{
isString
:
true
,
exitHandler
:
options
.
exitHandler
}
)
}
tests/ui/views/mainWindow/contacts.qml
View file @
05d701fa
...
...
@@ -6,6 +6,8 @@ import 'qrc:/ui/components/contact'
import
'
qrc:/ui/components/form
'
import
'
qrc:/ui/components/scrollBar
'
import
'
qrc:/ui/scripts/utils.js
'
as
Utils
ColumnLayout
{
spacing
:
2
...
...
@@ -169,7 +171,7 @@ ColumnLayout {
RowLayout
{
anchors.fill
:
parent
anchors.leftMargin
:
15
anchors.rightMargin
:
1
5
anchors.rightMargin
:
2
5
spacing
:
15
// Avatar.
...
...
@@ -233,7 +235,13 @@ ColumnLayout {
ActionButton
{
iconSize
:
parent
.
height
icon
:
'
delete
'
onClicked
:
console
.
log
(
'
action: delete
'
)
onClicked
:
Utils
.
openConfirmDialog
(
contact
,
{
descriptionText
:
qsTr
(
'
removeContactDescription
'
),
exitHandler
:
function
(
status
)
{
console
.
log
(
'
remove contact
'
,
status
)
},
title
:
qsTr
(
'
removeContactTitle
'
)
})
}
}
}
...
...
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