Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-windows
Commits
9d0011fe
Commit
9d0011fe
authored
Mar 05, 2020
by
Ming Rui Zhang
Browse files
messagewebview: add typing indicator support
Change-Id: I69ecb47073ae54a2c8f887598381794df54ef3ef
parent
571566bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/callwidget.cpp
View file @
9d0011fe
...
...
@@ -942,6 +942,8 @@ CallWidget::setupChatView(const lrc::api::conversation::Info& convInfo)
ui
->
sendContactRequestButton
->
setVisible
(
shouldShowSendContactRequestBtn
);
ui
->
messageView
->
setMessagesVisibility
(
false
);
connect
(
LRCInstance
::
getCurrentConversationModel
(),
&
ConversationModel
::
composingStatusChanged
,
ui
->
messageView
,
&
MessageWebView
::
contactIsComposing
);
Utils
::
oneShotConnect
(
ui
->
messageView
,
&
MessageWebView
::
sendMessageContentSaved
,
[
this
,
convInfo
,
accountId
=
accountInfo
.
id
,
lastConvUid
=
lastConvUid_
](
const
QString
&
content
)
{
if
(
!
lastConvUid
.
isEmpty
())
{
...
...
src/messagewebview.cpp
View file @
9d0011fe
...
...
@@ -129,6 +129,7 @@ MessageWebView::MessageWebView(QWidget *parent)
fullScreenWebWidget_
.
reset
();
}
});
}
MessageWebView
::~
MessageWebView
()
...
...
@@ -505,6 +506,15 @@ MessageWebView::setSendMessageContent(const QString& content)
page
()
->
runJavaScript
(
s
,
QWebEngineScript
::
MainWorld
);
}
void
MessageWebView
::
contactIsComposing
(
const
QString
&
uid
,
const
QString
&
contactUri
,
bool
isComposing
)
{
if
(
LRCInstance
::
getCurrentConvUid
()
==
uid
)
{
QString
s
=
QString
::
fromLatin1
(
"showTypingIndicator(`%1`, %2);"
).
arg
(
contactUri
).
arg
(
isComposing
);
page
()
->
runJavaScript
(
s
,
QWebEngineScript
::
MainWorld
);
}
}
// JS bridging incoming
Q_INVOKABLE
int
PrivateBridging
::
log
(
const
QString
&
arg
)
...
...
@@ -784,7 +794,13 @@ PrivateBridging::saveSendMessageContent(const QString& arg)
qDebug
()
<<
"JS bridging - exception during saveSendMessageContent!"
;
}
return
0
;
}
Q_INVOKABLE
int
PrivateBridging
::
onComposing
(
bool
isComposing
)
{
LRCInstance
::
getCurrentConversationModel
()
->
setIsComposing
(
LRCInstance
::
getCurrentConvUid
(),
isComposing
);
return
0
;
}
FullScreenWebWidget
::
FullScreenWebWidget
(
QWebEngineView
*
oldView
,
QWidget
*
parent
)
...
...
src/messagewebview.h
View file @
9d0011fe
...
...
@@ -63,6 +63,7 @@ public:
Q_INVOKABLE
int
openAudioRecorder
(
int
spikePosX
,
int
spikePosY
);
Q_INVOKABLE
int
openVideoRecorder
(
int
spikePosX
,
int
spikePosY
);
Q_INVOKABLE
int
saveSendMessageContent
(
const
QString
&
arg
);
Q_INVOKABLE
int
onComposing
(
bool
isComposing
);
};
class
MessageWebView
:
public
QWebEngineView
...
...
@@ -109,6 +110,7 @@ public:
void
displayNavbar
(
bool
display
);
void
requestSendMessageContent
();
void
setSendMessageContent
(
const
QString
&
content
);
void
contactIsComposing
(
const
QString
&
uid
,
const
QString
&
contactUri
,
bool
isComposing
);
protected:
...
...
Write
Preview
Supports
Markdown
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