Classes | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes
Wadseeker Class Reference

Main controlling class. More...

List of all members.

Classes

class  PrivData
class  SeekParameters

Public Slots

void abort ()

Signals

void allDone (bool bSuccess)
void fileDownloadFinished (const QString &filename)
 Emitted when a particular file finishes downloading.
void fileDownloadProgress (const QString &filename, qint64 done, qint64 total)
 Emits download progress.
void fileDownloadStarted (const QString &filename, const QUrl &url)
 Emitted when a file download starts.
void fileInstalled (const QString &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 QStringList &filenames)
 Emitted when Wadseeker begins the seek operation.
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 ()
bool isDownloadingFile (const QString &file) const
 Check if Wadseeker is currently downloading given file.
bool isWorking () const
 Check if Wadseeker is still working.
void setCustomSite (const QUrl &url)
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 skipFileCurrentUrl (const QString &fileName)
 Skips current URL for the specified file.
void skipSiteSeek (const QUrl &url)
 Skips site seeks for specified URL.
bool startSeek (const QStringList &wads)
QString targetDirectory () const

Static Public Member Functions

static const QString defaultIdgamesUrl ()
static QStringList defaultSitesListEncoded ()
static bool isForbiddenWad (const QString &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.

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

Constructor & Destructor Documentation

Wadseeker::Wadseeker ( )

Initializes a new instance of Wadseeker.

Wadseeker::~Wadseeker ( )

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.
const QString Wadseeker::defaultIdgamesUrl ( ) [static]
Returns:
Default URL of Idgames archive, hardcoded into the library.
QStringList Wadseeker::defaultSitesListEncoded ( ) [static]

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

void Wadseeker::fileDownloadFinished ( const QString &  filename) [signal]

Emitted when a particular file finishes downloading.

NOTE: This doesn't mean that the WAD was successfully installed. It only servers 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 QString &  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 QString &  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 QString &  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.
bool Wadseeker::isDownloadingFile ( const QString &  file) const

Check if Wadseeker is currently downloading given file.

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

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

Parameters:
wadName of wad 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 QStringList &  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::setCustomSite ( const QUrl &  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.

Parameters:
urlA 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

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::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::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 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.

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]
Initial value:
{
    QString("http://doom.dogsoft.net/getwad.php?search=%WADNAME%"),
    QString("http://www.wadhost.fathax.com/files/"),

    QString("http://www.rarefiles.com/download/"),
    QString("http://wads.coffeenet.org/zips/"),

    QString("http://static.totaltrash.org/wads/"),
    QString("") 
}

List of default sites to search for files.

See also:
setPrimarySitesToDefault
const QString Wadseeker::forbiddenWads [static]
Initial value:
{
    "attack", "blacktwr", "bloodsea", "canyon", "catwalk", "combine", "doom",
    "doom2", "fistula", "garrison", "geryon", "heretic", "hexen", "hexdd",
    "manor", "mephisto", "minos", "nessus", "paradox", "plutonia", "subspace",
    "subterra", "teeth", "tnt", "ttrap", "strife1", "vesperas", "virgil",
    "voices", ""
}

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

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