diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 10064ff18..4026bf105 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,7 +48,7 @@ build_clazy_clang_tidy: script: - srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json - - CLAZY_IGNORE_DIRS="settings_core.cpp|settings.cpp" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-copyable-polymorphic,no-qstring-allocations,no-missing-qobject-macro" ninja + - CLAZY_IGNORE_DIRS="settings_core.cpp|settings.cpp" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-qstring-allocations,no-missing-qobject-macro" ninja # Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later - sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h - "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\"" diff --git a/core/action.cpp b/core/action.cpp index 66e78330f..acf6ae051 100644 --- a/core/action.cpp +++ b/core/action.cpp @@ -32,6 +32,9 @@ class Okular::ActionPrivate qDeleteAll( m_nextActions ); } + ActionPrivate(const ActionPrivate &) = delete; + ActionPrivate &operator=(const ActionPrivate &) = delete; + QVariant m_nativeId; QVector< Action * > m_nextActions; }; diff --git a/core/annotations.cpp b/core/annotations.cpp index f1d3b315d..ac8a2f381 100644 --- a/core/annotations.cpp +++ b/core/annotations.cpp @@ -168,6 +168,10 @@ QRect AnnotationUtils::annotationGeometry( const Annotation * annotation, } //END AnnotationUtils implementation +AnnotationProxy::AnnotationProxy() +{ +} + AnnotationProxy::~AnnotationProxy() { } diff --git a/core/annotations.h b/core/annotations.h index bb7de968f..0e1f3ced3 100644 --- a/core/annotations.h +++ b/core/annotations.h @@ -716,11 +716,16 @@ class OKULARCORE_EXPORT AnnotationProxy Removal ///< Generator can remove native annotations }; + AnnotationProxy(); + /** * Destroys the annotation proxy. */ virtual ~AnnotationProxy(); + AnnotationProxy(const AnnotationProxy &) = delete; + AnnotationProxy &operator=(const AnnotationProxy &) = delete; + /** * Query for the supported capabilities. */ diff --git a/core/annotations_p.h b/core/annotations_p.h index ab4113c34..50c26a161 100644 --- a/core/annotations_p.h +++ b/core/annotations_p.h @@ -32,6 +32,9 @@ class AnnotationPrivate virtual ~AnnotationPrivate(); + AnnotationPrivate(const AnnotationPrivate &) = delete; + AnnotationPrivate &operator=(const AnnotationPrivate &) = delete; + /** * Transforms the annotation coordinates with the transformation * defined by @p matrix. diff --git a/core/area.h b/core/area.h index 0746acdff..94971fd7e 100644 --- a/core/area.h +++ b/core/area.h @@ -493,6 +493,9 @@ class OKULARCORE_EXPORT ObjectRect */ virtual ~ObjectRect(); + ObjectRect(const ObjectRect &o) = delete; + ObjectRect &operator=(const ObjectRect &o) = delete; + /** * Returns the object type of the object rectangle. * @see ObjectType diff --git a/core/bookmarkmanager.cpp b/core/bookmarkmanager.cpp index 00594a819..b40ac8f8b 100644 --- a/core/bookmarkmanager.cpp +++ b/core/bookmarkmanager.cpp @@ -106,6 +106,9 @@ class BookmarkManager::Private : public KBookmarkOwner // delete manager; } + Private(const Private &) = delete; + Private &operator=(const Private &) = delete; + QUrl currentUrl() const override; QString currentTitle() const override; bool enableOption(BookmarkOption option) const override; diff --git a/core/document.h b/core/document.h index 8c3f494e0..73c9c8686 100644 --- a/core/document.h +++ b/core/document.h @@ -1410,6 +1410,9 @@ class OKULARCORE_EXPORT EmbeddedFile */ virtual ~EmbeddedFile(); + EmbeddedFile(const EmbeddedFile &) = delete; + EmbeddedFile &operator=(const EmbeddedFile &) = delete; + /** * Returns the name of the file */ diff --git a/core/form_p.h b/core/form_p.h index cbba06272..6c937ff57 100644 --- a/core/form_p.h +++ b/core/form_p.h @@ -25,6 +25,9 @@ class FormFieldPrivate explicit FormFieldPrivate( FormField::FieldType type ); virtual ~FormFieldPrivate(); + FormFieldPrivate(const FormFieldPrivate &) = delete; + FormFieldPrivate &operator=(const FormFieldPrivate &) = delete; + void setDefault(); virtual void setValue( const QString& ) = 0; diff --git a/core/observer.h b/core/observer.h index 9474b5192..5a2520611 100644 --- a/core/observer.h +++ b/core/observer.h @@ -37,6 +37,9 @@ class OKULARCORE_EXPORT DocumentObserver */ virtual ~DocumentObserver(); + DocumentObserver(const DocumentObserver &) = delete; + DocumentObserver &operator=(const DocumentObserver &) = delete; + /** * Flags that can be sent from the document to all observers to * inform them about the type of object that has been changed. diff --git a/core/rotationjob_p.h b/core/rotationjob_p.h index d33ab0cef..5376a10eb 100644 --- a/core/rotationjob_p.h +++ b/core/rotationjob_p.h @@ -33,6 +33,9 @@ class RotationJobInternal : public ThreadWeaver::Job Rotation rotation() const; NormalizedRect rect() const; + RotationJobInternal(const RotationJobInternal &) = delete; + RotationJobInternal &operator=(const RotationJobInternal &) = delete; + protected: void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) override; diff --git a/core/view_p.h b/core/view_p.h index 53602803b..7d5c7fe7f 100644 --- a/core/view_p.h +++ b/core/view_p.h @@ -24,6 +24,9 @@ class ViewPrivate ViewPrivate(); virtual ~ViewPrivate(); + ViewPrivate(const ViewPrivate &) = delete; + ViewPrivate &operator=(const ViewPrivate &) = delete; + QString name; DocumentPrivate *document; }; diff --git a/generators/chm/kio-msits/msits.h b/generators/chm/kio-msits/msits.h index 9e02cf878..83288f034 100644 --- a/generators/chm/kio-msits/msits.h +++ b/generators/chm/kio-msits/msits.h @@ -37,6 +37,9 @@ public: ProtocolMSITS ( const QByteArray&, const QByteArray& ); ~ProtocolMSITS() override; + ProtocolMSITS(const ProtocolMSITS &) = delete; + ProtocolMSITS &operator=(const ProtocolMSITS &) = delete; + void get (const QUrl & ) override; void listDir (const QUrl & url) override; void stat (const QUrl & url) override; diff --git a/generators/chm/lib/ebook.h b/generators/chm/lib/ebook.h index d0b39f565..e05ae39d1 100644 --- a/generators/chm/lib/ebook.h +++ b/generators/chm/lib/ebook.h @@ -84,6 +84,9 @@ class EBook EBook(); virtual ~EBook(); + EBook(const EBook &) = delete; + EBook &operator=(const EBook &) = delete; + /*! * \brief Attempts to load chm or epub file. * \param archiveName filename. diff --git a/generators/comicbook/unrarflavours.h b/generators/comicbook/unrarflavours.h index cf5e07fe1..4789c952a 100644 --- a/generators/comicbook/unrarflavours.h +++ b/generators/comicbook/unrarflavours.h @@ -29,6 +29,9 @@ class UnrarFlavour public: virtual ~UnrarFlavour(); + UnrarFlavour(const UnrarFlavour &) = delete; + UnrarFlavour &operator=(const UnrarFlavour &) = delete; + virtual QStringList processListing( const QStringList &data ) = 0; virtual QString name() const = 0; diff --git a/generators/djvu/kdjvu.h b/generators/djvu/kdjvu.h index d8366b7bc..e50316f1b 100644 --- a/generators/djvu/kdjvu.h +++ b/generators/djvu/kdjvu.h @@ -70,8 +70,12 @@ class KDjVu friend class KDjVu; public: + Link() = default; virtual ~Link(); + Link(const Link &) = delete; + Link &operator=(const Link &) = delete; + enum LinkType { PageLink, UrlLink }; enum LinkArea { UnknownArea, RectArea, EllipseArea, PolygonArea }; virtual int type() const = 0; @@ -130,6 +134,9 @@ class KDjVu public: virtual ~Annotation(); + Annotation(const Annotation &) = delete; + Annotation &operator=(const Annotation &) = delete; + enum AnnotationType { TextAnnotation, LineAnnotation }; virtual int type() const = 0; QPoint point() const; diff --git a/generators/dvi/TeXFont.h b/generators/dvi/TeXFont.h index d9478e280..63c3fbcb8 100644 --- a/generators/dvi/TeXFont.h +++ b/generators/dvi/TeXFont.h @@ -23,6 +23,9 @@ class TeXFont { virtual ~TeXFont(); + TeXFont(const TeXFont &) = delete; + TeXFont &operator=(const TeXFont &) = delete; + void setDisplayResolution() { for(glyph &g : glyphtable) diff --git a/generators/dvi/dviPageInfo.cpp b/generators/dvi/dviPageInfo.cpp index 3864c5c35..04c9dd94b 100644 --- a/generators/dvi/dviPageInfo.cpp +++ b/generators/dvi/dviPageInfo.cpp @@ -9,14 +9,6 @@ #include "dviPageInfo.h" -dviPageInfo::dviPageInfo( const dviPageInfo &dvipi ) -{ - width = dvipi.width; - height = dvipi.height; - resolution = dvipi.resolution; - pageNumber = dvipi.pageNumber; -} - dviPageInfo::dviPageInfo() { sourceHyperLinkList.reserve(200); diff --git a/generators/dvi/dviPageInfo.h b/generators/dvi/dviPageInfo.h index 8a7e781a1..58d9c445e 100644 --- a/generators/dvi/dviPageInfo.h +++ b/generators/dvi/dviPageInfo.h @@ -26,10 +26,12 @@ public: PageNumber pageNumber; dviPageInfo(); - dviPageInfo( const dviPageInfo &dvipi ); - + virtual ~dviPageInfo(); + dviPageInfo(const dviPageInfo &) = delete; + dviPageInfo &operator=(const dviPageInfo &) = delete; + virtual void clear(); /** \brief List of source hyperlinks diff --git a/generators/dvi/generator_dvi.cpp b/generators/dvi/generator_dvi.cpp index e85e64a21..9de36749d 100644 --- a/generators/dvi/generator_dvi.cpp +++ b/generators/dvi/generator_dvi.cpp @@ -212,17 +212,12 @@ QImage DviGenerator::image( Okular::PixmapRequest *request ) if (s.isValid()) { - ps = s; /* it should be the user specified size, if any, instead */ + pageInfo->resolution = (double)(pageInfo->width)/s.width().getLength_in_inch(); + } + else + { + pageInfo->resolution = (double)(pageInfo->width)/ps.width().getLength_in_inch(); } - - pageInfo->resolution = (double)(pageInfo->width)/ps.width().getLength_in_inch(); - -#if 0 - qCDebug(OkularDviDebug) << *request - << ", res:" << pageInfo->resolution << " - (" << pageInfo->width << "," - << ps.width().getLength_in_inch() << ")," << ps.width().getLength_in_mm() - << endl; -#endif m_dviRenderer->drawPage( pageInfo ); diff --git a/generators/dvi/pageSize.cpp b/generators/dvi/pageSize.cpp index 265f7ecd9..c282f7afd 100644 --- a/generators/dvi/pageSize.cpp +++ b/generators/dvi/pageSize.cpp @@ -171,21 +171,6 @@ void pageSize::setPageSize(const QString& width, const QString& _widthUnits, con emit sizeChanged(*this); } - -pageSize &pageSize::operator= (const pageSize &src) -{ - SimplePageSize oldPage = *this; - - currentSize = src.currentSize; - pageWidth = src.pageWidth; - pageHeight = src.pageHeight; - - if ( !isNearlyEqual(oldPage)) - emit sizeChanged(*this); - return *this; -} - - void pageSize::rectifySizes() { // Now do some sanity checks to make sure that values are not diff --git a/generators/dvi/pageSize.h b/generators/dvi/pageSize.h index aab62d649..ed33bad1c 100644 --- a/generators/dvi/pageSize.h +++ b/generators/dvi/pageSize.h @@ -53,6 +53,9 @@ public: /** \brief Initializes the pageSize with a SimplePageSize. */ pageSize(const SimplePageSize&); + pageSize(const pageSize &) = delete; + pageSize &operator=(const pageSize &) = delete; + /** \brief List of standard pageSizes This method returns the names of standard pageSizes, @@ -139,16 +142,9 @@ public: @param height_in_mm page height in mm */ - virtual void setPageSize(double width_in_mm, double height_in_mm); + void setPageSize(double width_in_mm, double height_in_mm); using SimplePageSize::setPageSize; - /** \brief Copy operator. - - This operator will emit the signal sizeChanged() if one of the - dimensions of *this and src differ by more than two millimeters. - */ - pageSize & operator= (const pageSize &src); - /** \brief Preferred unit for the current page size @returns The name of the unit, one of "cm", "mm" or "in", which is diff --git a/generators/dvi/simplePageSize.h b/generators/dvi/simplePageSize.h index 6e14eb176..32161c672 100644 --- a/generators/dvi/simplePageSize.h +++ b/generators/dvi/simplePageSize.h @@ -47,7 +47,7 @@ class SimplePageSize */ SimplePageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; } - virtual ~SimplePageSize() {} + ~SimplePageSize() {} /** \brief Sets the page width and height @@ -57,7 +57,7 @@ class SimplePageSize @param width @param height */ - virtual void setPageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; } + void setPageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; } /** \brief Returns the page width. */ Length width() const { return pageWidth; } diff --git a/interfaces/configinterface.h b/interfaces/configinterface.h index bb6181cf7..1dc88161e 100644 --- a/interfaces/configinterface.h +++ b/interfaces/configinterface.h @@ -38,11 +38,16 @@ namespace Okular { class OKULARCORE_EXPORT ConfigInterface { public: + ConfigInterface() {} + /** * Destroys the config interface. */ virtual ~ConfigInterface() {} + ConfigInterface(const ConfigInterface &) = delete; + ConfigInterface &operator=(const ConfigInterface &) = delete; + /** * This method is called to tell the generator to re-parse its configuration. * diff --git a/interfaces/guiinterface.h b/interfaces/guiinterface.h index c56daa4f9..937462d19 100644 --- a/interfaces/guiinterface.h +++ b/interfaces/guiinterface.h @@ -39,11 +39,16 @@ namespace Okular { class OKULARCORE_EXPORT GuiInterface : protected KXMLGUIClient { public: + GuiInterface() {} + /** * Destroys the gui interface. */ ~GuiInterface() override {} + GuiInterface(const GuiInterface &) = delete; + GuiInterface &operator=(const GuiInterface &) = delete; + /** * This method requests the XML GUI Client provided by the interface. */ diff --git a/interfaces/printinterface.h b/interfaces/printinterface.h index 334deda6e..dbc86ba0b 100644 --- a/interfaces/printinterface.h +++ b/interfaces/printinterface.h @@ -39,11 +39,16 @@ namespace Okular { class OKULARCORE_EXPORT PrintInterface { public: + PrintInterface() {} + /** * Destroys the printer interface. */ virtual ~PrintInterface() {} + PrintInterface(const PrintInterface &) = delete; + PrintInterface &operator=(const PrintInterface &) = delete; + /** * Builds and returns a new printing configuration widget. * diff --git a/interfaces/saveinterface.h b/interfaces/saveinterface.h index f052209e9..534b5328e 100644 --- a/interfaces/saveinterface.h +++ b/interfaces/saveinterface.h @@ -49,11 +49,16 @@ class OKULARCORE_EXPORT SaveInterface }; Q_DECLARE_FLAGS( SaveOptions, SaveOption ) + SaveInterface() {} + /** * Destroys the save interface. */ virtual ~SaveInterface() {} + SaveInterface(const SaveInterface &) = delete; + SaveInterface &operator=(const SaveInterface &) = delete; + /** * Query for the supported saving options. * diff --git a/interfaces/viewerinterface.h b/interfaces/viewerinterface.h index 929bc1c19..4bb8028fc 100644 --- a/interfaces/viewerinterface.h +++ b/interfaces/viewerinterface.h @@ -31,8 +31,12 @@ namespace Okular { class VIEWERINTERFACE_EXPORT ViewerInterface { public: + ViewerInterface() {} virtual ~ViewerInterface() {} + ViewerInterface(const ViewerInterface &) = delete; + ViewerInterface &operator=(const ViewerInterface &) = delete; + /** * Show the specified source location centrally in the viewer. * diff --git a/kdocumentviewer.h b/kdocumentviewer.h index 02d30ff61..8d771bf59 100644 --- a/kdocumentviewer.h +++ b/kdocumentviewer.h @@ -24,8 +24,12 @@ class QUrl; class OKULARPART_EXPORT KDocumentViewer { public: + KDocumentViewer() {} virtual ~KDocumentViewer() {} + KDocumentViewer(const KDocumentViewer &) = delete; + KDocumentViewer &operator=(const KDocumentViewer &) = delete; + /** * Open the document at the specified @p url at page @p page. */ diff --git a/ui/annotationtools.h b/ui/annotationtools.h index bd048029f..c41bcf9f9 100644 --- a/ui/annotationtools.h +++ b/ui/annotationtools.h @@ -35,6 +35,9 @@ class AnnotatorEngine explicit AnnotatorEngine( const QDomElement & engineElement ); virtual ~AnnotatorEngine(); + AnnotatorEngine(const AnnotatorEngine &) = delete; + AnnotatorEngine &operator=(const AnnotatorEngine &) = delete; + // enum definitions enum EventType { Press, Move, Release }; enum Button { None, Left, Right }; diff --git a/ui/bookmarklist.cpp b/ui/bookmarklist.cpp index 002fa7daf..ac6af93a9 100644 --- a/ui/bookmarklist.cpp +++ b/ui/bookmarklist.cpp @@ -47,6 +47,9 @@ class BookmarkItem : public QTreeWidgetItem setData( 0, PageItemDelegate::PageRole, QString::number( m_viewport.pageNumber + 1 ) ); } + BookmarkItem(const BookmarkItem &) = delete; + BookmarkItem &operator=(const BookmarkItem &) = delete; + QVariant data( int column, int role ) const override { switch ( role ) @@ -101,6 +104,9 @@ class FileItem : public QTreeWidgetItem setData( 0, UrlRole, QVariant::fromValue( url ) ); } + FileItem(const FileItem &) = delete; + FileItem &operator=(const FileItem &) = delete; + QVariant data( int column, int role ) const override { switch ( role ) diff --git a/ui/formwidgets.h b/ui/formwidgets.h index a438f4aab..ece7970f7 100644 --- a/ui/formwidgets.h +++ b/ui/formwidgets.h @@ -161,6 +161,9 @@ class FormWidgetIface FormWidgetIface( QWidget * w, Okular::FormField * ff ); virtual ~FormWidgetIface(); + FormWidgetIface(const FormWidgetIface &) = delete; + FormWidgetIface &operator=(const FormWidgetIface &) = delete; + Okular::NormalizedRect rect() const; void setWidthHeight( int w, int h ); void moveTo( int x, int y ); diff --git a/ui/sidebar.cpp b/ui/sidebar.cpp index d8748599d..82d1f2582 100644 --- a/ui/sidebar.cpp +++ b/ui/sidebar.cpp @@ -50,6 +50,9 @@ class SidebarItem : public QListWidgetItem setToolTip( text ); } + SidebarItem(const SidebarItem &) = delete; + SidebarItem &operator=(const SidebarItem &) = delete; + QWidget* widget() const { return m_widget;