Moved dummy implementation of DocumentObserver in observer.cpp,

so we are free to change behaviour later.

API & documentation cleanup

@pinto Can you check the comments please, whether they are correct?

svn path=/trunk/playground/graphics/okular/; revision=610731
remotes/origin/KDE/4.0
Tobias Koenig 20 years ago
parent 9e0ccabb58
commit 60ef83b026
  1. 1
      CMakeLists.txt
  2. 42
      core/observer.cpp
  3. 51
      core/observer.h

@ -36,6 +36,7 @@ set(okularcore_SRCS
core/document.cpp
core/generator.cpp
core/link.cpp
core/observer.cpp
core/page.cpp
core/pagetransition.cpp
core/rotationjob.cpp

@ -0,0 +1,42 @@
/***************************************************************************
* Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> *
* Copyright (C) 2005 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "observer.h"
using namespace Okular;
DocumentObserver::~DocumentObserver()
{
}
void DocumentObserver::notifySetup( const QVector< Okular::Page * >&, bool )
{
}
void DocumentObserver::notifyViewportChanged( bool )
{
}
void DocumentObserver::notifyPageChanged( int, int )
{
}
void DocumentObserver::notifyContentsCleared( int )
{
}
void DocumentObserver::notifyVisibleRectsChanged()
{
}
bool DocumentObserver::canUnloadPixmap( int ) const
{
return true;
}

@ -52,7 +52,7 @@ class DocumentObserver
/**
* Destroys the document observer.
*/
virtual ~DocumentObserver() {};
virtual ~DocumentObserver();
/**
* Must return an unique ID for each observer (used for notifications).
@ -83,14 +83,49 @@ class DocumentObserver
VisibleAreas = 16 ///< The visible are changed
};
virtual void notifySetup( const QVector< Okular::Page * > &/*pages*/, bool /*documentChanged*/ ) {};
virtual void notifyViewportChanged( bool /*smoothMove*/ ) {};
virtual void notifyPageChanged( int /*pageNumber*/, int /*changedFlags*/ ) {};
virtual void notifyContentsCleared( int /*changedFlags*/ ) {};
virtual void notifyVisibleRectsChanged() {};
/**
* This method is called whenever the document is initialized or reconstructed.
*
* @param pages The vector of pages of the document.
* @param documentChanged If true, the document is reconstructed.
*/
virtual void notifySetup( const QVector< Okular::Page * > &pages, bool documentChanged );
/**
* This method is called whenever the viewport has been changed.
*
* @param smoothMove If true, the move shall be animated.
*/
virtual void notifyViewportChanged( bool smoothMove );
/**
* This method is called whenever the content on @p page described by the
* passed @p flags has been changed.
*/
virtual void notifyPageChanged( int page, int flags );
/**
* This method is called whenever the content described by the passed @p flags
* has been cleared.
*/
virtual void notifyContentsCleared( int flags );
/**
* This method is called whenever the visible rects have been changed.
*/
virtual void notifyVisibleRectsChanged();
/**
* Returns whether the observer agrees that all pixmaps for the given
* @p page can be unloaded to improve memory usage.
*
* Returns true per default.
*/
virtual bool canUnloadPixmap( int page ) const;
// queries to observers
virtual bool canUnloadPixmap( int /*pageNum*/ ) const { return true; }
private:
class Private;
Private* d;
};
}

Loading…
Cancel
Save