| 90 | PresentationFrame &operator=(const PresentationFrame &) = delete; |
| 91 | |
| 92 | void recalcGeometry(int width, int height, float screenRatio) |
| 93 | { |
| 94 | // calculate frame geometry keeping constant aspect ratio |
| 95 | float pageRatio = page->ratio(); |
| 96 | int pageWidth = width, pageHeight = height; |
| 97 | if (pageRatio > screenRatio) { |
| 98 | pageWidth = (int)((float)pageHeight / pageRatio); |
| 99 | } else { |
| 100 | pageHeight = (int)((float)pageWidth * pageRatio); |
| 101 | } |
| 102 | geometry.setRect((width - pageWidth) / 2, (height - pageHeight) / 2, pageWidth, pageHeight); |
| 103 | |
| 104 | for (VideoWidget *vw : std::as_const(videoWidgets)) { |
| 105 | const Okular::NormalizedRect r = vw->normGeometry(); |
| 106 | QRect vwgeom = r.geometry(geometry.width(), geometry.height()); |
| 107 | vw->resize(vwgeom.size()); |
| 108 | vw->move(geometry.topLeft() + vwgeom.topLeft()); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | const Okular::Page *page; |
| 113 | QRect geometry; |