delete copy constructor and assignment operator of some internal classes

they are unused(except the PageViewItem one), but if anyone would use
them things would go wrong, so protect us from it

Actually fixes a bug in PageView::slotFitWindowToPage in which we were
copying constructing PageViewItem and that's bad
This commit is contained in:
Albert Astals Cid 2019-01-10 00:28:49 +01:00
parent ff2f60754d
commit 47d7d04b5e
23 changed files with 87 additions and 3 deletions

View file

@ -77,6 +77,9 @@ public:
delete m_buffer;
}
PlayData(const PlayData &) = delete;
PlayData &operator=(const PlayData &) = delete;
Phonon::MediaObject * m_mediaobject;
Phonon::AudioOutput * m_output;
QBuffer * m_buffer;

View file

@ -46,6 +46,9 @@ class OKULARCORE_EXPORT TextSelection
*/
~TextSelection();
TextSelection(const TextSelection &) = delete;
TextSelection &operator=(const TextSelection &) = delete;
/**
* Changes the end point of the selection to the given @p point.
*/

View file

@ -24,6 +24,9 @@ class ExecutorKJS
explicit ExecutorKJS( DocumentPrivate *doc );
~ExecutorKJS();
ExecutorKJS(const ExecutorKJS &) = delete;
ExecutorKJS &operator=(const ExecutorKJS &) = delete;
void execute( const QString &script, Event *event );
private:

View file

@ -30,6 +30,9 @@ class Scripter
public:
~Scripter();
Scripter(const Scripter &) = delete;
Scripter &operator=(const Scripter &) = delete;
QString execute( ScriptType type, const QString &script );
void setEvent( Event *event );

View file

@ -107,6 +107,9 @@ class TilesManager
TilesManager( int pageNumber, int width, int height, Rotation rotation = Rotation0 );
~TilesManager();
TilesManager(const TilesManager &) = delete;
TilesManager &operator=(const TilesManager &) = delete;
/**
* Sets the pixmap of the tiles covered by @p rect (which represents
* the location of @p pixmap on the page).

View file

@ -32,6 +32,9 @@ struct UnrarHelper
UnrarHelper();
~UnrarHelper();
UnrarHelper(const UnrarHelper &) = delete;
UnrarHelper &operator=(const UnrarHelper &) = delete;
UnrarFlavour *kind;
QString unrarPath;
QString lsarPath;

View file

@ -34,6 +34,9 @@ class KDjVu
KDjVu();
~KDjVu();
KDjVu(const KDjVu &) = delete;
KDjVu &operator=(const KDjVu &) = delete;
/**
* A DjVu page.
*/

View file

@ -31,6 +31,9 @@ class macro {
macro();
~macro();
macro(const macro &) = delete;
macro &operator=(const macro &) = delete;
// address of first byte of macro
unsigned char* pos;
// address of last+1 byte
@ -72,6 +75,9 @@ class TeXFontDefinition {
class fontPool *pool, double _enlargement);
~TeXFontDefinition();
TeXFontDefinition(const TeXFontDefinition &) = delete;
TeXFontDefinition &operator=(const TeXFontDefinition &) = delete;
void reset();
void fontNameReceiver(const QString&);

View file

@ -32,6 +32,9 @@ class dvifile : public bigEndianByteReader
~dvifile();
dvifile(const dvifile &) = delete;
dvifile &operator=(const dvifile &) = delete;
fontPool * font_pool;
QString filename;
QString generatorString;

View file

@ -21,6 +21,9 @@ class fontEncodingPool {
fontEncodingPool();
~fontEncodingPool();
fontEncodingPool(const fontEncodingPool &) = delete;
fontEncodingPool &operator=(const fontEncodingPool &) = delete;
fontEncoding *findByName(const QString &name);
private:

View file

@ -10,6 +10,9 @@
struct bitmap {
bitmap();
~bitmap();
bitmap(const bitmap &) = delete;
bitmap &operator=(const bitmap &) = delete;
// width and height in pixels
quint16 w, h;

View file

@ -27,6 +27,9 @@ public:
pageInfo(const QString& _PostScriptString);
~pageInfo();
pageInfo(const pageInfo &) = delete;
pageInfo &operator=(const pageInfo &) = delete;
QColor background;
QColor permanentBackground;
QString *PostScriptString;

View file

@ -24,6 +24,9 @@ class Document
explicit Document( const QString &fileName );
~Document();
Document(const Document &) = delete;
Document &operator=(const Document &) = delete;
bool open( const QString &password );
QString lastErrorString() const;

View file

@ -215,6 +215,9 @@ class Manifest
~Manifest();
Manifest(const Manifest &) = delete;
Manifest &operator=(const Manifest &) = delete;
/**
Check if the manifest indicates that a file is encrypted
*/

View file

@ -50,6 +50,9 @@ class QUnpluck
QUnpluck();
~QUnpluck();
QUnpluck(const QUnpluck &) = delete;
QUnpluck &operator=(const QUnpluck &) = delete;
bool open( const QString &fileName );
QList<QTextDocument*> pages() const { return mPages; }

View file

@ -99,6 +99,9 @@ struct XpsPathGeometry
qDeleteAll( paths );
}
XpsPathGeometry(const XpsPathGeometry &) = delete;
XpsPathGeometry &operator=(const XpsPathGeometry &) = delete;
QList< XpsPathFigure* > paths;
Qt::FillRule fillRule;
XpsMatrixTransform transform;
@ -153,6 +156,9 @@ public:
XpsPage(XpsFile *file, const QString &fileName);
~XpsPage();
XpsPage(const XpsPage &) = delete;
XpsPage &operator=(const XpsPage &) = delete;
QSizeF size() const;
bool renderToImage( QImage *p );
bool renderToPainter( QPainter *painter );
@ -189,6 +195,9 @@ public:
XpsDocument(XpsFile *file, const QString &fileName);
~XpsDocument();
XpsDocument(const XpsDocument &) = delete;
XpsDocument &operator=(const XpsDocument &) = delete;
/**
the total number of pages in this document
*/
@ -234,6 +243,9 @@ public:
XpsFile();
~XpsFile();
XpsFile(const XpsFile &) = delete;
XpsFile &operator=(const XpsFile &) = delete;
bool loadDocument( const QString & fileName );
bool closeDocument();

View file

@ -32,6 +32,9 @@ struct AnnItem
AnnItem( AnnItem *parent, int page );
~AnnItem();
AnnItem(const AnnItem &) = delete;
AnnItem &operator=(const AnnItem &) = delete;
AnnItem *parent;
QList< AnnItem* > children;

View file

@ -287,6 +287,9 @@ class AuthorGroupItem
qDeleteAll( mChilds );
}
AuthorGroupItem(const AuthorGroupItem &) = delete;
AuthorGroupItem &operator=(const AuthorGroupItem &) = delete;
void appendChild( AuthorGroupItem *child ) { mChilds.append( child ); }
AuthorGroupItem* parent() const { return mParent; }
AuthorGroupItem* child( int row ) const { return mChilds.value( row ); }

View file

@ -36,6 +36,9 @@ public:
LatexRenderer();
~LatexRenderer();
LatexRenderer(const LatexRenderer &) = delete;
LatexRenderer &operator=(const LatexRenderer &) = delete;
Error renderLatexInHtml( QString& html, const QColor &textColor, int fontSize, int resolution, QString &latexOutput );
static bool mightContainLatex ( const QString& text );

View file

@ -5548,17 +5548,21 @@ void PageView::slotToggleChangeColors()
void PageView::slotFitWindowToPage()
{
PageViewItem currentPageItem = nullptr;
const PageViewItem *currentPageItem = nullptr;
QSize viewportSize = viewport()->size();
foreach ( const PageViewItem * pageItem, d->items )
{
if ( pageItem->isVisible() )
{
currentPageItem = *pageItem;
currentPageItem = pageItem;
break;
}
}
const QSize pageSize = QSize( currentPageItem.uncroppedWidth() + kcolWidthMargin, currentPageItem.uncroppedHeight() + krowHeightMargin );
if ( !currentPageItem )
return;
const QSize pageSize = QSize( currentPageItem->uncroppedWidth() + kcolWidthMargin, currentPageItem->uncroppedHeight() + krowHeightMargin );
if ( verticalScrollBar()->isVisible() )
viewportSize.setWidth( viewportSize.width() + verticalScrollBar()->width() );
if ( horizontalScrollBar()->isVisible() )

View file

@ -46,6 +46,9 @@ class PageViewItem
PageViewItem( const Okular::Page * page );
~PageViewItem();
PageViewItem(const PageViewItem &) = delete;
PageViewItem &operator=(const PageViewItem &) = delete;
const Okular::Page * page() const;
int pageNumber() const;
double zoomFactor() const;

View file

@ -78,11 +78,16 @@
// transition effect to the next frame
struct PresentationFrame
{
PresentationFrame() = default;
~PresentationFrame()
{
qDeleteAll( videoWidgets );
}
PresentationFrame(const PresentationFrame &) = delete;
PresentationFrame &operator=(const PresentationFrame &) = delete;
void recalcGeometry( int width, int height, float screenRatio )
{
// calculate frame geometry keeping constant aspect ratio

View file

@ -28,6 +28,9 @@ struct TOCItem
TOCItem( TOCItem *parent, const QDomElement &e );
~TOCItem();
TOCItem(const TOCItem &) = delete;
TOCItem &operator=(const TOCItem &) = delete;
QString text;
Okular::DocumentViewport viewport;
QString extFileName;