Mercurial > hg > svcore
comparison data/fileio/FileSource.cpp @ 1007:ba404199345f tonioni
Merge from default branch
| author | Chris Cannam |
|---|---|
| date | Mon, 10 Nov 2014 09:19:49 +0000 |
| parents | 60e2927b1475 |
| children | 3a48b22fed48 |
comparison
equal
deleted
inserted
replaced
| 980:6e6da0636e5e | 1007:ba404199345f |
|---|---|
| 76 m_url(fileOrUrl, QUrl::StrictMode), | 76 m_url(fileOrUrl, QUrl::StrictMode), |
| 77 m_localFile(0), | 77 m_localFile(0), |
| 78 m_reply(0), | 78 m_reply(0), |
| 79 m_preferredContentType(preferredContentType), | 79 m_preferredContentType(preferredContentType), |
| 80 m_ok(false), | 80 m_ok(false), |
| 81 m_cancelled(false), | |
| 81 m_lastStatus(0), | 82 m_lastStatus(0), |
| 82 m_resource(fileOrUrl.startsWith(':')), | 83 m_resource(fileOrUrl.startsWith(':')), |
| 83 m_remote(isRemote(fileOrUrl)), | 84 m_remote(isRemote(fileOrUrl)), |
| 84 m_done(false), | 85 m_done(false), |
| 85 m_leaveLocalFile(false), | 86 m_leaveLocalFile(false), |
| 165 FileSource::FileSource(QUrl url, ProgressReporter *reporter) : | 166 FileSource::FileSource(QUrl url, ProgressReporter *reporter) : |
| 166 m_url(url), | 167 m_url(url), |
| 167 m_localFile(0), | 168 m_localFile(0), |
| 168 m_reply(0), | 169 m_reply(0), |
| 169 m_ok(false), | 170 m_ok(false), |
| 171 m_cancelled(false), | |
| 170 m_lastStatus(0), | 172 m_lastStatus(0), |
| 171 m_resource(false), | 173 m_resource(false), |
| 172 m_remote(isRemote(url.toString())), | 174 m_remote(isRemote(url.toString())), |
| 173 m_done(false), | 175 m_done(false), |
| 174 m_leaveLocalFile(false), | 176 m_leaveLocalFile(false), |
| 197 QObject(), | 199 QObject(), |
| 198 m_url(rf.m_url), | 200 m_url(rf.m_url), |
| 199 m_localFile(0), | 201 m_localFile(0), |
| 200 m_reply(0), | 202 m_reply(0), |
| 201 m_ok(rf.m_ok), | 203 m_ok(rf.m_ok), |
| 204 m_cancelled(rf.m_cancelled), | |
| 202 m_lastStatus(rf.m_lastStatus), | 205 m_lastStatus(rf.m_lastStatus), |
| 203 m_resource(rf.m_resource), | 206 m_resource(rf.m_resource), |
| 204 m_remote(rf.m_remote), | 207 m_remote(rf.m_remote), |
| 205 m_done(false), | 208 m_done(false), |
| 206 m_leaveLocalFile(false), | 209 m_leaveLocalFile(false), |
| 482 m_localFile = 0; | 485 m_localFile = 0; |
| 483 } | 486 } |
| 484 m_done = true; | 487 m_done = true; |
| 485 if (m_reply) { | 488 if (m_reply) { |
| 486 QNetworkReply *r = m_reply; | 489 QNetworkReply *r = m_reply; |
| 490 disconnect(r, 0, this, 0); | |
| 487 m_reply = 0; | 491 m_reply = 0; |
| 488 // Can only call abort() when there are no errors. | 492 // Can only call abort() when there are no errors. |
| 489 if (r->error() == QNetworkReply::NoError) { | 493 if (r->error() == QNetworkReply::NoError) { |
| 490 r->abort(); | 494 r->abort(); |
| 491 } | 495 } |
| 566 | 570 |
| 567 bool | 571 bool |
| 568 FileSource::isDone() const | 572 FileSource::isDone() const |
| 569 { | 573 { |
| 570 return m_done; | 574 return m_done; |
| 575 } | |
| 576 | |
| 577 bool | |
| 578 FileSource::wasCancelled() const | |
| 579 { | |
| 580 return m_cancelled; | |
| 571 } | 581 } |
| 572 | 582 |
| 573 bool | 583 bool |
| 574 FileSource::isResource() const | 584 FileSource::isResource() const |
| 575 { | 585 { |
| 708 { | 718 { |
| 709 m_done = true; | 719 m_done = true; |
| 710 cleanup(); | 720 cleanup(); |
| 711 | 721 |
| 712 m_ok = false; | 722 m_ok = false; |
| 723 m_cancelled = true; | |
| 713 m_errorString = tr("Download cancelled"); | 724 m_errorString = tr("Download cancelled"); |
| 714 } | 725 } |
| 715 | 726 |
| 716 void | 727 void |
| 717 FileSource::replyFinished() | 728 FileSource::replyFinished() |
