void ajax::request(const QUrl& url, const QVariant& req) { if( mRequestQueue.value(url).count() >= 4 ) dispatchQueue(url); mRequestQueue[url].append(req); mRequestQueueTimer->start(); }
ajax::ajax(QObject *parent_object) : QObject(parent_object) { Q_ASSERT(g_ajax_inst == 0); mLog = LogWidget::getSingletonPtr(); mRequestQueueTimer = new QTimer; mRequestQueueTimer->setSingleShot(true); connect(mRequestQueueTimer, SIGNAL(timeout()), this, SLOT(dispatchQueue())); g_ajax_inst = this; }
ajax::ajax(QObject *parent_object) : QObject(parent_object) { Q_ASSERT(g_ajax_inst == 0); mURL = settings->url(); mLog = LogWidget::getSingletonPtr(); mRequestQueueTimer = new QTimer; mRequestQueueTimer->setSingleShot(true); connect(mRequestQueueTimer, SIGNAL(timeout()), this, SLOT(dispatchQueue())); offlineTransfer *transfer = offlineTransfer::inst(); connect(transfer, SIGNAL(transferFinished(const QVariantMap&, const QString&)), this, SIGNAL(response(const QVariantMap&, const QString&)), Qt::QueuedConnection); connect(transfer, SIGNAL(transferFailed(const QString&)), this, SLOT(handleError(const QString&)), Qt::QueuedConnection); g_ajax_inst = this; }