summaryrefslogtreecommitdiff
path: root/src/downloadmanager.h
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-04-05 15:36:42 +0200
committerTannin <devnull@localhost>2014-04-05 15:36:42 +0200
commitcabed9b268c9f095d5e3b98a6797b0bcdcd38b1f (patch)
tree454b03b0c5664e90fe586e7b39603e34a526d35b /src/downloadmanager.h
parent98e5e57a845541acddf519a81957261f58008cb9 (diff)
parentc017f4a0d50b67a44e276bd5ae8929ed3990c62c (diff)
Merge with branch1.1
Diffstat (limited to 'src/downloadmanager.h')
-rw-r--r--src/downloadmanager.h59
1 files changed, 56 insertions, 3 deletions
diff --git a/src/downloadmanager.h b/src/downloadmanager.h
index a5f7d5b8..4e8467ee 100644
--- a/src/downloadmanager.h
+++ b/src/downloadmanager.h
@@ -83,10 +83,14 @@ private:
int m_Tries;
bool m_ReQueried;
+ quint32 m_TaskProgressId;
+
MOBase::ModRepositoryFileInfo *m_FileInfo;
+ bool m_Hidden;
+
static DownloadInfo *createNew(const MOBase::ModRepositoryFileInfo *fileInfo, const QStringList &URLs);
- static DownloadInfo *createFromMeta(const QString &filePath);
+ static DownloadInfo *createFromMeta(const QString &filePath, bool showHidden);
/**
* @brief rename the file
@@ -106,7 +110,7 @@ private:
private:
static unsigned int s_NextDownloadID;
private:
- DownloadInfo() : m_TotalSize(0), m_ReQueried(false), m_FileInfo(NULL) {}
+ DownloadInfo() : m_TotalSize(0), m_ReQueried(false) {}
};
public:
@@ -152,6 +156,11 @@ public:
void setSupportedExtensions(const QStringList &extensions);
/**
+ * @brief sets whether hidden files are to be shown after all
+ */
+ void setShowHidden(bool showHidden);
+
+ /**
* @brief download from an already open network connection
*
* @param reply the network reply to download from
@@ -188,6 +197,19 @@ public:
int numTotalDownloads() const;
/**
+ * @brief retrieve number of pending downloads (nexus downloads for which we don't know the name and url yet)
+ * @return number of pending downloads
+ */
+ int numPendingDownloads() const;
+
+ /**
+ * @brief retrieve the info of a pending download
+ * @param index index of the pending download (index in the range [0, numPendingDownloads()[)
+ * @return pair of modid, fileid
+ */
+ std::pair<int, int> getPendingDownload(int index);
+
+ /**
* @brief retrieve the full path to the download specified by index
*
* @param index the index to look up
@@ -254,6 +276,13 @@ public:
int getModID(int index) const;
/**
+ * @brief determine if the specified file is supposed to be hidden
+ * @param index index of the file to look up
+ * @return true if the specified file is supposed to be hidden
+ */
+ bool isHidden(int index) const;
+
+ /**
* @brief retrieve all nexus info of the download specified by index
*
* @param index index of the file to look up
@@ -332,6 +361,11 @@ signals:
*/
void downloadSpeed(const QString &serverName, int bytesPerSecond);
+ /**
+ * @brief emitted whenever a new download is added to the list
+ */
+ void downloadAdded();
+
public slots:
/**
@@ -343,6 +377,12 @@ public slots:
void removeDownload(int index, bool deleteFile);
/**
+ * @brief restores the specified download to view (which was previously hidden
+ * @param index index of the download to restore
+ */
+ void restoreDownload(int index);
+
+ /**
* @brief cancel the specified download. This will lead to the corresponding file to be deleted
*
* @param index index of the download to cancel
@@ -363,7 +403,7 @@ public slots:
void nxmDownloadURLsAvailable(int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
- void nxmRequestFailed(int modID, QVariant userData, int requestID, const QString &errorString);
+ void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
private slots:
@@ -405,6 +445,10 @@ private:
DownloadInfo *downloadInfoByID(unsigned int id);
+ QDateTime matchDate(const QString &timeString);
+
+ void removePending(int modID, int fileID);
+
private:
static const int AUTOMATIC_RETRIES = 3;
@@ -412,6 +456,9 @@ private:
private:
NexusInterface *m_NexusInterface;
+
+ QVector<std::pair<int, int> > m_PendingDownloads;
+
QVector<DownloadInfo*> m_ActiveDownloads;
QString m_OutputDirectory;
@@ -424,6 +471,12 @@ private:
std::map<QString, int> m_DownloadFails;
+ bool m_ShowHidden;
+
+ QRegExp m_DateExpression;
+
};
+
+
#endif // DOWNLOADMANAGER_H