MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / start

Method start

src/plugins/linglong/linglongplugin.cpp:27–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27bool LinglongPlugin::start()
28{
29 qInfo() << __FUNCTION__;
30 // language register.
31 LanguageService *languageService = dpfGetService(LanguageService);
32 if (languageService) {
33 QString errorString;
34 bool ret = languageService->regClass<LLGenerator>(LLGenerator::toolKitName(), &errorString);
35 if (!ret) {
36 qCritical() << errorString;
37 } else {
38 ret = languageService->create<LLGenerator>(LLGenerator::toolKitName(), &errorString);
39 if (!ret) {
40 qCritical() << errorString;
41 }
42 }
43 }
44
45 // project register.
46 ProjectService *projectService = dpfGetService(ProjectService);
47 if (projectService) {
48 QString errorString;
49 projectService->implGenerator<LLProjectGenerator>(LLProjectGenerator::toolKitName(), &errorString);
50 }
51
52 //builder register
53 BuilderService *builderService = dpfGetService(BuilderService);
54 if (builderService) {
55 QString errorString;
56 bool ret = builderService->regClass<LLBuilderGenerator>(LLBuilderGenerator::toolKitName(), &errorString);
57 if (ret) {
58 builderService->create<LLBuilderGenerator>(LLBuilderGenerator::toolKitName(), &errorString);
59 }
60 }
61
62 QAction *action = new QAction(QIcon::fromTheme("linglong"), LL_NAME, this);
63 windowService = dpfGetService(WindowService);
64 if (!windowService)
65 return false;
66
67 windowService->addNavigationItem(new AbstractAction(action), Priority::low);
68 std::function<AbstractWidget *()> findCreator = []() -> AbstractWidget * {
69 return new AbstractWidget(new MainFrame());
70 };
71
72 // mainFrame will setParent when register to windowService
73 windowService->registerWidgetCreator(LL_NAME, findCreator);
74
75 connect(action, &QAction::triggered, this, [=]() {
76 windowService->showWidgetAtPosition(LL_NAME, Position::FullWindow, true);
77 windowService->showContextWidget();
78 MainFrame::checkToolInstalled("ll-cli");
79 }, Qt::DirectConnection);
80
81 return true;
82}
83
84dpf::Plugin::ShutdownFlag LinglongPlugin::stop()

Callers 8

checkToolInstalledMethod · 0.45
updateInstalledMethod · 0.45
updateRepositoryMethod · 0.45
updateRunningMethod · 0.45
runAppMethod · 0.45
installAppMethod · 0.45
uninstallAppMethod · 0.45
checkCommandValidityMethod · 0.45

Calls 6

toolKitNameFunction · 0.85
connectFunction · 0.85
addNavigationItemMethod · 0.80
registerWidgetCreatorMethod · 0.80
showWidgetAtPositionMethod · 0.80
showContextWidgetMethod · 0.80

Tested by

no test coverage detected