mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
#1401 Add ModelChangeDetector
This commit is contained in:
parent
1e3af05879
commit
82b6e4b8f2
@ -28,6 +28,8 @@ set( PROJECT_FILES
|
|||||||
cafPdmUiFieldSpecialization.h
|
cafPdmUiFieldSpecialization.h
|
||||||
cafPdmUiItem.cpp
|
cafPdmUiItem.cpp
|
||||||
cafPdmUiItem.h
|
cafPdmUiItem.h
|
||||||
|
cafPdmUiModelChangeDetector.cpp
|
||||||
|
cafPdmUiModelChangeDetector.h
|
||||||
cafPdmUiObjectEditorHandle.cpp
|
cafPdmUiObjectEditorHandle.cpp
|
||||||
cafPdmUiObjectEditorHandle.h
|
cafPdmUiObjectEditorHandle.h
|
||||||
cafPdmUiObjectHandle.cpp
|
cafPdmUiObjectHandle.cpp
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "cafAssert.h"
|
#include "cafAssert.h"
|
||||||
#include "cafPdmFieldHandle.h"
|
#include "cafPdmFieldHandle.h"
|
||||||
|
#include "cafPdmUiModelChangeDetector.h"
|
||||||
#include "cafPdmUiObjectHandle.h"
|
#include "cafPdmUiObjectHandle.h"
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
@ -38,6 +38,8 @@ void PdmUiFieldHandle::notifyFieldChanged(const QVariant& oldFieldValue, const Q
|
|||||||
|
|
||||||
// Update field editors
|
// Update field editors
|
||||||
this->updateConnectedEditors();
|
this->updateConnectedEditors();
|
||||||
|
|
||||||
|
PdmUiModelChangeDetector::instance()->setModelIsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
//##################################################################################################
|
||||||
|
//
|
||||||
|
// Copyright (C) Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// This library may be used under the terms of either the GNU General Public License or
|
||||||
|
// the GNU Lesser General Public License as follows:
|
||||||
|
//
|
||||||
|
// GNU General Public License Usage
|
||||||
|
// This library 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 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
// GNU Lesser General Public License Usage
|
||||||
|
// This library is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
//##################################################################################################
|
||||||
|
|
||||||
|
#include "cafPdmUiModelChangeDetector.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace caf {
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmUiModelChangeDetector::PdmUiModelChangeDetector()
|
||||||
|
: m_modelIsChanged(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmUiModelChangeDetector* PdmUiModelChangeDetector::instance()
|
||||||
|
{
|
||||||
|
static PdmUiModelChangeDetector staticInstance;
|
||||||
|
|
||||||
|
return &staticInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void PdmUiModelChangeDetector::setModelIsChanged()
|
||||||
|
{
|
||||||
|
m_modelIsChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void PdmUiModelChangeDetector::reset()
|
||||||
|
{
|
||||||
|
m_modelIsChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool PdmUiModelChangeDetector::isModelChanged() const
|
||||||
|
{
|
||||||
|
return m_modelIsChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end namespace caf
|
@ -0,0 +1,58 @@
|
|||||||
|
//##################################################################################################
|
||||||
|
//
|
||||||
|
// Copyright (C) Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// This library may be used under the terms of either the GNU General Public License or
|
||||||
|
// the GNU Lesser General Public License as follows:
|
||||||
|
//
|
||||||
|
// GNU General Public License Usage
|
||||||
|
// This library 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 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
// GNU Lesser General Public License Usage
|
||||||
|
// This library is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
//##################################################################################################
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
|
||||||
|
class PdmUiModelChangeDetector
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static PdmUiModelChangeDetector* instance();
|
||||||
|
|
||||||
|
void setModelIsChanged();
|
||||||
|
void reset();
|
||||||
|
bool isModelChanged() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
PdmUiModelChangeDetector();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_modelIsChanged;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // End of namespace caf
|
||||||
|
|
Loading…
Reference in New Issue
Block a user