comparison layer/ImageLayer.cpp @ 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
comparison
equal deleted inserted replaced
316:c0b9eec70639 317:e251c3599ea8
890 890
891 if (m_remoteFiles.find(img) != m_remoteFiles.end()) { 891 if (m_remoteFiles.find(img) != m_remoteFiles.end()) {
892 return; 892 return;
893 } 893 }
894 894
895 QUrl url(img); 895 RemoteFile *rf = new RemoteFile(img);
896 if (RemoteFile::canHandleScheme(url)) { 896 if (rf->isOK()) {
897 RemoteFile *rf = new RemoteFile(url); 897 std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl;
898 if (rf->isOK()) { 898 m_remoteFiles[img] = rf;
899 std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl; 899 connect(rf, SIGNAL(ready()), this, SLOT(remoteFileReady()));
900 m_remoteFiles[img] = rf; 900 } else {
901 connect(rf, SIGNAL(ready()), this, SLOT(remoteFileReady())); 901 delete rf;
902 } else {
903 delete rf;
904 }
905 } 902 }
906 } 903 }
907 } 904 }
908 905
909 void 906 void