forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.1'
Conflicts: README tests/auto/debugger/tst_dumpers.cpp Change-Id: Ib9aef37a246bc3bb9bca0c32a902af3b09ef3146
This commit is contained in:
@@ -98,7 +98,7 @@ public:
|
||||
item->setText(0, CommandMappings::tr("Command"));
|
||||
|
||||
defaultButton = new QPushButton(CommandMappings::tr("Reset All"), groupBox);
|
||||
defaultButton->setToolTip(CommandMappings::tr("Reset all to default"));
|
||||
defaultButton->setToolTip(CommandMappings::tr("Reset all to default."));
|
||||
|
||||
importButton = new QPushButton(CommandMappings::tr("Import..."), groupBox);
|
||||
exportButton = new QPushButton(CommandMappings::tr("Export..."), groupBox);
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
targetEdit->setFiltering(true);
|
||||
|
||||
resetButton = new QPushButton(targetEditGroup);
|
||||
resetButton->setToolTip(CommandMappings::tr("Reset to default"));
|
||||
resetButton->setToolTip(CommandMappings::tr("Reset to default."));
|
||||
resetButton->setText(CommandMappings::tr("Reset"));
|
||||
|
||||
QLabel *infoLabel = new QLabel(targetEditGroup);
|
||||
|
||||
@@ -1492,8 +1492,13 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId,
|
||||
OpenEditorFlags flags, bool *newEditor)
|
||||
{
|
||||
if (flags & EditorManager::OpenInOtherSplit)
|
||||
m_instance->gotoOtherSplit();
|
||||
if (flags & EditorManager::OpenInOtherSplit) {
|
||||
if (flags & EditorManager::NoNewSplits)
|
||||
m_instance->gotoNextSplit();
|
||||
else
|
||||
m_instance->gotoOtherSplit();
|
||||
}
|
||||
|
||||
return m_instance->openEditor(m_instance->currentEditorView(),
|
||||
fileName, editorId, flags, newEditor);
|
||||
}
|
||||
@@ -1659,11 +1664,19 @@ QStringList EditorManager::getOpenFileNames()
|
||||
|
||||
IEditor *EditorManager::openEditorWithContents(const Id &editorId,
|
||||
QString *titlePattern,
|
||||
const QByteArray &contents)
|
||||
const QByteArray &contents,
|
||||
OpenEditorFlags flags)
|
||||
{
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << editorId.name() << titlePattern << contents;
|
||||
|
||||
if (flags & EditorManager::OpenInOtherSplit) {
|
||||
if (flags & EditorManager::NoNewSplits)
|
||||
m_instance->gotoNextSplit();
|
||||
else
|
||||
m_instance->gotoOtherSplit();
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
QString title;
|
||||
@@ -1714,6 +1727,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
|
||||
|
||||
m_instance->addEditor(edt);
|
||||
QApplication::restoreOverrideCursor();
|
||||
activateEditor(edt, flags);
|
||||
return edt;
|
||||
}
|
||||
|
||||
@@ -1785,9 +1799,6 @@ void EditorManager::autoSave()
|
||||
if (!errors.isEmpty())
|
||||
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
|
||||
errors.join(QLatin1String("\n")));
|
||||
|
||||
// Also save settings while accessing the disk anyway:
|
||||
ICore::saveSettings();
|
||||
}
|
||||
|
||||
MakeWritableResult EditorManager::makeFileWritable(IDocument *document)
|
||||
|
||||
@@ -98,22 +98,25 @@ public:
|
||||
static EditorToolBar *createToolBar(QWidget *parent = 0);
|
||||
|
||||
enum OpenEditorFlag {
|
||||
NoFlags = 0,
|
||||
DoNotChangeCurrentEditor = 1,
|
||||
IgnoreNavigationHistory = 2,
|
||||
DoNotMakeVisible = 4,
|
||||
CanContainLineNumber = 8,
|
||||
OpenInOtherSplit = 16
|
||||
OpenInOtherSplit = 16,
|
||||
NoNewSplits = 32
|
||||
};
|
||||
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
|
||||
|
||||
static QString splitLineNumber(QString *fileName);
|
||||
static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(),
|
||||
OpenEditorFlags flags = 0, bool *newEditor = 0);
|
||||
OpenEditorFlags flags = NoFlags, bool *newEditor = 0);
|
||||
static IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
|
||||
const Id &editorId = Id(), OpenEditorFlags flags = 0,
|
||||
const Id &editorId = Id(), OpenEditorFlags flags = NoFlags,
|
||||
bool *newEditor = 0);
|
||||
static IEditor *openEditorWithContents(const Id &editorId,
|
||||
QString *titlePattern = 0, const QByteArray &contents = QByteArray());
|
||||
static IEditor *openEditorWithContents(const Id &editorId, QString *titlePattern = 0,
|
||||
const QByteArray &contents = QByteArray(),
|
||||
OpenEditorFlags flags = NoFlags);
|
||||
|
||||
static bool openExternalEditor(const QString &fileName, const Id &editorId);
|
||||
|
||||
@@ -259,11 +262,12 @@ private:
|
||||
|
||||
static IEditor *placeEditor(Internal::EditorView *view, IEditor *editor);
|
||||
static IEditor *duplicateEditor(IEditor *editor);
|
||||
static IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0);
|
||||
static void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
|
||||
static IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = NoFlags);
|
||||
static void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry,
|
||||
OpenEditorFlags flags = NoFlags);
|
||||
static void activateView(Internal::EditorView *view);
|
||||
static IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
|
||||
const Id &id = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0);
|
||||
const Id &id = Id(), OpenEditorFlags flags = NoFlags, bool *newEditor = 0);
|
||||
static int visibleDocumentsCount();
|
||||
|
||||
static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
|
||||
|
||||
@@ -146,7 +146,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||
m_cancelButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
||||
connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
|
||||
m_searchAgainButton = new QToolButton(topWidget);
|
||||
m_searchAgainButton->setToolTip(tr("Repeat the search with same parameters"));
|
||||
m_searchAgainButton->setToolTip(tr("Repeat the search with same parameters."));
|
||||
m_searchAgainButton->setText(tr("Search again"));
|
||||
m_searchAgainButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
||||
m_searchAgainButton->setVisible(false);
|
||||
@@ -158,7 +158,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||
m_replaceTextEdit->setEnabled(false);
|
||||
m_replaceTextEdit->setTabOrder(m_replaceTextEdit, m_searchResultTreeView);
|
||||
m_replaceButton = new QToolButton(topWidget);
|
||||
m_replaceButton->setToolTip(tr("Replace all occurrences"));
|
||||
m_replaceButton->setToolTip(tr("Replace all occurrences."));
|
||||
m_replaceButton->setText(tr("Replace"));
|
||||
m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
||||
m_replaceButton->setEnabled(false);
|
||||
|
||||
@@ -298,6 +298,7 @@
|
||||
#include <QStatusBar>
|
||||
|
||||
using namespace Core::Internal;
|
||||
using namespace ExtensionSystem;
|
||||
|
||||
namespace Core {
|
||||
|
||||
@@ -316,7 +317,7 @@ ICore::ICore(MainWindow *mainwindow)
|
||||
m_mainwindow = mainwindow;
|
||||
// Save settings once after all plugins are initialized:
|
||||
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()),
|
||||
this, SIGNAL(saveSettingsRequested()));
|
||||
this, SLOT(saveSettings()));
|
||||
}
|
||||
|
||||
ICore::~ICore()
|
||||
@@ -356,7 +357,10 @@ bool ICore::showWarningWithOptions(const QString &title, const QString &text,
|
||||
|
||||
QSettings *ICore::settings(QSettings::Scope scope)
|
||||
{
|
||||
return m_mainwindow->settings(scope);
|
||||
if (scope == QSettings::UserScope)
|
||||
return PluginManager::settings();
|
||||
else
|
||||
return PluginManager::globalSettings();
|
||||
}
|
||||
|
||||
SettingsDatabase *ICore::settingsDatabase()
|
||||
|
||||
@@ -118,6 +118,7 @@ public:
|
||||
|
||||
static void emitNewItemsDialogRequested();
|
||||
|
||||
public slots:
|
||||
static void saveSettings();
|
||||
|
||||
signals:
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
|
||||
/*!
|
||||
\class Core::IVersionControl::TopicCache
|
||||
@@ -76,6 +77,11 @@ QString IVersionControl::vcsMakeWritableText() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QStringList IVersionControl::additionalToolsPath() const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString IVersionControl::vcsTopic(const QString &topLevel)
|
||||
{
|
||||
return m_topicCache ? m_topicCache->topic(topLevel) : QString();
|
||||
|
||||
@@ -198,6 +198,12 @@ public:
|
||||
*/
|
||||
virtual QString vcsMakeWritableText() const;
|
||||
|
||||
/*!
|
||||
* 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.
|
||||
*/
|
||||
virtual QStringList additionalToolsPath() const;
|
||||
|
||||
signals:
|
||||
void repositoryChanged(const QString &repository);
|
||||
void filesChanged(const QStringList &files);
|
||||
|
||||
@@ -158,18 +158,18 @@ void ExecuteFilter::runHeadCommand()
|
||||
const ExecuteData &d = m_taskQueue.head();
|
||||
const QString fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable);
|
||||
if (fullPath.isEmpty()) {
|
||||
MessageManager::write(tr("Could not find executable for '%1'").arg(d.executable));
|
||||
MessageManager::write(tr("Could not find executable for '%1'.").arg(d.executable));
|
||||
m_taskQueue.dequeue();
|
||||
runHeadCommand();
|
||||
return;
|
||||
}
|
||||
MessageManager::write(tr("Starting command '%1'").arg(headCommand()));
|
||||
MessageManager::write(tr("Starting command '%1'.").arg(headCommand()));
|
||||
m_process->setWorkingDirectory(d.workingDirectory);
|
||||
m_process->setCommand(fullPath, d.arguments);
|
||||
m_process->start();
|
||||
m_process->closeWriteChannel();
|
||||
if (!m_process->waitForStarted(1000)) {
|
||||
MessageManager::write(tr("Could not start process: %1").arg(m_process->errorString()));
|
||||
MessageManager::write(tr("Could not start process: %1.").arg(m_process->errorString()));
|
||||
m_taskQueue.dequeue();
|
||||
runHeadCommand();
|
||||
}
|
||||
|
||||
@@ -99,8 +99,10 @@
|
||||
#include <QPushButton>
|
||||
#include <QStyleFactory>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
using namespace ExtensionSystem;
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
enum { debugMainWindow = 0 };
|
||||
|
||||
@@ -108,9 +110,7 @@ MainWindow::MainWindow() :
|
||||
Utils::AppMainWindow(),
|
||||
m_coreImpl(new ICore(this)),
|
||||
m_additionalContexts(Constants::C_GLOBAL),
|
||||
m_settings(ExtensionSystem::PluginManager::settings()),
|
||||
m_globalSettings(ExtensionSystem::PluginManager::globalSettings()),
|
||||
m_settingsDatabase(new SettingsDatabase(QFileInfo(m_settings->fileName()).path(),
|
||||
m_settingsDatabase(new SettingsDatabase(QFileInfo(PluginManager::settings()->fileName()).path(),
|
||||
QLatin1String("QtCreator"),
|
||||
this)),
|
||||
m_printer(0),
|
||||
@@ -151,7 +151,7 @@ MainWindow::MainWindow() :
|
||||
(void) new DocumentManager(this);
|
||||
OutputPaneManager::create();
|
||||
|
||||
Utils::HistoryCompleter::setSettings(m_settings);
|
||||
Utils::HistoryCompleter::setSettings(PluginManager::settings());
|
||||
|
||||
setWindowTitle(tr("Qt Creator"));
|
||||
if (!Utils::HostOsInfo::isMacHost())
|
||||
@@ -269,8 +269,6 @@ MainWindow::~MainWindow()
|
||||
m_mimeTypeSettings = 0;
|
||||
delete m_systemEditor;
|
||||
m_systemEditor = 0;
|
||||
delete m_settings;
|
||||
m_settings = 0;
|
||||
delete m_printer;
|
||||
m_printer = 0;
|
||||
delete m_vcsManager;
|
||||
@@ -955,14 +953,6 @@ void MainWindow::openFileWith()
|
||||
}
|
||||
}
|
||||
|
||||
QSettings *MainWindow::settings(QSettings::Scope scope) const
|
||||
{
|
||||
if (scope == QSettings::UserScope)
|
||||
return m_settings;
|
||||
else
|
||||
return m_globalSettings;
|
||||
}
|
||||
|
||||
IContext *MainWindow::contextObject(QWidget *widget)
|
||||
{
|
||||
return m_contextWidgets.value(widget);
|
||||
@@ -1068,7 +1058,8 @@ static const char modeSelectorVisibleKey[] = "ModeSelectorVisible";
|
||||
|
||||
void MainWindow::readSettings()
|
||||
{
|
||||
m_settings->beginGroup(QLatin1String(settingsGroup));
|
||||
QSettings *settings = PluginManager::settings();
|
||||
settings->beginGroup(QLatin1String(settingsGroup));
|
||||
|
||||
if (m_overrideColor.isValid()) {
|
||||
Utils::StyleHelper::setBaseColor(m_overrideColor);
|
||||
@@ -1076,38 +1067,39 @@ void MainWindow::readSettings()
|
||||
m_overrideColor = Utils::StyleHelper::baseColor();
|
||||
} else {
|
||||
Utils::StyleHelper::setBaseColor(
|
||||
m_settings->value(QLatin1String(colorKey),
|
||||
settings->value(QLatin1String(colorKey),
|
||||
QColor(Utils::StyleHelper::DEFAULT_BASE_COLOR)).value<QColor>());
|
||||
}
|
||||
|
||||
bool modeSelectorVisible = m_settings->value(QLatin1String(modeSelectorVisibleKey), true).toBool();
|
||||
bool modeSelectorVisible = settings->value(QLatin1String(modeSelectorVisibleKey), true).toBool();
|
||||
ModeManager::setModeSelectorVisible(modeSelectorVisible);
|
||||
m_toggleModeSelectorAction->setChecked(modeSelectorVisible);
|
||||
|
||||
m_settings->endGroup();
|
||||
settings->endGroup();
|
||||
|
||||
m_editorManager->readSettings();
|
||||
m_navigationWidget->restoreSettings(m_settings);
|
||||
m_rightPaneWidget->readSettings(m_settings);
|
||||
m_navigationWidget->restoreSettings(settings);
|
||||
m_rightPaneWidget->readSettings(settings);
|
||||
}
|
||||
|
||||
void MainWindow::writeSettings()
|
||||
{
|
||||
m_settings->beginGroup(QLatin1String(settingsGroup));
|
||||
QSettings *settings = PluginManager::settings();
|
||||
settings->beginGroup(QLatin1String(settingsGroup));
|
||||
|
||||
if (!(m_overrideColor.isValid() && Utils::StyleHelper::baseColor() == m_overrideColor))
|
||||
m_settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::requestedBaseColor());
|
||||
settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::requestedBaseColor());
|
||||
|
||||
m_settings->setValue(QLatin1String(windowGeometryKey), saveGeometry());
|
||||
m_settings->setValue(QLatin1String(windowStateKey), saveState());
|
||||
m_settings->setValue(QLatin1String(modeSelectorVisibleKey), ModeManager::isModeSelectorVisible());
|
||||
settings->setValue(QLatin1String(windowGeometryKey), saveGeometry());
|
||||
settings->setValue(QLatin1String(windowStateKey), saveState());
|
||||
settings->setValue(QLatin1String(modeSelectorVisibleKey), ModeManager::isModeSelectorVisible());
|
||||
|
||||
m_settings->endGroup();
|
||||
settings->endGroup();
|
||||
|
||||
DocumentManager::saveSettings();
|
||||
m_actionManager->saveSettings(m_settings);
|
||||
m_actionManager->saveSettings(settings);
|
||||
m_editorManager->saveSettings();
|
||||
m_navigationWidget->saveSettings(m_settings);
|
||||
m_navigationWidget->saveSettings(settings);
|
||||
}
|
||||
|
||||
void MainWindow::updateAdditionalContexts(const Context &remove, const Context &add)
|
||||
@@ -1264,10 +1256,14 @@ bool MainWindow::showWarningWithOptions(const QString &title,
|
||||
|
||||
void MainWindow::restoreWindowState()
|
||||
{
|
||||
m_settings->beginGroup(QLatin1String(settingsGroup));
|
||||
if (!restoreGeometry(m_settings->value(QLatin1String(windowGeometryKey)).toByteArray()))
|
||||
QSettings *settings = PluginManager::settings();
|
||||
settings->beginGroup(QLatin1String(settingsGroup));
|
||||
if (!restoreGeometry(settings->value(QLatin1String(windowGeometryKey)).toByteArray()))
|
||||
resize(1008, 700); // size without window decoration
|
||||
restoreState(m_settings->value(QLatin1String(windowStateKey)).toByteArray());
|
||||
m_settings->endGroup();
|
||||
restoreState(settings->value(QLatin1String(windowStateKey)).toByteArray());
|
||||
settings->endGroup();
|
||||
show();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
@@ -95,7 +95,6 @@ public:
|
||||
|
||||
Core::IDocument *openFiles(const QStringList &fileNames, ICore::OpenFilesFlags flags);
|
||||
|
||||
QSettings *settings(QSettings::Scope scope) const;
|
||||
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
|
||||
virtual QPrinter *printer() const;
|
||||
IContext * currentContextObject() const;
|
||||
@@ -162,8 +161,6 @@ private:
|
||||
|
||||
ICore *m_coreImpl;
|
||||
Context m_additionalContexts;
|
||||
QSettings *m_settings;
|
||||
QSettings *m_globalSettings;
|
||||
SettingsDatabase *m_settingsDatabase;
|
||||
mutable QPrinter *m_printer;
|
||||
ActionManager *m_actionManager;
|
||||
|
||||
@@ -71,7 +71,6 @@ struct ModeManagerPrivate
|
||||
QSignalMapper *m_signalMapper;
|
||||
Context m_addedContexts;
|
||||
int m_oldCurrent;
|
||||
bool m_saveSettingsOnModeChange;
|
||||
bool m_modeSelectorVisible;
|
||||
};
|
||||
|
||||
@@ -99,15 +98,12 @@ ModeManager::ModeManager(Internal::MainWindow *mainWindow,
|
||||
d->m_oldCurrent = -1;
|
||||
d->m_actionBar = new Internal::FancyActionBar(modeStack);
|
||||
d->m_modeStack->addCornerWidget(d->m_actionBar);
|
||||
d->m_saveSettingsOnModeChange = false;
|
||||
d->m_modeSelectorVisible = true;
|
||||
d->m_modeStack->setSelectionWidgetVisible(d->m_modeSelectorVisible);
|
||||
|
||||
connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int)));
|
||||
connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int)));
|
||||
connect(d->m_signalMapper, SIGNAL(mapped(int)), this, SLOT(slotActivateMode(int)));
|
||||
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()), this, SLOT(handleStartup()));
|
||||
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(handleShutdown()));
|
||||
}
|
||||
|
||||
void ModeManager::init()
|
||||
@@ -237,12 +233,6 @@ void ModeManager::enabledStateChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void ModeManager::handleStartup()
|
||||
{ d->m_saveSettingsOnModeChange = true; }
|
||||
|
||||
void ModeManager::handleShutdown()
|
||||
{ d->m_saveSettingsOnModeChange = false; }
|
||||
|
||||
void ModeManager::aboutToRemoveObject(QObject *obj)
|
||||
{
|
||||
IMode *mode = Aggregation::query<IMode>(obj);
|
||||
@@ -281,11 +271,8 @@ void ModeManager::currentTabAboutToChange(int index)
|
||||
{
|
||||
if (index >= 0) {
|
||||
IMode *mode = d->m_modes.at(index);
|
||||
if (mode) {
|
||||
if (d->m_saveSettingsOnModeChange)
|
||||
ICore::saveSettings();
|
||||
if (mode)
|
||||
emit currentModeAboutToChange(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,8 +82,6 @@ private slots:
|
||||
void currentTabChanged(int index);
|
||||
void updateModeToolTip();
|
||||
void enabledStateChanged();
|
||||
void handleStartup();
|
||||
void handleShutdown();
|
||||
|
||||
private:
|
||||
explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack);
|
||||
|
||||
@@ -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,14 @@ void VcsManager::configureVcs()
|
||||
d->m_unconfiguredVcs->id());
|
||||
}
|
||||
|
||||
void VcsManager::handleConfigurationChanges()
|
||||
{
|
||||
d->m_cachedAdditionalToolsPathsDirty = true;
|
||||
IVersionControl *vcs = qobject_cast<IVersionControl *>(sender());
|
||||
if (vcs)
|
||||
emit configurationChanged(vcs);
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#if defined(WITH_TESTS)
|
||||
|
||||
@@ -90,14 +90,22 @@ 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);
|
||||
void configurationChanged(const IVersionControl *vcs);
|
||||
|
||||
public slots:
|
||||
static void clearVersionControlCache();
|
||||
|
||||
private slots:
|
||||
static void configureVcs();
|
||||
void handleConfigurationChanges();
|
||||
|
||||
private:
|
||||
explicit VcsManager(QObject *parent = 0);
|
||||
|
||||
Reference in New Issue
Block a user