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
1d289809
Commit
1d289809
authored
Nov 28, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app/DefaultTranslator): check linphone contexts
parent
e689cb46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
App.hpp
tests/src/app/App.hpp
+1
-0
DefaultTranslator.cpp
tests/src/app/DefaultTranslator.cpp
+20
-0
DefaultTranslator.hpp
tests/src/app/DefaultTranslator.hpp
+8
-0
TimelineModel.cpp
tests/src/components/timeline/TimelineModel.cpp
+4
-3
No files found.
tests/src/app/App.hpp
View file @
1d289809
...
...
@@ -38,6 +38,7 @@ public slots:
private:
App
(
int
&
argc
,
char
**
argv
);
~
App
()
=
default
;
void
initContentApp
();
...
...
tests/src/app/DefaultTranslator.cpp
View file @
1d289809
#include <QDirIterator>
#include <QtDebug>
#include "DefaultTranslator.hpp"
// ===================================================================
DefaultTranslator
::
DefaultTranslator
()
{
QDirIterator
it
(
":"
,
QDirIterator
::
Subdirectories
);
while
(
it
.
hasNext
())
{
QFileInfo
info
(
it
.
next
());
if
(
info
.
suffix
()
==
"qml"
)
{
QString
basename
=
info
.
baseName
();
if
(
m_contexts
.
contains
(
basename
))
qWarning
()
<<
QStringLiteral
(
"QML file `%1` already exists in context list."
).
arg
(
basename
);
else
m_contexts
<<
basename
;
}
}
}
QString
DefaultTranslator
::
translate
(
const
char
*
context
,
const
char
*
source_text
,
const
char
*
disambiguation
,
int
n
)
const
{
if
(
!
m_contexts
.
contains
(
context
))
return
""
;
QString
translation
=
QTranslator
::
translate
(
context
,
source_text
,
disambiguation
,
n
);
if
(
translation
.
length
()
==
0
)
...
...
tests/src/app/DefaultTranslator.hpp
View file @
1d289809
#ifndef DEFAULT_TRANSLATOR_H_
#define DEFAULT_TRANSLATOR_H_
#include <QSet>
#include <QTranslator>
// ===================================================================
class
DefaultTranslator
:
public
QTranslator
{
public:
DefaultTranslator
();
~
DefaultTranslator
()
=
default
;
QString
translate
(
const
char
*
context
,
const
char
*
source_text
,
const
char
*
disambiguation
=
Q_NULLPTR
,
int
n
=
-
1
)
const
override
;
private:
QSet
<
QString
>
m_contexts
;
};
#endif
tests/src/components/timeline/TimelineModel.cpp
View file @
1d289809
#include <algorithm>
#include <QDateTime>
#include <QSet>
#include <linphone++/linphone.hh>
#include "../../utils.hpp"
...
...
@@ -89,17 +90,17 @@ void TimelineModel::init_entries () {
}
// Insert calls events.
Q
Hash
<
QString
,
bool
>
address_done
;
Q
Set
<
QString
>
address_done
;
for
(
const
auto
&
call_log
:
core
->
getCallLogs
())
{
// Get a sip uri to check.
QString
address
=
Utils
::
linphoneStringToQString
(
call_log
->
getRemoteAddress
()
->
asString
()
);
if
(
address_done
.
value
(
address
))
if
(
address_done
.
contains
(
address
))
continue
;
// Already used.
address_done
[
address
]
=
true
;
address_done
<<
address
;
// Make a new map.
QVariantMap
map
;
...
...
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