Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Slots | Static Protected Member Functions

Wadseeker Class Reference

Main controlling class. More...

List of all members.

Public Types

enum  MessageType { Notice = 0, NoticeImportant = 1, Error = 2, CriticalError = 3 }

Public Slots

void abort ()
void skipSite ()


void aborted ()
void allDone ()
void downloadProgress (int done, int total)
void message (const QString &msg, Wadseeker::MessageType type)

Public Member Functions

 Wadseeker ()
 ~Wadseeker ()
bool areAllFilesFound () const
float downloadSpeed () const
 Retrieves speed of current download in bytes per second.
float estimatedTimeUntilArrivalOfCurrentFile () const
 Retrieves amount of seconds REMAINING till current download is finished.
const QStringList & filesNotFound () const
void seekWads (const QStringList &wads)
void setCustomSite (const QUrl &url)
void setPrimarySites (const QStringList &lst)
void setPrimarySitesToDefault ()
void setTargetDirectory (const QString &dir)
void setUseIdgames (bool use, bool highPriority=false, QString archiveURL=defaultIdgamesUrl())
QString targetDirectory () const

Static Public Member Functions

static const QString defaultIdgamesUrl ()
static QStringList defaultSitesListEncoded ()
static bool isForbiddenWad (const QString &wad)
static void setTimeConnectTimeout (int seconds)
static void setTimeDownloadTimeout (int seconds)

Static Public Attributes

static const QString defaultSites []
static const QString forbiddenWads []

Protected Slots

void messageSlot (const QString &msg, int type)
void wwwAborted ()

Static Protected Member Functions

static QStringList wantedFilenames (const QString &wad, QString &zip)

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.


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
    QStringList listOfWads;
    listOfWads << "doom2.wad"; // This will be ignored beacuse of iwadNames
    listOfWads << "somemod.wad";
    listOfWads << "somemod.pk3";

Member Enumeration Documentation

Wadseeker library uses a message system that contains a type of message together with a string representing it's content. Types should be treated as follows:

  • Notice - this is just an information of what Wadseeker is currently doing
  • NoticeImportant - an information on an important event
  • Error - something bad happened but Wadseeker is able to continue by itself.
  • CriticalError - Wadseeker stops working after such error. Programmer should return control to the main application.

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::aborted (  )  [signal]

Emitted after abort() method is used and when it's safe to assume that Wadseeker finished all its jobs.

void Wadseeker::allDone (  )  [signal]

Emitted when Wadseeker finishes iterating through all files passed to seekWads() method. This signal is emitted regardless if all files were found or not. To check this use areAllFilesFound() method.

bool Wadseeker::areAllFilesFound (  )  const
true if all files that were passed to seekWads() method were found.
const QString Wadseeker::defaultIdgamesUrl (  )  [static]
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::downloadProgress ( int  done,
int  total 
) [signal]

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

done - bytes downloaded
total - size of file
float Wadseeker::downloadSpeed (  )  const

Retrieves speed of current download in bytes per second.

If it is impossible to calculate time due to insufficient data being present returned value is 0.
float Wadseeker::estimatedTimeUntilArrivalOfCurrentFile (  )  const

Retrieves amount of seconds REMAINING till current download is finished.

If it is impossible to calculate time due to speed being equal to zero or insufficient data being present returned value is negative.
const QStringList & Wadseeker::filesNotFound (  )  const
list of files that weren't found
bool Wadseeker::isForbiddenWad ( const QString &  wad  )  [static]

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

wad Name of wad trying to be searched for.
True if Wadseeker will refuse to download the wad specified.
See also:
void Wadseeker::message ( const QString &  msg,
Wadseeker::MessageType  type 
) [signal]

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

msg - content of the message
type - See: Wadseeker::MessageType
void Wadseeker::messageSlot ( const QString &  msg,
int  type 
) [protected, slot]

This slot acts as a pipe to the message signal.

See also:
void Wadseeker::seekWads ( 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.

wads - list of files that will be searched for
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.

url - a valid, absolute URL
void Wadseeker::setPrimarySites ( const QStringList &  lst  ) 

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.

lst - list of valid, absolute URLs
void Wadseeker::setPrimarySitesToDefault (  ) 

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

See also:
void Wadseeker::setTargetDirectory ( const QString &  dir  ) 

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

void Wadseeker::setTimeConnectTimeout ( int  seconds  )  [static]

Sets time after which to abort connecting if no response is received.

seconds - time in seconds
void Wadseeker::setTimeDownloadTimeout ( int  seconds  )  [static]

Sets time after which to abort downloading if data stops coming.

seconds - time in seconds
void Wadseeker::setUseIdgames ( bool  use,
bool  highPriority = false,
QString  archiveURL = defaultIdgamesUrl() 

Sets parameters for Idgames protocol.

use - If true, idgames search will be performed. If false, idgames archive will be skipped.
highPriority - If true, idgames archive will be searched right after the custom site. If false, idgames archive will be searched after all other sites fail.
archiveURL - URL to Idgames search page
void Wadseeker::skipSite (  )  [slot]

Skips current site and proceeds to the next one in the queue.

QString Wadseeker::targetDirectory (  )  const

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

QStringList Wadseeker::wantedFilenames ( const QString &  wad,
QString &  zip 
) [static, protected]

Returns the name of the actual files that will be searched for. For example, if somemod.wad was searched for, this would return somemod.wad and

wad Absolute file being searched for. (ex: somemod.wad)
[out] zip - returns name of according zip file
void Wadseeker::wwwAborted (  )  [protected, slot]

Activated when WWW class finishes aborting, emits aborted() signal.

See also:

Member Data Documentation

const QString Wadseeker::defaultSites [static]
Initial value:

List of default sites to search for files.

See also:
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:

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