Project Report

Text-only Preview

Project Report
by
Gino Cappelli
Prof: Vittorio Ghini
University of Bologna
A.Y. 2010/2011
1

Table of contents
1. Introduction
3
2. Set-up of the environment
5
3. Added features
7
4. Modularity and Portability
20
5. Future development
22
2

1. Introduction
In the following report are explained some important points of
the project on which I have worked during the third year of my
Degree at University of Bologna.
The main project objective has been to add some features to an
existing application called Jangiu [1]. The application is a cross-
platform VoIP Client for smart-phones with a friendly user interface
[2]. This application has been mainly developed for the Symbian
O.S. [3] (in C++) using the Qt libraries [4] for the design of the
GUI. My scope of interests regarded the "user-interface" (graphic)
side, moving the important part of my project to the Qt modules of
the application (and not to the low-level modules containing the
implementation of the SIP protocol [5]). In facts, I developed two
main features:
* A search functionality (of the contacts), based on a prefix
inserted in a search bar
* The division of the contacts using groups
In the next chapter are described many troubles that I have had
during the set-up of the Carbide C++ environment [6].
In the chapters 3 and 4 it is explained how the above features
have been added and the repercussion of these modules on the
application portability.
Finally, the chapter 5 suggests some possible future
development plans for this application.
3

Figure 1: An image of the Jangiu application running
on the Symbian emulator [7]
4

2. Set-up of the environment
The Jangiu application has been developed using the Carbide
C++ IDE (v 2.7) that provides many useful features for the Symbian
developers. In [1] is explained how to correctly perform all the
steps necessary to set-up the IDE with the application and all its
libraries
(Qt, PjSIP (Open Source SIP Stack) [8] ).
Once obtained the source code of the Jangiu application (see
[1]), and correctly imported the project in the IDE ([1]), it will be
possible to carry out the following steps to solve many problems
concerning the correct behavior of the application:
*
Comment the line 995 in the sock_common.c file (under
pjproject [see 1], pjlib/src/pj/sock_common.c)
len = sizeof(a);

status = pj_sock_getsockname(fd, &a, &len);

if (status != PJ_SUCCESS) {
pj_sock_close(fd);
return status;

}

// COMMENT THE FOLLOWING LINE

// pj_sock_close(fd);
* Comment the line 403 in the ioqueue_symbian.cpp file (under
pjproject, pjlib/src/pj/ioqueue_symbian.cpp)
// Call callback.
if (cb_.on_accept_complete) {
cb_.on_accept_complete( key_, op_key, (pj_sock_t)pjNewSock,
PJ_SUCCESS);
}
}
// COMMENT THE FOLLOWING LINE
//ioqueue_->eventCount++;
5

*
In the files symbian_ua.mmp (under pjproject) and
jangiu_exe.mmp (under the jangiu project) set the variables
EPOCSTACKSIZE and EPOCHEAPSIZE to { 0x50000 }
and { 0x50000 0x1000000 } respectively.
EPOCSTACKSIZE
0x50000
EPOCHEAPSIZE
0x50000 0x1000000
Figure 2: The Carbide C/C++ IDE
6

3. Added features
The two changes made to the Jangiu application affect the user-
interface, as shows the image below.
Figure 3: The two changes apported to the user-inteface:
1. The search bar
2. The groups

7

Both the features affect the user-interface, mainly the
contactsdialog.cpp file under the jangiu/src folder. Consequently, in
this chapter, it will be explained how this file has been changed and
how the added code works.
3.1 The search bar
To implement this functionality the following tasks have been
made:
*
Added the input line in the ui_contactsdialog.h file
*
Implemented two functions: search() and keyReleaseEvent()
The input line is a Qt filed and it is not interesting, while the
two functions capture the events on this input line to implement the
search mechanism. Particularly, the keyReleaseEvent() function
waits for a keyboard event (letters, numbers, ...) on the input-line
and passes the new content to the search() function, that in turn
selects the contacts to display on the top window.
Insert "f"
ab
input-line
abf
new input-line
search("abf")
Figure 4: How the keyboard events are handled
8

The following code, taken from the keyReleaseEvent()
function, implements the keyboard event handling:
void ContactsDialog::keyReleaseEvent(QKeyEvent *event)
{
/**
* STEP 1:
* Handling the keyboard
*/
switch (event->nativeVirtualKey()){
//
// Discard all the common non-alphanumeric
// keyboard events.
//
case EKeyYes:
{
event->ignore();
break;
}
case EKeyNo:
{
event->ignore();
break;
}
...
... OTHER NON-ALPHANUMERIC EVENTS
...
//
// Handling the alphanumeric events
default:
{
if(event->text()>="0" && event->text()<="9")
{
// QString to Int conversion flag
bool success;
//
// IMPORTANT CONVENTION:
// ui->lineEdit_2 is the 'search input-field'
//
switch(event->text().toInt(&success,10/*base*/))
{
case 0:
// Do nothing
// because button 0 does not contain letters
break;
case 1:
// Do nothing
// because button 1 does not contain letters
break;
9

case 2:
// Case 2 = charachter 'a'
if(success)
{
// If the search input-field is not
focused
if(!(ui->lineEdit_2->hasFocus()))
{
// Append the charachter in the
field
ui->lineEdit_2->
insert(QString("a"));
// and set the focus on it
ui->lineEdit_2->setFocus();
}
}
break;
case 3:
// Case 3 = charachter 'd'
if(success)
{
// If the search input-field is not
focused
if(!(ui->lineEdit_2->hasFocus()))
{
// Append the charachter in the
field
ui->lineEdit_2->
insert(QString("d"));
// and set the focus on it
ui->lineEdit_2->setFocus();
}
}
break;
...
... OTHER CHARACHERS (4 to 9)
...
default:
// Do nothing
break;
};
}
else
{
10