ThreadHandler::ThreadHandler(QObject *parent) : QObject(parent) { aui = new ApplicationUpdateInterface(this); requestHandler = new RequestHandler(this); blackList = new BlackList(this); thumbnailRemoverThread = new QThread(); thumbnailRemover = new ThumbnailRemover(); thumbnailRemover->moveToThread(thumbnailRemoverThread); connect(thumbnailRemoverThread, SIGNAL(started()), thumbnailRemover, SLOT(removeOutdated())); thumbnailRemoverThread->start(QThread::LowPriority); connect(this, SIGNAL(removeFiles(QStringList)), thumbnailRemover, SLOT(removeFiles(QStringList))); settings = new QSettings("settings.ini", QSettings::IniFormat); loadSettings(); connect(requestHandler, SIGNAL(response(QUrl,QByteArray,bool)), this, SLOT(processRequestResponse(QUrl,QByteArray,bool))); connect(requestHandler, SIGNAL(responseError(QUrl,int)), this, SLOT(handleRequestError(QUrl,int))); // connect(downloadManager, SIGNAL(error(QString)), ui->statusBar, SLOT(showMessage(QString))); // connect(downloadManager, SIGNAL(finishedRequestsChanged(int)), this, SLOT(updateDownloadProgress())); // connect(downloadManager, SIGNAL(totalRequestsChanged(int)), this, SLOT(updateDownloadProgress())); connect(aui, SIGNAL(connectionEstablished()), this, SLOT(updaterConnected())); connect(aui, SIGNAL(updateFinished()), this, SLOT(updateFinished())); connect(aui, SIGNAL(updaterVersionSent(QString)), this, SLOT(setUpdaterVersion(QString))); createComponentList(); #ifdef __DEBUG__ createSupervisedDownload(QUrl(QString::fromUtf8("file:d:/Qt/fourchan-dl/webupdate.xml")); #else createSupervisedDownload(QUrl(QString::fromUtf8("http://www.sourceforge.net/projects/fourchan-dl/files/webupdate/webupdate.xml/download"))); #endif autosaveTimer = new QTimer(this); autosaveTimer->setInterval(1000*60*10); // 10 Minutes autosaveTimer->setSingleShot(false); connect(autosaveTimer, SIGNAL(timeout()), this, SLOT(saveSettings())); }
void TokenCollectorBase::insertConnect(const std::string &token, intptr_t data) { for (std::list<Item>::reverse_iterator it = mPendingClients.rbegin(), it_end = mPendingClients.rend(); it != it_end; ++it) { if (it->token == token) { foundMatch(it->data, data); mPendingClients.erase(--it.base()); return; } } time_t current = time(NULL); Item item; item.token = token; item.data = data; item.timeStamp = current; mPendingConnects.push_back(item); removeOutdated(current); }