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
GitLab 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
dcda6c40
Commit
dcda6c40
authored
Jan 7, 2014
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
[ #38116 ] Begin to add Auto Completion model unit tests
parent
555b87cf
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/numbercompletionmodel.cpp
+1
-1
1 addition, 1 deletion
src/numbercompletionmodel.cpp
src/numbercompletionmodel.h
+4
-1
4 additions, 1 deletion
src/numbercompletionmodel.h
src/phonedirectorymodel.h
+10
-6
10 additions, 6 deletions
src/phonedirectorymodel.h
with
15 additions
and
8 deletions
src/numbercompletionmodel.cpp
+
1
−
1
View file @
dcda6c40
...
@@ -196,7 +196,7 @@ void NumberCompletionModel::updateModel()
...
@@ -196,7 +196,7 @@ void NumberCompletionModel::updateModel()
emit
layoutChanged
();
emit
layoutChanged
();
}
}
void
NumberCompletionModel
::
getRange
(
QMap
<
QString
,
PhoneDirectoryModel
::
NumberWrapper
*>
map
,
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
)
void
NumberCompletionModel
::
getRange
(
QMap
<
QString
,
PhoneDirectoryModel
::
NumberWrapper
*>
map
,
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
)
const
{
{
if
(
prefix
.
isEmpty
())
if
(
prefix
.
isEmpty
())
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
src/numbercompletionmodel.h
+
4
−
1
View file @
dcda6c40
...
@@ -61,6 +61,10 @@ public:
...
@@ -61,6 +61,10 @@ public:
bool
isUsingUnregisteredAccounts
();
bool
isUsingUnregisteredAccounts
();
QString
prefix
()
const
;
QString
prefix
()
const
;
protected
:
//Helper
void
getRange
(
QMap
<
QString
,
PhoneDirectoryModel
::
NumberWrapper
*>
map
,
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
)
const
;
private
:
private
:
enum
class
Columns
{
enum
class
Columns
{
CONTENT
=
0
,
CONTENT
=
0
,
...
@@ -73,7 +77,6 @@ private:
...
@@ -73,7 +77,6 @@ private:
void
updateModel
();
void
updateModel
();
//Helper
//Helper
void
getRange
(
QMap
<
QString
,
PhoneDirectoryModel
::
NumberWrapper
*>
map
,
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
);
void
locateNameRange
(
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
);
void
locateNameRange
(
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
);
void
locateNumberRange
(
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
);
void
locateNumberRange
(
const
QString
&
prefix
,
QSet
<
PhoneNumber
*>&
set
);
uint
getWeight
(
PhoneNumber
*
number
);
uint
getWeight
(
PhoneNumber
*
number
);
...
...
This diff is collapsed.
Click to expand it.
src/phonedirectorymodel.h
+
10
−
6
View file @
dcda6c40
...
@@ -36,6 +36,9 @@ class LIB_EXPORT PhoneDirectoryModel : public QAbstractTableModel {
...
@@ -36,6 +36,9 @@ class LIB_EXPORT PhoneDirectoryModel : public QAbstractTableModel {
//NumberCompletionModel need direct access to the indexes
//NumberCompletionModel need direct access to the indexes
friend
class
NumberCompletionModel
;
friend
class
NumberCompletionModel
;
//Friend unit test class
friend
class
AutoCompletionTest
;
//Phone number need to update the indexes as they change
//Phone number need to update the indexes as they change
friend
class
PhoneNumber
;
friend
class
PhoneNumber
;
...
@@ -76,6 +79,13 @@ public:
...
@@ -76,6 +79,13 @@ public:
//Static
//Static
QVector
<
PhoneNumber
*>
getNumbersByPopularity
()
const
;
QVector
<
PhoneNumber
*>
getNumbersByPopularity
()
const
;
protected:
//Internal data structures
///@struct NumberWrapper Wrap phone numbers to prevent collisions
struct
NumberWrapper
{
QVector
<
PhoneNumber
*>
numbers
;
};
private
:
private
:
//Model columns
//Model columns
...
@@ -100,12 +110,6 @@ private:
...
@@ -100,12 +110,6 @@ private:
UID
=
17
,
UID
=
17
,
};
};
//Internal data structures
///@struct NumberWrapper Wrap phone numbers to prevent collisions
struct
NumberWrapper
{
QVector
<
PhoneNumber
*>
numbers
;
};
//Constructor
//Constructor
explicit
PhoneDirectoryModel
(
QObject
*
parent
=
nullptr
);
explicit
PhoneDirectoryModel
(
QObject
*
parent
=
nullptr
);
...
...
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