示例#1
0
void LoaderQueue::loadNext()
{
	LYXERR(Debug::GRAPHICS, "LoaderQueue: "
		<< cache_queue_.size() << " items in the queue");
	int counter = s_numimages_;
	while (!cache_queue_.empty() && counter--) {
		Cache::ItemPtr ptr = cache_queue_.front();
		cache_set_.erase(ptr);
		cache_queue_.pop_front();
		if (ptr->status() == WaitingToLoad)
			ptr->startLoading();
	}
	if (!cache_queue_.empty())
		startLoader();
	else
		stopLoader();
}
示例#2
0
void Document::init() {
  if (m_doc) {
    delete m_doc;
  }

  QList<BackendPage *> backends;
  m_doc = m_loader->releaseBackend(backends);

  if (!m_doc) {
    return;
  }

  qreal width = 0;
  qreal height = 0;

  int pages = backends.size();
  for (int x = 0; x < pages; x++) {
    BackendPage *backend = backends[x];

    DocumentPage *page = new DocumentPage(backend, x, QPointF(0, height), this);
    m_pages << page;

    QSizeF size = page->size();
    qreal rectWidth = size.width();
    qreal rectHeight = size.height();

    width = qMax(width, rectWidth);
    height += rectHeight;
  }

  backends.clear();

  qDebug() << "width" << width << "height" << height;

  setWidth(width);
  setHeight(height);

  setState(Document::Loaded);

  stopLoader();

  emit pageCountChanged();
}
示例#3
0
void Document::clearDocument() {
  stopLoader();

  delete m_doc;
  m_doc = 0;
}