# HG changeset patch # User Chris Cannam # Date 1192724426 0 # Node ID e9fe3923bdf4123f6ad23635c6bc8741e89d744c # Parent e251c3599ea89883fabad42194c9e313fede6d47 * RemoteFile -> FileSource now it's used all over the place for local files as well. diff -r e251c3599ea8 -r e9fe3923bdf4 layer/ImageLayer.cpp --- a/layer/ImageLayer.cpp Thu Oct 18 15:31:20 2007 +0000 +++ b/layer/ImageLayer.cpp Thu Oct 18 16:20:26 2007 +0000 @@ -21,7 +21,7 @@ #include "view/View.h" #include "data/model/ImageModel.h" -#include "data/fileio/RemoteFile.h" +#include "data/fileio/FileSource.h" #include "widgets/ImageDialog.h" @@ -52,7 +52,7 @@ ImageLayer::~ImageLayer() { - for (RemoteFileMap::iterator i = m_remoteFiles.begin(); + for (FileSourceMap::iterator i = m_remoteFiles.begin(); i != m_remoteFiles.end(); ++i) { delete i->second; } @@ -884,7 +884,7 @@ void ImageLayer::checkAddRemote(QString img) const { - if (RemoteFile::isRemote(img)) { + if (FileSource::isRemote(img)) { std::cerr << "ImageLayer::checkAddRemote(" << img.toStdString() << "): yes, trying..." << std::endl; @@ -892,7 +892,7 @@ return; } - RemoteFile *rf = new RemoteFile(img); + FileSource *rf = new FileSource(img); if (rf->isOK()) { std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl; m_remoteFiles[img] = rf; @@ -920,11 +920,11 @@ { // std::cerr << "ImageLayer::remoteFileReady" << std::endl; - RemoteFile *rf = dynamic_cast(sender()); + FileSource *rf = dynamic_cast(sender()); if (!rf) return; QString img; - for (RemoteFileMap::const_iterator i = m_remoteFiles.begin(); + for (FileSourceMap::const_iterator i = m_remoteFiles.begin(); i != m_remoteFiles.end(); ++i) { if (i->second == rf) { img = i->first; diff -r e251c3599ea8 -r e9fe3923bdf4 layer/ImageLayer.h --- a/layer/ImageLayer.h Thu Oct 18 15:31:20 2007 +0000 +++ b/layer/ImageLayer.h Thu Oct 18 16:20:26 2007 +0000 @@ -28,7 +28,7 @@ class View; class QPainter; -class RemoteFile; +class FileSource; class ImageLayer : public Layer { @@ -115,12 +115,12 @@ typedef std::map ImageMap; typedef std::map ViewImageMap; - typedef std::map RemoteFileMap; + typedef std::map FileSourceMap; static ImageMap m_images; static QMutex m_imageMapMutex; mutable ViewImageMap m_scaled; - mutable RemoteFileMap m_remoteFiles; + mutable FileSourceMap m_remoteFiles; QString getLocalFilename(QString img) const; void checkAddRemote(QString img) const; diff -r e251c3599ea8 -r e9fe3923bdf4 widgets/ImageDialog.cpp --- a/widgets/ImageDialog.cpp Thu Oct 18 15:31:20 2007 +0000 +++ b/widgets/ImageDialog.cpp Thu Oct 18 16:20:26 2007 +0000 @@ -26,7 +26,7 @@ #include #include -#include "data/fileio/RemoteFile.h" +#include "data/fileio/FileSource.h" #include "data/fileio/FileFinder.h" #include @@ -179,14 +179,14 @@ delete m_remoteFile; m_remoteFile = 0; - if (RemoteFile::isRemote(fileName)) { + if (FileSource::isRemote(fileName)) { QUrl url(fileName); - if (!RemoteFile::canHandleScheme(url)) { + if (!FileSource::canHandleScheme(url)) { QMessageBox::critical(this, tr("Unsupported scheme in URL"), tr("The URL scheme \"%1\" is not supported") .arg(url.scheme())); } else { - m_remoteFile = new RemoteFile(url); + m_remoteFile = new FileSource(url); m_remoteFile->waitForData(); if (!m_remoteFile->isOK()) { QMessageBox::critical(this, tr("File download failed"), diff -r e251c3599ea8 -r e9fe3923bdf4 widgets/ImageDialog.h --- a/widgets/ImageDialog.h Thu Oct 18 15:31:20 2007 +0000 +++ b/widgets/ImageDialog.h Thu Oct 18 16:20:26 2007 +0000 @@ -22,7 +22,7 @@ class QLineEdit; class QLabel; class QPushButton; -class RemoteFile; +class FileSource; class ImageDialog : public QDialog { @@ -65,7 +65,7 @@ QPushButton *m_okButton; - RemoteFile *m_remoteFile; + FileSource *m_remoteFile; }; #endif