Commit c5dfa1f2 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

VcsManager: Add method to get additionalToolsPaths from all IVcsControls



Change-Id: I87910a5a3ccc8e9e00d1b9081ea860832b9fe576
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 85d3cc84
......@@ -85,7 +85,7 @@ public:
QString topLevel;
};
VcsManagerPrivate() : m_unconfiguredVcs(0)
VcsManagerPrivate() : m_unconfiguredVcs(0), m_cachedAdditionalToolsPathsDirty(true)
{ }
~VcsManagerPrivate()
......@@ -180,6 +180,9 @@ public:
QMap<QString, VcsInfo *> m_cachedMatches;
QList<VcsInfo *> m_vcsInfoList;
IVersionControl *m_unconfiguredVcs;
QStringList m_cachedAdditionalToolsPaths;
bool m_cachedAdditionalToolsPathsDirty;
};
static VcsManagerPrivate *d = 0;
......@@ -213,6 +216,8 @@ void VcsManager::extensionsInitialized()
DocumentManager::instance(), SIGNAL(filesChangedInternally(QStringList)));
connect(versionControl, SIGNAL(repositoryChanged(QString)),
m_instance, SIGNAL(repositoryChanged(QString)));
connect(versionControl, SIGNAL(configurationChanged()),
m_instance, SLOT(handleConfigurationChanges()));
}
}
......@@ -411,6 +416,17 @@ QString VcsManager::msgToAddToVcsFailed(const QStringList &files, const IVersion
.arg(vc->displayName(), files.join(QString(QLatin1Char('\n'))));
}
QStringList VcsManager::additionalToolsPath()
{
if (d->m_cachedAdditionalToolsPathsDirty) {
d->m_cachedAdditionalToolsPaths.clear();
foreach (IVersionControl *vc, allVersionControls())
d->m_cachedAdditionalToolsPaths.append(vc->additionalToolsPath());
d->m_cachedAdditionalToolsPathsDirty = false;
}
return d->m_cachedAdditionalToolsPaths;
}
void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNames)
{
IVersionControl *vc = findVersionControlForDirectory(directory);
......@@ -462,6 +478,11 @@ void VcsManager::configureVcs()
d->m_unconfiguredVcs->id());
}
void VcsManager::handleConfigurationChanges()
{
d->m_cachedAdditionalToolsPathsDirty = true;
}
} // namespace Core
#if defined(WITH_TESTS)
......
......@@ -90,6 +90,12 @@ public:
static QString msgAddToVcsFailedTitle();
static QString msgToAddToVcsFailed(const QStringList &files, const IVersionControl *vc);
/*!
* Return a list of paths where tools that came with the VCS may be installed.
* This is helpful on windows where e.g. git comes with a lot of nice unix tools.
*/
static QStringList additionalToolsPath();
signals:
void repositoryChanged(const QString &repository);
......@@ -98,6 +104,7 @@ public slots:
private slots:
static void configureVcs();
void handleConfigurationChanges();
private:
explicit VcsManager(QObject *parent = 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment