Enable most of clazy level2

This commit is contained in:
Albert Astals Cid 2020-02-20 18:45:46 +01:00
parent 968e9d6073
commit 93540ac16d
65 changed files with 207 additions and 192 deletions

View file

@ -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_CHECKS="level0,level1,old-style-connect" ninja
- 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
# 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: '*'}\""

View file

@ -127,7 +127,7 @@ NormalizedRect::NormalizedRect( double l, double t, double r, double b )
// note: check for swapping coords?
: left( l ), top( t ), right( r ), bottom( b ) {}
NormalizedRect::NormalizedRect( const QRect & r, double xScale, double yScale )
NormalizedRect::NormalizedRect( const QRect & r, double xScale, double yScale ) // clazy:exclude=function-args-by-value TODO when BIC changes are allowed
: left( (double)r.left() / xScale ), top( (double)r.top() / yScale ),
right( (double)r.right() / xScale ), bottom( (double)r.bottom() / yScale ) {}

View file

@ -185,7 +185,7 @@ QString DocumentPrivate::namePaperSize(double inchesWidth, double inchesHeight)
}
}
QString DocumentPrivate::localizedSize(const QSizeF &size) const
QString DocumentPrivate::localizedSize(const QSizeF size) const
{
double inchesWidth = 0, inchesHeight = 0;
switch (m_generator->pagesSizeMetric())

View file

@ -136,7 +136,7 @@ class DocumentPrivate
bool updateMetadataXmlNameAndDocSize();
QString pagesSizeString() const;
QString namePaperSize(double inchesWidth, double inchesHeight) const;
QString localizedSize(const QSizeF &size) const;
QString localizedSize(const QSizeF size) const;
qulonglong calculateMemoryToFree();
void cleanupPixmapMemory();
void cleanupPixmapMemory( qulonglong memoryToFree );

View file

@ -31,7 +31,7 @@
using namespace Okular;
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) TODO when BIC changes are allowed
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) clazy:exclude=function-args-by-ref TODO when BIC changes are allowed
QPrinter::Orientation documentOrientation, FileDeletePolicy fileDeletePolicy,
PageSelectPolicy pageSelectPolicy, const QString &pageRange )
{
@ -39,7 +39,7 @@ int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(perf
pageSelectPolicy, pageRange, ScaleMode::FitToPrintArea );
}
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) TODO when BIC changes are allowed
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) clazy:exclude=function-args-by-ref TODO when BIC changes are allowed
QPrinter::Orientation documentOrientation,
FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy,
const QString &pageRange, ScaleMode scaleMode )
@ -49,7 +49,7 @@ int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(perf
documentOrientation, scaleMode );
}
int FilePrinter::doPrintFiles(QPrinter &printer, const QStringList fileList, FileDeletePolicy fileDeletePolicy, // NOLINT(performance-unnecessary-value-param) TODO when BIC changes are allowed
int FilePrinter::doPrintFiles(QPrinter &printer, const QStringList fileList, FileDeletePolicy fileDeletePolicy, // NOLINT(performance-unnecessary-value-param) clazy:exclude=function-args-by-ref TODO when BIC changes are allowed
PageSelectPolicy pageSelectPolicy, const QString &pageRange,
QPrinter::Orientation documentOrientation )
{

View file

@ -518,7 +518,7 @@ void Generator::requestFontData(const Okular::FontInfo & /*font*/, QByteArray *
}
void Generator::setDPI(const QSizeF & dpi)
void Generator::setDPI(const QSizeF & dpi) // clazy:exclude=function-args-by-value TODO remove the & when we do a BIC change elsewhere
{
Q_D( Generator );
d->m_dpi = dpi;

View file

@ -455,7 +455,7 @@ class OKULARCORE_EXPORT Generator : public QObject
*
* @since 0.19 (KDE 4.13)
*/
void setDPI(const QSizeF &dpi);
void setDPI(const QSizeF &dpi); // TODO remove the & when we do a BIC change elsewhere
/**
* Returns the 'layers model' object of the document or NULL if

View file

@ -86,7 +86,7 @@ QString Movie::url() const
return d->m_url;
}
void Movie::setSize( const QSize &aspect )
void Movie::setSize( const QSize &aspect ) // clazy:exclude=function-args-by-value TODO remove the & when we do a BIC change elsewhere
{
d->m_aspect = aspect;
}

View file

@ -62,7 +62,7 @@ class OKULARCORE_EXPORT Movie
/**
* Sets the size for the movie.
*/
void setSize( const QSize &aspect );
void setSize( const QSize &aspect ); // TODO remove the & when we do a BIC change elsewhere
/**
* Returns the size of the movie.

View file

@ -70,7 +70,7 @@ KJSObject JSOCG::object( KJSContext *ctx )
return g_OCGProto->constructObject( ctx, nullptr );
}
KJSObject JSOCG::wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int &i, const int &j )
KJSObject JSOCG::wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int i, const int j )
{
QPair< int, int > *pair = new QPair< int ,int >( i, j );
g_OCGCache->insert( pair, model );

View file

@ -21,7 +21,7 @@ class JSOCG
public:
static void initType( KJSContext *ctx );
static KJSObject object( KJSContext *ctx );
static KJSObject wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int &i, const int &j );
static KJSObject wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int i, const int j );
static void clearCachedFields();
};

View file

@ -94,7 +94,7 @@ static bool segmentsOverlap(double left1, double right1, double left2, double ri
return false;
}
static bool doesConsumeY(const QRect& first, const QRect& second, int threshold)
static bool doesConsumeY(const QRect first, const QRect second, int threshold)
{
return segmentsOverlap(first.top(), first.bottom(), second.top(), second.bottom(), threshold);
}
@ -290,7 +290,7 @@ public:
{
};
RegionText(const WordsWithCharacters &wordsWithCharacters, const QRect &area)
RegionText(const WordsWithCharacters &wordsWithCharacters, const QRect area)
: m_region_wordWithCharacters(wordsWithCharacters), m_area(area)
{
}
@ -314,7 +314,7 @@ public:
return m_area;
}
inline void setArea(const QRect &area)
inline void setArea(const QRect area)
{
m_area = area;
}

View file

@ -26,7 +26,7 @@
using namespace Okular;
QRect Utils::rotateRect( const QRect & source, int width, int height, int orientation )
QRect Utils::rotateRect( const QRect & source, int width, int height, int orientation ) // clazy:exclude=function-args-by-value TODO remove the & when we do a BIC change elsewhere
{
QRect ret;

View file

@ -32,7 +32,7 @@ class OKULARCORE_EXPORT Utils
* Rotate the rect \p source in the area \p width x \p height with the
* specified \p orientation .
*/
static QRect rotateRect( const QRect & source, int width, int height, int orientation );
static QRect rotateRect( const QRect & source, int width, int height, int orientation ); // TODO remove the & when we do a BIC change elsewhere
/**
* Return the real DPI of the display containing given widget

View file

@ -54,7 +54,7 @@ QDataStream &operator>>( QDataStream &s, Document &l )
return s;
}
QDataStream &operator<<( QDataStream &s, const Document &l )
QDataStream &operator<<( QDataStream &s, const Document l )
{
s << (short)l.docNumber;
s << (short)l.frequency;

View file

@ -38,22 +38,22 @@ struct Document
{
Document( int d, int f ) : docNumber( d ), frequency( f ) {}
Document() : docNumber( -1 ), frequency( 0 ) {}
bool operator==( const Document &doc ) const
bool operator==( const Document doc ) const
{
return docNumber == doc.docNumber;
}
bool operator<( const Document &doc ) const
bool operator<( const Document doc ) const
{
return frequency > doc.frequency;
}
bool operator<=( const Document &doc ) const
bool operator<=( const Document doc ) const
{
return frequency >= doc.frequency;
}
bool operator>( const Document &doc ) const
bool operator>( const Document doc ) const
{
return frequency < doc.frequency;
}
@ -63,7 +63,7 @@ struct Document
};
QDataStream &operator>>( QDataStream &s, Document &l );
QDataStream &operator<<( QDataStream &s, const Document &l );
QDataStream &operator<<( QDataStream &s, const Document l );
class Index : public QObject
{
@ -124,4 +124,6 @@ class Index : public QObject
};
Q_DECLARE_TYPEINFO(QtAs::Document, Q_MOVABLE_TYPE);
#endif // EBOOK_SEARCH_INDEX_H

View file

@ -26,7 +26,7 @@
#include <stdio.h>
QDebug &operator<<( QDebug & s, const ddjvu_rect_t &r )
QDebug &operator<<( QDebug & s, const ddjvu_rect_t r )
{
s.nospace() << "[" << r.x << "," << r.y << " - " << r.w << "x" << r.h << "]";
return s.space();

View file

@ -42,7 +42,7 @@ class Anchor {
@param pg number of the page
@param _distance_from_top distance from the top of the page
*/
Anchor(const PageNumber& pg, const Length& _distance_from_top): page(pg), distance_from_top(_distance_from_top) {}
Anchor(const PageNumber pg, const Length _distance_from_top): page(pg), distance_from_top(_distance_from_top) {}
/** \brief quick validity check for anchors

View file

@ -680,7 +680,7 @@ void dviRenderer::setResolution(double resolution_in_DPI)
}
void dviRenderer::handleSRCLink(const QString &linkText, const QPoint& point, DocumentWidget *widget)
void dviRenderer::handleSRCLink(const QString &linkText, const QPoint point, DocumentWidget *widget)
{
Q_UNUSED( linkText );
Q_UNUSED( point );

View file

@ -46,7 +46,7 @@ extern const int MFResolutions[];
class DVI_SourceFileAnchor {
public:
DVI_SourceFileAnchor() {}
DVI_SourceFileAnchor(const QString& name, quint32 ln, quint32 pg, const Length& _distance_from_top)
DVI_SourceFileAnchor(const QString& name, quint32 ln, quint32 pg, const Length _distance_from_top)
: fileName(name), line(ln), page(pg),
distance_from_top(_distance_from_top) {}
@ -159,14 +159,14 @@ public Q_SLOTS:
void exportPS(const QString& fname = QString(), const QStringList& options = QStringList(), QPrinter* printer = nullptr, QPrinter::Orientation orientation = QPrinter::Portrait);
void exportPDF();
void handleSRCLink(const QString &linkText, const QPoint& point, DocumentWidget *widget);
void handleSRCLink(const QString &linkText, const QPoint point, DocumentWidget *widget);
void embedPostScript();
virtual void drawPage(RenderedDocumentPagePixmap* page);
virtual void getText(RenderedDocumentPagePixmap* page);
SimplePageSize sizeOfPage(const PageNumber& page);
SimplePageSize sizeOfPage(const PageNumber page);
const QVector<DVI_SourceFileAnchor>& sourceAnchors() { return sourceHyperLinkAnchors; }

View file

@ -14,7 +14,7 @@
#include "dviRenderer.h"
SimplePageSize dviRenderer::sizeOfPage(const PageNumber& page)
SimplePageSize dviRenderer::sizeOfPage(const PageNumber page)
{
#if !defined(QT_NO_THREAD)
// Wait for all access to this DocumentRenderer to finish

View file

@ -117,13 +117,13 @@ bool DviGenerator::doCloseDocument()
}
void DviGenerator::fillViewportFromAnchor( Okular::DocumentViewport &vp,
const Anchor &anch, const Okular::Page *page ) const
const Anchor anch, const Okular::Page *page ) const
{
fillViewportFromAnchor( vp, anch, page->width(), page->height() );
}
void DviGenerator::fillViewportFromAnchor( Okular::DocumentViewport &vp,
const Anchor &anch, int pW, int pH ) const
const Anchor anch, int pW, int pH ) const
{
vp.pageNumber = anch.page - 1;

View file

@ -60,9 +60,9 @@ class DviGenerator : public Okular::Generator
void loadPages( QVector< Okular::Page * > & pagesVector );
Okular::TextPage *extractTextFromPage( dviPageInfo *pageInfo );
void fillViewportFromAnchor( Okular::DocumentViewport &vp, const Anchor &anch,
void fillViewportFromAnchor( Okular::DocumentViewport &vp, const Anchor anch,
int pW, int pH ) const;
void fillViewportFromAnchor( Okular::DocumentViewport &vp, const Anchor &anch,
void fillViewportFromAnchor( Okular::DocumentViewport &vp, const Anchor anch,
const Okular::Page *page ) const;
QLinkedList<Okular::ObjectRect*> generateDviLinks( const dviPageInfo *pageInfo );
};

View file

@ -39,7 +39,7 @@ public:
@param re value for the box
@param lT valus for the text field
*/
Hyperlink(quint32 bl, const QRect& re, const QString& lT): baseline(bl), box(re), linkText(lT) {}
Hyperlink(quint32 bl, const QRect re, const QString& lT): baseline(bl), box(re), linkText(lT) {}
/** \brief Base line of a hyperlink

View file

@ -118,15 +118,15 @@ class Length
int getLength_in_pixel(double res) const { return int(getLength_in_inch() * res); }
/** @returns true is lengths differ by no more than 2mm */
bool isNearlyEqual(const Length &o) const {return fabs(length_in_mm-o.getLength_in_mm()) <= 2.0;}
bool isNearlyEqual(const Length o) const {return fabs(length_in_mm-o.getLength_in_mm()) <= 2.0;}
/** Comparison of two lengthes */
bool operator > (const Length &o) const {return (length_in_mm > o.getLength_in_mm());}
bool operator < (const Length &o) const {return (length_in_mm < o.getLength_in_mm());}
bool operator > (const Length o) const {return (length_in_mm > o.getLength_in_mm());}
bool operator < (const Length o) const {return (length_in_mm < o.getLength_in_mm());}
/** Comparison of two lengthes */
bool operator >= (const Length &o) const {return (length_in_mm >= o.getLength_in_mm());}
bool operator <= (const Length &o) const {return (length_in_mm <= o.getLength_in_mm());}
bool operator >= (const Length o) const {return (length_in_mm >= o.getLength_in_mm());}
bool operator <= (const Length o) const {return (length_in_mm <= o.getLength_in_mm());}
/** Ratio of two lengthes
@ -136,19 +136,19 @@ class Length
@returns the ratio of the two lengthes as a double
*/
double operator / (const Length &o) const {return (length_in_mm/o.getLength_in_mm());}
double operator / (const Length o) const {return (length_in_mm/o.getLength_in_mm());}
/** Sum of two lengthes
@returns the sum of the lengthes as a Length
*/
Length operator + (const Length &o) const {Length r; r.length_in_mm = length_in_mm + o.length_in_mm; return r; }
Length operator + (const Length o) const {Length r; r.length_in_mm = length_in_mm + o.length_in_mm; return r; }
/** Difference of two lengthes
@returns the difference of the lengthes as a Length
*/
Length operator - (const Length &o) const {Length r; r.length_in_mm = length_in_mm - o.length_in_mm; return r; }
Length operator - (const Length o) const {Length r; r.length_in_mm = length_in_mm - o.length_in_mm; return r; }
/** Division of a length

View file

@ -65,7 +65,7 @@ ghostscript_interface::~ghostscript_interface() {
}
void ghostscript_interface::setPostScript(const PageNumber& page, const QString& PostScript) {
void ghostscript_interface::setPostScript(const PageNumber page, const QString& PostScript) {
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << "ghostscript_interface::setPostScript( " << page << ", ... )";
#endif
@ -89,7 +89,7 @@ void ghostscript_interface::setIncludePath(const QString &_includePath) {
}
void ghostscript_interface::setBackgroundColor(const PageNumber& page, const QColor& background_color, bool permanent) {
void ghostscript_interface::setBackgroundColor(const PageNumber page, const QColor& background_color, bool permanent) {
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << "ghostscript_interface::setBackgroundColor( " << page << ", " << background_color << " )";
#endif
@ -110,7 +110,7 @@ void ghostscript_interface::setBackgroundColor(const PageNumber& page, const QCo
}
}
void ghostscript_interface::restoreBackgroundColor(const PageNumber& page)
void ghostscript_interface::restoreBackgroundColor(const PageNumber page)
{
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << "ghostscript_interface::restoreBackgroundColor( " << page << " )";
@ -125,7 +125,7 @@ void ghostscript_interface::restoreBackgroundColor(const PageNumber& page)
// Returns the background color for a certain page. This color is
// always guaranteed to be valid
QColor ghostscript_interface::getBackgroundColor(const PageNumber& page) const {
QColor ghostscript_interface::getBackgroundColor(const PageNumber page) const {
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << "ghostscript_interface::getBackgroundColor( " << page << " )";
#endif
@ -146,7 +146,7 @@ void ghostscript_interface::clear() {
}
void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, const QString& filename, long magnification) {
void ghostscript_interface::gs_generate_graphics_file(const PageNumber page, const QString& filename, long magnification) {
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << "ghostscript_interface::gs_generate_graphics_file( " << page << ", " << filename << " )";
#endif
@ -293,7 +293,7 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co
}
void ghostscript_interface::graphics(const PageNumber& page, double dpi, long magnification, QPainter* paint) {
void ghostscript_interface::graphics(const PageNumber page, double dpi, long magnification, QPainter* paint) {
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << "ghostscript_interface::graphics( " << page << ", " << dpi << ", ... ) called.";
#endif

View file

@ -47,7 +47,7 @@ public:
void clear();
// sets the PostScript which is used on a certain page
void setPostScript(const PageNumber& page, const QString& PostScript);
void setPostScript(const PageNumber page, const QString& PostScript);
// sets path from additional postscript files may be read
void setIncludePath(const QString &_includePath);
@ -56,19 +56,19 @@ public:
// background color can be restored by calling restoreBackground(page).
// The Option permanent = false is used when we want to display a different paper
// color as the one specified in the dvi file.
void setBackgroundColor(const PageNumber& page, const QColor& background_color, bool permanent = true);
void setBackgroundColor(const PageNumber page, const QColor& background_color, bool permanent = true);
// Restore the background to the color which was specified by the last call to setBackgroundColor()
// With option permanent = true.
void restoreBackgroundColor(const PageNumber& page);
void restoreBackgroundColor(const PageNumber page);
// Draws the graphics of the page into the painter, if possible. If
// the page does not contain any graphics, nothing happens
void graphics(const PageNumber& page, double dpi, long magnification, QPainter* paint);
void graphics(const PageNumber page, double dpi, long magnification, QPainter* paint);
// Returns the background color for a certain page. If no color was
// set, Qt::white is returned.
QColor getBackgroundColor(const PageNumber& page) const;
QColor getBackgroundColor(const PageNumber page) const;
QString *PostScriptHeaderString;
@ -82,7 +82,7 @@ public:
static QString locateEPSfile(const QString &filename, const QUrl &base);
private:
void gs_generate_graphics_file(const PageNumber& page, const QString& filename, long magnification);
void gs_generate_graphics_file(const PageNumber page, const QString& filename, long magnification);
QHash<quint16,pageInfo*> pageList;
double resolution; // in dots per inch

View file

@ -45,7 +45,7 @@ class SimplePageSize
@param width
@param height
*/
SimplePageSize(const Length& width, const Length& height) { pageWidth = width; pageHeight = height; }
SimplePageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; }
virtual ~SimplePageSize() {}
@ -57,7 +57,7 @@ class SimplePageSize
@param width
@param height
*/
virtual void setPageSize(const Length& width, const Length& height) { pageWidth = width; pageHeight = height; }
virtual void setPageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; }
/** \brief Returns the page width. */
Length width() const { return pageWidth; }

View file

@ -42,7 +42,7 @@ public:
@param re value for the box
@param lT valus for the text field
*/
TextBox(const QRect& re, const QString& lT): box(re), text(lT) {}
TextBox(const QRect re, const QString& lT): box(re), text(lT) {}
/** \brief Bounding box of the text or hyperlink

View file

@ -131,7 +131,7 @@ void Converter::_handle_anchors(const QTextBlock &start, const QString &name) {
}
}
void Converter::_insert_local_links(const QString &key, const QPair<int, int> &value)
void Converter::_insert_local_links(const QString &key, const QPair<int, int> value)
{
if(mLocalLinks.contains(key)){
mLocalLinks[key].append(value);

View file

@ -31,7 +31,7 @@ namespace Epub {
void _emitData(Okular::DocumentInfo::Key key, enum epub_metadata type);
void _handle_anchors(const QTextBlock &start, const QString &name);
void _insert_local_links(const QString &key, const QPair<int, int> &value);
void _insert_local_links(const QString &key, const QPair<int, int> value);
EpubDocument *mTextDocument;
QHash<QString, QTextBlock> mSectionMap;

View file

@ -277,7 +277,7 @@ void StyleFormatProperty::setTextFormat( const TextFormatProperty &format )
mTextFormat = format;
}
void StyleFormatProperty::setTableColumnFormat( const TableColumnFormatProperty &format )
void StyleFormatProperty::setTableColumnFormat( const TableColumnFormatProperty format )
{
mTableColumnFormat = format;
}

View file

@ -219,7 +219,7 @@ class StyleFormatProperty
void setParagraphFormat( const ParagraphFormatProperty &format );
void setTextFormat( const TextFormatProperty &format );
void setTableColumnFormat( const TableColumnFormatProperty &format );
void setTableColumnFormat( const TableColumnFormatProperty format );
void setTableCellFormat( const TableCellFormatProperty &format );
private:

View file

@ -168,7 +168,7 @@ static bool nextAbbPathToken(AbbPathToken *token)
/**
Read point (two reals delimited by comma) from abbreviated path data
*/
static QPointF getPointFromString(AbbPathToken *token, bool relative, const QPointF &currentPosition) {
static QPointF getPointFromString(AbbPathToken *token, bool relative, const QPointF currentPosition) {
//TODO Check grammar
QPointF result;

View file

@ -3045,17 +3045,17 @@ void Part::slotPrintPreview()
}
}
void Part::slotShowTOCMenu(const Okular::DocumentViewport &vp, const QPoint &point, const QString &title)
void Part::slotShowTOCMenu(const Okular::DocumentViewport &vp, const QPoint point, const QString &title)
{
showMenu(m_document->page(vp.pageNumber), point, title, vp, true);
}
void Part::slotShowMenu(const Okular::Page *page, const QPoint &point)
void Part::slotShowMenu(const Okular::Page *page, const QPoint point)
{
showMenu(page, point);
}
void Part::showMenu(const Okular::Page *page, const QPoint &point, const QString &bookmarkTitle, const Okular::DocumentViewport &vp, bool showTOCActions)
void Part::showMenu(const Okular::Page *page, const QPoint point, const QString &bookmarkTitle, const Okular::DocumentViewport &vp, bool showTOCActions)
{
if ( m_embedMode == PrintPreviewMode )
return;
@ -3669,7 +3669,7 @@ bool Part::eventFilter(QObject * watched, QEvent * event)
break;
}
return false;
return KParts::ReadWritePart::eventFilter(watched, event);
}
void Part::updateAboutBackendAction()

10
part.h
View file

@ -174,9 +174,9 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
void openSourceReference(const QString& absFileName, int line, int column);
void viewerMenuStateChange(bool enabled);
void enableCloseAction(bool enable);
void mimeTypeChanged(QMimeType mimeType);
void mimeTypeChanged(const QMimeType &mimeType);
void urlsDropped( const QList<QUrl>& urls );
void fitWindowToPage( const QSize& pageViewPortSize, const QSize& pageSize );
void fitWindowToPage( const QSize pageViewPortSize, const QSize pageSize );
protected:
// reimplemented from KParts::ReadWritePart
@ -210,8 +210,8 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
bool slotSaveFileAs(bool showOkularArchiveAsDefaultFormat = false);
void slotGetNewStuff();
void slotNewConfig();
void slotShowMenu(const Okular::Page *page, const QPoint &point);
void slotShowTOCMenu(const Okular::DocumentViewport &vp, const QPoint &point, const QString &title);
void slotShowMenu(const Okular::Page *page, const QPoint point);
void slotShowTOCMenu(const Okular::DocumentViewport &vp, const QPoint point, const QString &title);
void slotShowProperties();
void slotShowEmbeddedFiles();
void slotShowLeftPanel();
@ -255,7 +255,7 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
private:
bool aboutToShowContextMenu(QMenu *menu, QAction *action, QMenu *contextMenu);
void showMenu(const Okular::Page *page, const QPoint &point, const QString &bookmarkTitle = QString(), const Okular::DocumentViewport &vp = DocumentViewport(), bool showTOCActions = false);
void showMenu(const Okular::Page *page, const QPoint point, const QString &bookmarkTitle = QString(), const Okular::DocumentViewport &vp = DocumentViewport(), bool showTOCActions = false);
bool eventFilter(QObject * watched, QEvent * event) override;
Document::OpenResult doOpenFile(const QMimeType &mime, const QString &fileNameToOpen, bool *isCompressedFile);
bool openUrl( const QUrl &url, bool swapInsteadOfOpening );

View file

@ -183,7 +183,7 @@ bool Shell::eventFilter(QObject *obj, QEvent *event)
}
}
}
return false;
return KParts::MainWindow::eventFilter(obj, event);
}
bool Shell::isValid() const
@ -834,7 +834,7 @@ void Shell::moveTabData( int from, int to )
m_tabs.move( from, to );
}
void Shell::slotFitWindowToPage(const QSize& pageViewSize, const QSize& pageSize )
void Shell::slotFitWindowToPage(const QSize pageViewSize, const QSize pageSize )
{
const int xOffset = pageViewSize.width() - pageSize.width();
const int yOffset = pageViewSize.height() - pageSize.height();

View file

@ -128,7 +128,7 @@ private Q_SLOTS:
void undoCloseTab();
void moveTabData( int from, int to );
void slotFitWindowToPage( const QSize& pageViewSize, const QSize& pageSize );
void slotFitWindowToPage( const QSize pageViewSize, const QSize pageSize );
Q_SIGNALS:
void moveSplitter(int sideWidgetSize);

View file

@ -62,7 +62,7 @@ void AnnotationPopup::addAnnotation( Okular::Annotation* annotation, int pageNum
mAnnotations.append( pair );
}
void AnnotationPopup::exec( const QPoint &point )
void AnnotationPopup::exec( const QPoint point )
{
if ( mAnnotations.isEmpty() )
return;

View file

@ -38,7 +38,7 @@ class AnnotationPopup : public QObject
void addAnnotation( Okular::Annotation* annotation, int pageNumber );
void exec( const QPoint &point = QPoint() );
void exec( const QPoint point = QPoint() );
Q_SIGNALS:
void openAnnotationWindow( Okular::Annotation *annotation, int pageNumber );
@ -51,11 +51,7 @@ class AnnotationPopup : public QObject
AnnotPagePair( Okular::Annotation *a, int pn ) : annotation( a ), pageNumber( pn )
{ }
~AnnotPagePair() = default;
AnnotPagePair( const AnnotPagePair & pair ) = default;
AnnotPagePair &operator=( const AnnotPagePair & pair ) = default;
bool operator==( const AnnotPagePair & pair ) const
bool operator==( const AnnotPagePair pair ) const
{ return annotation == pair.annotation && pageNumber == pair.pageNumber; }
Okular::Annotation* annotation;

View file

@ -295,7 +295,7 @@ void AnnotWindow::showEvent( QShowEvent * event )
textEdit->setFocus();
}
bool AnnotWindow::eventFilter(QObject *, QEvent *e)
bool AnnotWindow::eventFilter(QObject *o, QEvent *e)
{
if ( e->type () == QEvent::ShortcutOverride )
{
@ -324,7 +324,7 @@ bool AnnotWindow::eventFilter(QObject *, QEvent *e)
{
raise();
}
return false;
return QFrame::eventFilter(o, e);
}
void AnnotWindow::slotUpdateUndoAndRedoInContextMenu(QMenu* menu)

View file

@ -229,7 +229,7 @@ void BookmarkList::slotChanged( QTreeWidgetItem * item )
}
}
void BookmarkList::slotContextMenu( const QPoint& p )
void BookmarkList::slotContextMenu( const QPoint p )
{
QTreeWidgetItem * item = m_tree->itemAt( p );
BookmarkItem* bmItem = item ? dynamic_cast<BookmarkItem*>( item ) : nullptr;
@ -239,7 +239,7 @@ void BookmarkList::slotContextMenu( const QPoint& p )
contextMenuForFileItem( p, fItem );
}
void BookmarkList::contextMenuForBookmarkItem( const QPoint& p, BookmarkItem* bmItem )
void BookmarkList::contextMenuForBookmarkItem( const QPoint p, BookmarkItem* bmItem )
{
Q_UNUSED( p );
if ( !bmItem || !bmItem->viewport().isValid() )
@ -261,7 +261,7 @@ void BookmarkList::contextMenuForBookmarkItem( const QPoint& p, BookmarkItem* bm
m_document->bookmarkManager()->removeBookmark( bmItem->url(), bmItem->bookmark() );
}
void BookmarkList::contextMenuForFileItem( const QPoint& p, FileItem* fItem )
void BookmarkList::contextMenuForFileItem( const QPoint p, FileItem* fItem )
{
Q_UNUSED( p );
if ( !fItem )

View file

@ -41,7 +41,7 @@ class BookmarkList : public QWidget, public Okular::DocumentObserver
void slotFilterBookmarks( bool );
void slotExecuted( QTreeWidgetItem * item );
void slotChanged( QTreeWidgetItem * item );
void slotContextMenu( const QPoint& p );
void slotContextMenu( const QPoint p );
void slotBookmarksChanged( const QUrl& url );
private:
@ -49,8 +49,8 @@ class BookmarkList : public QWidget, public Okular::DocumentObserver
void goTo( BookmarkItem * item );
void selectiveUrlUpdate( const QUrl& url, QTreeWidgetItem*& item );
QTreeWidgetItem* itemForUrl(const QUrl &url ) const;
void contextMenuForBookmarkItem( const QPoint& p, BookmarkItem* bmItem );
void contextMenuForFileItem( const QPoint& p, FileItem* fItem );
void contextMenuForBookmarkItem( const QPoint p, BookmarkItem* bmItem );
void contextMenuForFileItem( const QPoint p, FileItem* fItem );
Okular::Document * m_document;
QTreeWidget * m_tree;

View file

@ -144,7 +144,7 @@ void EmbeddedFilesDialog::viewFileItem( QTreeWidgetItem* item, int /*column*/ )
viewFile( ef );
}
void EmbeddedFilesDialog::attachViewContextMenu( const QPoint& /*pos*/ )
void EmbeddedFilesDialog::attachViewContextMenu()
{
QList<QTreeWidgetItem *> selected = m_tw->selectedItems();
if ( selected.isEmpty() )

View file

@ -30,7 +30,7 @@ Q_OBJECT
private Q_SLOTS:
void saveFileFromButton();
void attachViewContextMenu( const QPoint& pos );
void attachViewContextMenu();
void updateSaveButton();
void viewFileFromButton();
void viewFileItem( QTreeWidgetItem* item, int column );

View file

@ -46,7 +46,7 @@ bool OKMenuTitle::eventFilter(QObject *object, QEvent *event)
Q_UNUSED(object);
if (event->type() == QEvent::Paint) {
return false;
return QWidgetAction::eventFilter(object, event);
} else if (event->type() == QEvent::KeyRelease) {
// If we're receiving the key release event is because we just gained
// focus though a key event, use the same key to move it to the next action

View file

@ -54,14 +54,14 @@ inline QPen buildPen( const Okular::Annotation *ann, double width, const QColor
}
void PagePainter::paintPageOnPainter( QPainter * destPainter, const Okular::Page * page,
Okular::DocumentObserver *observer, int flags, int scaledWidth, int scaledHeight, const QRect &limits )
Okular::DocumentObserver *observer, int flags, int scaledWidth, int scaledHeight, const QRect limits )
{
paintCroppedPageOnPainter( destPainter, page, observer, flags, scaledWidth, scaledHeight, limits,
Okular::NormalizedRect( 0, 0, 1, 1 ), nullptr );
}
void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okular::Page * page,
Okular::DocumentObserver *observer, int flags, int scaledWidth, int scaledHeight, const QRect &limits,
Okular::DocumentObserver *observer, int flags, int scaledWidth, int scaledHeight, const QRect limits,
const Okular::NormalizedRect &crop, Okular::NormalizedPoint *viewPortPoint )
{
qreal dpr = destPainter->device()->devicePixelRatioF();
@ -791,7 +791,7 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula
/** Private Helpers :: Pixmap conversion **/
void PagePainter::cropPixmapOnImage( QImage & dest, const QPixmap * src, const QRect & r )
void PagePainter::cropPixmapOnImage( QImage & dest, const QPixmap * src, const QRect r )
{
qreal dpr = src->devicePixelRatioF();

View file

@ -40,7 +40,7 @@ class Q_DECL_EXPORT PagePainter
// in 'flags'. 'limits' is the bounding rect of the paint operation,
// 'scaledWidth' and 'scaledHeight' the expected size of page contents
static void paintPageOnPainter( QPainter * destPainter, const Okular::Page * page, Okular::DocumentObserver *observer,
int flags, int scaledWidth, int scaledHeight, const QRect & pageLimits );
int flags, int scaledWidth, int scaledHeight, const QRect pageLimits );
// draw (using painter 'destPainter') the 'page' requested by 'observer' using features
// in 'flags'.
@ -50,11 +50,11 @@ class Q_DECL_EXPORT PagePainter
// 'crop' is the (normalized) cropped rectangle within the page.
// The painter's (0,0) is assumed to be top left of the painted ('pageLimits') rect.
static void paintCroppedPageOnPainter( QPainter * destPainter, const Okular::Page * page, Okular::DocumentObserver *observer,
int flags, int scaledWidth, int scaledHeight, const QRect & pageLimits,
int flags, int scaledWidth, int scaledHeight, const QRect pageLimits,
const Okular::NormalizedRect & crop, Okular::NormalizedPoint *viewPortPoint );
private:
static void cropPixmapOnImage( QImage & dest, const QPixmap * src, const QRect & r );
static void cropPixmapOnImage( QImage & dest, const QPixmap * src, const QRect r );
static void recolor(QImage *image, const QColor &foreground, const QColor &background);
// set the alpha component of the image to a given value

View file

@ -864,8 +864,10 @@ void PageView::displayMessage( const QString & message, const QString & details,
}
// hide messageWindow if string is empty
if ( message.isEmpty() )
return d->messageWindow->hide();
if ( message.isEmpty() ) {
d->messageWindow->hide();
return;
}
// display message (duration is length dependent)
if (duration==-1)
@ -944,12 +946,12 @@ QPoint PageView::contentAreaPosition() const
return QPoint( horizontalScrollBar()->value(), verticalScrollBar()->value() );
}
QPoint PageView::contentAreaPoint( const QPoint & pos ) const
QPoint PageView::contentAreaPoint( const QPoint pos ) const
{
return pos + contentAreaPosition();
}
QPointF PageView::contentAreaPoint( const QPointF & pos ) const
QPointF PageView::contentAreaPoint( const QPointF pos ) const
{
return pos + contentAreaPosition();
}
@ -3548,7 +3550,7 @@ void PageView::scrollContentsBy( int dx, int dy )
}
//END widget events
QList< Okular::RegularAreaRect * > PageView::textSelections( const QPoint& start, const QPoint& end, int& firstpage )
QList< Okular::RegularAreaRect * > PageView::textSelections( const QPoint start, const QPoint end, int& firstpage )
{
firstpage = -1;
QList< Okular::RegularAreaRect * > ret;
@ -3626,7 +3628,7 @@ QList< Okular::RegularAreaRect * > PageView::textSelections( const QPoint& start
}
void PageView::drawDocumentOnPainter( const QRect & contentsRect, QPainter * p )
void PageView::drawDocumentOnPainter( const QRect contentsRect, QPainter * p )
{
QColor backColor;
@ -3891,7 +3893,7 @@ void PageView::textSelectionClear()
}
}
void PageView::selectionStart( const QPoint & pos, const QColor & color, bool /*aboveAll*/ )
void PageView::selectionStart( const QPoint pos, const QColor & color, bool /*aboveAll*/ )
{
selectionClear();
d->mouseSelecting = true;
@ -3905,7 +3907,7 @@ void PageView::selectionStart( const QPoint & pos, const QColor & color, bool /*
}
}
void PageView::scrollPosIntoView( const QPoint & pos )
void PageView::scrollPosIntoView( const QPoint pos )
{
// this number slows the speed of the page by its value, chosen not to be too fast or too slow, the actual speed is determined from the mouse position, not critical
const int damping=6;
@ -3954,7 +3956,7 @@ QPoint PageView::viewportToContentArea( const Okular::DocumentViewport & vp ) co
return c;
}
void PageView::updateSelection( const QPoint & pos )
void PageView::updateSelection( const QPoint pos )
{
if ( d->mouseSelecting )
{
@ -3990,7 +3992,7 @@ void PageView::updateSelection( const QPoint & pos )
}
}
static Okular::NormalizedPoint rotateInNormRect( const QPoint &rotated, const QRect &rect, Okular::Rotation rotation )
static Okular::NormalizedPoint rotateInNormRect( const QPoint rotated, const QRect rect, Okular::Rotation rotation )
{
Okular::NormalizedPoint ret;
@ -4013,7 +4015,7 @@ static Okular::NormalizedPoint rotateInNormRect( const QPoint &rotated, const QR
return ret;
}
Okular::RegularAreaRect * PageView::textSelectionForItem( const PageViewItem * item, const QPoint & startPoint, const QPoint & endPoint )
Okular::RegularAreaRect * PageView::textSelectionForItem( const PageViewItem * item, const QPoint startPoint, const QPoint endPoint )
{
const QRect & geometry = item->uncroppedGeometry();
Okular::NormalizedPoint startCursor( 0.0, 0.0 );
@ -4281,7 +4283,7 @@ void PageView::updateCursor()
updateCursor( p );
}
void PageView::updateCursor( const QPoint &p )
void PageView::updateCursor( const QPoint p )
{
// reset mouse over link it will be re-set if that still valid
d->mouseOverLinkObject = nullptr;
@ -4376,7 +4378,7 @@ void PageView::reloadForms()
}
void PageView::moveMagnifier( const QPoint& p ) // non scaled point
void PageView::moveMagnifier( const QPoint p ) // non scaled point
{
const int w = d->magnifierView->width() * 0.5;
const int h = d->magnifierView->height() * 0.5;
@ -4419,7 +4421,7 @@ void PageView::moveMagnifier( const QPoint& p ) // non scaled point
d->magnifierView->move(x, y);
}
void PageView::updateMagnifier( const QPoint& p ) // scaled point
void PageView::updateMagnifier( const QPoint p ) // scaled point
{
/* translate mouse coordinates to page coordinates and inform the magnifier of the situation */
PageViewItem *item = pickItemOnPoint(p.x(), p.y());
@ -4491,7 +4493,7 @@ void PageView::toggleFormWidgets( bool on )
}
}
void PageView::resizeContentArea( const QSize & newSize )
void PageView::resizeContentArea( const QSize newSize )
{
const QSize vs = viewport()->size();
int hRange = newSize.width() - vs.width();
@ -4566,7 +4568,7 @@ void PageView::addWebShortcutsMenu( QMenu * menu, const QString & text )
}
}
QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPos)
QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint eventPos)
{
// check if the right-click was over a link
const double nX = item->absToPageX(eventPos.x());
@ -4834,7 +4836,7 @@ void PageView::delayedResizeEvent()
slotRequestVisiblePixmaps();
}
static void slotRequestPreloadPixmap( Okular::DocumentObserver * observer, const PageViewItem * i, const QRect &expandedViewportRect, QLinkedList< Okular::PixmapRequest * > *requestedPixmaps )
static void slotRequestPreloadPixmap( Okular::DocumentObserver * observer, const PageViewItem * i, const QRect expandedViewportRect, QLinkedList< Okular::PixmapRequest * > *requestedPixmaps )
{
Okular::NormalizedRect preRenderRegion;
const QRect intersectionRect = expandedViewportRect.intersected( i->croppedGeometry() );

View file

@ -93,8 +93,8 @@ Q_OBJECT
QVariant capability( ViewCapability capability ) const override;
void setCapability( ViewCapability capability, const QVariant &option ) override;
QList< Okular::RegularAreaRect * > textSelections( const QPoint& start, const QPoint& end, int& firstpage );
Okular::RegularAreaRect * textSelectionForItem( const PageViewItem * item, const QPoint & startPoint = QPoint(), const QPoint & endPoint = QPoint() );
QList< Okular::RegularAreaRect * > textSelections( const QPoint start, const QPoint end, int& firstpage );
Okular::RegularAreaRect * textSelectionForItem( const PageViewItem * item, const QPoint startPoint = QPoint(), const QPoint endPoint = QPoint() );
void reparseConfig();
@ -104,8 +104,8 @@ Q_OBJECT
int contentAreaWidth() const;
int contentAreaHeight() const;
QPoint contentAreaPosition() const;
QPoint contentAreaPoint( const QPoint & pos ) const;
QPointF contentAreaPoint( const QPointF & pos ) const;
QPoint contentAreaPoint( const QPoint pos ) const;
QPointF contentAreaPoint( const QPointF pos ) const;
bool areSourceLocationsShownGraphically() const;
void setShowSourceLocationsGraphically(bool show);
@ -135,11 +135,11 @@ Q_OBJECT
void externalKeyPressEvent( QKeyEvent *e );
Q_SIGNALS:
void rightClick( const Okular::Page *, const QPoint & );
void rightClick( const Okular::Page *, const QPoint );
void mouseBackButtonClick();
void mouseForwardButtonClick();
void escPressed();
void fitWindowToPage( const QSize& pageViewPortSize, const QSize& pageSize );
void fitWindowToPage( const QSize pageViewPortSize, const QSize pageSize );
void triggerSearch( const QString& text );
protected:
@ -167,18 +167,18 @@ Q_OBJECT
private:
// draw background and items on the opened qpainter
void drawDocumentOnPainter( const QRect & contentsRect, QPainter * p );
void drawDocumentOnPainter( const QRect contentsRect, QPainter * p );
// update item width and height using current zoom parameters
void updateItemSize( PageViewItem * item, int colWidth, int rowHeight );
// return the widget placed on a certain point or 0 if clicking on empty space
PageViewItem * pickItemOnPoint( int x, int y );
// start / modify / clear selection rectangle
void selectionStart( const QPoint & pos, const QColor & color, bool aboveAll = false );
void selectionStart( const QPoint pos, const QColor & color, bool aboveAll = false );
void selectionClear( const ClearMode mode = ClearAllSelection );
void drawTableDividers(QPainter * screenPainter);
void guessTableDividers();
// update either text or rectangle selection
void updateSelection( const QPoint & pos );
void updateSelection( const QPoint pos );
// compute the zoom factor value for FitWidth and FitPage mode
double zoomFactorFitMode( ZoomMode mode );
// update internal zoom values and end in a slotRelayoutPages();
@ -189,10 +189,10 @@ Q_OBJECT
void updateViewMode ( const int nr );
void textSelectionClear();
// updates cursor
void updateCursor( const QPoint &p );
void updateCursor( const QPoint p );
void moveMagnifier( const QPoint &p );
void updateMagnifier( const QPoint &p );
void moveMagnifier( const QPoint p );
void updateMagnifier( const QPoint p );
int viewColumns() const;
@ -201,14 +201,14 @@ Q_OBJECT
void toggleFormWidgets( bool on );
void resizeContentArea( const QSize & newSize );
void resizeContentArea( const QSize newSize );
void updatePageStep();
void addSearchWithinDocumentAction(QMenu * menu, const QString & searchText );
void addWebShortcutsMenu( QMenu * menu, const QString & text );
QMenu* createProcessLinkMenu( PageViewItem *item, const QPoint & eventPos );
QMenu* createProcessLinkMenu( PageViewItem *item, const QPoint eventPos );
// used when selecting stuff, makes the view scroll as necessary to keep the mouse inside the view
void scrollPosIntoView( const QPoint & pos );
void scrollPosIntoView( const QPoint pos );
QPoint viewportToContentArea( const Okular::DocumentViewport & vp ) const;
// called from slots to turn off trim modes mutually exclusive to id

View file

@ -796,8 +796,8 @@ QCursor PageViewAnnotator::cursor() const
return m_engine->cursor();
}
QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::EventType & eventType, const AnnotatorEngine::Button & button,
const QPointF & pos, PageViewItem * item )
QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::EventType eventType, const AnnotatorEngine::Button button,
const QPointF pos, PageViewItem * item )
{
// creationCompleted is intended to be set by event(), handled subsequently by end(), and cleared within end().
// If it's set here, we recursed for some reason (e.g., stacked event loop).
@ -892,7 +892,7 @@ QRect PageViewAnnotator::routeMouseEvent( QMouseEvent * e, PageViewItem * item )
return performRouteMouseOrTabletEvent( eventType, button, e->localPos(), item );
}
QRect PageViewAnnotator::routeTabletEvent( QTabletEvent * e, PageViewItem * item, const QPoint & localOriginInGlobal )
QRect PageViewAnnotator::routeTabletEvent( QTabletEvent * e, PageViewItem * item, const QPoint localOriginInGlobal )
{
// Unlike routeMouseEvent, routeTabletEvent must explicitly ignore events it doesn't care about so that
// the corresponding mouse event will later be delivered.
@ -935,12 +935,12 @@ bool PageViewAnnotator::routeKeyEvent( QKeyEvent * event )
return false;
}
bool PageViewAnnotator::routePaints( const QRect & wantedRect ) const
bool PageViewAnnotator::routePaints( const QRect wantedRect ) const
{
return m_engine && m_toolBar && wantedRect.intersects( m_lastDrawnRect ) && m_lockedItem;
}
void PageViewAnnotator::routePaint( QPainter * painter, const QRect & paintRect )
void PageViewAnnotator::routePaint( QPainter * painter, const QRect paintRect )
{
// if there's no locked item, then there's no decided place to draw on
if ( !m_lockedItem )

View file

@ -76,12 +76,12 @@ class PageViewAnnotator : public QObject
QCursor cursor() const;
QRect routeMouseEvent( QMouseEvent * event, PageViewItem * item );
QRect routeTabletEvent( QTabletEvent * event, PageViewItem * item, const QPoint & localOriginInGlobal );
QRect performRouteMouseOrTabletEvent( const AnnotatorEngine::EventType & eventType, const AnnotatorEngine::Button & button,
const QPointF & pos, PageViewItem * item );
QRect routeTabletEvent( QTabletEvent * event, PageViewItem * item, const QPoint localOriginInGlobal );
QRect performRouteMouseOrTabletEvent( const AnnotatorEngine::EventType eventType, const AnnotatorEngine::Button button,
const QPointF pos, PageViewItem * item );
bool routeKeyEvent( QKeyEvent * event );
bool routePaints( const QRect & wantedRect ) const;
void routePaint( QPainter * painter, const QRect & paintRect );
bool routePaints( const QRect wantedRect ) const;
void routePaint( QPainter * painter, const QRect paintRect );
void reparseConfig();

View file

@ -66,7 +66,7 @@ void AnnotationDescription::invalidate()
pageNumber = -1;
}
AnnotationDescription::AnnotationDescription( PageViewItem * newPageViewItem, const QPoint& eventPos )
AnnotationDescription::AnnotationDescription( PageViewItem * newPageViewItem, const QPoint eventPos )
{
const Okular::AnnotationObjectRect * annObjRect = nullptr;
if ( newPageViewItem )
@ -103,7 +103,7 @@ MouseAnnotation::~MouseAnnotation()
{
}
void MouseAnnotation::routeMousePressEvent( PageViewItem * pageViewItem, const QPoint & eventPos )
void MouseAnnotation::routeMousePressEvent( PageViewItem * pageViewItem, const QPoint eventPos )
{
/* Is there a selected annotation? */
if ( m_focusedAnnotation.isValid() )
@ -163,7 +163,7 @@ void MouseAnnotation::routeMouseReleaseEvent()
*/
}
void MouseAnnotation::routeMouseMoveEvent( PageViewItem * pageViewItem, const QPoint & eventPos, bool leftButtonPressed )
void MouseAnnotation::routeMouseMoveEvent( PageViewItem * pageViewItem, const QPoint eventPos, bool leftButtonPressed )
{
if ( !pageViewItem )
{
@ -270,7 +270,7 @@ void MouseAnnotation::routeTooltipEvent( const QHelpEvent * helpEvent )
}
}
void MouseAnnotation::routePaint( QPainter * painter, const QRect & paintRect )
void MouseAnnotation::routePaint( QPainter * painter, const QRect paintRect )
{
/* QPainter draws relative to the origin of uncropped viewport. */
static const QColor borderColor = QColor::fromHsvF( 0, 0, 1.0 );
@ -537,7 +537,7 @@ QRect MouseAnnotation::getFullBoundingRect( const AnnotationDescription & ad ) c
}
/* Apply the command determined by m_state to the currently focused annotation. */
void MouseAnnotation::performCommand( const QPoint & newPos )
void MouseAnnotation::performCommand( const QPoint newPos )
{
const QRect & pageViewItemRect = m_focusedAnnotation.pageViewItem->uncroppedGeometry();
QPointF mouseDelta( newPos - pageViewItemRect.topLeft() - m_mousePosition );
@ -597,7 +597,7 @@ void MouseAnnotation::updateViewport( const AnnotationDescription & ad ) const
/* eventPos: Mouse position in uncropped page coordinates.
ad: The annotation to get the handle for. */
MouseAnnotation::ResizeHandle MouseAnnotation::getHandleAt( const QPoint & eventPos, const AnnotationDescription & ad ) const
MouseAnnotation::ResizeHandle MouseAnnotation::getHandleAt( const QPoint eventPos, const AnnotationDescription & ad ) const
{
ResizeHandle selected = RH_None;
@ -678,7 +678,7 @@ QRect MouseAnnotation::getHandleRect( ResizeHandle handle, const AnnotationDescr
}
/* Convert a resize handle delta into two adjust delta coordinates. */
void MouseAnnotation::handleToAdjust( const QPointF & dIn, QPointF & dOut1, QPointF & dOut2, MouseAnnotation::ResizeHandle handle, Okular::Rotation rotation )
void MouseAnnotation::handleToAdjust( const QPointF dIn, QPointF & dOut1, QPointF & dOut2, MouseAnnotation::ResizeHandle handle, Okular::Rotation rotation )
{
const MouseAnnotation::ResizeHandle rotatedHandle = MouseAnnotation::rotateHandle( handle, rotation);
dOut1.rx() = ( rotatedHandle & MouseAnnotation::RH_Left ) ? dIn.x() : 0;
@ -687,7 +687,7 @@ void MouseAnnotation::handleToAdjust( const QPointF & dIn, QPointF & dOut1, QPoi
dOut2.ry() = ( rotatedHandle & MouseAnnotation::RH_Bottom ) ? dIn.y() : 0;
}
QPointF MouseAnnotation::rotateInRect( const QPointF & rotated, Okular::Rotation rotation )
QPointF MouseAnnotation::rotateInRect( const QPointF rotated, Okular::Rotation rotation )
{
QPointF ret;

View file

@ -47,7 +47,7 @@ class AnnotationDescription
public:
AnnotationDescription()
: annotation( nullptr ), pageViewItem( nullptr ), pageNumber( -1 ) {}
AnnotationDescription( PageViewItem * newPageViewItem, const QPoint& eventPos );
AnnotationDescription( PageViewItem * newPageViewItem, const QPoint eventPos );
bool isValid() const;
bool isContainedInPage( const Okular::Document * document, int pageNumber ) const;
void invalidate();
@ -77,13 +77,13 @@ public:
~MouseAnnotation() override;
/* Process a mouse press event. eventPos: Mouse position in content area coordinates. */
void routeMousePressEvent( PageViewItem * pageViewItem, const QPoint & eventPos );
void routeMousePressEvent( PageViewItem * pageViewItem, const QPoint eventPos );
/* Process a mouse release event. */
void routeMouseReleaseEvent();
/* Process a mouse move event. eventPos: Mouse position in content area coordinates. */
void routeMouseMoveEvent( PageViewItem * pageViewItem, const QPoint & eventPos, bool leftButtonPressed );
void routeMouseMoveEvent( PageViewItem * pageViewItem, const QPoint eventPos, bool leftButtonPressed );
/* Process a key event. */
void routeKeyPressEvent( const QKeyEvent * e );
@ -92,7 +92,7 @@ public:
void routeTooltipEvent( const QHelpEvent * helpEvent );
/* Process a paint event. */
void routePaint( QPainter * painter, const QRect & paintRect );
void routePaint( QPainter * painter, const QRect paintRect );
/* Cancel the current selection or action, if any. */
void cancel();
@ -148,13 +148,13 @@ public:
private:
void setState( MouseAnnotationState state, const AnnotationDescription & ad );
QRect getFullBoundingRect( const AnnotationDescription & ad ) const;
void performCommand( const QPoint & newPos );
void performCommand( const QPoint newPos );
void finishCommand();
void updateViewport( const AnnotationDescription & ad ) const;
ResizeHandle getHandleAt( const QPoint & eventPos, const AnnotationDescription & ad ) const;
ResizeHandle getHandleAt( const QPoint eventPos, const AnnotationDescription & ad ) const;
QRect getHandleRect( ResizeHandle handle, const AnnotationDescription & ad ) const;
static void handleToAdjust( const QPointF & dIn, QPointF & dOut1, QPointF & dOut2, MouseAnnotation::ResizeHandle handle, Okular::Rotation rotation );
static QPointF rotateInRect( const QPointF & rotated, Okular::Rotation rotation );
static void handleToAdjust( const QPointF dIn, QPointF & dOut1, QPointF & dOut2, MouseAnnotation::ResizeHandle handle, Okular::Rotation rotation );
static QPointF rotateInRect( const QPointF rotated, Okular::Rotation rotation );
static ResizeHandle rotateHandle( ResizeHandle handle, Okular::Rotation rotation );
void processAction( const AnnotationDescription& ad );

View file

@ -1042,7 +1042,7 @@ void PresentationWidget::testCursorOnLink( int x, int y )
}
}
void PresentationWidget::overlayClick( const QPoint & position )
void PresentationWidget::overlayClick( const QPoint position )
{
// clicking the progress indicator
int xPos = position.x() - m_overlayGeometry.x() - m_overlayGeometry.width() / 2,
@ -1751,7 +1751,7 @@ void PresentationWidget::setScreen( int newScreen )
applyNewScreenSize( oldSize );
}
void PresentationWidget::applyNewScreenSize( const QSize & oldSize )
void PresentationWidget::applyNewScreenSize( const QSize oldSize )
{
repositionContent();

View file

@ -82,7 +82,7 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
const Okular::Action * getLink( int x, int y, QRect * geometry = nullptr ) const;
const Okular::Annotation * getAnnotation( int x, int y, QRect * geometry = nullptr ) const;
void testCursorOnLink( int x, int y );
void overlayClick( const QPoint & position );
void overlayClick( const QPoint position );
void changePage( int newPage );
void generatePage( bool disableTransition = false );
void generateIntroPage( QPainter & p );
@ -97,7 +97,7 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
void repositionContent();
void requestPixmaps();
void setScreen( int );
void applyNewScreenSize( const QSize & oldSize );
void applyNewScreenSize( const QSize oldSize );
void inhibitPowerManagement();
void allowPowerManagement();
void showTopBar( bool );

View file

@ -197,7 +197,7 @@ void PropertiesDialog::reallyStartFontReading()
m_document->startFontReading();
}
void PropertiesDialog::showFontsMenu(const QPoint &pos)
void PropertiesDialog::showFontsMenu(const QPoint pos)
{
QTreeView *view = static_cast<QTreeView*>(sender());
QModelIndex index = view->indexAt(pos);

View file

@ -38,7 +38,7 @@ class PropertiesDialog : public KPageDialog
void slotFontReadingProgress( int page );
void slotFontReadingEnded();
void reallyStartFontReading();
void showFontsMenu(const QPoint &pos);
void showFontsMenu(const QPoint pos);
private:
Okular::Document * m_document;

View file

@ -273,7 +273,7 @@ QModelIndexList Reviews::retrieveAnnotations(const QModelIndex& idx) const
return ret;
}
void Reviews::contextMenuRequested( const QPoint &pos )
void Reviews::contextMenuRequested( const QPoint pos )
{
AnnotationPopup popup( m_document, AnnotationPopup::SingleAnnotationMode, this );
connect(&popup, &AnnotationPopup::openAnnotationWindow, this, &Reviews::openAnnotationWindow);

View file

@ -57,7 +57,7 @@ class Reviews : public QWidget, public Okular::DocumentObserver
private Q_SLOTS:
void activated( const QModelIndex& );
void contextMenuRequested( const QPoint& );
void contextMenuRequested( const QPoint );
void saveSearchOptions();
private:

View file

@ -760,7 +760,7 @@ void Sidebar::saveSplitterSize() const
Okular::Settings::self()->save();
}
void Sidebar::listContextMenu( const QPoint &pos )
void Sidebar::listContextMenu( const QPoint pos )
{
QMenu menu( this );
menu.setTitle( i18n( "Okular" ) );

View file

@ -56,7 +56,7 @@ class OKULARPART_EXPORT Sidebar : public QWidget
private Q_SLOTS:
void itemClicked( QListWidgetItem *item );
void splitterMoved( int pos, int index );
void listContextMenu( const QPoint & );
void listContextMenu( const QPoint );
void showTextToggled( bool );
void iconSizeChanged( QAction *action );

View file

@ -69,9 +69,9 @@ class ThumbnailListPrivate : public QWidget
// called by ThumbnailWidgets to get the overlay bookmark pixmap
const QPixmap * getBookmarkOverlay() const;
// called by ThumbnailWidgets to send (forward) the mouse move signals
ChangePageDirection forwardTrack( const QPoint &, const QSize & );
ChangePageDirection forwardTrack( const QPoint, const QSize );
ThumbnailWidget* itemFor( const QPoint & p ) const;
ThumbnailWidget* itemFor( const QPoint p ) const;
void delayedRequestVisiblePixmaps( int delayMs = 0 );
// SLOTS:
@ -114,7 +114,7 @@ class ThumbnailWidget
const Okular::Page * page() const { return m_page; }
QRect visibleRect() const { return m_visibleRect.geometry( m_pixmapWidth, m_pixmapHeight ); }
void paint( QPainter &p, const QRect &clipRect );
void paint( QPainter &p, const QRect clipRect );
static int margin() { return m_margin; }
@ -125,7 +125,7 @@ class ThumbnailWidget
QPoint pos() const { return m_rect.topLeft(); }
void move( int x, int y ) { m_rect.setTopLeft( QPoint( x, y ) ); }
void update() { m_parent->update( m_rect ); }
void update( const QRect & rect ) { m_parent->update( rect.translated( m_rect.topLeft() ) ); }
void update( const QRect rect ) { m_parent->update( rect.translated( m_rect.topLeft() ) ); }
private:
// the margin around the widget
@ -165,7 +165,7 @@ ThumbnailListPrivate::~ThumbnailListPrivate()
{
}
ThumbnailWidget* ThumbnailListPrivate::itemFor( const QPoint & p ) const
ThumbnailWidget* ThumbnailListPrivate::itemFor( const QPoint p ) const
{
QVector< ThumbnailWidget * >::const_iterator tIt = m_thumbnails.constBegin(), tEnd = m_thumbnails.constEnd();
for ( ; tIt != tEnd; ++tIt )
@ -457,7 +457,7 @@ ThumbnailWidget *ThumbnailListPrivate::getThumbnailbyOffset(int current, int off
return m_thumbnails[idx];
}
ThumbnailListPrivate::ChangePageDirection ThumbnailListPrivate::forwardTrack(const QPoint &point, const QSize &r )
ThumbnailListPrivate::ChangePageDirection ThumbnailListPrivate::forwardTrack(const QPoint point, const QSize r )
{
Okular::DocumentViewport vp = m_document->viewport();
const double deltaX = (double)point.x() / r.width(),
@ -497,8 +497,10 @@ void ThumbnailList::slotFilterBookmarks( bool filterOn )
//BEGIN widget events
void ThumbnailList::keyPressEvent( QKeyEvent * keyEvent )
{
if ( d->m_thumbnails.count() < 1 )
return keyEvent->ignore();
if ( d->m_thumbnails.count() < 1 ) {
keyEvent->ignore();
return;
}
int nextPage = -1;
if ( keyEvent->key() == Qt::Key_Up )
@ -524,8 +526,10 @@ void ThumbnailList::keyPressEvent( QKeyEvent * keyEvent )
else if ( keyEvent->key() == Qt::Key_End )
nextPage = d->m_thumbnails[ d->m_thumbnails.count() - 1 ]->pageNumber();
if ( nextPage == -1 )
return keyEvent->ignore();
if ( nextPage == -1 ) {
keyEvent->ignore();
return;
}
keyEvent->accept();
if ( d->m_selected )
@ -700,8 +704,10 @@ void ThumbnailWidget::setVisibleRect( const Okular::NormalizedRect & rect )
void ThumbnailListPrivate::mousePressEvent( QMouseEvent * e )
{
ThumbnailWidget* item = itemFor( e->pos() );
if ( !item ) // mouse on the spacing between items
return e->ignore();
if ( !item ) { // mouse on the spacing between items
e->ignore();
return;
}
const QRect r = item->visibleRect();
const int margin = ThumbnailWidget::margin();
@ -727,8 +733,10 @@ void ThumbnailListPrivate::mouseReleaseEvent( QMouseEvent * e )
{
ThumbnailWidget* item = itemFor( e->pos() );
m_mouseGrabItem = item;
if ( !item ) // mouse on the spacing between items
return e->ignore();
if ( !item ) { // mouse on the spacing between items
e->ignore();
return;
}
QRect r = item->visibleRect();
const QPoint p = e->pos() - item->pos();
@ -754,8 +762,10 @@ void ThumbnailListPrivate::mouseMoveEvent( QMouseEvent * e )
if ( e->buttons() == Qt::NoButton )
{
ThumbnailWidget* item = itemFor( e->pos() );
if ( !item ) // mouse on the spacing between items
return e->ignore();
if ( !item ) { // mouse on the spacing between items
e->ignore();
return;
}
QRect r = item->visibleRect();
const int margin = ThumbnailWidget::margin();
@ -769,11 +779,14 @@ void ThumbnailListPrivate::mouseMoveEvent( QMouseEvent * e )
setCursor( Qt::ArrowCursor );
}
return e->ignore();
e->ignore();
return;
}
// no item under the mouse or previously selected
if ( !m_mouseGrabItem )
return e->ignore();
if ( !m_mouseGrabItem ) {
e->ignore();
return;
}
const QRect r = m_mouseGrabItem->rect();
if ( !m_mouseGrabPos.isNull() )
{
@ -883,8 +896,10 @@ void ThumbnailListPrivate::mouseMoveEvent( QMouseEvent * e )
void ThumbnailListPrivate::wheelEvent( QWheelEvent * e )
{
const ThumbnailWidget* item = itemFor( e->pos() );
if ( !item ) // wheeling on the spacing between items
return e->ignore();
if ( !item ) { // wheeling on the spacing between items
e->ignore();
return;
}
const QRect r = item->visibleRect();
const int margin = ThumbnailWidget::margin();
@ -908,7 +923,7 @@ void ThumbnailListPrivate::contextMenuEvent( QContextMenuEvent * e )
}
}
void ThumbnailWidget::paint( QPainter &p, const QRect &_clipRect )
void ThumbnailWidget::paint( QPainter &p, const QRect _clipRect )
{
const int width = m_pixmapWidth + m_margin;
QRect clipRect = _clipRect;

View file

@ -62,7 +62,7 @@ Q_OBJECT
bool viewportEvent( QEvent * ) override;
Q_SIGNALS:
void rightClick( const Okular::Page *, const QPoint & );
void rightClick( const Okular::Page *, const QPoint );
private:
friend class ThumbnailListPrivate;

View file

@ -54,7 +54,7 @@ Q_OBJECT
Q_SIGNALS:
void hasTOC(bool has);
void rightClick( const Okular::DocumentViewport &, const QPoint &, const QString & );
void rightClick( const Okular::DocumentViewport &, const QPoint , const QString & );
private Q_SLOTS:
void slotExecuted( const QModelIndex & );