void ImageTextBrowser::addString(QString s)
{
    if (preprocessor_)
        s = preprocessor_->preprocess(s);
    downloadResources(s);
    QString html = toHtml();
    if (s.indexOf("<img") == 0)
        s = "<br>" + s;
    html += s + "\n";
    setHtml(html);
    QScrollBar * vBar = this->verticalScrollBar();
    vBar->setValue(vBar->maximum());
}
bool SPOTFileDownload::downloadResources(const std::string & resFolder)
{
  std::cout << "\nDownloading resources to SPOT." << resFolder << std::endl<< std::endl;

  Poco::File foldr(resFolder);
  if(!foldr.exists() || !foldr.isDirectory())
  {
    std::cout << "SPOTFileDownload - not a valid "<< CResourcesFoldername << " folder. "<< resFolder << std::endl;
    return true;
  }


  Poco::DirectoryIterator end;
  for (Poco::DirectoryIterator it(resFolder); it != end; ++it)
  {
    if(it->isDirectory())
    {
      if(!downloadResources(it->path()))
      {
        return false;
      }
    }
    else
    {
      unsigned char resType;
      if(getResTypeId(resFolder, resType) )
      {
        std::cout << "SPOTFileDownload - ready to install " << it->path() << std::endl << std::endl;
        if(!this->downloadResourceFile(it->path(),resType))
        {
          std::cout << "resource download fail" << std::endl<< std::endl;
          return false;
        }
        else
        {
          std::cout << "resource download Ok" << std::endl<< std::endl;
        }
      }
    }
  }
  return true;
}