mysocials-core 1.0
|
The service manager class. More...
#include <servicemgr.h>
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. | |
Account * | account (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. |
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.
ServiceMgr::ServiceMgr | ( | QObject * | parent = 0 | ) |
Default constructor.
parent | Pointer to parent object. |
ServiceMgr::ServiceMgr | ( | const ServiceMgr & | src | ) |
A copy constructor.
src | Copied object. |
Account * ServiceMgr::account | ( | QString | accountId | ) |
void ServiceMgr::addAccount | ( | QString | accountName, |
DriverInfo * | driver | ||
) |
Create new account and adds it to list.
accountName | The name of account. |
driver | Selected 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.
oldAcc | Pointer 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.
msg | Deleted 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();
startPhoto | The Photo instance with image info and URL to image from service. |
nearest | The 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.
errMsg | The text of error message. |
action | Describes action in which error occured. |
isMajor | True 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.
Gets list of friend albums.
al | The friend album which contained in the list. |
isNeedUpdate | True if need to get new album list, otherwise - false. |
useSignal | True if return must be sended as signal, otherwise - false. |
AlbumList ServiceMgr::getAlbums | ( | bool | isNeedUpdate, |
const bool | useSignal | ||
) |
Gets list of owner albums.
isNeedUpdate | True if need to get new album list, otherwise - false. |
useSignal | True if return must be sended as signal, otherwise - false. |
AlbumList ServiceMgr::getAlbums | ( | const Friend & | curFriend, |
const bool | isNeedUpdate, | ||
const bool | useSignal | ||
) |
Gets list of friend albums.
curFriend | Instance of |
isNeedUpdate | True if need to get new album list, otherwise - false. |
useSignal | True if return must also be send as signal, otherwise - false. |
PhotoCommentList ServiceMgr::getComments | ( | const Photo & | curPhoto, |
const bool | isNeedUpdate, | ||
const bool | useSignal | ||
) |
Get list of comments for specified image.
curPhoto | The Photo instance of specified image. |
isNeedUpdate | True if need to get new list, otherwise - false. |
useSignal | True if return must be sended as signal, otherwise - false. |
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.
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.
type | The type of feed. |
FriendList ServiceMgr::getFriends | ( | const bool | isNeedUpdate, |
const bool | useSignal | ||
) |
Get list of friends.
isNeedUpdate | True if need to get new friend list, otherwise - false. |
useSignal | True if return must also be send as signal, otherwise - false. |
MessageList ServiceMgr::getInboxMessages | ( | const bool | isNeedUpdate, |
const bool | useSignal | ||
) |
Get list of messages from Inbox folder.
isNeedUpdate | True if need to get new message list, otherwise - false. |
useSignal | True if return must be sended as signal, otherwise - false. |
MessageList ServiceMgr::getOutboxMessages | ( | const bool | isNeedUpdate, |
const bool | useSignal | ||
) |
Get list of messages from Outbox folder.
isNeedUpdate | True if need to get new message list, otherwise - false. |
useSignal | True if return must be sended as signal, otherwise - false. |
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.
curAlbum | The Photo instance. |
isNeedUpdate | True if need to get new image list, otherwise - false. |
useSignal | True if return must be sended as signal, otherwise - false. |
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.
curAlbum | The Album instance. |
isNeedUpdate | True if need to get new image list, otherwise - false. |
useSignal | True if return must be sended as signal, otherwise - false. |
Load image list for selected album.
Function loads image list for selected album from cache.
curPhoto | Instance of Photo class contained data of image from selected album. |
Load image list for selected album.
Function loads image list for selected album from cache.
curAcc | Pointer to selected account. |
curPhoto | Instance of Photo class contained data of image from 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.
comment | The PhotoComment instance. |
isNeedUpdate | True if profile must to be updated, false if it has not. |
useSignal | True if return must also be send as signal, otherwise - false. |
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.
accountId | The account ID. |
ownerId | The owner ID on service. |
isNeedUpdate | True if profile must to be updated, false if it has not. |
useSignal | True if return must also be send as signal, otherwise - false. |
void ServiceMgr::messageDeleted | ( | QString | messageId | ) | [signal] |
Message was deleted signal.
This signal sends when message was deleted successfully.
messageId | The id of deleted message. |
void ServiceMgr::messageSent | ( | QString | ownerId, |
QString | title, | ||
QString | message | ||
) | [signal] |
ownerId | |
title | |
message |
void ServiceMgr::photoUploaded | ( | QString | accountId, |
QString | albumId, | ||
QString | local_file_name, | ||
QString | photoId | ||
) | [signal] |
accountId | |
albumId | |
local_file_name | |
photoId |
bool ServiceMgr::readMessage | ( | const QString & | accountId, |
const QString & | messageId | ||
) |
Marks message as read.
accountId | ID of account to which message belongs. |
messageId | ID of message. |
bool ServiceMgr::sendComment | ( | const Photo & | curPhoto, |
const QString & | comment | ||
) |
Send owner comment to specified image.
curPhoto | The Photo instance of commented image. |
comment | The text of comment. |
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.
accountId | ID of account. |
ownerId | The ID of message recepient. |
title | The message title. |
message | The message. |
void ServiceMgr::updateAccounts | ( | QString | accountId, |
AccountList | list | ||
) | [signal] |
Update account list signal.
This signal sent when new list of friends was download successfully.
list | The new list of accounts. |
Update album list signal.
owner | The albums owner. |
list | The list of albums. |
isLastUpdate | True 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
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.
list | The list of events in the feed. |
type | The type of feed. |
void ServiceMgr::updateFriends | ( | FriendList | list, |
bool | isLastUpdate | ||
) | [signal] |
Update friends list signal.
list | The list of friends. |
isLastUpdate | True 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.
list | The list of messages. |
isLastUpdate | True 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.
list | The list of messages. |
isLastUpdate | True 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.
photoId | The image ID. |
list | The 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.
accountId | The ID of account. |
ownerId | The ID of album owner. |
albumId | The album ID. |
list | The list of images. |
isLastUpdate | True if it is last signal, otherwise - false. |
void ServiceMgr::updateProfile | ( | Friend | profile | ) | [signal] |
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()
accountId | The name on account. |
albumId | The identificator of album. |
file | The path to file with image. |
description | The 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.
album | Album instance with selected album info. |
file | The path to file with image. |
description | The description of uploaded image. |
QSettings* ServiceMgr::settings |
Application settings storage.
Store settings into FILE_SETTINGS file.