MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / initialiseModule

Method initialiseModule

plugins/vcs/GitModule.cpp:62–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void GitModule::initialiseModule(const IApplicationContext& ctx)
63{
64 // Register commands
65 registerCommands();
66 createPreferencePage();
67
68 // Initialise libgit2 to have the memory handlers etc. set up
69 git_libgit2_init();
70
71 auto modPath = GlobalGameManager().getModPath();
72 _repository = std::make_unique<git::Repository>(modPath);
73
74 if (_repository->isOk())
75 {
76 rMessage() << "Opened repository at " << modPath << std::endl;
77 rMessage() << "Repository is currently on branch " << _repository->getCurrentBranchName() << std::endl;
78 }
79 else
80 {
81 _repository.reset();
82 }
83
84 GlobalMainFrame().signal_MainFrameConstructed().connect([&]()
85 {
86 _statusBarWidget = std::make_unique<ui::VcsStatus>(GlobalStatusBarManager().getStatusBar());
87 GlobalStatusBarManager().addElement(ui::VcsStatus::Name, _statusBarWidget->getWidget(),
88 ::ui::statusbar::StandardPosition::MapEditStopwatch + 10);
89
90 _statusBarWidget->setRepository(_repository);
91 });
92
93 GlobalVersionControlManager().registerModule(shared_from_this());
94}
95
96void GitModule::shutdownModule()
97{

Callers

nothing calls this directly

Calls 12

rMessageFunction · 0.85
getModPathMethod · 0.80
isOkMethod · 0.80
getCurrentBranchNameMethod · 0.80
getStatusBarMethod · 0.80
setRepositoryMethod · 0.80
registerCommandsFunction · 0.50
resetMethod · 0.45
connectMethod · 0.45
addElementMethod · 0.45
getWidgetMethod · 0.45
registerModuleMethod · 0.45

Tested by

no test coverage detected