void BookModel::clearPages() { beginResetModel(); qDeleteAll(d->entries); d->entries.clear(); emit pageCountChanged(); endResetModel(); }
void BookModel::addPage(QString url, QString title) { BookPage* page = new BookPage(); page->url = url; page->title = title; beginInsertRows(QModelIndex(), d->entries.count(), d->entries.count()); d->entries.append(page); emit pageCountChanged(); endInsertRows(); }
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(); }
void DocumentItem::setPath(const QString &path) { //TODO: remote urls m_document->openDocument(path, KUrl(path), KMimeType::findByUrl(KUrl(path))); m_tocModel->fill(m_document->documentSynopsis()); m_tocModel->setCurrentViewport(m_document->viewport()); m_matchingPages.clear(); for (uint i = 0; i < m_document->pages(); ++i) { m_matchingPages << (int)i; } emit matchingPagesChanged(); emit pathChanged(); emit pageCountChanged(); emit openedChanged(); emit supportsSearchingChanged(); emit windowTitleForDocumentChanged(); }
void PDFDocument::jobFinished(PDFJob* job) { switch(job->type()) { case PDFJob::UnLockDocumentJob: { emit documentLocked(); emit pageCountChanged(); break; } case PDFJob::RenderPageJob: { RenderPageJob* j = static_cast<RenderPageJob*>(job); emit pageFinished(j->m_index, j->m_page); break; } case PDFJob::PageSizesJob: { PageSizesJob* j = static_cast<PageSizesJob*>(job); emit pageSizesFinished(j->m_pageSizes); break; } default: break; } job->deleteLater(); }
void Document::clearPages() { qDeleteAll(m_pages); m_pages.clear(); emit pageCountChanged(); }