Privl Class Reference

The privl class represents the framework for all screens (central widgets) and the main application logic. More...

#include <Privl.h>

List of all members.

Public Types

enum  STATES {
  LOGIN, MAP, FRIENDS, SMS,
  SETTINGS
}

Public Slots

void showLoginScreen ()
 Create an instance of the login screen and show it.
void showMapScreen ()
 Create an instance of the Map screen and show it.
void showFriendScreen ()
 Create an instance of the friend screen and show it.
void showSmsScreen ()
 Create an insatnce of the Sms Screen and show it.
void showSettingScreen ()
 Create an instance of the settings screen and show it.
void actionShareAll ()
 Slot called if user clicks on Share all.
void actionShareFriend ()
 Slot called if user clicks on Share with one friend.
void actionFindMe ()
 Slot called if user clicks on Find Me.
void actionFindMeLast ()
 Slot called if user clicks on Find My Last Position.
void actionFindFriends ()
 Slot called if user clicks on Find All Friends.
void actionFindFriend ()
 Slot called if user clicks on Find Friend.
void actionFindDistance ()
 Slot called if user clicks on Find Distance.
void actionLogin ()
 Send a request to Sharing to login on the SharingService.
void actionSaveCredentials ()
 Slot called to save user's credentials.
void actionResetCache ()
 Slot called if user clicks on Reset Cache.
void loggedAction (bool success, QString msg)
 Slot called upon login answer.
void recvLocationAction (QString source, double lat, double lng)
 Slot called upon user location update.
void recvFriendLocationAction (QString id, double lat, double lng)
 Update Friend's Location.
void logoutAction ()
 Log out.
void updateAction ()
 Slot called if user clicks on update.
void setError (QString err)
 Show an error message.
void setStatus (QString status)
 Display a status message.
void focusFriend (QListWidgetItem *item)
 Slot called if an action related to a friend is selected (find, distance, share).
void setShowDistance (bool show)
 Set whether the distance to a freind should be shown.
void actionSaChanged (QString id, QString action)
 Slot called if user gets/sets/deletes SA.
void actionLevelChanged (int level)
 Slot called if user changes action level.
void actionModeChanged (int mode)
 Slot called if user changes localization method.
void actionSmsSelected (QModelIndex ind)
 Slot called if has selected an SMS.
void actionTTLChanged (int val)
 Slot called if user changes the TTL.
void exit ()
 Exit the application.

Public Member Functions

 Privl (QWidget *parent=0)
 Construct the core application object.
void loadUserSettings ()
 Load user settings from the file c://privl_settings.txt.
void connectCallbacks ()
 Connect signals and slots.
void loadMap ()
 reload map with current parameters
void loadMap (QGeoCoordinate center)
 Reload map with new center.
void loadMap (QGeoCoordinate center, int zoom)
 Reload map with new center and new zoom.
void loadMap (QGeoCoordinate center, int zoom, QString selId)
 Reload map with new center and new zoom and focus on other friend.
void loadMap (int height, int width)
 Reload map with new center and new zoom.
void setFriends (QHash< QString, Friend * > fl)
 Update the current's instance friend list.
void addFriend (QString id, double lat, double lng)
 Slot called if new friend information arrives.
void clearFriends ()
 Clear the current list of friends.
void setMe (QString id, double lat, double lng)
 Update the current user's information.
FriendgetMe ()
 Get an pointer to curretn user.
void cleanUp ()
 Cleanup current user and friend list.
void setCenter (QGeoCoordinate center)
 Set current center.
void setShowFriends (bool show)
 Clear the current list of friends.
void setSelectId (QString id)
 Set selected friend.

Public Attributes

loginscreenlogin
mapscreenmaps
FriendScreenfriends
SmsScreensms
SettingScreensettings
STATES state

Detailed Description

The privl class represents the framework for all screens (central widgets) and the main application logic.

This class represents the general screen of the application. It contains the cenral widget which is set by one out of five different screens (map, settings, friends, sms, login). The class additionaly contains any information of these 5 screen that should last longer than the time that specific screen is displayed. The functions in this class are responsible for setting up the correct screen and for high level logic (user interaction, status, error, ...)


Member Function Documentation

void Privl::actionLevelChanged ( int  level  )  [slot]

Slot called if user changes action level.

Parameters:
level is the new privacy level
void Privl::actionModeChanged ( int  mode  )  [slot]

Slot called if user changes localization method.

Parameters:
mode is the id of the new mode
void Privl::actionSaChanged ( QString  id,
QString  action 
) [slot]

Slot called if user gets/sets/deletes SA.

Parameters:
id is the Friend's ID
is the action {get,set, del}
void Privl::actionSmsSelected ( QModelIndex  ind  )  [slot]

Slot called if has selected an SMS.

Parameters:
ind is the offset of the SMS
void Privl::actionTTLChanged ( int  ttl  )  [slot]

Slot called if user changes the TTL.

Parameters:
ttl is the new ttl
void Privl::addFriend ( QString  id,
double  lat,
double  lng 
)

Slot called if new friend information arrives.

Parameters:
id is the friend's ID
lat is the friend's position latitude
lng is the friend's position longitude
void Privl::focusFriend ( QListWidgetItem *  item  )  [slot]

Slot called if an action related to a friend is selected (find, distance, share).

Parameters:
item is a pointer to the selected QListWIdgetItem which has information about the selected friend
Friend * Privl::getMe (  ) 

Get an pointer to curretn user.

Returns:
instance to current user
void Privl::loadMap ( int  height,
int  width 
)

Reload map with new center and new zoom.

Parameters:
center is the new center
zoom is the new zoom
void Privl::loadMap ( QGeoCoordinate  center,
int  zoom,
QString  selId 
)

Reload map with new center and new zoom and focus on other friend.

Parameters:
center is the new center
zoom is the new zoom
selID the ID of the selected friend
void Privl::loadMap ( QGeoCoordinate  center,
int  zoom 
)

Reload map with new center and new zoom.

Parameters:
center is the new center
zoom is the new zoom
void Privl::loadMap ( QGeoCoordinate  center  ) 

Reload map with new center.

Parameters:
center is the new map center
void Privl::loggedAction ( bool  success,
QString  msg 
) [slot]

Slot called upon login answer.

Called by an async login answer from Sharing, including error message

Parameters:
success indicates the login status
msg contains an (error-)message
void Privl::logoutAction (  )  [slot]

Log out.

Clean up and log out

void Privl::recvFriendLocationAction ( QString  id,
double  lat,
double  lng 
) [slot]

Update Friend's Location.

Called by an instance of Sharing if a new Friend 's location is available

Parameters:
id is the Freind's ID in the sharing Service
lat is the latitude of the friend's position
lng is the longitude of the friend's position
void Privl::recvLocationAction ( QString  source,
double  lat,
double  lng 
) [slot]

Slot called upon user location update.

Called in both cases: new location coming from Location or Sharing

Parameters:
lat is the latitude of the user's position
lng is the longitude of the user's position
void Privl::setCenter ( QGeoCoordinate  center  ) 

Set current center.

Parameters:
center is the new centers
void Privl::setError ( QString  err  )  [slot]

Show an error message.

Parameters:
err is the error message
void Privl::setFriends ( QHash< QString, Friend * >  fl  ) 

Update the current's instance friend list.

Parameters:
the new list of friends
void Privl::setSelectId ( QString  id  ) 

Set selected friend.

Parameters:
id is the selected friend's id
void Privl::setShowDistance ( bool  show  )  [slot]

Set whether the distance to a freind should be shown.

Parameters:
show should be set to true to show the distance
void Privl::setShowFriends ( bool  show  ) 

Clear the current list of friends.

Parameters:
 
void Privl::setStatus ( QString  status  )  [slot]

Display a status message.

Parameters:
status is the status message
void Privl::showLoginScreen (  )  [slot]

Create an instance of the login screen and show it.

If the user has chosen to remember his credentials, fields are updated accordingly

void Privl::showMapScreen (  )  [slot]

Create an instance of the Map screen and show it.

This function also loads the map

void Privl::showSettingScreen (  )  [slot]

Create an instance of the settings screen and show it.

Fields are updated according to saved user settings.


The documentation for this class was generated from the following files:
Generated on Thu Jun 24 21:31:43 2010 for PrivL by  doxygen 1.6.3