Skip to content

Commit

Permalink
Refactoring WindowManager as the singletone class
Browse files Browse the repository at this point in the history
  • Loading branch information
MahBoiDeveloper committed Apr 29, 2024
1 parent 9da9955 commit 16ca488
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/GUI/WindowManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class WindowManager final
std::unique_ptr<LaunchWidget> pLaunchWidget = nullptr;
std::unique_ptr<HotkeysMainWindow> pHotkeysEditor = nullptr;
QString WindowName;
public:
inline static std::unique_ptr<WindowManager> Instance = nullptr;

public: // Methods
WindowManager();
Expand Down
8 changes: 4 additions & 4 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ int main(int argc, char *argv[])
QApplication HotkeyEditor(argc, argv);

// Define logger as a singleton class, that could be used anywhere in project
Logger::Instance = make_unique<Logger>();
CSFParser::Instance = make_unique<CSFParser>(Config::RESOURCE_FOLDER + "/DataSamples/generalsRU.csf");
Logger::Instance = make_unique<Logger>();
WindowManager::Instance = make_unique<WindowManager>();
CSFParser::Instance = make_unique<CSFParser>(Config::RESOURCE_FOLDER + "/DataSamples/generalsRU.csf");

try
{
WindowManager wndManager;
wndManager.Show();
WindowManager::Instance->Show();
HotkeyEditor.exec();
}
catch (const exception& exception)
Expand Down

0 comments on commit 16ca488

Please sign in to comment.