repositorymodel.cpp 649 B

123456789101112131415161718192021222324252627282930
  1. #include "repositorymodel.h"
  2. #include <QDebug>
  3. #include <QSettings>
  4. RepositoryModel::RepositoryModel(QObject* parent) : UniversalListModel(parent)
  5. {
  6. }
  7. RepositoryModel::~RepositoryModel()
  8. {
  9. }
  10. void RepositoryModel::addRepository(GitRepository *repository)
  11. {
  12. if(m_repolist.contains(repository->name())) {
  13. qDebug() << "Repository is already opened";
  14. return;
  15. }
  16. m_repolist.append(repository->name());
  17. append(repository);
  18. setActiveRepositoryIndex(m_repolist.count() - 1);
  19. }
  20. void RepositoryModel::removeRepository(GitRepository* repository)
  21. {
  22. m_repolist.removeAll(repository->name());
  23. remove(repository);
  24. }