MCPcopy Create free account
hub / github.com/KDE/kdevelop / addProject

Method addProject

plugins/git/repostatusmodel.cpp:64–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void RepoStatusModel::addProject(const IProject* p)
65{
66 auto* const versionControlPlugin = p->versionControlPlugin();
67 if (!versionControlPlugin) {
68 return;
69 }
70 auto* const plugin = versionControlPlugin->extension<GitPlugin>();
71 if (!plugin) {
72 return;
73 }
74
75 const auto projectIt = new QStandardItem(p->name());
76 const auto indexIt =
77 new QStandardItem(QIcon::fromTheme(QStringLiteral("flag-green")),
78 i18nc("Files in a vcs which have changes staged for commit", "Staged changes"));
79 const auto worktreeIt =
80 new QStandardItem(QIcon::fromTheme(QStringLiteral("flag-yellow")),
81 i18nc("Files in a vcs which have changes not yet staged for commit", "Unstaged changes"));
82 const auto conflictIt =
83 new QStandardItem(QIcon::fromTheme(QStringLiteral("flag-red")),
84 i18nc("Files in a vcs which have unresolved (merge) conflicts", "Conflicts"));
85 const auto untrackedIt = new QStandardItem(QIcon::fromTheme(QStringLiteral("flag-black")),
86 i18nc("Files which are not tracked by a vcs", "Untracked files"));
87 const auto pluginInfo = ICore::self()->pluginController()->pluginInfo(plugin);
88 const auto pathUrl = p->path().toUrl();
89
90 projectIt->setData(p->name(), RepoStatusModel::NameRole);
91 projectIt->setData(pathUrl, RepoStatusModel::ProjectUrlRole);
92 projectIt->setData(ProjectRoot, AreaRole);
93 projectIt->setSelectable(false);
94 projectIt->setIcon(QIcon::fromTheme(pluginInfo.iconName()));
95
96 indexIt->setData(i18nc("Files in a vcs which have changes staged for commit", "Staged"), RepoStatusModel::NameRole);
97 indexIt->setToolTip(i18n("Files with changes staged for commit"));
98 indexIt->setData(IndexRoot, AreaRole);
99 indexIt->setData(pathUrl, RepoStatusModel::ProjectUrlRole);
100 indexIt->setSelectable(false);
101
102 worktreeIt->setData(i18nc("Files in a vcs which have changes not checked in to repo", "Modified"),
103 RepoStatusModel::NameRole);
104 worktreeIt->setToolTip(i18n("Files with changes"));
105 worktreeIt->setData(WorkTreeRoot, AreaRole);
106 worktreeIt->setData(pathUrl, RepoStatusModel::ProjectUrlRole);
107 worktreeIt->setSelectable(false);
108
109 conflictIt->setData(i18nc("Files in git which have unresolved (merge) conflicts", "Conflicts"),
110 RepoStatusModel::NameRole);
111 conflictIt->setToolTip(i18n("Files with unresolved (merge) conflicts"));
112 conflictIt->setData(ConflictRoot, AreaRole);
113 conflictIt->setData(pathUrl, RepoStatusModel::ProjectUrlRole);
114 conflictIt->setSelectable(false);
115
116 untrackedIt->setData(i18nc("Files which are not tracked by a vcs", "Untracked"), RepoStatusModel::NameRole);
117 untrackedIt->setToolTip(i18n("Files not tracked in VCS"));
118 untrackedIt->setData(UntrackedRoot, AreaRole);
119 untrackedIt->setData(pathUrl, RepoStatusModel::ProjectUrlRole);
120 untrackedIt->setSelectable(false);
121

Callers 1

Calls 11

versionControlPluginMethod · 0.80
pluginControllerMethod · 0.80
setIconMethod · 0.80
setToolTipMethod · 0.80
nameMethod · 0.45
pluginInfoMethod · 0.45
toUrlMethod · 0.45
pathMethod · 0.45
setDataMethod · 0.45
iconNameMethod · 0.45

Tested by 1