Main controlling class. More...
#include <wadseeker.h>
Public Slots | |
void | abort () |
Signals | |
void | allDone (bool bSuccess) |
void | fileDownloadFinished (const QString &filename) |
Emitted when a particular file finishes downloading. More... | |
void | fileDownloadProgress (const QString &filename, qint64 done, qint64 total) |
Emits download progress. More... | |
void | fileDownloadStarted (const QString &filename, const QUrl &url) |
Emitted when a file download starts. More... | |
void | fileInstalled (const QString &filename) |
Emitted when a particular file is installed correctly. More... | |
void | message (const QString &msg, WadseekerLib::MessageType type) |
Emitted when Wadseeker wants to communicate about its progress with outside world. More... | |
void | seekStarted (const QStringList &filenames) |
Emitted when Wadseeker begins the seek operation. More... | |
void | serviceFinished (const QString &name) |
Notifies that Wadseeker is done querying a customized service. More... | |
void | serviceStarted (const QString &name) |
Notifies that Wadseeker started querying a customized service. More... | |
void | siteFinished (const QUrl &site) |
Emitted when a WWW site finishes download. More... | |
void | siteProgress (const QUrl &site, qint64 bytes, qint64 total) |
Emitted when a WWW site is being downloaded. More... | |
void | siteRedirect (const QUrl &oldUrl, const QUrl &newUrl) |
Emitted when a WWW site redirects to a different site. More... | |
void | siteStarted (const QUrl &site) |
Emitted when a download of a WWW site starts. More... | |
Public Member Functions | |
Wadseeker () | |
~Wadseeker () | |
bool | isDownloadingFile (const QString &file) const |
Check if Wadseeker is currently downloading given file. More... | |
bool | isWorking () const |
Check if Wadseeker is still working. More... | |
void | setCustomSite (const QString &url) |
void | setIdgamesEnabled (bool bEnabled) |
Toggles Idgames enabled state. More... | |
void | setIdgamesUrl (QString archiveURL) |
Sets URL to Idgames search page. More... | |
void | setMaximumConcurrentDownloads (unsigned max) |
Sets maximum number of concurrent WAD downloads. More... | |
void | setMaximumConcurrentSeeks (unsigned max) |
Sets maximum number of concurrent site seeks. More... | |
void | setPrimarySites (const QStringList &urlList) |
void | setPrimarySitesToDefault () |
void | setTargetDirectory (const QString &dir) |
void | setWadArchiveEnabled (bool enabled) |
If set to true, Wadseeker will contact http://www.wad-archive.com to look for download URLs. More... | |
void | skipFileCurrentUrl (const QString &fileName) |
Skips current URL for the specified file. More... | |
void | skipService (const QString &service) |
Aborts querying a service if such query is in progress. More... | |
void | skipSiteSeek (const QUrl &url) |
Skips site seeks for specified URL. More... | |
bool | startSeek (const QStringList &wads) |
QString | targetDirectory () const |
Static Public Member Functions | |
static const QString | defaultIdgamesUrl () |
static QStringList | defaultSitesListEncoded () |
static QStringList | filterAllowedOnlyWads (const QStringList &wads) |
Lists only wads for which isForbiddenWad() returns false. More... | |
static QStringList | filterForbiddenOnlyWads (const QStringList &wads) |
Lists only wads for which isForbiddenWad() returns true. More... | |
static bool | isForbiddenWad (const QString &wad) |
Attempts to detect if the input is on a list of forbidden wads. More... | |
Static Public Attributes | |
static const QString | defaultSites [] |
List of default sites to search for files. More... | |
static const QString | forbiddenWads [] |
Main controlling class.
The Wadseeker class provides an interface for searching for and downloading modifications for Doom engine games. Wadseeker will search for mods in a list of locations provided by setPrimarySites.
Wadseeker will ignore a predefined set of file names which it suspects to be attempts to illegally download commercial game data, so passing in any name which is found in iwadNames will result in the file being ignored.
Using Wadseeker is quite simple, there are three steps required for use:
Observe the following example on how to do these things.
Definition at line 85 of file wadseeker.h.
Wadseeker::Wadseeker | ( | ) |
Initializes a new instance of Wadseeker.
Wadseeker::~Wadseeker | ( | ) |
Deallocates an instance of Wadseeker.
|
slot |
Issues abort commands throughout entire library. aborted() signal is emitted when Wadseeker finishes aborting.
|
signal |
Emitted when Wadseeker finishes iterating through all files passed to seekWads() method.
bSuccess | True if all seeked WADs were installed. False if any single one of the WADs was not found or if abort was issued. |
|
static |
|
static |
Runs content of defaultSites array through QUrl::toPercentEncoding() and returns a list of so encoded strings.
|
signal |
Emitted when a particular file finishes downloading.
NOTE: This doesn't mean that the WAD was successfully installed. It only serves as a notification that a download has been completed.
filename | Unique filename for the affected file. Emitted previously by seekStarted() signal as an entry on the filenames list. |
|
signal |
Emits download progress.
Programmer may use this for example to update a progress bar.
filename | Unique filename for the affected file. Emitted previously by seekStarted() signal as an entry on the filenames list. |
done | Bytes already downloaded. |
total | Total size of the downloaded file. |
|
signal |
Emitted when a file download starts.
filename | Name of the downloaded file. |
url | URL from which the file is being downloaded. |
|
signal |
Emitted when a particular file is installed correctly.
filename | Unique filename for the affected file. Emitted previously by seekStarted() signal as an entry on the filenames list. |
|
static |
Lists only wads for which isForbiddenWad() returns false.
|
static |
Lists only wads for which isForbiddenWad() returns true.
bool Wadseeker::isDownloadingFile | ( | const QString & | file | ) | const |
Check if Wadseeker is currently downloading given file.
wad | Name of the file as specified by seekStarted() signal. |
|
static |
Attempts to detect if the input is on a list of forbidden wads.
wad | Name of wad trying to be searched for. |
bool Wadseeker::isWorking | ( | ) | const |
Check if Wadseeker is still working.
|
signal |
Emitted when Wadseeker wants to communicate about its progress with outside world.
msg | - content of the message |
type | - See: Wadseeker::MessageType |
|
signal |
|
signal |
Notifies that Wadseeker is done querying a customized service.
name | Unique name of the service. |
|
signal |
Notifies that Wadseeker started querying a customized service.
Customized services are: WadArchive, idgames.
name | Unique name of the service. Can be used to abort querying of this service by passing it to skipService(). |
void Wadseeker::setCustomSite | ( | const QString & | url | ) |
Sets a custom site. This site has priority over all other sites and will be searched first. For example a link provided by the server can be passed here.
Custom site can be set before the seek is started.
url | A valid, absolute URL. |
void Wadseeker::setIdgamesEnabled | ( | bool | bEnabled | ) |
Toggles Idgames enabled state.
If true, Idgames search will be performed. If false, Idgames archive will be skipped.
void Wadseeker::setIdgamesUrl | ( | QString | archiveURL | ) |
Sets URL to Idgames search page.
void Wadseeker::setMaximumConcurrentDownloads | ( | unsigned | max | ) |
Sets maximum number of concurrent WAD downloads.
Default value: 3
max | Number of max. concurrent downloads. Cannot be lesser than one. |
void Wadseeker::setMaximumConcurrentSeeks | ( | unsigned | max | ) |
Sets maximum number of concurrent site seeks.
Default value: 3
max | Number of max. concurrent seeks. Cannot be lesser than one. |
void Wadseeker::setPrimarySites | ( | const QStringList & | urlList | ) |
Sets a list of primary sites. This is where Wadseeker begins it's search and where it returns to if nothing of interest was found on other pages.
Primary sites must be set before the seek is started.
urlList | List of valid, absolute URLs |
void Wadseeker::setPrimarySitesToDefault | ( | ) |
Convenience method. Sets list of primary sites to sites hardcoded into library itself.
void Wadseeker::setTargetDirectory | ( | const QString & | dir | ) |
Target directory is a directory where all seeked files will be saved. If this directory is not writable the seek will fail.
Must be set before the seek is started. @param dir Path to a writable directory.
void Wadseeker::setWadArchiveEnabled | ( | bool | enabled | ) |
If set to true, Wadseeker will contact http://www.wad-archive.com to look for download URLs.
|
signal |
Emitted when a WWW site finishes download.
|
signal |
Emitted when a WWW site is being downloaded.
|
signal |
Emitted when a WWW site redirects to a different site.
|
signal |
Emitted when a download of a WWW site starts.
void Wadseeker::skipFileCurrentUrl | ( | const QString & | fileName | ) |
Skips current URL for the specified file.
If available a new file URL will be immediately taken from the queue and new download will begin.
fileName | This must be a file name specified by seekStarted() signal. If file name is not valid or download for this file is not in progress then no operation will be performed. |
void Wadseeker::skipService | ( | const QString & | service | ) |
Aborts querying a service if such query is in progress.
service | Name of the service as emitted by serviceStarted() signal. |
void Wadseeker::skipSiteSeek | ( | const QUrl & | url | ) |
Skips site seeks for specified URL.
If available a new site URL will be immediately taken from the queue for inspection.
url | This must be one of the URLs that was emitted through siteStarted() or siteRedirect() signals. If unknown URL is passed no operation will be performed. |
bool Wadseeker::startSeek | ( | const QStringList & | wads | ) |
Library's "entry" method. This is where Wadseeker begins to iterate through WWW sites to find all files specified on the list. seekStarted() signal is emitted.
wads | List of files that will be searched for. |
QString Wadseeker::targetDirectory | ( | ) | const |
Target directory is a directory where all seeked files will be saved.
@return Path to a directory last set by setTargetDirectory().
|
static |
List of default sites to search for files.
Definition at line 95 of file wadseeker.h.
|
static |
List of file names that will be ignored as they are part of a commercial product. Empty string at the end of the array is required and indicates the end of the array.
Definition at line 104 of file wadseeker.h.