Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-qt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-qt
Commits
2343f34b
Commit
2343f34b
authored
1 year ago
by
Andreas Traczyk
Committed by
Sébastien Blin
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
messaging: run previewengine on its own thread
Change-Id: Iff267600c0802fbadedb58174b5fe65bbd1a443f
parent
692ba0d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/previewengine.cpp
+12
-0
12 additions, 0 deletions
src/app/previewengine.cpp
src/app/previewengine.h
+3
-1
3 additions, 1 deletion
src/app/previewengine.h
with
15 additions
and
1 deletion
src/app/previewengine.cpp
+
12
−
0
View file @
2343f34b
...
...
@@ -18,6 +18,7 @@
#include
"previewengine.h"
#include
<QRegularExpression>
#include
<QThread>
const
QRegularExpression
PreviewEngine
::
newlineRe
(
"
\\
r?
\\
n"
);
...
...
@@ -25,10 +26,21 @@ PreviewEngine::PreviewEngine(ConnectivityMonitor* cm, QObject* parent)
:
NetworkManager
(
cm
,
parent
)
,
htmlParser_
(
new
HtmlParser
(
this
))
{
// Run this object in a separate thread.
thread_
=
new
QThread
();
moveToThread
(
thread_
);
thread_
->
start
();
// Connect on a queued connection to avoid blocking caller thread.
connect
(
this
,
&
PreviewEngine
::
parseLink
,
this
,
&
PreviewEngine
::
onParseLink
,
Qt
::
QueuedConnection
);
}
PreviewEngine
::~
PreviewEngine
()
{
thread_
->
quit
();
thread_
->
wait
();
}
QString
PreviewEngine
::
getTagContent
(
const
QList
<
QString
>&
tags
,
const
QString
&
value
)
{
...
...
This diff is collapsed.
Click to expand it.
src/app/previewengine.h
+
3
−
1
View file @
2343f34b
...
...
@@ -27,7 +27,7 @@ class PreviewEngine final : public NetworkManager
Q_DISABLE_COPY
(
PreviewEngine
)
public:
PreviewEngine
(
ConnectivityMonitor
*
cm
,
QObject
*
parent
=
nullptr
);
~
PreviewEngine
()
=
default
;
~
PreviewEngine
();
Q_SIGNALS:
void
parseLink
(
const
QString
&
messageId
,
const
QString
&
link
);
...
...
@@ -45,4 +45,6 @@ private:
QString
getImage
(
const
QList
<
QString
>&
metaTags
);
static
const
QRegularExpression
newlineRe
;
QThread
*
thread_
;
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment