23 #ifndef __WADSEEKER_H_
24 #define __WADSEEKER_H_
28 #include <QStringList>
31 #include "entities/waddownloadinfo.h"
32 #include "wadseekerexportinfo.h"
33 #include "wadseekermessagetype.h"
35 #define WADSEEKER_CONNECT_TIMEOUT_SECONDS_DEFAULT 30
36 #define WADSEEKER_DOWNLOAD_TIMEOUT_SECONDS_DEFAULT 120
39 class WadArchiveClient;
93 static const QString defaultSites[];
102 static const QString forbiddenWads[];
107 static const QString defaultIdgamesUrl();
114 static QStringList defaultSitesListEncoded();
119 static QStringList filterAllowedOnlyWads(
const QStringList &wads);
123 static QStringList filterForbiddenOnlyWads(
const QStringList &wads);
134 static bool isForbiddenWad(
const QString& wad);
152 bool isDownloadingFile(
const QString& file)
const;
163 bool isWorking()
const;
175 void setCustomSite(
const QUrl& url);
183 void setIdgamesEnabled(
bool bEnabled);
188 void setIdgamesUrl(QString archiveURL);
198 void setMaximumConcurrentDownloads(
unsigned max);
208 void setMaximumConcurrentSeeks(
unsigned max);
220 void setPrimarySites(
const QStringList& urlList);
228 void setPrimarySitesToDefault();
239 void setTargetDirectory(
const QString& dir);
245 void setWadArchiveEnabled(
bool enabled);
259 void skipFileCurrentUrl(
const QString& fileName);
272 void skipSiteSeek(
const QUrl& url);
283 bool startSeek(
const QStringList& wads);
291 QString targetDirectory()
const;
309 void allDone(
bool bSuccess);
323 void fileDownloadFinished(
const QString& filename);
340 void fileDownloadProgress(
const QString& filename, qint64 done, qint64 total);
350 void fileDownloadStarted(
const QString& filename,
const QUrl& url);
360 void fileInstalled(
const QString& filename);
369 void message(
const QString& msg, WadseekerLib::MessageType type);
379 void seekStarted(
const QStringList& filenames);
384 void siteFinished(
const QUrl& site);
389 void siteProgress(
const QUrl& site, qint64 bytes, qint64 total);
394 void siteRedirect(
const QUrl& oldUrl,
const QUrl& newUrl);
399 void siteStarted(
const QUrl& site);
405 bool bIdgamesEnabled;
406 bool bWadArchiveEnabled;
409 unsigned maxConcurrentDownloads;
410 unsigned maxConcurrentSeeks;
411 QString saveDirectoryPath;
412 QStringList seekedWads;
413 QStringList sitesUrls;
435 QList<Idgames* > idgamesClients;
437 SeekParameters seekParameters;
444 SeekParameters* seekParametersForCurrentSeek;
446 WadArchiveClient* wadArchiveClient;
447 WadRetriever* wadRetriever;
448 WWWSeeker* wwwSeeker;
453 void cleanUpAfterFinish();
454 bool isAllFinished()
const;
459 void prepareSeekObjects();
461 void setupIdgamesClients(
const QList<WadDownloadInfo>& wadDownloadInfoList);
462 void setupSitesUrls();
463 void setupWadArchiveClient(
const QList<WadDownloadInfo> &wadDownloadInfos);
465 void startNextIdgamesClient();
466 void startWadArchiveClient();
469 void cleanUpIfAllFinished();
470 void fileLinkFound(
const QString& filename,
const QUrl& url);
471 void fileMirrorLinksFound(
const QString& filename,
const QList<QUrl>& urls);
472 void idgamesClientFinished(Idgames* pEmitter);
473 void reportBadUrl(
const QUrl &url);
474 void wadRetrieverDownloadFinished(WadDownloadInfo wadDownloadInfo);
475 void wadRetrieverDownloadProgress(WadDownloadInfo wadDownloadInfo, qint64 current, qint64 total);
476 void wadRetrieverDownloadStarted(WadDownloadInfo wadDownloadInfo,
const QUrl& url);
477 void wadRetrieverFinished();
478 void wadRetrieverMessage(
const QString& message, WadseekerLib::MessageType type);
479 void wadRetrieverWadInstalled(WadDownloadInfo wadDownloadInfo);
480 void wwwSeekerFinished();