forked from qt-creator/qt-creator
Use new static ICore interface.
Change-Id: I9b690d9b150c8d162b15370f9f8986267c9128f1 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -295,9 +295,9 @@ private:
|
||||
QStringList m_fileNames;
|
||||
};
|
||||
|
||||
inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property, const QString &entry)
|
||||
Core::IEditor *locateEditor(const char *property, const QString &entry)
|
||||
{
|
||||
foreach (Core::IEditor *ed, core->editorManager()->openedEditors())
|
||||
foreach (Core::IEditor *ed, Core::ICore::editorManager()->openedEditors())
|
||||
if (ed->file()->property(property).toString() == entry)
|
||||
return ed;
|
||||
return 0;
|
||||
@@ -350,12 +350,11 @@ const char *GitClient::stashNamePrefix = "stash@{";
|
||||
GitClient::GitClient(GitSettings *settings) :
|
||||
m_cachedGitVersion(0),
|
||||
m_msgWait(tr("Waiting for data...")),
|
||||
m_core(Core::ICore::instance()),
|
||||
m_repositoryChangedSignalMapper(0),
|
||||
m_settings(settings)
|
||||
{
|
||||
QTC_CHECK(settings);
|
||||
connect(m_core, SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
|
||||
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
|
||||
}
|
||||
|
||||
GitClient::~GitClient()
|
||||
@@ -398,7 +397,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis
|
||||
const QString &dynamicPropertyValue) const
|
||||
{
|
||||
VcsBase::VcsBaseEditorWidget *rc = 0;
|
||||
Core::IEditor *outputEditor = locateEditor(m_core, registerDynamicProperty, dynamicPropertyValue);
|
||||
Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue);
|
||||
if (!outputEditor)
|
||||
return 0;
|
||||
|
||||
@@ -428,7 +427,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
|
||||
QTC_CHECK(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue));
|
||||
|
||||
// Create new, set wait message, set up with source and codec
|
||||
Core::IEditor *outputEditor = m_core->editorManager()->openEditorWithContents(id, &title, m_msgWait);
|
||||
Core::IEditor *outputEditor = Core::ICore::editorManager()->openEditorWithContents(id, &title, m_msgWait);
|
||||
outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue);
|
||||
rc = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
|
||||
connect(rc, SIGNAL(annotateRevisionRequested(QString,QString,int)),
|
||||
@@ -445,7 +444,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
|
||||
}
|
||||
|
||||
rc->setForceReadOnly(true);
|
||||
m_core->editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
|
||||
Core::ICore::editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
|
||||
|
||||
if (configWidget)
|
||||
rc->setConfigurationWidget(configWidget);
|
||||
@@ -689,7 +688,7 @@ void GitClient::show(const QString &source, const QString &id, const QStringList
|
||||
|
||||
void GitClient::saveSettings()
|
||||
{
|
||||
settings()->writeSettings(m_core->settings());
|
||||
settings()->writeSettings(Core::ICore::settings());
|
||||
}
|
||||
|
||||
void GitClient::slotBlameRevisionRequested(const QString &source, QString change, int lineNumber)
|
||||
@@ -932,8 +931,7 @@ bool GitClient::synchronousInit(const QString &workingDirectory)
|
||||
outputWindow()->appendError(commandOutputFromLocal8Bit(errorText));
|
||||
else {
|
||||
// TODO: Turn this into a VcsBaseClient and use resetCachedVcsInfo(...)
|
||||
Core::VcsManager *vcsManager = m_core->vcsManager();
|
||||
vcsManager->resetVersionControlForDirectory(workingDirectory);
|
||||
Core::ICore::vcsManager()->resetVersionControlForDirectory(workingDirectory);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -1190,7 +1188,7 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri
|
||||
message = creatorStashMessage(messageKeyword);
|
||||
do {
|
||||
if ((flags & StashPromptDescription)) {
|
||||
if (!inputText(Core::ICore::instance()->mainWindow(),
|
||||
if (!inputText(Core::ICore::mainWindow(),
|
||||
tr("Stash Description"), tr("Description:"), &message))
|
||||
break;
|
||||
}
|
||||
@@ -1481,7 +1479,7 @@ GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory, Q
|
||||
return StashFailed;
|
||||
}
|
||||
|
||||
const int answer = askWithDetailedText(m_core->mainWindow(), tr("Changes"),
|
||||
const int answer = askWithDetailedText(Core::ICore::mainWindow(), tr("Changes"),
|
||||
tr("Would you like to stash your changes?"),
|
||||
statusOutput, QMessageBox::Yes, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
|
||||
switch (answer) {
|
||||
@@ -1941,7 +1939,7 @@ GitClient::RevertResult GitClient::revertI(QStringList files,
|
||||
|
||||
// Ask to revert (to do: Handle lists with a selection dialog)
|
||||
const QMessageBox::StandardButton answer
|
||||
= QMessageBox::question(m_core->mainWindow(),
|
||||
= QMessageBox::question(Core::ICore::mainWindow(),
|
||||
tr("Revert"),
|
||||
tr("The file has been changed. Do you want to revert it?"),
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
@@ -2263,8 +2261,7 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
||||
const Utils::SynchronousProcessResponse resp =
|
||||
synchronousGit(workingDirectory.path(), arguments, flags);
|
||||
// TODO: Turn this into a VcsBaseClient and use resetCachedVcsInfo(...)
|
||||
Core::VcsManager *vcsManager = m_core->vcsManager();
|
||||
vcsManager->resetVersionControlForDirectory(workingDirectory.absolutePath());
|
||||
Core::ICore::vcsManager()->resetVersionControlForDirectory(workingDirectory.absolutePath());
|
||||
return (resp.result == Utils::SynchronousProcessResponse::Finished);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,6 @@ private:
|
||||
mutable unsigned m_cachedGitVersion;
|
||||
|
||||
const QString m_msgWait;
|
||||
Core::ICore *m_core;
|
||||
QSignalMapper *m_repositoryChangedSignalMapper;
|
||||
GitSettings *m_settings;
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ static GitoriousHostWidget *createHostWidget()
|
||||
// First time? Populate gitorious from settings.
|
||||
// If there is still no host, add "gitorious.org"
|
||||
Gitorious &gitorious = Gitorious::instance();
|
||||
const QSettings *settings = Core::ICore::instance()->settings();
|
||||
const QSettings *settings = Core::ICore::settings();
|
||||
const QString group = QLatin1String(settingsGroupC);
|
||||
if (!gitorious.hostCount()) {
|
||||
gitorious.restoreSettings(group, settings);
|
||||
@@ -83,7 +83,7 @@ GitoriousHostWizardPage::GitoriousHostWizardPage(QWidget *parent) :
|
||||
GitoriousHostWizardPage::~GitoriousHostWizardPage()
|
||||
{
|
||||
// Write out settings + selected row.
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
if (m_widget->isHostListDirty())
|
||||
Gitorious::instance().saveSettings(QLatin1String(settingsGroupC), settings);
|
||||
if (m_widget->isValid())
|
||||
|
||||
@@ -127,7 +127,6 @@ GitPlugin *GitPlugin::m_instance = 0;
|
||||
|
||||
GitPlugin::GitPlugin() :
|
||||
VcsBase::VcsBasePlugin(QLatin1String(Git::Constants::GITSUBMITEDITOR_ID)),
|
||||
m_core(0),
|
||||
m_commandLocator(0),
|
||||
m_showAction(0),
|
||||
m_submitCurrentAction(0),
|
||||
@@ -281,8 +280,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
m_core = Core::ICore::instance();
|
||||
m_settings.readSettings(m_core->settings());
|
||||
m_settings.readSettings(Core::ICore::settings());
|
||||
|
||||
m_gitClient = new GitClient(&m_settings);
|
||||
|
||||
@@ -312,7 +310,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
addAutoReleasedObject(m_commandLocator);
|
||||
|
||||
//register actions
|
||||
Core::ActionManager *actionManager = m_core->actionManager();
|
||||
Core::ActionManager *actionManager = Core::ICore::actionManager();
|
||||
|
||||
Core::ActionContainer *toolsContainer =
|
||||
actionManager->actionContainer(Core::Constants::M_TOOLS);
|
||||
@@ -638,7 +636,7 @@ void GitPlugin::undoRepositoryChanges()
|
||||
QTC_ASSERT(state.hasTopLevel(), return)
|
||||
const QString msg = tr("Undo all pending changes to the repository\n%1?").arg(QDir::toNativeSeparators(state.topLevel()));
|
||||
const QMessageBox::StandardButton answer
|
||||
= QMessageBox::question(m_core->mainWindow(),
|
||||
= QMessageBox::question(Core::ICore::mainWindow(),
|
||||
tr("Undo Changes"), msg,
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
@@ -710,7 +708,7 @@ void GitPlugin::startCommit(bool amend)
|
||||
|
||||
Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd, bool amend)
|
||||
{
|
||||
Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, Constants::GITSUBMITEDITOR_ID,
|
||||
Core::IEditor *editor = Core::ICore::editorManager()->openEditor(fileName, Constants::GITSUBMITEDITOR_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
GitSubmitEditor *submitEditor = qobject_cast<GitSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
@@ -732,8 +730,8 @@ void GitPlugin::submitCurrentLog()
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
QList<Core::IEditor*> editors;
|
||||
editors.push_back(m_core->editorManager()->currentEditor());
|
||||
m_core->editorManager()->closeEditors(editors);
|
||||
editors.push_back(Core::ICore::editorManager()->currentEditor());
|
||||
Core::ICore::editorManager()->closeEditors(editors);
|
||||
}
|
||||
|
||||
bool GitPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor)
|
||||
@@ -776,7 +774,7 @@ bool GitPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEdi
|
||||
bool closeEditor = true;
|
||||
if (model->hasCheckedFiles() || !m_commitAmendSHA1.isEmpty()) {
|
||||
// get message & commit
|
||||
if (!m_core->fileManager()->saveFile(fileIFace))
|
||||
if (!Core::ICore::fileManager()->saveFile(fileIFace))
|
||||
return false;
|
||||
|
||||
closeEditor = m_gitClient->addAndCommit(m_submitRepository, editor->panelData(),
|
||||
@@ -860,7 +858,7 @@ void GitPlugin::cleanRepository(const QString &directory)
|
||||
const bool gotFiles = m_gitClient->synchronousCleanList(directory, &files, &errorMessage);
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
QWidget *parent = Core::ICore::instance()->mainWindow();
|
||||
QWidget *parent = Core::ICore::mainWindow();
|
||||
if (!gotFiles) {
|
||||
QMessageBox::warning(parent, tr("Unable to retrieve file list"),
|
||||
errorMessage);
|
||||
@@ -893,7 +891,7 @@ static bool ensureFileSaved(const QString &fileName)
|
||||
Core::IFile *file = editors.front()->file();
|
||||
if (!file || !file->isModified())
|
||||
return true;
|
||||
Core::FileManager *fm = Core::ICore::instance()->fileManager();
|
||||
Core::FileManager *fm = Core::ICore::fileManager();
|
||||
bool canceled;
|
||||
QList<Core::IFile *> files;
|
||||
files << file;
|
||||
@@ -932,7 +930,7 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
|
||||
// Prompt for file
|
||||
if (file.isEmpty()) {
|
||||
const QString filter = tr("Patches (*.patch *.diff)");
|
||||
file = QFileDialog::getOpenFileName(Core::ICore::instance()->mainWindow(),
|
||||
file = QFileDialog::getOpenFileName(Core::ICore::mainWindow(),
|
||||
tr("Choose Patch"),
|
||||
QString(), filter);
|
||||
if (file.isEmpty())
|
||||
@@ -981,7 +979,7 @@ template <class NonModalDialog>
|
||||
dialog->show();
|
||||
dialog->raise();
|
||||
} else {
|
||||
dialog = new NonModalDialog(Core::ICore::instance()->mainWindow());
|
||||
dialog = new NonModalDialog(Core::ICore::mainWindow());
|
||||
dialog->refresh(topLevel, true);
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IEditorFactory;
|
||||
class ICore;
|
||||
class Command;
|
||||
class Context;
|
||||
class ActionManager;
|
||||
@@ -183,7 +182,6 @@ private:
|
||||
void startCommit(bool amend);
|
||||
|
||||
static GitPlugin *m_instance;
|
||||
Core::ICore *m_core;
|
||||
Locator::CommandLocator *m_commandLocator;
|
||||
QAction *m_createRepositoryAction;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user