Remove all singletons except EditorBaseApplication

This commit is contained in:
SweetId
2023-10-18 19:04:14 -04:00
parent 00d0793b67
commit 7132511562
14 changed files with 31 additions and 68 deletions

View File

@@ -11,8 +11,6 @@ namespace Nz
class NAZARAEDITOR_CORE_API ActionStack final
{
public:
static ActionStack* Instance();
void ExecuteAction(const std::string& name)
{
ExecuteAction(CreateAction(name));
@@ -57,10 +55,9 @@ namespace Nz
protected:
ActionStack();
~ActionStack();
ActionStack(ActionStack&) = delete;
ActionStack& operator=(ActionStack&) = delete;
ActionStack& operator=(const ActionStack&) = delete;
ActionStack(ActionStack&&) = delete;
ActionStack& operator=(ActionStack&&) = delete;
@@ -70,8 +67,6 @@ namespace Nz
m_availableActions.push_back(std::make_unique<TAction>(properties));
}
static ActionStack* s_instance;
int64_t m_currentIndex;
std::vector<std::shared_ptr<EditorAction>> m_undoRedoStack;

View File

@@ -9,6 +9,7 @@
#include <NazaraEditor/Core/Core.hpp>
#include <NazaraEditor/Core/Application/Action.hpp>
#include <NazaraEditor/Core/Application/ActionStack.hpp>
#include <NazaraEditor/Core/Application/EditorLogger.hpp>
#include <NazaraEditor/Core/Application/Level.hpp>
#include <NazaraEditor/Core/UI/PopupManager.hpp>
#include <NazaraEditor/Core/UI/Window.hpp>
@@ -38,10 +39,19 @@ namespace Nz
virtual ~EditorBaseApplication();
static EditorBaseApplication* Instance();
ActionStack& GetActionStack() { return m_actionStack; }
const ActionStack& GetActionStack() const { return m_actionStack; }
EditorPopupManager& GetPopupManager() { return m_popupManager; }
const EditorPopupManager& GetPopupManager() const { return m_popupManager; }
EditorLogger& GetLogger() { return *m_logger; }
const EditorLogger& GetLogger() const { return *m_logger; }
void SetResourceFolder(const std::filesystem::path& path) { m_resourceFolder = path; }
std::filesystem::path GetResourceFolder() const { return m_resourceFolder; }
void SetLogger(EditorLogger& logger) { m_logger = &logger; }
Nz::Level& GetLevel();
virtual bool NewLevel();
virtual bool CloseLevel() { return false; }
@@ -73,6 +83,7 @@ namespace Nz
std::filesystem::path m_resourceFolder;
Nz::ActionStack m_actionStack;
Nz::EditorPopupManager m_popupManager;
Nz::EditorLogger* m_logger;
Nz::Level m_level;
};

View File

@@ -9,16 +9,17 @@ namespace Nz
{
public:
EditorLogger();
virtual ~EditorLogger();
static EditorLogger* Instance();
void Clear() { m_text.clear(); }
const std::vector<std::string>& GetLog() const { return m_text; }
private:
static EditorLogger* s_instance;
EditorLogger(EditorLogger&) = delete;
EditorLogger& operator=(const EditorLogger&) = delete;
EditorLogger(EditorLogger&&) = delete;
EditorLogger& operator=(EditorLogger&&) = delete;
std::vector<std::string> m_text;
};
}

View File

@@ -38,8 +38,6 @@ namespace Nz
class NAZARAEDITOR_CORE_API EditorPopupManager
{
public:
static EditorPopupManager* Instance();
void Update();
uint64_t CreatePopup(const EditorPopupParameters& parameters);
@@ -47,7 +45,6 @@ namespace Nz
private:
EditorPopupManager();
~EditorPopupManager();
EditorPopupManager(const EditorPopupManager&) = delete;
EditorPopupManager& operator=(const EditorPopupManager&) = delete;
@@ -61,7 +58,6 @@ namespace Nz
std::vector<std::unique_ptr<EditorPopup>> m_popups;
std::vector<uint64_t> m_popupsToDelete;
static EditorPopupManager* s_instance;
friend class EditorBaseApplication;
};
}