Skip to content

Commit

Permalink
App/DocumentObserver: make slot methods unimplemented rather pure-vir…
Browse files Browse the repository at this point in the history
…tual and clenup derived classes accordingly
  • Loading branch information
Fat-Zer authored and wwmayer committed Sep 2, 2015
1 parent 3f83501 commit 0603c3f
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 99 deletions.
15 changes: 10 additions & 5 deletions src/App/DocumentObserver.h
Expand Up @@ -61,15 +61,20 @@ class AppExport DocumentObserver

private:
/** Checks if a new document was created */
virtual void slotCreatedDocument(const App::Document& Doc) = 0;
virtual void slotCreatedDocument(const App::Document& Doc)
{}
/** Checks if the given document is about to be closed */
virtual void slotDeletedDocument(const App::Document& Doc) = 0;
virtual void slotDeletedDocument(const App::Document& Doc)
{}
/** Checks if a new object was added. */
virtual void slotCreatedObject(const App::DocumentObject& Obj) = 0;
virtual void slotCreatedObject(const App::DocumentObject& Obj)
{}
/** Checks if the given object is about to be removed. */
virtual void slotDeletedObject(const App::DocumentObject& Obj) = 0;
virtual void slotDeletedObject(const App::DocumentObject& Obj)
{}
/** The property of an observed object has changed */
virtual void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop) = 0;
virtual void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{}

protected:
Document* getDocument() const;
Expand Down
12 changes: 0 additions & 12 deletions src/Mod/Fem/Gui/ActiveAnalysisObserver.cpp
Expand Up @@ -80,10 +80,6 @@ void ActiveAnalysisObserver::highlightActiveObject(const Gui::HighlightMode& mod
activeDocument->signalHighlightObject(*activeView, mode, on);
}

void ActiveAnalysisObserver::slotCreatedDocument(const App::Document& Doc)
{
}

void ActiveAnalysisObserver::slotDeletedDocument(const App::Document& Doc)
{
App::Document* d = getDocument();
Expand All @@ -95,18 +91,10 @@ void ActiveAnalysisObserver::slotDeletedDocument(const App::Document& Doc)
}
}

void ActiveAnalysisObserver::slotCreatedObject(const App::DocumentObject& Obj)
{
}

void ActiveAnalysisObserver::slotDeletedObject(const App::DocumentObject& Obj)
{
if (activeObject == &Obj) {
activeObject = 0;
activeView = 0;
}
}

void ActiveAnalysisObserver::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{
}
3 changes: 0 additions & 3 deletions src/Mod/Fem/Gui/ActiveAnalysisObserver.h
Expand Up @@ -50,11 +50,8 @@ class ActiveAnalysisObserver : public App::DocumentObserver
ActiveAnalysisObserver();
~ActiveAnalysisObserver();

void slotCreatedDocument(const App::Document& Doc);
void slotDeletedDocument(const App::Document& Doc);
void slotCreatedObject(const App::DocumentObject& Obj);
void slotDeletedObject(const App::DocumentObject& Obj);
void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop);

private:
static ActiveAnalysisObserver* inst;
Expand Down
4 changes: 0 additions & 4 deletions src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp
Expand Up @@ -148,10 +148,6 @@ void DlgEvaluateMeshImp::slotChangedObject(const App::DocumentObject& Obj, const
}
}

void DlgEvaluateMeshImp::slotCreatedDocument(const App::Document& Doc)
{
}

void DlgEvaluateMeshImp::slotDeletedDocument(const App::Document& Doc)
{
if (&Doc == getDocument()) {
Expand Down
2 changes: 0 additions & 2 deletions src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h
Expand Up @@ -72,8 +72,6 @@ class DlgEvaluateMeshImp : public QDialog, public Ui_DlgEvaluateMesh, public App
void setMesh( Mesh::Feature* );

private:
/** Checks if a new document was created */
void slotCreatedDocument(const App::Document& Doc);
/** Checks if the given document is about to be closed */
void slotDeletedDocument(const App::Document& Doc);
/** Checks if a new object was added. */
Expand Down
16 changes: 0 additions & 16 deletions src/Mod/Mesh/Gui/ViewProviderCurvature.cpp
Expand Up @@ -224,14 +224,6 @@ void ViewProviderMeshCurvature::init(const Mesh::PropertyCurvatureList* pCurvInf
pcColorBar->setRange( fMin, fMax, 3 );
}

void ViewProviderMeshCurvature::slotCreatedObject(const App::DocumentObject& Obj)
{
}

void ViewProviderMeshCurvature::slotDeletedObject(const App::DocumentObject& Obj)
{
}

void ViewProviderMeshCurvature::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{
// we get this for any object for that a property has changed. Thus, we must regard that object
Expand All @@ -248,14 +240,6 @@ void ViewProviderMeshCurvature::slotChangedObject(const App::DocumentObject& Obj
}
}

void ViewProviderMeshCurvature::slotCreatedDocument(const App::Document& Doc)
{
}

void ViewProviderMeshCurvature::slotDeletedDocument(const App::Document& Doc)
{
}

void ViewProviderMeshCurvature::attach(App::DocumentObject *pcFeat)
{
// creats the standard viewing modes
Expand Down
9 changes: 0 additions & 9 deletions src/Mod/Mesh/Gui/ViewProviderCurvature.h
Expand Up @@ -101,15 +101,6 @@ class MeshGuiExport ViewProviderMeshCurvature : public Gui::ViewProviderDocument
private:
void init(const Mesh::PropertyCurvatureList *prop);

/** Checks if a new document was created */
void slotCreatedDocument(const App::Document& Doc);
/** Checks if the given document is about to be closed */
void slotDeletedDocument(const App::Document& Doc);
/** Checks if a new object was added. */
void slotCreatedObject(const App::DocumentObject& Obj);
/** Checks if the given object is about to be removed. */
void slotDeletedObject(const App::DocumentObject& Obj);
/** The property of an observed object has changed */
void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop);

protected:
Expand Down
16 changes: 0 additions & 16 deletions src/Mod/Sandbox/App/DocumentProtector.cpp
Expand Up @@ -254,29 +254,13 @@ void DocumentProtector::init()
moveToThread(QCoreApplication::instance()->thread());
}

void DocumentProtector::slotCreatedDocument(const App::Document& Doc)
{
}

void DocumentProtector::slotDeletedDocument(const App::Document& Doc)
{
if (&Doc == getDocument()) {
this->detachDocument();
}
}

void DocumentProtector::slotCreatedObject(const App::DocumentObject& Obj)
{
}

void DocumentProtector::slotDeletedObject(const App::DocumentObject& Obj)
{
}

void DocumentProtector::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{
}

void DocumentProtector::validate()
{
if (!this->getDocument())
Expand Down
12 changes: 0 additions & 12 deletions src/Mod/Sandbox/Gui/AppSandboxGui.cpp
Expand Up @@ -61,18 +61,6 @@ class ObjectObserver : public App::DocumentObserver
{
}
private:
void slotCreatedDocument(const App::Document& Doc)
{
}
void slotDeletedDocument(const App::Document& Doc)
{
}
void slotCreatedObject(const App::DocumentObject& Obj)
{
}
void slotDeletedObject(const App::DocumentObject& Obj)
{
}
void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{
if (object == &Obj && Prop.getTypeId() == Part::PropertyGeometryList::getClassTypeId()) {
Expand Down
18 changes: 0 additions & 18 deletions src/Mod/Spreadsheet/App/SheetObserver.cpp
Expand Up @@ -42,24 +42,6 @@ SheetObserver::SheetObserver(App::Document * document, PropertySheet *_sheet)
{
}

/**
* Unimplemented.
*
*/

void SheetObserver::slotCreatedDocument(const App::Document &Doc)
{
}

/**
* Unimplemented.
*
*/

void SheetObserver::slotDeletedDocument(const App::Document &Doc)
{
}

/**
* Invalidate cells that depend on this document object.
*
Expand Down
2 changes: 0 additions & 2 deletions src/Mod/Spreadsheet/App/SheetObserver.h
Expand Up @@ -33,8 +33,6 @@ class SheetObserver : public App::DocumentObserver {
public:
SheetObserver(App::Document* document, PropertySheet *_sheet);
~SheetObserver() { }
virtual void slotCreatedDocument(const App::Document& Doc);
virtual void slotDeletedDocument(const App::Document& Doc);
virtual void slotCreatedObject(const App::DocumentObject& Obj);
virtual void slotDeletedObject(const App::DocumentObject& Obj);
virtual void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop);
Expand Down

0 comments on commit 0603c3f

Please sign in to comment.