class for applications using transfer-ui More...
Public Types |
|
enum | TransferType { TRANSFER_TYPES_UPLOAD, TRANSFER_TYPES_DOWNLOAD, TRANSFER_TYPES_SYNC } |
This is an enumeration of the kinds of transfers supported by TransferUI. More... |
|
Signals |
|
void | cancelTransfer (Transfer *transfer) |
Signal emitted when some of transfers related to this client is asked to be cancelled. |
|
void | pauseTransfer (Transfer *transfer) |
Signal emitted when some of transfers related to this client is asked to be paused. |
|
void | repairErrorTransfer (Transfer *transfer) |
Signal emitted when error repair is requested. |
|
void | startTransfer (Transfer *transfer) |
Signal emitted when some of transfers related to this client is asked to be started/continued. |
|
void | summaryReport (int failed, int active, int pending, int completed) |
Summary update of all transfers followed by transfer-ui. |
|
Public Member Functions |
|
bool | askForSummaryUpdate () |
Ask TransferUI to send summary update. |
|
Client (QObject *parent=0) | |
constructor |
|
bool | init () |
function to initialize the client library instance. |
|
bool | isTUIVisible () const |
check if the transfer-ui is visible to the user |
|
int | progressTimeDelta () const |
get function for the progress time delta |
|
double | progressValueDelta () const |
get function for the progress value delta |
|
Transfer * | registerTransfer (const QString &name, TransferType type, const QString &clientId=QString()) |
Register a new transient transfer. |
|
void | removeTransfer (const QString &tid) |
Remove the transfer whose id is passed from list of transfers. |
|
void | setProgressTimeDelta (int delta) |
set the progress time delta. |
|
void | setProgressValueDelta (double delta) |
set the progress value delta. |
|
bool | showUI () |
Ask transfer-ui to show it's UI. |
class for applications using transfer-ui
TransferUI::Client::Client | ( | QObject * | parent = 0 |
) |
constructor
parent |
bool TransferUI::Client::askForSummaryUpdate | ( | ) |
Ask TransferUI to send summary update.
TransferUI emits back the summaryReport for this request.
void TransferUI::Client::cancelTransfer | ( | Transfer * | transfer | ) | [signal] |
Signal emitted when some of transfers related to this client is asked to be cancelled.
Transfer will emit signal first then it will be emited by client.
transfer | transfer that is asked to be cancelledconnect(client,SIGNAL(cancelTransfer(Transfer*)), this, SLOT(transferCancelled(Transfer*))); void TUITestClient::transferCancelled(Transfer * transfer) { //User has cancelled the transfer, take neccessary action and mark transfer //as cancelled //eg uploadTransfer was cancelled by the user //eg. send the cancel notification to the service //if cancel was sucessful transfer->markCancelled(); //else //% "Something went wrong in cancel process" QString cancelErrMsg = qtTrid("qtn_tui_cancel_errxxxx"); transfer->markCancelFailed(cancelErrMsg); //Remove from the list of client transfers client->removeTransfer(uploadTransfer->transferId()); } |
bool TransferUI::Client::init | ( | ) |
function to initialize the client library instance.
void TUITestClient::initTUIClient() { // Create libtuiclient client = new TransferUI::Client(this); // Establish the connection between TUIClient and transfer-ui if(!client->init()) { qDebug()<<"Cannot initialize TUIClient";//error delete client; }
void TransferUI::Client::pauseTransfer | ( | Transfer * | transfer | ) | [signal] |
Signal emitted when some of transfers related to this client is asked to be paused.
Transfer will emit signal first then it will be emited by client.
transfer | Transfer that is asked to be pausedconnect(client,SIGNAL(pauseTransfer(Transfer*)), this, SLOT(transferPaused(Transfer*))); void TUITestClient::transferPaused(Transfer * transfer) { //User requested transfer to pause, pause transfer and update TransferUI transfer->markPaused(); } |
int TransferUI::Client::progressTimeDelta | ( | ) | const |
get function for the progress time delta
double TransferUI::Client::progressValueDelta | ( | ) | const |
get function for the progress value delta
Transfer* TransferUI::Client::registerTransfer | ( | const QString & | name, | |
TransferType | type, | |||
const QString & | clientId = QString() |
|||
) |
Register a new transient transfer.
This function registers a transfer which doesn't uses tracker. A unique identifier is generated by TransferUI and returned as Id. Id is used to control presentation of the transfer registered in TransferUI. The transfer details other than title and type will be set to default values. libtuiclient has a failsafe mechanism which re-populates the transfers in transfer-ui if transfer-ui crashes, hence when the transfer is completed or canceled, transfer should be removed from the client list using removeTransfer. For the first registered transfer of this client , transfer-ui emits its visibility state signals tuiOpened() / tuiClosed()
Size will be set to zero
Total file count will be set to 1
State will be set to pending without any message
Thumbnail is set to default thumbnail
TargetName will be set to Null.
name | transfer name which will be presented to the user | |
type | transfer type , TransferType enum | |
clientId | client id of the client. This parameter is used get special attributes for the client. clients should install config file into /usr/share/transfer-ui/clients/<clientid> path. transfer-ui reads the attributes from the given path. At present "DetailsDBusInterface" is supported by transfer-ui which displays custom details dialog when user clicks on the transfer. |
void TUITestClient::registerTransfer() { //Add a new upload transfer in TransferUI uploadTransfer = client->registerTransfer("New Upload Transfer",TransferUI::Client::TRANSFER_TYPES_UPLOAD); //Add a new download transfer in TransferUI downloadTransfer = client->registerTransfer("New Download Transfer", TransferUI::Client::TRANSFER_TYPES_DOWNLOAD); //Add a new Sync transfer in TransferUI syncTransfer = client->registerTransfer("Synchronizing", TransferUI::Client::TRANSFER_TYPES_SYNC); //Commit usage uploadTransfer->waitForCommit(); //start commit uploadTransfer->setName("filename.jpg"); uploadTransfer->setTargetName("picasa"); uploadTransfer->setFilesCount(10); uploadTransfer->setSize(1000); uploadTransfer->commit(); //end commit //Reduces three dbus calls to transfer-ui }
void TransferUI::Client::removeTransfer | ( | const QString & | tid | ) |
Remove the transfer whose id is passed from list of transfers.
This does not remove transfers from transfer-ui. After removing from the list, transfer will not recieve any signals from the transfer-ui.
tid | Id of the transfer to be removed.void TUITestClient::removeTransfer() { //Get the transfer identifier QString tdId = uploadTransfer->transferId(); //remove upload transfer from TransferUI client->removeTransfer(tdId); delete uploadTransfer; uploadTransfer= 0; } |
void TransferUI::Client::repairErrorTransfer | ( | Transfer * | transfer | ) | [signal] |
Signal emitted when error repair is requested.
transfer | Transfer that is asked to be pausedconnect(client,SIGNAL(repairErrorTransfer(Transfer*)), this, SLOT(transferErrorRepairRequested(Transfer*))); void TUITestClient::transferErrorRepairRequested(Transfer * transfer) { //User has requested for repair the error take some action } |
void TransferUI::Client::setProgressTimeDelta | ( | int | delta | ) |
set the progress time delta.
This delta is applicable for all the transfers in the client. Changing default delta value will impact the performance.Delta value should be non-negative value and greater than 50 ms.
delta | modified delta value in milliseconds |
void TransferUI::Client::setProgressValueDelta | ( | double | delta | ) |
set the progress value delta.
This delta is applicable for all the transfers in the client. Changing default delta value will impact the performance. Delta values should be in the range of 0.01 to 1. Other than those, delta values will be ignored
delta | modified delta value. |
bool TransferUI::Client::showUI | ( | ) |
Ask transfer-ui to show it's UI.
void TransferUI::Client::startTransfer | ( | Transfer * | transfer | ) | [signal] |
Signal emitted when some of transfers related to this client is asked to be started/continued.
Transfer will emit signal first then it will be emited by client.
transfer | transfer that is asked to be started/continuedconnect(client,SIGNAL(startTransfer(Transfer*)), this, SLOT(transferResumed(Transfer*))); void TUITestClient::transferResumed(Transfer * transfer) { //User requested transfer to resume, resume transfer and update TransferUI transfer->markResumed(); } |
void TransferUI::Client::summaryReport | ( | int | failed, | |
int | active, | |||
int | pending, | |||
int | completed | |||
) | [signal] |
Summary update of all transfers followed by transfer-ui.
failed | number of failed transfers | |
active | number of active transfers | |
pending | number of pending transfers | |
completed | number of completed transfers currently presented by Transfer UI |
(c) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). GNU Lesser General Public License, version 2.1 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
MeeGo 1.2 Harmattan API
|