00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __WADSEEKER_H_
00024 #define __WADSEEKER_H_
00025
00026 #include <QList>
00027 #include <QString>
00028 #include <QStringList>
00029 #include <QUrl>
00030
00031 #ifdef Q_OS_WIN32
00032 #ifdef WADSEEKER_API_EXPORT
00033 #define WADSEEKER_API __declspec(dllexport)
00034 #else
00035 #define WADSEEKER_API __declspec(dllimport)
00036 #endif
00037 #else
00038 #define WADSEEKER_API
00039 #endif
00040
00041 class WWW;
00042
00083 class WADSEEKER_API Wadseeker : public QObject
00084 {
00085 Q_OBJECT
00086
00087 public:
00100 enum MessageType
00101 {
00102 Notice = 0,
00103 Error = 1,
00104 CriticalError = 2
00105 };
00106
00110 static const QString author();
00111
00116 static const QString defaultSites[];
00122 static const QString iwadNames[];
00123
00129 static QStringList defaultSitesListEncoded();
00130
00131
00135 static const QString description();
00136
00143 static bool isIwad(const QString& wad);
00144
00148 static const QString version();
00149
00153 static const QString yearSpan();
00154
00158 Wadseeker();
00162 ~Wadseeker();
00163
00168 void abort();
00169
00174 bool areAllFilesFound() const;
00175
00179 const QStringList& filesNotFound() const;
00180
00187 void seekWads(const QStringList& wads);
00188
00195 void setCustomSite(const QUrl& url);
00196
00203 void setPrimarySites(const QStringList& lst);
00204
00210 void setPrimarySitesToDefault();
00211
00216 void setTargetDirectory(const QString& dir);
00217
00222 QString targetDirectory() const;
00223
00224
00225
00226 signals:
00231 void aborted();
00232
00239 void allDone();
00240
00247 void downloadProgress(int done, int total);
00248
00255 void message(const QString& msg, Wadseeker::MessageType type);
00256
00257 protected:
00264 static QStringList wantedFilenames(const QString& wad);
00265
00266 protected slots:
00271 void messageSlot(const QString& msg,
00272 Wadseeker::MessageType type);
00273
00274 private:
00275 int iNextWad;
00276 QString currentWad;
00277 QStringList notFound;
00278 QStringList seekedWads;
00279 QString targetDir;
00280 WWW *www;
00281
00282 void nextWad();
00283
00284
00285 private slots:
00286 void downloadProgressSlot(int done, int total);
00287 void fileDone(QByteArray& data, const QString& filename);
00288 void wadFail();
00289 };
00290
00291 #endif
00292