Skip to content

Commit

Permalink
#5408: Remove now redundant signals from IUndoSystem that are covered…
Browse files Browse the repository at this point in the history
… by signal_undoEvent()
  • Loading branch information
codereader committed Oct 29, 2021
1 parent 74e6d3e commit 4e9291a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 44 deletions.
6 changes: 0 additions & 6 deletions include/iundo.h
Expand Up @@ -82,12 +82,6 @@ class IUndoSystem
// Returns true if an operation is already started
virtual bool operationStarted() const = 0;

// Emitted after an undo operation is fully completed, allows objects to refresh their state
virtual sigc::signal<void>& signal_postUndo() = 0;

// Emitted after a redo operation is fully completed, allows objects to refresh their state
virtual sigc::signal<void>& signal_postRedo() = 0;

// greebo: This finishes the current operation and removes
// it immediately from the stack, therefore it never existed.
virtual void cancel() = 0;
Expand Down
14 changes: 2 additions & 12 deletions radiantcore/map/Map.cpp
Expand Up @@ -91,8 +91,6 @@ void Map::clearMapResource()

void Map::connectToUndoSystem()
{
_postUndoListener.disconnect();
_postRedoListener.disconnect();
_modifiedStatusListener.disconnect();
_undoEventListener.disconnect();

Expand All @@ -102,14 +100,6 @@ void Map::connectToUndoSystem()

if (!_resource->getRootNode()) return;

_postUndoListener = _resource->getRootNode()->getUndoSystem().signal_postUndo().connect([this]()
{
_mapPostUndoSignal.emit();
});
_postRedoListener = _resource->getRootNode()->getUndoSystem().signal_postRedo().connect([this]()
{
_mapPostRedoSignal.emit();
});
_undoEventListener = _resource->getRootNode()->getUndoSystem().signal_undoEvent().connect(
sigc::mem_fun(this, &Map::onUndoEvent)
);
Expand All @@ -124,10 +114,12 @@ void Map::onUndoEvent(IUndoSystem::EventType type, const std::string& operationN
break;

case IUndoSystem::EventType::OperationUndone:
_mapPostUndoSignal.emit();
OperationMessage::Send(fmt::format(_("Undo: {0}"), operationName));
break;

case IUndoSystem::EventType::OperationRedone:
_mapPostRedoSignal.emit();
OperationMessage::Send(fmt::format(_("Redo: {0}"), operationName));
break;
}
Expand Down Expand Up @@ -1499,8 +1491,6 @@ void Map::initialiseModule(const IApplicationContext& ctx)

void Map::shutdownModule()
{
_postUndoListener.disconnect();
_postRedoListener.disconnect();
_undoEventListener.disconnect();

abortMergeOperation();
Expand Down
2 changes: 0 additions & 2 deletions radiantcore/map/Map.h
Expand Up @@ -75,8 +75,6 @@ class Map :
std::list<scene::MergeActionNodeBase::Ptr> _mergeActionNodes;
sigc::connection _mergeOperationListener;

sigc::connection _postUndoListener;
sigc::connection _postRedoListener;
sigc::connection _modifiedStatusListener;
sigc::connection _undoEventListener;

Expand Down
15 changes: 0 additions & 15 deletions radiantcore/undo/UndoSystem.cpp
Expand Up @@ -97,8 +97,6 @@ void UndoSystem::undo()
_undoStack.pop_back();
_eventSignal.emit(EventType::OperationUndone, operationName);

_signalPostUndo.emit();

// Trigger the onPostUndo event on all scene nodes
GlobalSceneGraph().foreachNode([&] (const scene::INodePtr& node)->bool
{
Expand Down Expand Up @@ -133,8 +131,6 @@ void UndoSystem::redo()
_redoStack.pop_back();
_eventSignal.emit(EventType::OperationRedone, operationName);

_signalPostRedo.emit();

// Trigger the onPostRedo event on all scene nodes
GlobalSceneGraph().foreachNode([&] (const scene::INodePtr& node)->bool
{
Expand All @@ -156,17 +152,6 @@ void UndoSystem::clear()
// there are some "persistent" observers like EntityInspector and ShaderClipboard
}

sigc::signal<void>& UndoSystem::signal_postUndo()
{
return _signalPostUndo;
}

// Emitted after a redo operation is fully completed, allows objects to refresh their state
sigc::signal<void>& UndoSystem::signal_postRedo()
{
return _signalPostRedo;
}

sigc::signal<void(IUndoSystem::EventType, const std::string&)>& UndoSystem::signal_undoEvent()
{
return _eventSignal;
Expand Down
10 changes: 1 addition & 9 deletions radiantcore/undo/UndoSystem.h
Expand Up @@ -48,9 +48,6 @@ class UndoSystem final :

registry::CachedKey<std::size_t> _undoLevels;

sigc::signal<void> _signalPostUndo;
sigc::signal<void> _signalPostRedo;

sigc::signal<void(EventType, const std::string&)> _eventSignal;

public:
Expand All @@ -66,7 +63,7 @@ class UndoSystem final :
bool operationStarted() const override;

// greebo: This finishes the current operation and
// removes it instantly from the stack
// instantly removes it from the stack
void cancel() override;

void finish(const std::string& command) override;
Expand All @@ -76,11 +73,6 @@ class UndoSystem final :

void clear() override;

sigc::signal<void>& signal_postUndo() override;

// Emitted after a redo operation is fully completed, allows objects to refresh their state
sigc::signal<void>& signal_postRedo() override;

sigc::signal<void(EventType, const std::string&)>& signal_undoEvent() override;

private:
Expand Down

0 comments on commit 4e9291a

Please sign in to comment.