# HG changeset patch # User Chris Cannam # Date 1192721480 0 # Node ID e251c3599ea89883fabad42194c9e313fede6d47 # Parent c0b9eec70639c4d2ae8da150a3d585af5eaae075 * 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 diff -r c0b9eec70639 -r e251c3599ea8 layer/ImageLayer.cpp --- 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; } } } diff -r c0b9eec70639 -r e251c3599ea8 widgets/ImageDialog.cpp --- 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")