diff -r 987f35e96467 -r c8ef30fd0e54 src/partDownloader.cc --- a/src/partDownloader.cc Sun Jun 22 21:13:50 2014 +0300 +++ b/src/partDownloader.cc Sun Jun 29 15:22:43 2014 +0300 @@ -61,9 +61,8 @@ { QString path = cfg::downloadFilePath; -#if DIRSLASH_CHAR != '/' - path.replace (DIRSLASH, "/"); -#endif + if (DIRSLASH[0] != '/') + path.replace (DIRSLASH, "/"); return path; } @@ -270,7 +269,7 @@ if (not req->isFinished()) return; - if (req->state() == PartDownloadRequest::EFailed) + if (req->state() == DLRQ_Failed) failed = true; } @@ -324,7 +323,7 @@ // PartDownloadRequest::PartDownloadRequest (QString url, QString dest, bool primary, PartDownloader* parent) : QObject (parent), - m_state (ERequesting), + m_state (DLRQ_Requesting), m_prompt (parent), m_url (url), m_destinaton (dest), @@ -362,15 +361,15 @@ // void PartDownloadRequest::updateToTable() { - const int labelcol = PartDownloader::PartLabelColumn, - progcol = PartDownloader::ProgressColumn; - QTableWidget* table = prompt()->interface()->progress; - QProgressBar* prog; + int const labelcol = PartDownloader::PartLabelColumn; + int const progcol = PartDownloader::ProgressColumn; + QTableWidget* table = prompt()->interface()->progress; + QProgressBar* prog; switch (state()) { - case ERequesting: - case EDownloading: + case DLRQ_Requesting: + case DLRQ_Downloading: { prog = qobject_cast (table->cellWidget (tableRow(), progcol)); @@ -384,10 +383,10 @@ prog->setValue (numBytesRead()); } break; - case EFinished: - case EFailed: + case DLRQ_Finished: + case DLRQ_Failed: { - const QString text = (state() == EFinished) + const QString text = (state() == DLRQ_Finished) ? "FINISHED" : "FAILED"; @@ -421,10 +420,10 @@ if (isPrimary() && not prompt()->isAborted()) critical (networkReply()->errorString()); - setState (EFailed); + setState (DLRQ_Failed); } - elif (state() != EFailed) - setState (EFinished); + elif (state() != DLRQ_Failed) + setState (DLRQ_Finished); setNumBytesRead (numBytesTotal()); updateToTable(); @@ -435,11 +434,11 @@ delete filePointer(); setFilePointer (null); - if (state() == EFailed) + if (state() == DLRQ_Failed) QFile::remove (filePath()); } - if (state() != EFinished) + if (state() != DLRQ_Finished) { prompt()->checkIfFinished(); return; @@ -482,7 +481,7 @@ { setNumBytesRead (recv); setNumBytesTotal (total); - setState (EDownloading); + setState (DLRQ_Downloading); updateToTable(); } @@ -490,7 +489,7 @@ // void PartDownloadRequest::readyRead() { - if (state() == EFailed) + if (state() == DLRQ_Failed) return; if (filePointer() == null) @@ -504,7 +503,7 @@ if (not filePointer()->open (QIODevice::WriteOnly)) { critical (format (tr ("Couldn't open %1 for writing: %2"), filePath(), strerror (errno))); - setState (EFailed); + setState (DLRQ_Failed); networkReply()->abort(); updateToTable(); prompt()->checkIfFinished(); @@ -519,7 +518,7 @@ // bool PartDownloadRequest::isFinished() const { - return state() == EFinished || state() == EFailed; + return state() == DLRQ_Finished || state() == DLRQ_Failed; } // =============================================================================