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
f556fde8
Commit
f556fde8
authored
Dec 08, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(views/App/MainWindow/ContactEdit): username can be edited
parent
add3cffb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
111 additions
and
22 deletions
+111
-22
resources.qrc
tests/resources.qrc
+1
-0
ContactModel.cpp
tests/src/components/contacts/ContactModel.cpp
+9
-10
ContactModel.hpp
tests/src/components/contacts/ContactModel.hpp
+2
-2
ScrollableTextEdit.qml
tests/ui/modules/Common/Form/ScrollableTextEdit.qml
+83
-0
TextEdit.qml
tests/ui/modules/Common/Form/TextEdit.qml
+5
-7
qmldir
tests/ui/modules/Common/qmldir
+1
-0
Message.qml
tests/ui/modules/Linphone/Chat/Message.qml
+0
-2
ContactEdit.qml
tests/ui/views/App/MainWindow/ContactEdit.qml
+10
-1
No files found.
tests/resources.qrc
View file @
f556fde8
...
...
@@ -137,6 +137,7 @@
<file>
ui/modules/Common/Form/CheckBoxText.qml
</file>
<file>
ui/modules/Common/Form/ExclusiveButtons.qml
</file>
<file>
ui/modules/Common/Form/ListForm.qml
</file>
<file>
ui/modules/Common/Form/ScrollableTextEdit.qml
</file>
<file>
ui/modules/Common/Form/SmallButton.qml
</file>
<file>
ui/modules/Common/Form/TextButtonA.qml
</file>
<file>
ui/modules/Common/Form/TextButtonB.qml
</file>
...
...
tests/src/components/contacts/ContactModel.cpp
View file @
f556fde8
...
...
@@ -30,13 +30,12 @@ QString ContactModel::getUsername () const {
);
}
bool
ContactModel
::
setUsername
(
const
QString
&
username
)
{
if
(
username
.
length
()
==
0
)
return
false
;
void
ContactModel
::
setUsername
(
const
QString
&
username
)
{
if
(
username
.
length
()
==
0
||
username
==
getUsername
()
)
return
;
return
!
m_linphone_friend
->
setName
(
Utils
::
qStringToLinphoneString
(
username
)
);
if
(
!
m_linphone_friend
->
setName
(
Utils
::
qStringToLinphoneString
(
username
)))
emit
contactUpdated
();
}
// -------------------------------------------------------------------
...
...
@@ -62,12 +61,12 @@ QString ContactModel::getAvatar () const {
));
}
bool
ContactModel
::
setAvatar
(
const
QString
&
path
)
{
void
ContactModel
::
setAvatar
(
const
QString
&
path
)
{
// 1. Try to copy photo in avatars folder.
QFile
file
(
path
);
if
(
!
file
.
exists
()
||
QImageReader
::
imageFormat
(
path
).
size
()
==
0
)
return
false
;
return
;
QFileInfo
info
(
file
);
QString
uuid
=
QUuid
::
createUuid
().
toString
();
...
...
@@ -79,7 +78,7 @@ bool ContactModel::setAvatar (const QString &path) {
file_id
;
if
(
!
file
.
copy
(
dest
))
return
false
;
return
;
qInfo
()
<<
QStringLiteral
(
"Update avatar of `%1`. (path=%2)"
)
.
arg
(
getUsername
()).
arg
(
dest
);
...
...
@@ -116,7 +115,7 @@ bool ContactModel::setAvatar (const QString &path) {
emit
contactUpdated
();
return
true
;
return
;
}
// -------------------------------------------------------------------
...
...
tests/src/components/contacts/ContactModel.hpp
View file @
f556fde8
...
...
@@ -89,10 +89,10 @@ signals:
private:
QString
getUsername
()
const
;
bool
setUsername
(
const
QString
&
username
);
void
setUsername
(
const
QString
&
username
);
QString
getAvatar
()
const
;
bool
setAvatar
(
const
QString
&
path
);
void
setAvatar
(
const
QString
&
path
);
QVariantList
getSipAddresses
()
const
;
void
setSipAddresses
(
const
QVariantList
&
sip_addresses
);
...
...
tests/ui/modules/Common/Form/ScrollableTextEdit.qml
0 → 100644
View file @
f556fde8
import
QtQuick
2.7
import
QtQuick
2.7
as
Quick
import
Common
1.0
import
Common
.
Styles
1.0
// ===================================================================
Item
{
property
alias
text
:
textEdit
.
text
property
alias
font
:
textEdit
.
font
property
alias
color
:
textEdit
.
color
signal
editionFinished
// -----------------------------------------------------------------
function
_handleEditionFinished
()
{
textEdit
.
cursorPosition
=
0
editionFinished
()
}
// -----------------------------------------------------------------
Rectangle
{
anchors.fill
:
flick
color
:
textEdit
.
activeFocus
&&
!
textEdit
.
readOnly
?
TextEditStyle
.
backgroundColor
.
focused
:
TextEditStyle
.
backgroundColor
.
normal
InvertedMouseArea
{
anchors.fill
:
parent
enabled
:
textEdit
.
activeFocus
onPressed
:
textEdit
.
focus
=
false
}
}
Flickable
{
id
:
flick
// See: http://doc.qt.io/qt-5/qml-qtquick-texttextEdit.html
function
_ensureVisible
(
r
)
{
if
(
contentX
>=
r
.
x
)
{
contentX
=
r
.
x
}
else
if
(
contentX
+
width
<=
r
.
x
+
r
.
width
)
{
contentX
=
r
.
x
+
r
.
width
-
width
}
if
(
contentY
>=
r
.
y
)
{
contentY
=
r
.
y
}
else
if
(
contentY
+
height
<=
r
.
y
+
r
.
height
)
{
contentY
=
r
.
y
+
r
.
height
-
height
}
}
anchors.fill
:
parent
boundsBehavior
:
Flickable
.
StopAtBounds
clip
:
true
contentHeight
:
textEdit
.
paintedHeight
contentWidth
:
textEdit
.
paintedWidth
interactive
:
textEdit
.
activeFocus
Quick.TextEdit
{
id
:
textEdit
color
:
activeFocus
&&
!
readOnly
?
TextEditStyle
.
textColor
.
focused
:
TextEditStyle
.
textColor
.
normal
padding
:
ListFormStyle
.
value
.
text
.
padding
selectByMouse
:
true
wrapMode
:
Text
.
Wrap
Keys.onEscapePressed
:
focus
=
false
Keys.onReturnPressed
:
focus
=
false
height
:
flick
.
height
width
:
flick
.
width
onCursorRectangleChanged
:
flick
.
_ensureVisible
(
cursorRectangle
)
onEditingFinished
:
_handleEditionFinished
()
}
}
}
tests/ui/modules/Common/Form/TextEdit.qml
View file @
f556fde8
...
...
@@ -8,16 +8,13 @@ import Common.Styles 1.0
TextEdit
{
id
:
textEdit
color
:
activeFocus
color
:
activeFocus
&&
!
readOnly
?
TextEditStyle
.
textColor
.
focused
:
TextEditStyle
.
textColor
.
normal
padding
:
ListFormStyle
.
value
.
text
.
padding
selectByMouse
:
true
verticalAlignment
:
TextEdit
.
AlignVCenter
width
:
!
activeFocus
?
parent
.
width
:
contentWidth
+
padding
*
2
wrapMode
:
Text
.
Wrap
Keys.onEscapePressed
:
focus
=
false
Keys.onReturnPressed
:
focus
=
false
...
...
@@ -29,9 +26,10 @@ TextEdit {
}
Rectangle
{
color
:
parent
.
activeFocus
anchors.fill
:
textEdit
color
:
textEdit
.
activeFocus
&&
!
readOnly
?
TextEditStyle
.
backgroundColor
.
focused
:
TextEditStyle
.
backgroundColor
.
normal
anchors.fill
:
parent
z
:
-
1
}
}
tests/ui/modules/Common/qmldir
View file @
f556fde8
...
...
@@ -38,6 +38,7 @@ CheckBoxText 1.0 Form/CheckBoxText.qml
ExclusiveButtons 1.0 Form/ExclusiveButtons.qml
LightButton 1.0 Form/LightButton.qml
ListForm 1.0 Form/ListForm.qml
ScrollableTextEdit 1.0 Form/ScrollableTextEdit.qml
TextButtonA 1.0 Form/TextButtonA.qml
TextButtonB 1.0 Form/TextButtonB.qml
TextEdit 1.0 Form/TextEdit.qml
...
...
tests/ui/modules/Linphone/Chat/Message.qml
View file @
f556fde8
...
...
@@ -70,8 +70,6 @@ Item {
// and http://doc.qt.io/qt-5/richtext-html-subset.html
textFormat
:
Text
.
RichText
// To supports links and imgs.
wrapMode
:
Text
.
Wrap
onHoveredLinkChanged
:
_handleHoveredLink
(
hoveredLink
)
onLinkActivated
:
Qt
.
openUrlExternally
(
link
)
...
...
tests/ui/views/App/MainWindow/ContactEdit.qml
View file @
f556fde8
...
...
@@ -96,8 +96,12 @@ ColumnLayout {
}
}
TextEdit
{
ScrollableTextEdit
{
id
:
editUsername
Layout.fillWidth
:
true
Layout.preferredHeight
:
ContactEditStyle
.
infoBar
.
buttons
.
size
color
:
ContactEditStyle
.
infoBar
.
username
.
color
font
{
...
...
@@ -106,6 +110,11 @@ ColumnLayout {
}
text
:
avatar
.
username
onEditionFinished
:
{
_contact
.
username
=
text
text
=
_contact
.
username
}
}
ActionBar
{
...
...
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