Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
linphone-desktop
Commits
370d07c1
Commit
370d07c1
authored
Dec 07, 2016
by
Ronan
Browse files
feat(views/App/MainWindow/ContactEdit): view in progress
parent
87059fa3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
161 additions
and
38 deletions
+161
-38
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-1
tests/assets/languages/en.ts
tests/assets/languages/en.ts
+4
-4
tests/assets/languages/fr.ts
tests/assets/languages/fr.ts
+4
-4
tests/src/components/contacts/ContactModel.cpp
tests/src/components/contacts/ContactModel.cpp
+69
-7
tests/src/components/contacts/ContactModel.hpp
tests/src/components/contacts/ContactModel.hpp
+40
-0
tests/ui/modules/Common/Form/ListForm.qml
tests/ui/modules/Common/Form/ListForm.qml
+25
-13
tests/ui/views/App/MainWindow/ContactEdit.qml
tests/ui/views/App/MainWindow/ContactEdit.qml
+18
-9
No files found.
tests/CMakeLists.txt
View file @
370d07c1
...
...
@@ -29,7 +29,7 @@ set(CUSTOM_FLAGS "\
-Wunused \
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CUSTOM_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
-DQT_QML_DEBUG"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
-DQT_QML_DEBUG
-DQT_DECLARATIVE_DEBUG
"
)
# --------------------------------------------------------------------
# Define packages, libs, sources, headers, resources and languages
...
...
tests/assets/languages/en.ts
View file @
370d07c1
...
...
@@ -116,11 +116,11 @@
<
/message
>
<
message
>
<
source
>
address
<
/source
>
<
translation
type
=
"
unfinished
"
>
ADDRESS
<
/translation
>
<
translation
type
=
"
obsolete
"
>
ADDRESS
<
/translation
>
<
/message
>
<
message
>
<
source
>
addressInput
<
/source
>
<
translation
type
=
"
unfinished
"
>
Address
<
/translation
>
<
translation
type
=
"
obsolete
"
>
Address
<
/translation
>
<
/message
>
<
message
>
<
source
>
emails
<
/source
>
...
...
@@ -132,11 +132,11 @@
<
/message
>
<
message
>
<
source
>
webSites
<
/source
>
<
translation
type
=
"
unfinished
"
>
WEB
SITE
(
S
)
<
/translation
>
<
translation
type
=
"
obsolete
"
>
WEB
SITE
(
S
)
<
/translation
>
<
/message
>
<
message
>
<
source
>
webSitesInput
<
/source
>
<
translation
type
=
"
unfinished
"
>
URL
<
/translation
>
<
translation
type
=
"
obsolete
"
>
URL
<
/translation
>
<
/message
>
<
message
>
<
source
>
avatarChooserTitle
<
/source
>
...
...
tests/assets/languages/fr.ts
View file @
370d07c1
...
...
@@ -108,11 +108,11 @@
<
/message
>
<
message
>
<
source
>
address
<
/source
>
<
translation
type
=
"
unfinished
"
>
ADRESSE
(
S
)
<
/translation
>
<
translation
type
=
"
obsolete
"
>
ADRESSE
(
S
)
<
/translation
>
<
/message
>
<
message
>
<
source
>
addressInput
<
/source
>
<
translation
type
=
"
unfinished
"
>
Adresse
<
/translation
>
<
translation
type
=
"
obsolete
"
>
Adresse
<
/translation
>
<
/message
>
<
message
>
<
source
>
emails
<
/source
>
...
...
@@ -124,11 +124,11 @@
<
/message
>
<
message
>
<
source
>
webSites
<
/source
>
<
translation
type
=
"
unfinished
"
>
SITE
(
S
)
WEB
<
/translation
>
<
translation
type
=
"
obsolete
"
>
SITE
(
S
)
WEB
<
/translation
>
<
/message
>
<
message
>
<
source
>
webSitesInput
<
/source
>
<
translation
type
=
"
unfinished
"
>
URL
<
/translation
>
<
translation
type
=
"
obsolete
"
>
URL
<
/translation
>
<
/message
>
<
message
>
<
source
>
avatarChooserTitle
<
/source
>
...
...
tests/src/components/contacts/ContactModel.cpp
View file @
370d07c1
...
...
@@ -22,13 +22,7 @@ ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) {
m_linphone_friend
=
linphone_friend
;
}
Presence
::
PresenceStatus
ContactModel
::
getPresenceStatus
()
const
{
return
m_presence_status
;
}
Presence
::
PresenceLevel
ContactModel
::
getPresenceLevel
()
const
{
return
Presence
::
getPresenceLevel
(
m_presence_status
);
}
// -------------------------------------------------------------------
QString
ContactModel
::
getUsername
()
const
{
return
Utils
::
linphoneStringToQString
(
...
...
@@ -45,6 +39,8 @@ bool ContactModel::setUsername (const QString &username) {
);
}
// -------------------------------------------------------------------
QString
ContactModel
::
getAvatar
()
const
{
// Find desktop avatar.
list
<
shared_ptr
<
belcard
::
BelCardPhoto
>
>
photos
=
...
...
@@ -123,6 +119,8 @@ bool ContactModel::setAvatar (const QString &path) {
return
true
;
}
// -------------------------------------------------------------------
QVariantList
ContactModel
::
getSipAddresses
()
const
{
QVariantList
list
;
...
...
@@ -133,9 +131,73 @@ QVariantList ContactModel::getSipAddresses () const {
}
void
ContactModel
::
setSipAddresses
(
const
QVariantList
&
sip_addresses
)
{
// TODO.
}
// -------------------------------------------------------------------
QVariantList
ContactModel
::
getCompanies
()
const
{
QVariantList
list
;
for
(
const
auto
&
company
:
m_linphone_friend
->
getVcard
()
->
getBelcard
()
->
getOrganizations
())
list
.
append
(
Utils
::
linphoneStringToQString
(
company
->
getValue
()));
return
list
;
}
void
ContactModel
::
setCompanies
(
const
QVariantList
&
companies
)
{
// TODO.
}
// -------------------------------------------------------------------
QVariantList
ContactModel
::
getEmails
()
const
{
QVariantList
list
;
for
(
const
auto
&
email
:
m_linphone_friend
->
getVcard
()
->
getBelcard
()
->
getEmails
())
list
.
append
(
Utils
::
linphoneStringToQString
(
email
->
getValue
()));
return
list
;
}
void
ContactModel
::
setEmails
(
const
QVariantList
&
emails
)
{
// TODO.
}
// -------------------------------------------------------------------
QVariantList
ContactModel
::
getUrls
()
const
{
QVariantList
list
;
for
(
const
auto
&
url
:
m_linphone_friend
->
getVcard
()
->
getBelcard
()
->
getURLs
())
list
.
append
(
Utils
::
linphoneStringToQString
(
url
->
getValue
()));
return
list
;
}
void
ContactModel
::
setUrls
(
const
QVariantList
&
urls
)
{
// TODO.
}
// -------------------------------------------------------------------
QList
<
QVariantMap
>
ContactModel
::
getAddresses
()
const
{
}
void
ContactModel
::
setAddresses
(
const
QList
<
QVariantMap
>
&
addresses
)
{
}
// -------------------------------------------------------------------
Presence
::
PresenceStatus
ContactModel
::
getPresenceStatus
()
const
{
return
m_presence_status
;
}
Presence
::
PresenceLevel
ContactModel
::
getPresenceLevel
()
const
{
return
Presence
::
getPresenceLevel
(
m_presence_status
);
}
QString
ContactModel
::
getSipAddress
()
const
{
return
Utils
::
linphoneStringToQString
(
m_linphone_friend
->
getAddress
()
->
asString
()
...
...
tests/src/components/contacts/ContactModel.hpp
View file @
370d07c1
...
...
@@ -35,6 +35,34 @@ class ContactModel : public QObject {
NOTIFY
contactUpdated
);
Q_PROPERTY
(
QVariantList
companies
READ
getCompanies
WRITE
setCompanies
NOTIFY
contactUpdated
);
Q_PROPERTY
(
QVariantList
emails
READ
getEmails
WRITE
setEmails
NOTIFY
contactUpdated
);
Q_PROPERTY
(
QVariantList
urls
READ
getUrls
WRITE
setUrls
NOTIFY
contactUpdated
);
Q_PROPERTY
(
QList
<
QVariantMap
>
addresses
READ
getAddresses
WRITE
setAddresses
NOTIFY
contactUpdated
);
Q_PROPERTY
(
Presence
::
PresenceStatus
presenceStatus
READ
getPresenceStatus
...
...
@@ -69,6 +97,18 @@ private:
QVariantList
getSipAddresses
()
const
;
void
setSipAddresses
(
const
QVariantList
&
sip_addresses
);
QVariantList
getCompanies
()
const
;
void
setCompanies
(
const
QVariantList
&
companies
);
QVariantList
getEmails
()
const
;
void
setEmails
(
const
QVariantList
&
emails
);
QVariantList
getUrls
()
const
;
void
setUrls
(
const
QVariantList
&
urls
);
QList
<
QVariantMap
>
getAddresses
()
const
;
void
setAddresses
(
const
QList
<
QVariantMap
>
&
addresses
);
Presence
::
PresenceStatus
getPresenceStatus
()
const
;
Presence
::
PresenceLevel
getPresenceLevel
()
const
;
...
...
tests/ui/modules/Common/Form/ListForm.qml
View file @
370d07c1
...
...
@@ -11,6 +11,7 @@ RowLayout {
property
alias
placeholder
:
placeholder
.
text
property
alias
title
:
text
.
text
property
var
defaultData
:
[]
// -----------------------------------------------------------------
...
...
@@ -24,10 +25,8 @@ RowLayout {
function
_handleEditionFinished
(
index
,
text
)
{
if
(
text
.
length
===
0
)
{
console
.
log
(
'
edition end
'
)
values
.
model
.
remove
(
index
)
}
else
{
console
.
log
(
'
edition end (text exists)
'
)
values
.
model
.
set
(
index
,
{
$value
:
text
})
}
...
...
@@ -87,10 +86,7 @@ RowLayout {
}
padding
:
ListFormStyle
.
value
.
text
.
padding
visible
:
{
console
.
log
(
'
placeholder
'
,
values
.
model
.
count
)
return
values
.
model
.
count
===
0
}
visible
:
values
.
model
.
count
===
0
verticalAlignment
:
Text
.
AlignVCenter
}
...
...
@@ -104,10 +100,7 @@ RowLayout {
Layout.fillWidth
:
true
Layout.preferredHeight
:
count
*
ListFormStyle
.
lineHeight
interactive
:
false
visible
:
{
console
.
log
(
'
values
'
,
model
.
count
)
return
model
.
count
>
0
}
visible
:
model
.
count
>
0
delegate
:
Item
{
implicitHeight
:
textEdit
.
height
...
...
@@ -150,14 +143,33 @@ RowLayout {
Component.onCompleted
:
{
if
(
$value
.
length
===
0
)
{
// Magic code. If it's the first inserted value,
// an event or a callback steal the item focus.
// I suppose it's an internal Qt qml event...
//
// So, I choose to run a callback executed after this
// internal event.
Utils
.
setTimeout
(
listForm
,
0
,
function
()
{
textEdit
.
forceActiveFocus
()
})
}
}
}
model
:
ListModel
{
ListElement
{
$value
:
'
merinos@sip.linphone.org
'
}
ListElement
{
$value
:
'
elisabeth.pro@sip.linphone.org
'
}
model
:
ListModel
{}
// ---------------------------------------------------------------
// Init values.
// ---------------------------------------------------------------
Component.onCompleted
:
{
if
(
!
defaultData
)
{
return
}
defaultData
.
forEach
(
function
(
data
)
{
model
.
append
({
$value
:
data
})
})
}
}
}
tests/ui/views/App/MainWindow/ContactEdit.qml
View file @
370d07c1
...
...
@@ -154,24 +154,33 @@ ColumnLayout {
anchors.right
:
parent
.
right
ListForm
{
title
:
qsTr
(
'
sipAccounts
'
)
placeholder
:
qsTr
(
'
sipAccountsInput
'
)
}
title
:
qsTr
(
'
sipAccounts
'
)
ListForm
{
title
:
qsTr
(
'
address
'
)
placeholder
:
qsTr
(
'
addressInput
'
)
defaultData
:
_contact
.
sipAddresses
}
ListForm
{
title
:
qsTr
(
'
emails
'
)
placeholder
:
qsTr
(
'
emailsInput
'
)
}
ListForm
{
title
:
qsTr
(
'
webSites
'
)
placeholder
:
qsTr
(
'
webSitesInput
'
)
defaultData
:
_contact
.
emails
}
}
}
}
/************************************************/
/* ListForm { */
/* title: qsTr('address') */
/* placeholder: qsTr('addressInput') */
/* } */
/* */
/* */
/* ListForm { */
/* title: qsTr('webSites') */
/* placeholder: qsTr('webSitesInput') */
/* } */
/************************************************/
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