Wadseeker Class Reference

Main controlling class. More...

List of all members.

Public Types

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

Public Slots

void abort ()
void skipSite ()

Signals

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
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 author ()
static const QString defaultIdgamesUrl ()
static QStringList defaultSitesListEncoded ()
static const QString description ()
static bool isIwad (const QString &wad)
static void setTimeConnectTimeout (int seconds)
static void setTimeDownloadTimeout (int seconds)
static const QString version ()
static const QString yearSpan ()

Static Public Attributes

static const QString defaultSites []
static const QString iwadNames []

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.

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);

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
  • 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
Returns:
true if all files that were passed to seekWads() method were found.
const QString Wadseeker::author (  )  [static]
Returns:
author of the library.
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.

const QString Wadseeker::description (  )  [static]
Returns:
description of the library.
void Wadseeker::downloadProgress ( int  done,
int  total 
) [signal]

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

Parameters:
done - bytes downloaded
total - size of file
const QStringList & Wadseeker::filesNotFound (  )  const
Returns:
list of files that weren't found
bool Wadseeker::isIwad ( const QString &  wad  )  [static]

Attempts to detect if the input is an iwad.

Parameters:
wad Name of wad trying to be searched for.
Returns:
True if the wad specified is an iwad.
See also:
iwadNames
void Wadseeker::message ( const QString &  msg,
Wadseeker::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::messageSlot ( const QString &  msg,
int  type 
) [protected, slot]

This slot acts as a pipe to the message signal.

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

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

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

Parameters:
lst - list 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.

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

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

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

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

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

Sets parameters for Idgames protocol.

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

const QString Wadseeker::version (  )  [static]
Returns:
version string of the library.
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 somemod.zip

Parameters:
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:
abort
aborted
const QString Wadseeker::yearSpan (  )  [static]
Returns:
Development dates.

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://hs.keystone.gr/lap/"),
    QString("http://www.rarefiles.com/download/"),
    QString("http://supergod.servegame.com/"),
    QString("http://wads.coffeenet.org/zips/"),
    QString("http://wads.interdoom.com/"),
    QString("") 
}

List of default sites to search for files.

See also:
setPrimarySitesToDefault
const QString Wadseeker::iwadNames [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:
isIwad

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