forked from qt-creator/qt-creator
Core: IVersionControl: Introduce a setTopicCache
More flexible than passing in the constructor. Change-Id: I7bb5b3fe02682e01ebbce246de547686ff871920 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -138,13 +138,17 @@ IVersionControl::RepoUrl IVersionControl::getRepoUrl(const QString &location) co
|
||||
return RepoUrl(location);
|
||||
}
|
||||
|
||||
void IVersionControl::setTopicCache(TopicCache *topicCache)
|
||||
{
|
||||
m_topicCache = topicCache;
|
||||
}
|
||||
|
||||
QString IVersionControl::vcsTopic(const QString &topLevel)
|
||||
{
|
||||
return m_topicCache ? m_topicCache->topic(topLevel) : QString();
|
||||
}
|
||||
|
||||
IVersionControl::IVersionControl(IVersionControl::TopicCache *topicCache)
|
||||
: m_topicCache(topicCache)
|
||||
IVersionControl::IVersionControl()
|
||||
{
|
||||
Core::VcsManager::addVersionControl(this);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
explicit IVersionControl(TopicCache *topicCache = nullptr);
|
||||
IVersionControl();
|
||||
~IVersionControl() override;
|
||||
|
||||
virtual QString displayName() const = 0;
|
||||
@@ -239,13 +239,15 @@ public:
|
||||
};
|
||||
virtual RepoUrl getRepoUrl(const QString &location) const;
|
||||
|
||||
void setTopicCache(TopicCache *topicCache);
|
||||
|
||||
signals:
|
||||
void repositoryChanged(const QString &repository);
|
||||
void filesChanged(const QStringList &files);
|
||||
void configurationChanged();
|
||||
|
||||
private:
|
||||
TopicCache *m_topicCache;
|
||||
TopicCache *m_topicCache = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -62,9 +62,10 @@ private:
|
||||
};
|
||||
|
||||
GitVersionControl::GitVersionControl(GitClient *client) :
|
||||
Core::IVersionControl(new GitTopicCache(client)),
|
||||
m_client(client)
|
||||
{ }
|
||||
{
|
||||
setTopicCache(new GitTopicCache(client));
|
||||
}
|
||||
|
||||
QString GitVersionControl::displayName() const
|
||||
{
|
||||
|
||||
@@ -64,9 +64,10 @@ private:
|
||||
};
|
||||
|
||||
MercurialControl::MercurialControl(MercurialClient *client) :
|
||||
Core::IVersionControl(new MercurialTopicCache(client)),
|
||||
mercurialClient(client)
|
||||
{ }
|
||||
{
|
||||
setTopicCache(new MercurialTopicCache(client));
|
||||
}
|
||||
|
||||
QString MercurialControl::displayName() const
|
||||
{
|
||||
|
||||
@@ -64,9 +64,10 @@ private:
|
||||
};
|
||||
|
||||
SubversionControl::SubversionControl(SubversionPluginPrivate *plugin) :
|
||||
Core::IVersionControl(new SubversionTopicCache(plugin)),
|
||||
m_plugin(plugin)
|
||||
{ }
|
||||
{
|
||||
setTopicCache(new SubversionTopicCache(plugin));
|
||||
}
|
||||
|
||||
QString SubversionControl::displayName() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user