if( NOT CMAKE_VERSION VERSION_LESS 3.1)
cmake_policy(SET CMP0054 NEW) # dont expand quoted strings in if()s
endif()
+if( NOT CMAKE_VERSION VERSION_LESS 3.10)
+ cmake_policy(SET CMP0071 NEW) # Also process generated source files with MOC
+endif()
+if( NOT CMAKE_VERSION VERSION_LESS 3.17)
+ cmake_policy(SET CMP0100 NEW) # Allow .hh extension
+endif()
project(dspdfviewer)
void DSPDFViewer::resetSlideClock()
{
/* Always resets the slide clock. */
- slideStart.start();
+ slideStart = QTime::currentTime();
if ( ! presentationClockRunning ) {
/* If this starts a presentation, also reset the presentation clock. */
- presentationStart.start();
+ presentationStart = QTime::currentTime();
}
- /* and make sure they'll get refreshed a second later aswell. */
- slideStart.start();
presentationClockRunning=true;
QTime DSPDFViewer::timeSince(const QTime& startPoint) const
{
QTime result(0,0);
- result = result.addMSecs(startPoint.elapsed());
+ result = result.addMSecs(
+ startPoint.msecsTo( QTime::currentTime() ) );
return result;
}
#include <cmath>
#include <boost/math/special_functions/round.hpp>
#include "debug.h"
+#include <QtGlobal>
using boost::math::iround;
if ( link.linkType() != Poppler::Link::Goto )
throw WrongLinkType();
QRect mySize;
- const QPixmap* pixmap = imageLabel->pixmap();
- if ( pixmap == 0 )
+#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
+ // QT Version is below 5.15, which added the Return-By-Value overload.
+ // Handle the copy ourselves.
+ // FIXME: Delete this code at some point
+ const QPixmap *ppixmap = imageLabel->pixmap();
+ if ( ppixmap == nullptr)
+ throw std::runtime_error("imageLabel with nullptr pixmap()");
+ const QPixmap pixmap = QPixmap{ *ppixmap }; //copy
+#else
+ // Qt version is at least 5.15, use Qt's own copy function.
+ const QPixmap pixmap = imageLabel->pixmap(Qt::ReturnByValue);
+#endif
+ if ( pixmap.isNull() )
throw /** FIXME Exception **/ std::runtime_error("Tried to construct a HyperlinkArea from an image label without a pixmap");
QRectF sizeWithinImageLabel = link.linkArea();
- mySize.setTop( iround(sizeWithinImageLabel.top() * pixmap->height()) );
- mySize.setLeft( iround(sizeWithinImageLabel.left() * pixmap->width()) );
+ mySize.setTop( iround(sizeWithinImageLabel.top() * pixmap.height()) );
+ mySize.setLeft( iround(sizeWithinImageLabel.left() * pixmap.width()) );
- mySize.setHeight(std::abs( iround(sizeWithinImageLabel.height() * pixmap->height())) );
- mySize.setWidth( iround(sizeWithinImageLabel.width() * pixmap->width()) );
+ mySize.setHeight(std::abs( iround(sizeWithinImageLabel.height() * pixmap.height())) );
+ mySize.setWidth( iround(sizeWithinImageLabel.width() * pixmap.width()) );
setParent(imageLabel);
setGeometry(mySize);
#include <QHBoxLayout>
#include <QLabel>
#include <QMouseEvent>
-#if defined(POPPLER_QT5) && defined(_WIN32)
#include <QWindow>
-#endif
+#include <QScreen>
#include "debug.h"
#include <QInputDialog>
#include <QMessageBox>
return;
this->setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint);
this->showNormal();
-#if defined(POPPLER_QT5) && defined(_WIN32)
- static QList<QScreen *> screens = QApplication::screens();
+
+ /* This works on Windows */
+#ifdef _WIN32
+ QList<QScreen *> screens = QApplication::screens();
if ( m_monitor < numeric_cast<unsigned>(screens.count()) )
this->windowHandle()->setScreen(screens[m_monitor]);
else
this->windowHandle()->setScreen(0);
this->showFullScreen();
#else
- QRect rect = QApplication::desktop()->screenGeometry( numeric_cast<int>(getMonitor()) );
- move(rect.topLeft());
+ QRect rect = QGuiApplication::screens().at(m_monitor)->geometry();
+ move( rect.topLeft() );
resize( rect.size() );
this->showFullScreen();
#endif
{
// QWidget::wheelEvent(e);
- if ( e->delta() > 0 )
+ if ( e->angleDelta().y() > 0 )
{
DEBUGOUT << "Back";
emit previousPageRequested();
! i3shellcode_executed
// Make sure to do this only once
) {
- QApplication::flush(); // Make sure the window has been painted
+ /* FIXME this is deprecated */
+ // QCoreApplication::flush(); // Make sure the window has been painted
+
// This is the second screen. It has now been created.
// so we should call the i3 shellcode now
const std::string shellcode = runtimeConfiguration.i3workaround_shellcode();
#include "testhelpers.hh"
#include <QDesktopWidget>
+#include <QScreen>
#include <QRect>
using namespace std;
SwapScreensAndCheckAlign::SwapScreensAndCheckAlign(DSPDFViewer& d):
dspdfviewer(d),
- screenPrimary( QApplication::desktop()->screenGeometry( 0 ) ),
- screenSecondary( QApplication::desktop()->screenGeometry( 1 ) ),
+ screenPrimary( QApplication::screens().at(0)->geometry() ),
+ screenSecondary( QApplication::screens().at(1)->geometry() ),
verify(true)
{
- DEBUGOUT << "Number of screens:" << QApplication::desktop()->numScreens() ;
+ DEBUGOUT << "Number of screens:" << QApplication::screens().size();
DEBUGOUT << "screen 0 [pri]:" << screenPrimary;
DEBUGOUT << "screen 1 [sec]:" << screenSecondary;
- if ( QApplication::desktop()->numScreens() != 2 ) {
+ if ( QApplication::screens().size() != 2 ) {
WARNINGOUT << "Not running in a dual-screen environment";
verify = false;
} else if ( screenPrimary == screenSecondary ) {