void PreviewToggleCommand::clean() {
  // Release all previewed images
  if (m_sl) {
    int i, fidsCount = m_fids.size();
    for (i = 0; i < fidsCount; ++i) {
      const TFrameId &fid = m_fids[i];

      int status = m_sl->getFrameStatus(fid);
      if (status & TXshSimpleLevel::CleanupPreview) {
        // Preview images are not just invalidated, but *unbound* from the IM.
        // This is currently done hard here - should be skipped to m_sl,
        // though...
        ImageManager *im = ImageManager::instance();
        im->unbind(m_sl->getImageId(fid, TXshSimpleLevel::CleanupPreview));

        IconGenerator::instance()->remove(m_sl.getPointer(), fid);

        m_sl->setFrameStatus(fid, status & ~TXshSimpleLevel::CleanupPreview);
      }
    }
  }

  m_sl = TXshSimpleLevelP();
  m_fids.clear();
}
void CameraTestToggleCommand::clean() {
  // Release all previewed images
  if (m_sl) {
    int i, fidsCount = m_fids.size();
    for (i = 0; i < fidsCount; ++i) {
      const TFrameId &fid = m_fids[i];

      int status = m_sl->getFrameStatus(fid);
      if (status & TXshSimpleLevel::CleanupPreview) {
        ImageManager *im = ImageManager::instance();
        im->unbind(m_sl->getImageId(fid, TXshSimpleLevel::CleanupPreview));

        IconGenerator::instance()->remove(m_sl.getPointer(), fid);

        m_sl->setFrameStatus(fid, status & ~TXshSimpleLevel::CleanupPreview);
      }
    }
  }

  m_sl = TXshSimpleLevelP();
  m_fids.clear();
}