| 62 | } |
| 63 | |
| 64 | void ProjectChangesModel::addProject(IProject* p) |
| 65 | { |
| 66 | auto* it = new QStandardItem(p->name()); |
| 67 | it->setData(p->name(), ProjectChangesModel::ProjectNameRole); |
| 68 | IPlugin* plugin = p->versionControlPlugin(); |
| 69 | if(plugin) { |
| 70 | auto* vcs = plugin->extension<IBasicVersionControl>(); |
| 71 | |
| 72 | auto info = ICore::self()->pluginController()->pluginInfo(plugin); |
| 73 | |
| 74 | it->setIcon(QIcon::fromTheme(info.iconName())); |
| 75 | it->setToolTip(vcs->name()); |
| 76 | |
| 77 | auto* branchingExtension = plugin->extension<KDevelop::IBranchingVersionControl>(); |
| 78 | if(branchingExtension) { |
| 79 | const auto pathUrl = p->path().toUrl(); |
| 80 | branchingExtension->registerRepositoryForCurrentBranchChanges(pathUrl, this); |
| 81 | // can't use new signal slot syntax here, IBranchingVersionControl is not a QObject |
| 82 | connect(plugin, SIGNAL(repositoryBranchChanged(QUrl)), this, SLOT(repositoryBranchChanged(QUrl)), |
| 83 | Qt::UniqueConnection); |
| 84 | repositoryBranchChanged(pathUrl); |
| 85 | } else |
| 86 | reload(QList<IProject*>() << p); |
| 87 | } else { |
| 88 | it->setEnabled(false); |
| 89 | } |
| 90 | |
| 91 | appendRow(it); |
| 92 | } |
| 93 | |
| 94 | void ProjectChangesModel::removeProject(IProject* p) |
| 95 | { |