Mercurial > hg > svgui
comparison layer/ImageLayer.cpp @ 318:e9fe3923bdf4
* RemoteFile -> FileSource
now it's used all over the place for local files as well.
author | Chris Cannam |
---|---|
date | Thu, 18 Oct 2007 16:20:26 +0000 |
parents | e251c3599ea8 |
children | 984c1975f1ff |
comparison
equal
deleted
inserted
replaced
317:e251c3599ea8 | 318:e9fe3923bdf4 |
---|---|
19 #include "base/RealTime.h" | 19 #include "base/RealTime.h" |
20 #include "base/Profiler.h" | 20 #include "base/Profiler.h" |
21 #include "view/View.h" | 21 #include "view/View.h" |
22 | 22 |
23 #include "data/model/ImageModel.h" | 23 #include "data/model/ImageModel.h" |
24 #include "data/fileio/RemoteFile.h" | 24 #include "data/fileio/FileSource.h" |
25 | 25 |
26 #include "widgets/ImageDialog.h" | 26 #include "widgets/ImageDialog.h" |
27 | 27 |
28 #include <QPainter> | 28 #include <QPainter> |
29 #include <QMouseEvent> | 29 #include <QMouseEvent> |
50 { | 50 { |
51 } | 51 } |
52 | 52 |
53 ImageLayer::~ImageLayer() | 53 ImageLayer::~ImageLayer() |
54 { | 54 { |
55 for (RemoteFileMap::iterator i = m_remoteFiles.begin(); | 55 for (FileSourceMap::iterator i = m_remoteFiles.begin(); |
56 i != m_remoteFiles.end(); ++i) { | 56 i != m_remoteFiles.end(); ++i) { |
57 delete i->second; | 57 delete i->second; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
882 } | 882 } |
883 | 883 |
884 void | 884 void |
885 ImageLayer::checkAddRemote(QString img) const | 885 ImageLayer::checkAddRemote(QString img) const |
886 { | 886 { |
887 if (RemoteFile::isRemote(img)) { | 887 if (FileSource::isRemote(img)) { |
888 | 888 |
889 std::cerr << "ImageLayer::checkAddRemote(" << img.toStdString() << "): yes, trying..." << std::endl; | 889 std::cerr << "ImageLayer::checkAddRemote(" << img.toStdString() << "): yes, trying..." << std::endl; |
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 RemoteFile *rf = new RemoteFile(img); | 895 FileSource *rf = new FileSource(img); |
896 if (rf->isOK()) { | 896 if (rf->isOK()) { |
897 std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl; | 897 std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl; |
898 m_remoteFiles[img] = rf; | 898 m_remoteFiles[img] = rf; |
899 connect(rf, SIGNAL(ready()), this, SLOT(remoteFileReady())); | 899 connect(rf, SIGNAL(ready()), this, SLOT(remoteFileReady())); |
900 } else { | 900 } else { |
918 void | 918 void |
919 ImageLayer::remoteFileReady() | 919 ImageLayer::remoteFileReady() |
920 { | 920 { |
921 // std::cerr << "ImageLayer::remoteFileReady" << std::endl; | 921 // std::cerr << "ImageLayer::remoteFileReady" << std::endl; |
922 | 922 |
923 RemoteFile *rf = dynamic_cast<RemoteFile *>(sender()); | 923 FileSource *rf = dynamic_cast<FileSource *>(sender()); |
924 if (!rf) return; | 924 if (!rf) return; |
925 | 925 |
926 QString img; | 926 QString img; |
927 for (RemoteFileMap::const_iterator i = m_remoteFiles.begin(); | 927 for (FileSourceMap::const_iterator i = m_remoteFiles.begin(); |
928 i != m_remoteFiles.end(); ++i) { | 928 i != m_remoteFiles.end(); ++i) { |
929 if (i->second == rf) { | 929 if (i->second == rf) { |
930 img = i->first; | 930 img = i->first; |
931 // std::cerr << "it's image \"" << img.toStdString() << "\"" << std::endl; | 931 // std::cerr << "it's image \"" << img.toStdString() << "\"" << std::endl; |
932 break; | 932 break; |