Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
71e593f8
Commit
71e593f8
authored
13 years ago
by
Emmanuel Lepage
Browse files
Options
Downloads
Patches
Plain Diff
[ #10222 ] Use categorized views, fix bookmark
parent
90426a19
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/CallModel.h
+5
-4
5 additions, 4 deletions
src/CallModel.h
src/CallModel.hpp
+47
-0
47 additions, 0 deletions
src/CallModel.hpp
with
52 additions
and
4 deletions
src/CallModel.h
+
5
−
4
View file @
71e593f8
...
...
@@ -126,10 +126,11 @@ class LIB_EXPORT CallModel : public CallModelBase {
void
removeConference
(
Call
*
call
);
//Getters
int
size
();
CallList
getCallList
();
static
const
CallHash
&
getHistory
();
static
const
QStringList
getHistoryCallId
();
int
size
();
CallList
getCallList
();
static
const
CallHash
&
getHistory
();
static
const
QStringList
getNumbersByPopularity
();
static
const
QStringList
getHistoryCallId
();
//Account related
static
Account
*
getCurrentAccount
(
);
...
...
This diff is collapsed.
Click to expand it.
src/CallModel.hpp
+
47
−
0
View file @
71e593f8
...
...
@@ -53,6 +53,27 @@ template <typename CallWidget, typename Index> typename CallModel<CallWidget,In
template
<
typename
CallWidget
,
typename
Index
>
typename
CallModel
<
CallWidget
,
Index
>::
InternalIndex
CallModel
<
CallWidget
,
Index
>::
m_sPrivateCallList_index
;
template
<
typename
CallWidget
,
typename
Index
>
typename
CallModel
<
CallWidget
,
Index
>::
InternalWidget
CallModel
<
CallWidget
,
Index
>::
m_sPrivateCallList_widget
;
/*****************************************************************************
* *
* Private classes *
* *
****************************************************************************/
class
SortableCallSource
{
public:
SortableCallSource
(
Call
*
call
=
0
)
:
count
(
0
),
callInfo
(
call
)
{}
uint
count
;
Call
*
callInfo
;
const
bool
operator
<
(
SortableCallSource
other
)
{
return
(
other
.
count
>
count
);
}
};
inline
bool
operator
<
(
const
SortableCallSource
&
s1
,
const
SortableCallSource
&
s2
)
{
return
s1
.
count
<
s2
.
count
;
}
/*****************************************************************************
* *
* Constructor *
...
...
@@ -427,6 +448,32 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
}
}
///Sort all history call by popularity and return the result (most popular first)
template
<
typename
CallWidget
,
typename
Index
>
const
QStringList
CallModel
<
CallWidget
,
Index
>::
getNumbersByPopularity
()
{
QHash
<
QString
,
SortableCallSource
*>
hc
;
foreach
(
Call
*
call
,
getHistory
())
{
if
(
!
hc
[
call
->
getPeerPhoneNumber
()])
{
hc
[
call
->
getPeerPhoneNumber
()]
=
new
SortableCallSource
(
call
);
}
hc
[
call
->
getPeerPhoneNumber
()]
->
count
++
;
}
QList
<
SortableCallSource
>
userList
;
foreach
(
SortableCallSource
*
i
,
hc
)
{
userList
<<
*
i
;
}
qSort
(
userList
);
QStringList
cl
;
for
(
int
i
=
userList
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
cl
<<
userList
[
i
].
callInfo
->
getPeerPhoneNumber
();
}
foreach
(
SortableCallSource
*
i
,
hc
)
{
delete
i
;
}
return
cl
;
}
/*****************************************************************************
* *
* Account related code *
...
...
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