Wadseeker Class Reference

Main controlling class. More...

#include <wadseeker.h>

+ Inheritance diagram for Wadseeker:

Public Slots

void abort ()
 

Signals

void allDone (bool bSuccess)
 
void fileDownloadFinished (const ModFile &filename)
 Emitted when a particular file finishes downloading.
 
void fileDownloadProgress (const ModFile &filename, qint64 done, qint64 total)
 Emits download progress.
 
void fileDownloadStarted (const ModFile &filename, const QUrl &url)
 Emitted when a file download starts.
 
void fileInstalled (const ModFile &filename)
 Emitted when a particular file is installed correctly.
 
void message (const QString &msg, WadseekerLib::MessageType type)
 Emitted when Wadseeker wants to communicate about its progress with outside world.
 
void seekStarted (const ModSet &filenames)
 Emitted when Wadseeker begins the seek operation.
 
void serviceFinished (const QString &name)
 Notifies that Wadseeker is done querying a customized service.
 
void serviceStarted (const QString &name)
 Notifies that Wadseeker started querying a customized service.
 
void siteFinished (const QUrl &site)
 Emitted when a WWW site finishes download.
 
void siteProgress (const QUrl &site, qint64 bytes, qint64 total)
 Emitted when a WWW site is being downloaded.
 
void siteRedirect (const QUrl &oldUrl, const QUrl &newUrl)
 Emitted when a WWW site redirects to a different site.
 
void siteStarted (const QUrl &site)
 Emitted when a download of a WWW site starts.
 

Public Member Functions

 Wadseeker ()
 
 ~Wadseeker () override
 
bool isDownloadingFile (const ModFile &file) const
 Check if Wadseeker is currently downloading given file.
 
bool isWorking () const
 Check if Wadseeker is still working.
 
void setCustomSite (const QString &url)
 
void setCustomSites (const QStringList &urls)
 
void setIdgamesEnabled (bool bEnabled)
 Toggles Idgames enabled state.
 
void setIdgamesUrl (QString archiveURL)
 Sets URL to Idgames search page.
 
void setMaximumConcurrentDownloads (unsigned max)
 Sets maximum number of concurrent WAD downloads.
 
void setMaximumConcurrentSeeks (unsigned max)
 Sets maximum number of concurrent site seeks.
 
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.
 
void skipFileCurrentUrl (const QString &fileName)
 Skips current URL for the specified file.
 
void skipService (const QString &service)
 Aborts querying a service if such query is in progress.
 
void skipSiteSeek (const QUrl &url)
 Skips site seeks for specified URL.
 
bool startSeek (const ModSet &wads)
 
QString targetDirectory () const
 

Static Public Member Functions

static const QString defaultIdgamesUrl ()
 
static QStringList defaultSitesListEncoded ()
 
static ModSet filterAllowedOnlyWads (const ModSet &wads)
 Lists only wads for which isForbiddenWad() returns false.
 
static ModSet filterForbiddenOnlyWads (const ModSet &wads)
 Lists only wads for which isForbiddenWad() returns true.
 
static bool isForbiddenWad (const ModFile &wad)
 Attempts to detect if the input is on a list of forbidden wads.
 

Static Public Attributes

static const QString defaultSites []
 List of default sites to search for files.
 
static const QString forbiddenWads []
 

Detailed Description

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.

Usage

Using Wadseeker is quite simple, there are three steps required for use:

  1. Initialize an instance of Wadseeker
  2. Configure some values such as the sites to search in and target directory.
  3. Create a list of wads to search for and pass it into seekWads.

Observe the following example on how to do these things.

ws.setPrimarySitesToDefault(); // Use the default list of sites
QStringList listOfWads;
listOfWads << "doom2.wad"; // This will be ignored because of iwadNames
listOfWads << "somemod.wad";
listOfWads << "somemod.pk3";
ws.seekWads(listOfWads);

Definition at line 87 of file wadseeker.h.

Constructor & Destructor Documentation

Wadseeker::Wadseeker ( )

Initializes a new instance of Wadseeker.

Wadseeker::~Wadseeker ( )
override

Deallocates an instance of Wadseeker.

Member Function Documentation

void Wadseeker::abort ( )
slot

Issues abort commands throughout entire library. aborted() signal is emitted when Wadseeker finishes aborting.

void Wadseeker::allDone ( bool  bSuccess)
signal

Emitted when Wadseeker finishes iterating through all files passed to seekWads() method.

Parameters
bSuccessTrue if all seeked WADs were installed. False if any single one of the WADs was not found or if abort was issued.
static const QString Wadseeker::defaultIdgamesUrl ( )
static
Returns
Default URL of Idgames archive, hardcoded into the library.
static QStringList Wadseeker::defaultSitesListEncoded ( )
static

Runs content of defaultSites array through QUrl::toPercentEncoding() and returns a list of so encoded strings.

void Wadseeker::fileDownloadFinished ( const ModFile &  filename)
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.

Parameters
filenameUnique filename for the affected file. Emitted previously by seekStarted() signal as an entry on the filenames list.
void Wadseeker::fileDownloadProgress ( const ModFile &  filename,
qint64  done,
qint64  total 
)
signal

Emits download progress.

Programmer may use this for example to update a progress bar.

Parameters
filenameUnique filename for the affected file. Emitted previously by seekStarted() signal as an entry on the filenames list.
doneBytes already downloaded.
totalTotal size of the downloaded file.
void Wadseeker::fileDownloadStarted ( const ModFile &  filename,
const QUrl &  url 
)
signal

Emitted when a file download starts.

Parameters
filenameName of the downloaded file.
urlURL from which the file is being downloaded.
void Wadseeker::fileInstalled ( const ModFile &  filename)
signal

Emitted when a particular file is installed correctly.

Parameters
filenameUnique filename for the affected file. Emitted previously by seekStarted() signal as an entry on the filenames list.
static ModSet Wadseeker::filterAllowedOnlyWads ( const ModSet &  wads)
static

Lists only wads for which isForbiddenWad() returns false.

static ModSet Wadseeker::filterForbiddenOnlyWads ( const ModSet &  wads)
static

Lists only wads for which isForbiddenWad() returns true.

bool Wadseeker::isDownloadingFile ( const ModFile &  file) const

Check if Wadseeker is currently downloading given file.

Parameters
wadName of the file as specified by seekStarted() signal.
static bool Wadseeker::isForbiddenWad ( const ModFile &  wad)
static

Attempts to detect if the input is on a list of forbidden wads.

Parameters
wadwad trying to be searched for.
Returns
True if Wadseeker will refuse to download the wad specified.
See Also
iwadNames
bool Wadseeker::isWorking ( ) const

Check if Wadseeker is still working.

Returns
True if any search or download is still in progress. False if all site searches are finished and there are no downloads in progress - in such case false will also be returned if there are still WADs pending for URLs but there is no way for these URLs to be provided.
void Wadseeker::message ( const QString &  msg,
WadseekerLib::MessageType  type 
)
signal

Emitted when Wadseeker wants to communicate about its progress with outside world.

Parameters
msg- content of the message
type- See: Wadseeker::MessageType
void Wadseeker::seekStarted ( const ModSet &  filenames)
signal

Emitted when Wadseeker begins the seek operation.

Parameters
filenamesContains unique names of all files that will be seeked. Wadseeker will continue to refer to those filenames in other signals.
void Wadseeker::serviceFinished ( const QString &  name)
signal

Notifies that Wadseeker is done querying a customized service.

Parameters
nameUnique name of the service.
See Also
serviceStarted()
void Wadseeker::serviceStarted ( const QString &  name)
signal

Notifies that Wadseeker started querying a customized service.

Customized services are: WadArchive, idgames.

Parameters
nameUnique name of the service. Can be used to abort querying of this service by passing it to skipService().
See Also
serviceFinished()
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.

Read about setCustomSites() for multiple sites

Parameters
urlA valid, absolute URL.
void Wadseeker::setCustomSites ( const QStringList &  urls)

Equal to setCustomSite, but for multiple sites. Do note that you shall only use one of these two.

Parameters
urlsA list of valid, absolute URLs.
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

Parameters
maxNumber of max. concurrent downloads. Cannot be lesser than one.
void Wadseeker::setMaximumConcurrentSeeks ( unsigned  max)

Sets maximum number of concurrent site seeks.

Default value: 3

Parameters
maxNumber 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.

Parameters
urlListList of valid, absolute URLs
void Wadseeker::setPrimarySitesToDefault ( )

Convenience method. Sets list of primary sites to sites hardcoded into library itself.

See Also
defaultSites
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.

Parameters
dirPath 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.

void Wadseeker::siteFinished ( const QUrl &  site)
signal

Emitted when a WWW site finishes download.

void Wadseeker::siteProgress ( const QUrl &  site,
qint64  bytes,
qint64  total 
)
signal

Emitted when a WWW site is being downloaded.

void Wadseeker::siteRedirect ( const QUrl &  oldUrl,
const QUrl &  newUrl 
)
signal

Emitted when a WWW site redirects to a different site.

void Wadseeker::siteStarted ( const QUrl &  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.

Parameters
fileNameThis 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.

Parameters
serviceName 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.

Parameters
urlThis 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 ModSet &  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.

Parameters
wadsList of files that will be searched for.
Returns
True if seek was started. False otherwise.
QString Wadseeker::targetDirectory ( ) const

Target directory is a directory where all seeked files will be saved.

Returns
Path to a directory last set by setTargetDirectory().

Member Data Documentation

const QString Wadseeker::defaultSites[]
static

List of default sites to search for files.

See Also
setPrimarySitesToDefault

Definition at line 97 of file wadseeker.h.

const QString Wadseeker::forbiddenWads[]
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.

See Also
isForbiddenWad

Definition at line 106 of file wadseeker.h.


The documentation for this class was generated from the following file: