mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 11:40:07 +00:00
Rename the virtual closeDocument() to doCloseDocument(), and make it protected.
Added a non-virtual closeDocument() in the base Generator class: this way, particular closing routines can be implemented in the "low level" of a generator. Apart the renaming, the logic of doCloseDocument() remains the same. CCMAIL: okular-devel@kde.org svn path=/trunk/KDE/kdegraphics/okular/; revision=723046
This commit is contained in:
parent
8ff3d1d705
commit
15155d8824
|
@ -123,6 +123,11 @@ bool Generator::loadDocumentFromData( const QByteArray &, QVector< Page * > & )
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Generator::closeDocument()
|
||||
{
|
||||
return doCloseDocument();
|
||||
}
|
||||
|
||||
bool Generator::canGeneratePixmap() const
|
||||
{
|
||||
Q_D( const Generator );
|
||||
|
|
|
@ -233,7 +233,7 @@ class OKULAR_EXPORT Generator : public QObject
|
|||
*
|
||||
* @returns true on success, false otherwise.
|
||||
*/
|
||||
virtual bool closeDocument() = 0;
|
||||
bool closeDocument();
|
||||
|
||||
/**
|
||||
* This method returns whether the generator is ready to
|
||||
|
@ -391,6 +391,14 @@ class OKULAR_EXPORT Generator : public QObject
|
|||
*/
|
||||
void signalPixmapRequestDone( PixmapRequest * request );
|
||||
|
||||
/**
|
||||
* This method is called when the document is closed and not used
|
||||
* any longer.
|
||||
*
|
||||
* @returns true on success, false otherwise.
|
||||
*/
|
||||
virtual bool doCloseDocument() = 0;
|
||||
|
||||
/**
|
||||
* Returns the image of the page as specified in
|
||||
* the passed pixmap @p request.
|
||||
|
|
|
@ -260,7 +260,7 @@ bool TextDocumentGenerator::loadDocument( const QString & fileName, QVector<Okul
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TextDocumentGenerator::closeDocument()
|
||||
bool TextDocumentGenerator::doCloseDocument()
|
||||
{
|
||||
Q_D( TextDocumentGenerator );
|
||||
delete d->mDocument;
|
||||
|
|
|
@ -130,7 +130,6 @@ class OKULAR_EXPORT TextDocumentGenerator : public Generator
|
|||
|
||||
// [INHERITED] load a document and fill up the pagesVector
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
// [INHERITED] perform actions on document / pages
|
||||
bool canGeneratePixmap() const;
|
||||
|
@ -147,6 +146,7 @@ class OKULAR_EXPORT TextDocumentGenerator : public Generator
|
|||
const Okular::DocumentSynopsis* generateDocumentSynopsis();
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
Okular::TextPage* textPage( Okular::Page *page );
|
||||
|
||||
private:
|
||||
|
|
|
@ -87,7 +87,7 @@ bool CHMGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CHMGenerator::closeDocument()
|
||||
bool CHMGenerator::doCloseDocument()
|
||||
{
|
||||
// delete the document information of the old document
|
||||
delete m_docInfo;
|
||||
|
|
|
@ -31,7 +31,6 @@ class CHMGenerator : public Okular::Generator
|
|||
CHMGenerator();
|
||||
~CHMGenerator();
|
||||
bool loadDocument( const QString & fileName, QVector< Okular::Page * > & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
const Okular::DocumentInfo * generateDocumentInfo();
|
||||
const Okular::DocumentSynopsis * generateDocumentSynopsis();
|
||||
|
@ -46,6 +45,7 @@ class CHMGenerator : public Okular::Generator
|
|||
void slotCompleted();
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
Okular::TextPage* textPage( Okular::Page *page );
|
||||
|
||||
private:
|
||||
|
|
|
@ -52,7 +52,7 @@ bool ComicBookGenerator::loadDocument( const QString & fileName, QVector<Okular:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ComicBookGenerator::closeDocument()
|
||||
bool ComicBookGenerator::doCloseDocument()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ class ComicBookGenerator : public Okular::Generator
|
|||
|
||||
// [INHERITED] load a document and fill up the pagesVector
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
// [INHERITED] print document using already configured kprinter
|
||||
bool print( KPrinter& printer );
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
QImage image( Okular::PixmapRequest * request );
|
||||
|
||||
private:
|
||||
|
|
|
@ -99,7 +99,7 @@ bool DjVuGenerator::loadDocument( const QString & fileName, QVector< Okular::Pag
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DjVuGenerator::closeDocument()
|
||||
bool DjVuGenerator::doCloseDocument()
|
||||
{
|
||||
userMutex()->lock();
|
||||
m_djvu->closeFile();
|
||||
|
|
|
@ -28,7 +28,6 @@ class DjVuGenerator : public Okular::Generator
|
|||
DjVuGenerator();
|
||||
~DjVuGenerator();
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
// document information
|
||||
const Okular::DocumentInfo * generateDocumentInfo();
|
||||
|
@ -40,6 +39,7 @@ class DjVuGenerator : public Okular::Generator
|
|||
QVariant metaData( const QString & key, const QVariant & option ) const;
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
// pixmap generation
|
||||
QImage image( Okular::PixmapRequest *request );
|
||||
Okular::TextPage* textPage( Okular::Page *page );
|
||||
|
|
|
@ -55,7 +55,7 @@ bool DviGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DviGenerator::closeDocument()
|
||||
bool DviGenerator::doCloseDocument()
|
||||
{
|
||||
delete m_docInfo;
|
||||
m_docInfo = 0;
|
||||
|
|
|
@ -27,7 +27,6 @@ class DviGenerator : public Okular::Generator
|
|||
public:
|
||||
DviGenerator();
|
||||
bool loadDocument( const QString & fileName, QVector< Okular::Page * > & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
bool canGeneratePixmap() const;
|
||||
void generatePixmap( Okular::PixmapRequest * request );
|
||||
|
@ -39,6 +38,7 @@ class DviGenerator : public Okular::Generator
|
|||
const Okular::DocumentSynopsis *generateDocumentSynopsis();
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
Okular::TextPage* textPage( Okular::Page *page );
|
||||
|
||||
private:
|
||||
|
|
|
@ -199,7 +199,7 @@ bool GSGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
|
|||
return loadDocumentWithDSC(name,pagesVector,ps);
|
||||
}
|
||||
|
||||
bool GSGenerator::closeDocument()
|
||||
bool GSGenerator::doCloseDocument()
|
||||
{
|
||||
delete internalDoc;
|
||||
internalDoc = 0;
|
||||
|
|
|
@ -29,7 +29,6 @@ class GSGenerator : public Okular::Generator, public Okular::ConfigInterface, pu
|
|||
/** virtual methods to reimplement **/
|
||||
// load a document and fill up the pagesVector
|
||||
bool loadDocument( const QString & fileName, QVector< Okular::Page * > & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
// Document description and Table of contents
|
||||
const Okular::DocumentInfo * generateDocumentInfo();
|
||||
|
@ -62,6 +61,9 @@ class GSGenerator : public Okular::Generator, public Okular::ConfigInterface, pu
|
|||
public slots:
|
||||
void slotImageGenerated(QImage *img, Okular::PixmapRequest *request);
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
|
||||
private:
|
||||
// conversion handling
|
||||
bool m_converted;
|
||||
|
|
|
@ -100,7 +100,7 @@ bool KIMGIOGenerator::loadDocumentFromData( const QByteArray & fileData, QVector
|
|||
return true;
|
||||
}
|
||||
|
||||
bool KIMGIOGenerator::closeDocument()
|
||||
bool KIMGIOGenerator::doCloseDocument()
|
||||
{
|
||||
m_img = QImage();
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ class KIMGIOGenerator : public Okular::Generator, public Okular::GuiInterface
|
|||
// [INHERITED] load a document and fill up the pagesVector
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool loadDocumentFromData( const QByteArray & fileData, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
// [INHERITED] print document using already configured kprinter
|
||||
bool print( KPrinter& printer );
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
QImage image( Okular::PixmapRequest * request );
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -94,7 +94,7 @@ bool PluckerGenerator::loadDocument( const QString & fileName, QVector<Okular::P
|
|||
return true;
|
||||
}
|
||||
|
||||
bool PluckerGenerator::closeDocument()
|
||||
bool PluckerGenerator::doCloseDocument()
|
||||
{
|
||||
mLinkAdded.clear();
|
||||
mLinks.clear();
|
||||
|
|
|
@ -29,7 +29,6 @@ class PluckerGenerator : public Okular::Generator
|
|||
|
||||
// [INHERITED] load a document and fill up the pagesVector
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
// [INHERITED] document information
|
||||
const Okular::DocumentInfo * generateDocumentInfo();
|
||||
|
@ -44,6 +43,9 @@ class PluckerGenerator : public Okular::Generator
|
|||
// [INHERITED] print document using already configured kprinter
|
||||
bool print( KPrinter& printer );
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
|
||||
private:
|
||||
QList<QTextDocument*> mPages;
|
||||
QSet<int> mLinkAdded;
|
||||
|
|
|
@ -442,7 +442,7 @@ bool PDFGenerator::init(QVector<Okular::Page*> & pagesVector, const QString &wal
|
|||
return true;
|
||||
}
|
||||
|
||||
bool PDFGenerator::closeDocument()
|
||||
bool PDFGenerator::doCloseDocument()
|
||||
{
|
||||
// remove internal objects
|
||||
userMutex()->lock();
|
||||
|
|
|
@ -55,7 +55,6 @@ class PDFGenerator : public Okular::Generator, public Okular::ConfigInterface, p
|
|||
// [INHERITED] load a document and fill up the pagesVector
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool loadDocumentFromData( const QByteArray & fileData, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
void loadPages(QVector<Okular::Page*> &pagesVector, int rotation=-1, bool clear=false);
|
||||
// [INHERITED] document information
|
||||
const Okular::DocumentInfo * generateDocumentInfo();
|
||||
|
@ -89,6 +88,7 @@ class PDFGenerator : public Okular::Generator, public Okular::ConfigInterface, p
|
|||
KPrintDialogPage* printConfigurationWidget() const;
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
Okular::TextPage* textPage( Okular::Page *page );
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -86,7 +86,7 @@ bool TIFFGenerator::loadDocument( const QString & fileName, QVector<Okular::Page
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TIFFGenerator::closeDocument()
|
||||
bool TIFFGenerator::doCloseDocument()
|
||||
{
|
||||
// closing the old document
|
||||
if ( d->tiff )
|
||||
|
|
|
@ -20,13 +20,13 @@ class TIFFGenerator : public Okular::Generator
|
|||
virtual ~TIFFGenerator();
|
||||
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
const Okular::DocumentInfo * generateDocumentInfo();
|
||||
|
||||
bool print( KPrinter& printer );
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
QImage image( Okular::PixmapRequest * request );
|
||||
|
||||
private:
|
||||
|
|
|
@ -1376,7 +1376,7 @@ bool XpsGenerator::loadDocument( const QString & fileName, QVector<Okular::Page*
|
|||
return true;
|
||||
}
|
||||
|
||||
bool XpsGenerator::closeDocument()
|
||||
bool XpsGenerator::doCloseDocument()
|
||||
{
|
||||
m_xpsFile->closeDocument();
|
||||
delete m_xpsFile;
|
||||
|
|
|
@ -266,14 +266,15 @@ class XpsGenerator : public Okular::Generator
|
|||
virtual ~XpsGenerator();
|
||||
|
||||
bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
|
||||
bool closeDocument();
|
||||
|
||||
const Okular::DocumentInfo * generateDocumentInfo();
|
||||
const Okular::DocumentSynopsis * generateDocumentSynopsis();
|
||||
|
||||
Okular::ExportFormat::List exportFormats() const;
|
||||
bool exportTo( const QString &fileName, const Okular::ExportFormat &format );
|
||||
|
||||
protected:
|
||||
bool doCloseDocument();
|
||||
QImage image( Okular::PixmapRequest *page );
|
||||
Okular::TextPage* textPage( Okular::Page * page );
|
||||
|
||||
|
|
Loading…
Reference in a new issue