Mercurial > hg > svgui
comparison layer/ImageLayer.cpp @ 584:1fe7951a61e8 debug-output
Remove most toStdString calls (no longer needed, with debug header)
author | Chris Cannam |
---|---|
date | Thu, 12 May 2011 17:31:43 +0100 |
parents | 69089c9dc42e |
children | f4960f8ce798 |
comparison
equal
deleted
inserted
replaced
583:4c484636d5ec | 584:1fe7951a61e8 |
---|---|
498 //!!! how to reap no-longer-used images? | 498 //!!! how to reap no-longer-used images? |
499 | 499 |
500 bool | 500 bool |
501 ImageLayer::getImageOriginalSize(QString name, QSize &size) const | 501 ImageLayer::getImageOriginalSize(QString name, QSize &size) const |
502 { | 502 { |
503 // std::cerr << "getImageOriginalSize: \"" << name.toStdString() << "\"" << std::endl; | 503 // std::cerr << "getImageOriginalSize: \"" << name << "\"" << std::endl; |
504 | 504 |
505 QMutexLocker locker(&m_imageMapMutex); | 505 QMutexLocker locker(&m_imageMapMutex); |
506 if (m_images.find(name) == m_images.end()) { | 506 if (m_images.find(name) == m_images.end()) { |
507 // std::cerr << "don't have, trying to open local" << std::endl; | 507 // std::cerr << "don't have, trying to open local" << std::endl; |
508 m_images[name] = QImage(getLocalFilename(name)); | 508 m_images[name] = QImage(getLocalFilename(name)); |
519 QImage | 519 QImage |
520 ImageLayer::getImage(View *v, QString name, QSize maxSize) const | 520 ImageLayer::getImage(View *v, QString name, QSize maxSize) const |
521 { | 521 { |
522 bool need = false; | 522 bool need = false; |
523 | 523 |
524 // std::cerr << "ImageLayer::getImage(" << v << ", " << name.toStdString() << ", (" | 524 // std::cerr << "ImageLayer::getImage(" << v << ", " << name << ", (" |
525 // << maxSize.width() << "x" << maxSize.height() << "))" << std::endl; | 525 // << maxSize.width() << "x" << maxSize.height() << "))" << std::endl; |
526 | 526 |
527 if (!m_scaled[v][name].isNull() && | 527 if (!m_scaled[v][name].isNull() && |
528 ((m_scaled[v][name].width() == maxSize.width() && | 528 ((m_scaled[v][name].width() == maxSize.width() && |
529 m_scaled[v][name].height() <= maxSize.height()) || | 529 m_scaled[v][name].height() <= maxSize.height()) || |
625 bool | 625 bool |
626 ImageLayer::addImage(long frame, QString url) | 626 ImageLayer::addImage(long frame, QString url) |
627 { | 627 { |
628 QImage image(getLocalFilename(url)); | 628 QImage image(getLocalFilename(url)); |
629 if (image.isNull()) { | 629 if (image.isNull()) { |
630 std::cerr << "Failed to open image from url \"" << url.toStdString() << "\" (local filename \"" << getLocalFilename(url).toStdString() << "\"" << std::endl; | 630 std::cerr << "Failed to open image from url \"" << url << "\" (local filename \"" << getLocalFilename(url) << "\"" << std::endl; |
631 delete m_fileSources[url]; | 631 delete m_fileSources[url]; |
632 m_fileSources.erase(url); | 632 m_fileSources.erase(url); |
633 return false; | 633 return false; |
634 } | 634 } |
635 | 635 |
904 } | 904 } |
905 | 905 |
906 void | 906 void |
907 ImageLayer::checkAddSource(QString img) const | 907 ImageLayer::checkAddSource(QString img) const |
908 { | 908 { |
909 std::cerr << "ImageLayer::checkAddSource(" << img.toStdString() << "): yes, trying..." << std::endl; | 909 std::cerr << "ImageLayer::checkAddSource(" << img << "): yes, trying..." << std::endl; |
910 | 910 |
911 if (m_fileSources.find(img) != m_fileSources.end()) { | 911 if (m_fileSources.find(img) != m_fileSources.end()) { |
912 return; | 912 return; |
913 } | 913 } |
914 | 914 |
915 ProgressDialog dialog(tr("Opening image URL..."), true, 2000); | 915 ProgressDialog dialog(tr("Opening image URL..."), true, 2000); |
916 FileSource *rf = new FileSource(img, &dialog); | 916 FileSource *rf = new FileSource(img, &dialog); |
917 if (rf->isOK()) { | 917 if (rf->isOK()) { |
918 std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename().toStdString() << ")" << std::endl; | 918 std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename() << ")" << std::endl; |
919 m_fileSources[img] = rf; | 919 m_fileSources[img] = rf; |
920 connect(rf, SIGNAL(ready()), this, SLOT(fileSourceReady())); | 920 connect(rf, SIGNAL(ready()), this, SLOT(fileSourceReady())); |
921 } else { | 921 } else { |
922 delete rf; | 922 delete rf; |
923 } | 923 } |
946 QString img; | 946 QString img; |
947 for (FileSourceMap::const_iterator i = m_fileSources.begin(); | 947 for (FileSourceMap::const_iterator i = m_fileSources.begin(); |
948 i != m_fileSources.end(); ++i) { | 948 i != m_fileSources.end(); ++i) { |
949 if (i->second == rf) { | 949 if (i->second == rf) { |
950 img = i->first; | 950 img = i->first; |
951 // std::cerr << "it's image \"" << img.toStdString() << "\"" << std::endl; | 951 // std::cerr << "it's image \"" << img << "\"" << std::endl; |
952 break; | 952 break; |
953 } | 953 } |
954 } | 954 } |
955 if (img == "") return; | 955 if (img == "") return; |
956 | 956 |