Mercurial > hg > svgui
changeset 317:e251c3599ea8
* Make RemoteFile far more pervasive, and use it for local files as well
so that we can handle both transparently. Make it shallow copy with
reference counting, so it can be used by value without having to worry
about the cache file lifetime. Use RemoteFile for MainWindow file-open
functions, etc
author | Chris Cannam |
---|---|
date | Thu, 18 Oct 2007 15:31:20 +0000 |
parents | c0b9eec70639 |
children | e9fe3923bdf4 |
files | layer/ImageLayer.cpp widgets/ImageDialog.cpp |
diffstat | 2 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/ImageLayer.cpp Thu Oct 18 10:15:07 2007 +0000 +++ b/layer/ImageLayer.cpp Thu Oct 18 15:31:20 2007 +0000 @@ -892,16 +892,13 @@ return; } - QUrl url(img); - if (RemoteFile::canHandleScheme(url)) { - RemoteFile *rf = new RemoteFile(url); - if (rf->isOK()) { - std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl; - m_remoteFiles[img] = rf; - connect(rf, SIGNAL(ready()), this, SLOT(remoteFileReady())); - } else { - delete rf; - } + RemoteFile *rf = new RemoteFile(img); + if (rf->isOK()) { + std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl; + m_remoteFiles[img] = rf; + connect(rf, SIGNAL(ready()), this, SLOT(remoteFileReady())); + } else { + delete rf; } } }
--- a/widgets/ImageDialog.cpp Thu Oct 18 10:15:07 2007 +0000 +++ b/widgets/ImageDialog.cpp Thu Oct 18 15:31:20 2007 +0000 @@ -187,7 +187,7 @@ .arg(url.scheme())); } else { m_remoteFile = new RemoteFile(url); - m_remoteFile->wait(); + m_remoteFile->waitForData(); if (!m_remoteFile->isOK()) { QMessageBox::critical(this, tr("File download failed"), tr("Failed to download URL \"%1\": %2")