mysocials-core 1.0
Public Types | Public Slots | Signals | Public Member Functions | Public Attributes

ServiceMgr Class Reference

The service manager class. More...

#include <servicemgr.h>

List of all members.

Public Types

enum  ProxyType { NoProxy, SystemProxy, UserProxy }
 

describes type of used proxy.

More...

Public Slots

void changeFilteredService (DriverInfo *driverInfo)
void disableSkipFriendListUpdate ()

Signals

void updateFriends (FriendList list, bool isLastUpdate)
 Update friends list signal.
void updateAlbumList (Friend owner, AlbumList list, bool isLastUpdate)
 Update album list signal.
void updatePhotoList (QString accountId, QString ownerId, QString albumId, PhotoList list, bool isLastUpdate)
 Update album content signal.
void updatePhotoCommentList (QString photoId, PhotoCommentList list)
 Update List of image comments signal.
void updateInboxMessageList (MessageList list, bool isLastUpdate)
 Update Inbox folder signal.
void updateOutboxMessageList (MessageList list, bool isLastUpdate)
 Update Outbox folder signal.
void updateAccounts (QString accountId, AccountList list)
 Update account list signal.
void errorOccured (QString errMsg, QTransport::Action action, bool isMajor)
 Error occured signal.
void updateProfile (Friend profile)
 Update profile signal.
void photoUploaded (QString accountId, QString albumId, QString local_file_name, QString photoId)
void messageSent (QString ownerId, QString title, QString message)
void messageDeleted (QString messageId)
 Message was deleted signal.
void updateFeed (QEventFeedList list, QEventFeed::FeedType type, bool isLastUpdate)
 Update feed of events signal.

Public Member Functions

 ServiceMgr (QObject *parent=0)
 Default constructor.
 ServiceMgr (const ServiceMgr &src)
 A copy constructor.
 ~ServiceMgr ()
 Destructor.
Friend getProfile (const QString &accountId, const QString &ownerId, const bool isNeedUpdate, const bool useSignal, const bool isFullProfile)
 Gets owner profile.
Friend getProfile (const PhotoComment &comment, const bool isNeedUpdate, const bool useSignal)
 Gets owner profile of comment author.
FriendList getFriends (const bool isNeedUpdate, const bool useSignal)
 Get list of friends.
AlbumList getAlbums (const Friend &curFriend, const bool isNeedUpdate, const bool useSignal)
 Gets list of friend albums.
AlbumList getAlbums (const Album &al, const bool isNeedUpdate, const bool useSignal)
 Gets list of friend albums.
AlbumList getAlbums (bool isNeedUpdate, const bool useSignal)
 Gets list of owner albums.
PhotoList getPhotos (const Album &curAlbum, const bool isNeedUpdate, const bool useSignal)
 Get content of album.
PhotoList getPhotos (const Photo &curPhoto, const bool isNeedUpdate, const bool useSignal)
 Get content of album.
PhotoCommentList getComments (const Photo &curPhoto, const bool isNeedUpdate, const bool useSignal)
 Get list of comments for specified image.
bool sendComment (const Photo &curPhoto, const QString &comment)
 Send owner comment to specified image.
MessageList getInboxMessages (const bool isNeedUpdate, const bool useSignal)
 Get list of messages from Inbox folder.
MessageList getOutboxMessages (const bool isNeedUpdate, const bool useSignal)
 Get list of messages from Outbox folder.
void deleteMessage (const Message &msg)
 Delete message from service.
bool sendMessage (const QString &accountId, const QString &ownerId, const QString &title, const QString &message)
 Sends private message to friend on service.
bool readMessage (const QString &accountId, const QString &messageId)
 Marks message as read.
AccountList getAccounts ()
 Gets list of accounts.
void addAccount (QString accountName, DriverInfo *driver)
 Create new account and adds it to list.
void deleteAccount (Account *oldAcc)
 Remove account from list.
Accountaccount (QString accountId)
 Gets Account instance for account ID.
void downloadPhotos (Photo startPhoto, int nearest)
 Download images from service.
QString downloadPhoto (Photo curPhoto)
void uploadPhoto (QString accountId, QString albumId, QString file, QString description)
 Upload image to service.
void uploadPhoto (const Album album, QString file, QString description)
 Upload image to service.
void updateDriverSettings ()
 Update settings for each account's driver (for example, proxy settings).
QList< DriverInfo * > getDrivers ()
 Gets list of supported drivers.
PhotoList getPhotosForAlbum (Photo curPhoto)
 Load image list for selected album.
PhotoList getPhotosForAlbum (Account *curAcc, Photo curPhoto)
 Load image list for selected album.
void clearCache ()
 Clear MySocials project cache storage.
QEventFeedList getFeed (QEventFeed::FeedType type, const bool isNeedUpdate, const bool useSignal)
 Get news list for selected type.
QEventFeedList getFeed (Account *acc, QEventFeed::FeedType type, const bool isNeedUpdate, const bool useSignal)
int getNumThreadsFriendUpdate () const
int getNumThreadsAlbumUpdate () const
int getNumThreadsPhotoUpdate () const
int getNumThreadsFeedUpdate () const

Public Attributes

QSettings * settings
 Application settings storage.

Detailed Description

The service manager class.

This class allows to access combined data from various services. All requested data are stored into cache and can be used many times.


Member Enumeration Documentation

describes type of used proxy.

Enumerator:
NoProxy 

No proxy settings exists.

SystemProxy 

Proxy settings gets from system environment.

UserProxy 

User defined proxy settings.


Constructor & Destructor Documentation

ServiceMgr::ServiceMgr ( QObject *  parent = 0)

Default constructor.

Parameters:
parentPointer to parent object.
ServiceMgr::ServiceMgr ( const ServiceMgr src)

A copy constructor.

Parameters:
srcCopied object.

Member Function Documentation

Account * ServiceMgr::account ( QString  accountId)

Gets Account instance for account ID.

Parameters:
accountIdThe Account ID.
Returns:
Pointer to Account instance.
void ServiceMgr::addAccount ( QString  accountName,
DriverInfo driver 
)

Create new account and adds it to list.

Parameters:
accountNameThe name of account.
driverSelected driver.
void ServiceMgr::clearCache ( )

Clear MySocials project cache storage.

Remove download data expect profiles and account settings.

void ServiceMgr::deleteAccount ( Account oldAcc)

Remove account from list.

This function removes account for a list of accounts and removes account's data form cache.

Parameters:
oldAccPointer to removed account.
void ServiceMgr::deleteMessage ( const Message msg)

Delete message from service.

If message was deleted successfully then signal messageDeleted() was called. Otherwise signal errorOccured() was called.

See also:
QTransport::deleteMessage()
Parameters:
msgDeleted message.
void ServiceMgr::downloadPhotos ( Photo  startPhoto,
int  nearest 
)

Download images from service.

Download selected photo and list of nearest images. The downloaded photos returns by signal QTransport::photosReceived();

Parameters:
startPhotoThe Photo instance with image info and URL to image from service.
nearestThe number of nearest images. Function downloads form (startPhoto - nearest) to (startPhoto + nearest) images.
void ServiceMgr::errorOccured ( QString  errMsg,
QTransport::Action  action,
bool  isMajor 
) [signal]

Error occured signal.

This signal sends when occured an error during request to driver or other action.

Parameters:
errMsgThe text of error message.
actionDescribes action in which error occured.
isMajorTrue if error is major and must be shown to user; false if error not major and uses to inform user.
AccountList ServiceMgr::getAccounts ( )

Gets list of accounts.

Returns:
List of accounts.
AlbumList ServiceMgr::getAlbums ( const Album al,
const bool  isNeedUpdate,
const bool  useSignal 
)

Gets list of friend albums.

Parameters:
alThe friend album which contained in the list.
isNeedUpdateTrue if need to get new album list, otherwise - false.
useSignalTrue if return must be sended as signal, otherwise - false.
Returns:
Stored list of albums. Newest list will be sent using
See also:
updateAlbumList signal.
AlbumList ServiceMgr::getAlbums ( bool  isNeedUpdate,
const bool  useSignal 
)

Gets list of owner albums.

Parameters:
isNeedUpdateTrue if need to get new album list, otherwise - false.
useSignalTrue if return must be sended as signal, otherwise - false.
Returns:
Stored list of albums. Newest list will be sent using
See also:
updateAlbumList signal.
AlbumList ServiceMgr::getAlbums ( const Friend curFriend,
const bool  isNeedUpdate,
const bool  useSignal 
)

Gets list of friend albums.

Parameters:
curFriendInstance of
See also:
Friend class contains friend properties.
Parameters:
isNeedUpdateTrue if need to get new album list, otherwise - false.
useSignalTrue if return must also be send as signal, otherwise - false.
Returns:
Stored list of albums. Newest list will be sent using
See also:
updateAlbumList signal.
PhotoCommentList ServiceMgr::getComments ( const Photo curPhoto,
const bool  isNeedUpdate,
const bool  useSignal 
)

Get list of comments for specified image.

Parameters:
curPhotoThe Photo instance of specified image.
isNeedUpdateTrue if need to get new list, otherwise - false.
useSignalTrue if return must be sended as signal, otherwise - false.
Returns:
Stored list of image comments. Newest list will be sent using
See also:
updatePhotoCommentList signal.
QList< DriverInfo * > ServiceMgr::getDrivers ( )

Gets list of supported drivers.

Function scans MySocials drivers folder and try to load each driver. If it loaded successfully then driver description adds into list.

Returns:
List of pointers to
See also:
DriverInfo instances with driver descriptions.
QEventFeedList ServiceMgr::getFeed ( QEventFeed::FeedType  type,
const bool  isNeedUpdate,
const bool  useSignal 
)

Get news list for selected type.

The updated feed will be sent using updateEventFeed.

Parameters:
typeThe type of feed.
Returns:
The cached news feed.
FriendList ServiceMgr::getFriends ( const bool  isNeedUpdate,
const bool  useSignal 
)

Get list of friends.

Parameters:
isNeedUpdateTrue if need to get new friend list, otherwise - false.
useSignalTrue if return must also be send as signal, otherwise - false.
Returns:
Stored list of friends. Newest list will be sent using
See also:
updateFriends signal.
MessageList ServiceMgr::getInboxMessages ( const bool  isNeedUpdate,
const bool  useSignal 
)

Get list of messages from Inbox folder.

Parameters:
isNeedUpdateTrue if need to get new message list, otherwise - false.
useSignalTrue if return must be sended as signal, otherwise - false.
Returns:
Stored list of messages from Inbox folder. Newest list will be sent using
See also:
updateInboxMessageList signal.
MessageList ServiceMgr::getOutboxMessages ( const bool  isNeedUpdate,
const bool  useSignal 
)

Get list of messages from Outbox folder.

Parameters:
isNeedUpdateTrue if need to get new message list, otherwise - false.
useSignalTrue if return must be sended as signal, otherwise - false.
Returns:
Stored list of messages from Outbox folder. Newest list will be sent using
See also:
updateOutboxMessageList signal.
PhotoList ServiceMgr::getPhotos ( const Photo curPhoto,
const bool  isNeedUpdate,
const bool  useSignal 
)

Get content of album.

The function checks album content size and the stored image list size. If these sizes not equal, then oldest items (list of albums or list of images fro specified album) will be updated.

Parameters:
curAlbumThe Photo instance.
isNeedUpdateTrue if need to get new image list, otherwise - false.
useSignalTrue if return must be sended as signal, otherwise - false.
Returns:
Stored list of images. Newest list will be sent using
See also:
updatePhotoList signal.
PhotoList ServiceMgr::getPhotos ( const Album curAlbum,
const bool  isNeedUpdate,
const bool  useSignal 
)

Get content of album.

The function checks album content size and the stored image list size. If these sizes not equal, then oldest items (list of albums or list of images fro specified album) will be updated.

Parameters:
curAlbumThe Album instance.
isNeedUpdateTrue if need to get new image list, otherwise - false.
useSignalTrue if return must be sended as signal, otherwise - false.
Returns:
Stored list of images. Newest list will be sent using
See also:
updatePhotoList signal.
PhotoList ServiceMgr::getPhotosForAlbum ( Photo  curPhoto)

Load image list for selected album.

Function loads image list for selected album from cache.

Parameters:
curPhotoInstance of Photo class contained data of image from selected album.
Returns:
Stored image list for selected album.
PhotoList ServiceMgr::getPhotosForAlbum ( Account curAcc,
Photo  curPhoto 
)

Load image list for selected album.

Function loads image list for selected album from cache.

Parameters:
curAccPointer to selected account.
curPhotoInstance of Photo class contained data of image from selected album.
Returns:
Stored image list for selected album.
Friend ServiceMgr::getProfile ( const PhotoComment comment,
const bool  isNeedUpdate,
const bool  useSignal 
)

Gets owner profile of comment author.

Function searches profile in downloaded friend lists and if it not found then try to receive from service.

Parameters:
commentThe PhotoComment instance.
isNeedUpdateTrue if profile must to be updated, false if it has not.
useSignalTrue if return must also be send as signal, otherwise - false.
Returns:
Owner profile stored in the cache.
See also:
updateProfile
Friend ServiceMgr::getProfile ( const QString &  accountId,
const QString &  ownerId,
const bool  isNeedUpdate,
const bool  useSignal,
const bool  isFullProfile 
)

Gets owner profile.

Function searches profile in downloaded friend lists and if it not found then try to receive from service.

Parameters:
accountIdThe account ID.
ownerIdThe owner ID on service.
isNeedUpdateTrue if profile must to be updated, false if it has not.
useSignalTrue if return must also be send as signal, otherwise - false.
Returns:
Owner profile stored in the cache.
See also:
updateProfile
void ServiceMgr::messageDeleted ( QString  messageId) [signal]

Message was deleted signal.

This signal sends when message was deleted successfully.

See also:
QTransport::messageDeleted()
Parameters:
messageIdThe id of deleted message.
void ServiceMgr::messageSent ( QString  ownerId,
QString  title,
QString  message 
) [signal]
Parameters:
ownerId
title
message
void ServiceMgr::photoUploaded ( QString  accountId,
QString  albumId,
QString  local_file_name,
QString  photoId 
) [signal]
Parameters:
accountId
albumId
local_file_name
photoId
bool ServiceMgr::readMessage ( const QString &  accountId,
const QString &  messageId 
)

Marks message as read.

Parameters:
accountIdID of account to which message belongs.
messageIdID of message.
bool ServiceMgr::sendComment ( const Photo curPhoto,
const QString &  comment 
)

Send owner comment to specified image.

Parameters:
curPhotoThe Photo instance of commented image.
commentThe text of comment.
Returns:
True if comment sent successfully, otherwise - false.
bool ServiceMgr::sendMessage ( const QString &  accountId,
const QString &  ownerId,
const QString &  title,
const QString &  message 
)

Sends private message to friend on service.

If message was sent successfully then signal messageSent() was called. Otherwise signal errorOccured() was called.

Parameters:
accountIdID of account.
ownerIdThe ID of message recepient.
titleThe message title.
messageThe message.
void ServiceMgr::updateAccounts ( QString  accountId,
AccountList  list 
) [signal]

Update account list signal.

This signal sent when new list of friends was download successfully.

See also:
addAccount()
getProfile()
deleteAccount()
Parameters:
listThe new list of accounts.
void ServiceMgr::updateAlbumList ( Friend  owner,
AlbumList  list,
bool  isLastUpdate 
) [signal]

Update album list signal.

See also:
getAlbums()
Parameters:
ownerThe albums owner.
listThe list of albums.
isLastUpdateTrue if it is a last signal, otherwise - false.
void ServiceMgr::updateDriverSettings ( )

Update settings for each account's driver (for example, proxy settings).

Settings gets from

See also:
settings storage.
void ServiceMgr::updateFeed ( QEventFeedList  list,
QEventFeed::FeedType  type,
bool  isLastUpdate 
) [signal]

Update feed of events signal.

This signal sends when feed of events was updated.

See also:
QTransport::eventFeedReceived
Parameters:
listThe list of events in the feed.
typeThe type of feed.
void ServiceMgr::updateFriends ( FriendList  list,
bool  isLastUpdate 
) [signal]

Update friends list signal.

See also:
getFriends()
Parameters:
listThe list of friends.
isLastUpdateTrue if it is a last signal, otherwise - false.
void ServiceMgr::updateInboxMessageList ( MessageList  list,
bool  isLastUpdate 
) [signal]

Update Inbox folder signal.

This signal sent when content of inbox folder was download successfully.

See also:
getInboxMessages()
Parameters:
listThe list of messages.
isLastUpdateTrue if it is last signal, otherwise - false.
void ServiceMgr::updateOutboxMessageList ( MessageList  list,
bool  isLastUpdate 
) [signal]

Update Outbox folder signal.

This signal sent when content of outbox folder was download successfully.

See also:
getInboxMessages()
Parameters:
listThe list of messages.
isLastUpdateTrue if it is last signal, otherwise - false.
void ServiceMgr::updatePhotoCommentList ( QString  photoId,
PhotoCommentList  list 
) [signal]

Update List of image comments signal.

This signal sent when list of comments was download successfully.

See also:
getComments()
Parameters:
photoIdThe image ID.
listThe list of comments.
void ServiceMgr::updatePhotoList ( QString  accountId,
QString  ownerId,
QString  albumId,
PhotoList  list,
bool  isLastUpdate 
) [signal]

Update album content signal.

This signal occurs when list of images was download successfully.

See also:
getPhotos()
Parameters:
accountIdThe ID of account.
ownerIdThe ID of album owner.
albumIdThe album ID.
listThe list of images.
isLastUpdateTrue if it is last signal, otherwise - false.
void ServiceMgr::updateProfile ( Friend  profile) [signal]

Update profile signal.

See also:
getProfile()
Parameters:
profileThe new profile.
void ServiceMgr::uploadPhoto ( QString  accountId,
QString  albumId,
QString  file,
QString  description = "" 
)

Upload image to service.

Function uploads the file with image to selected service. The result returns by signal QTransport::photoUploaded()

Parameters:
accountIdThe name on account.
albumIdThe identificator of album.
fileThe path to file with image.
descriptionThe description of uploaded image.
void ServiceMgr::uploadPhoto ( const Album  album,
QString  file,
QString  description 
)

Upload image to service.

Function uploads the file with image to selected service.

Parameters:
albumAlbum instance with selected album info.
fileThe path to file with image.
descriptionThe description of uploaded image.

Member Data Documentation

Application settings storage.

Store settings into FILE_SETTINGS file.


The documentation for this class was generated from the following files: