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
Show 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:
...
@@ -38,6 +38,7 @@ public slots:
private:
private:
App
(
int
&
argc
,
char
**
argv
);
App
(
int
&
argc
,
char
**
argv
);
~
App
()
=
default
;
void
initContentApp
();
void
initContentApp
();
...
...
tests/src/app/DefaultTranslator.cpp
View file @
1d289809
#include <QDirIterator>
#include <QtDebug>
#include <QtDebug>
#include "DefaultTranslator.hpp"
#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
(
QString
DefaultTranslator
::
translate
(
const
char
*
context
,
const
char
*
context
,
const
char
*
source_text
,
const
char
*
source_text
,
const
char
*
disambiguation
,
const
char
*
disambiguation
,
int
n
int
n
)
const
{
)
const
{
if
(
!
m_contexts
.
contains
(
context
))
return
""
;
QString
translation
=
QTranslator
::
translate
(
context
,
source_text
,
disambiguation
,
n
);
QString
translation
=
QTranslator
::
translate
(
context
,
source_text
,
disambiguation
,
n
);
if
(
translation
.
length
()
==
0
)
if
(
translation
.
length
()
==
0
)
...
...
tests/src/app/DefaultTranslator.hpp
View file @
1d289809
#ifndef DEFAULT_TRANSLATOR_H_
#ifndef DEFAULT_TRANSLATOR_H_
#define DEFAULT_TRANSLATOR_H_
#define DEFAULT_TRANSLATOR_H_
#include <QSet>
#include <QTranslator>
#include <QTranslator>
// ===================================================================
// ===================================================================
class
DefaultTranslator
:
public
QTranslator
{
class
DefaultTranslator
:
public
QTranslator
{
public:
DefaultTranslator
();
~
DefaultTranslator
()
=
default
;
QString
translate
(
QString
translate
(
const
char
*
context
,
const
char
*
context
,
const
char
*
source_text
,
const
char
*
source_text
,
const
char
*
disambiguation
=
Q_NULLPTR
,
const
char
*
disambiguation
=
Q_NULLPTR
,
int
n
=
-
1
int
n
=
-
1
)
const
override
;
)
const
override
;
private:
QSet
<
QString
>
m_contexts
;
};
};
#endif
#endif
tests/src/components/timeline/TimelineModel.cpp
View file @
1d289809
#include <algorithm>
#include <algorithm>
#include <QDateTime>
#include <QDateTime>
#include <QSet>
#include <linphone++/linphone.hh>
#include <linphone++/linphone.hh>
#include "../../utils.hpp"
#include "../../utils.hpp"
...
@@ -89,17 +90,17 @@ void TimelineModel::init_entries () {
...
@@ -89,17 +90,17 @@ void TimelineModel::init_entries () {
}
}
// Insert calls events.
// Insert calls events.
Q
Hash
<
QString
,
bool
>
address_done
;
Q
Set
<
QString
>
address_done
;
for
(
const
auto
&
call_log
:
core
->
getCallLogs
())
{
for
(
const
auto
&
call_log
:
core
->
getCallLogs
())
{
// Get a sip uri to check.
// Get a sip uri to check.
QString
address
=
Utils
::
linphoneStringToQString
(
QString
address
=
Utils
::
linphoneStringToQString
(
call_log
->
getRemoteAddress
()
->
asString
()
call_log
->
getRemoteAddress
()
->
asString
()
);
);
if
(
address_done
.
value
(
address
))
if
(
address_done
.
contains
(
address
))
continue
;
// Already used.
continue
;
// Already used.
address_done
[
address
]
=
true
;
address_done
<<
address
;
// Make a new map.
// Make a new map.
QVariantMap
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