MCPcopy Create free account
hub / github.com/KDE/okular / notifySetup

Method notifySetup

part/presentationwidget.cpp:321–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321void PresentationWidget::notifySetup(const QList<Okular::Page *> &pageSet, int setupFlags)
322{
323 // same document, nothing to change - here we assume the document sets up
324 // us with the whole document set as first notifySetup()
325 if (!(setupFlags & Okular::DocumentObserver::DocumentChanged)) {
326 return;
327 }
328
329 // delete previous frames (if any (shouldn't be))
330 qDeleteAll(m_frames);
331 if (!m_frames.isEmpty()) {
332 qCWarning(OkularUiDebug) << "Frames setup changed while a Presentation is in progress.";
333 }
334 m_frames.clear();
335
336 // create the new frames
337 float screenRatio = (float)m_height / (float)m_width;
338 for (const Okular::Page *page : pageSet) {
339 PresentationFrame *frame = new PresentationFrame(page);
340 const QList<Okular::Annotation *> annotations = page->annotations();
341 for (Okular::Annotation *a : annotations) {
342 if (a->subType() == Okular::Annotation::AMovie) {
343 Okular::MovieAnnotation *movieAnn = static_cast<Okular::MovieAnnotation *>(a);
344 VideoWidget *vw = new VideoWidget(movieAnn, movieAnn->movie(), m_document, this);
345 frame->videoWidgets.insert(movieAnn->movie(), vw);
346 vw->pageInitialized();
347 } else if (a->subType() == Okular::Annotation::ARichMedia) {
348 Okular::RichMediaAnnotation *richMediaAnn = static_cast<Okular::RichMediaAnnotation *>(a);
349 if (richMediaAnn->movie()) {
350 VideoWidget *vw = new VideoWidget(richMediaAnn, richMediaAnn->movie(), m_document, this);
351 frame->videoWidgets.insert(richMediaAnn->movie(), vw);
352 vw->pageInitialized();
353 }
354 } else if (a->subType() == Okular::Annotation::AScreen) {
355 const Okular::ScreenAnnotation *screenAnn = static_cast<Okular::ScreenAnnotation *>(a);
356 Okular::Movie *movie = GuiUtils::renditionMovieFromScreenAnnotation(screenAnn);
357 if (movie) {
358 VideoWidget *vw = new VideoWidget(screenAnn, movie, m_document, this);
359 frame->videoWidgets.insert(movie, vw);
360 vw->pageInitialized();
361 }
362 }
363 }
364 frame->recalcGeometry(m_width, m_height, screenRatio);
365 // add the frame to the vector
366 m_frames.push_back(frame);
367 }
368
369 // get metadata from the document
370 m_metaStrings.clear();
371 const Okular::DocumentInfo info = m_document->documentInfo(QSet<Okular::DocumentInfo::Key>() << Okular::DocumentInfo::Title << Okular::DocumentInfo::Author);
372 if (!info.get(Okular::DocumentInfo::Title).isNull()) {
373 m_metaStrings += i18n("Title: %1", info.get(Okular::DocumentInfo::Title));
374 }
375 if (!info.get(Okular::DocumentInfo::Author).isNull()) {
376 m_metaStrings += i18n("Author: %1", info.get(Okular::DocumentInfo::Author));
377 }
378 m_metaStrings += i18n("Pages: %1", m_document->pages());

Callers

nothing calls this directly

Calls 12

isEmptyMethod · 0.80
annotationsMethod · 0.80
subTypeMethod · 0.80
pageInitializedMethod · 0.80
recalcGeometryMethod · 0.80
documentInfoMethod · 0.80
clearMethod · 0.45
movieMethod · 0.45
isNullMethod · 0.45
getMethod · 0.45
pagesMethod · 0.45

Tested by

no test coverage detected