mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
AppFwk: Remove NotificationCenter from SelectionManager
This commit is contained in:
parent
1a3f9e87ae
commit
8e53e2a3cf
@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include "cafNotificationCenter.h"
|
|
||||||
#include "cafPdmReferenceHelper.h"
|
#include "cafPdmReferenceHelper.h"
|
||||||
#include "cafPdmUiFieldHandle.h"
|
#include "cafPdmUiFieldHandle.h"
|
||||||
#include "cafPdmUiObjectHandle.h"
|
#include "cafPdmUiObjectHandle.h"
|
||||||
@ -57,6 +56,14 @@ SelectionManager* SelectionManager::instance()
|
|||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Obsolete. Do not use this method.
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::NotificationCenter* SelectionManager::notificationCenter()
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -143,7 +150,6 @@ SelectionManager::SelectionManager()
|
|||||||
{
|
{
|
||||||
m_selectionForRole.resize(UNDEFINED);
|
m_selectionForRole.resize(UNDEFINED);
|
||||||
|
|
||||||
m_notificationCenter = nullptr;
|
|
||||||
m_activeChildArrayFieldHandle = nullptr;
|
m_activeChildArrayFieldHandle = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,33 +238,12 @@ void SelectionManager::clear(int role)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void SelectionManager::notifySelectionChanged()
|
void SelectionManager::notifySelectionChanged()
|
||||||
{
|
{
|
||||||
if (m_notificationCenter)
|
|
||||||
{
|
|
||||||
m_notificationCenter->notifyObserversOfSelectionChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto receiver: m_selectionReceivers)
|
for (auto receiver: m_selectionReceivers)
|
||||||
{
|
{
|
||||||
receiver->onSelectionManagerSelectionChanged();
|
receiver->onSelectionManagerSelectionChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void SelectionManager::setNotificationCenter(NotificationCenter* notificationCenter)
|
|
||||||
{
|
|
||||||
m_notificationCenter = notificationCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
NotificationCenter* SelectionManager::notificationCenter()
|
|
||||||
{
|
|
||||||
return m_notificationCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -65,29 +65,29 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SelectionManager* instance();
|
static SelectionManager* instance();
|
||||||
|
|
||||||
void setNotificationCenter(NotificationCenter* notificationCenter);
|
// OBSOLETE ! Remove when time to refactor the command system
|
||||||
NotificationCenter* notificationCenter();
|
NotificationCenter* notificationCenter();
|
||||||
|
|
||||||
void setActiveChildArrayFieldHandle(PdmChildArrayFieldHandle* childArray);
|
void setActiveChildArrayFieldHandle(PdmChildArrayFieldHandle* childArray);
|
||||||
PdmChildArrayFieldHandle* activeChildArrayFieldHandle();
|
PdmChildArrayFieldHandle* activeChildArrayFieldHandle();
|
||||||
|
|
||||||
void setPdmRootObject(PdmObjectHandle* root);
|
void setPdmRootObject(PdmObjectHandle* root);
|
||||||
PdmObjectHandle* pdmRootObject() { return m_rootObject; }
|
PdmObjectHandle* pdmRootObject() { return m_rootObject; }
|
||||||
|
|
||||||
PdmUiItem* selectedItem(int role = SelectionManager::APPLICATION_GLOBAL);
|
PdmUiItem* selectedItem(int role = SelectionManager::APPLICATION_GLOBAL);
|
||||||
void setSelectedItem(PdmUiItem* item, int role = SelectionManager::APPLICATION_GLOBAL);
|
void setSelectedItem(PdmUiItem* item, int role = SelectionManager::APPLICATION_GLOBAL);
|
||||||
|
|
||||||
void selectedItems(std::vector<PdmUiItem*>& items, int role = SelectionManager::APPLICATION_GLOBAL);
|
void selectedItems(std::vector<PdmUiItem*>& items, int role = SelectionManager::APPLICATION_GLOBAL);
|
||||||
void setSelectedItems(const std::vector<PdmUiItem*>& items, int role = SelectionManager::APPLICATION_GLOBAL);
|
void setSelectedItems(const std::vector<PdmUiItem*>& items, int role = SelectionManager::APPLICATION_GLOBAL);
|
||||||
|
|
||||||
void selectionAsReferences(std::vector<QString>& referenceList, int role = SelectionManager::APPLICATION_GLOBAL) const;
|
void selectionAsReferences(std::vector<QString>& referenceList, int role = SelectionManager::APPLICATION_GLOBAL) const;
|
||||||
void setSelectionFromReferences(const std::vector<QString>& referenceList, int role = SelectionManager::APPLICATION_GLOBAL);
|
void setSelectionFromReferences(const std::vector<QString>& referenceList, int role = SelectionManager::APPLICATION_GLOBAL);
|
||||||
|
|
||||||
void clearAll();
|
void clearAll();
|
||||||
void clear(int role);
|
void clear(int role);
|
||||||
void removeObjectFromAllSelections(PdmObjectHandle* pdmObject);
|
void removeObjectFromAllSelections(PdmObjectHandle* pdmObject);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void objectsByType(std::vector<T*>* typedObjects, int role = SelectionManager::APPLICATION_GLOBAL)
|
void objectsByType(std::vector<T*>* typedObjects, int role = SelectionManager::APPLICATION_GLOBAL)
|
||||||
@ -122,6 +122,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SelectionManager();
|
SelectionManager();
|
||||||
|
|
||||||
void notifySelectionChanged();
|
void notifySelectionChanged();
|
||||||
|
|
||||||
friend class SelectionChangedReceiver;
|
friend class SelectionChangedReceiver;
|
||||||
@ -131,7 +132,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
std::vector < std::vector< std::pair<PdmPointer<PdmObjectHandle>, PdmUiItem*> > > m_selectionForRole;
|
std::vector < std::vector< std::pair<PdmPointer<PdmObjectHandle>, PdmUiItem*> > > m_selectionForRole;
|
||||||
|
|
||||||
NotificationCenter* m_notificationCenter;
|
|
||||||
PdmChildArrayFieldHandle* m_activeChildArrayFieldHandle;
|
PdmChildArrayFieldHandle* m_activeChildArrayFieldHandle;
|
||||||
PdmPointer<PdmObjectHandle> m_rootObject;
|
PdmPointer<PdmObjectHandle> m_rootObject;
|
||||||
|
|
||||||
|
@ -110,10 +110,9 @@ public:
|
|||||||
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
||||||
QTableView* tableView();
|
QTableView* tableView();
|
||||||
|
|
||||||
|
protected:
|
||||||
QWidget* createEditorWidget(QWidget * parent) override;
|
QWidget* createEditorWidget(QWidget * parent) override;
|
||||||
QWidget* createLabelWidget(QWidget * parent) override;
|
QWidget* createLabelWidget(QWidget * parent) override;
|
||||||
protected:
|
|
||||||
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||||
|
|
||||||
virtual void onSelectionManagerSelectionChanged() override;
|
virtual void onSelectionManagerSelectionChanged() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user