diff options
Diffstat (limited to 'src/plugins/subversion/subversionplugin.cpp')
-rw-r--r-- | src/plugins/subversion/subversionplugin.cpp | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 5a3d567f1e..4d10297d9b 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -132,9 +132,9 @@ static inline QString debugCodec(const QTextCodec *c) return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec"); } -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::instance()->editorManager()->openedEditors()) if (ed->property(property).toString() == entry) return ed; return 0; @@ -164,7 +164,6 @@ StatusList parseStatusOutput(const QString &output) } // ------------- SubversionPlugin -Core::ICore *SubversionPlugin::m_coreInstance = 0; SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = 0; SubversionPlugin::SubversionPlugin() : @@ -261,15 +260,15 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe using namespace ExtensionSystem; m_subversionPluginInstance = this; - m_coreInstance = Core::ICore::instance(); + Core::ICore *core = Core::ICore::instance(); - if (!m_coreInstance->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) return false; m_versionControl = new SubversionControl(this); addObject(m_versionControl); - if (QSettings *settings = m_coreInstance->settings()) + if (QSettings *settings = core->settings()) m_settings.fromSettings(settings); m_coreListener = new CoreListener(this); @@ -293,7 +292,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe addObject(m_subversionOutputWindow); //register actions - Core::ActionManager *ami = m_coreInstance->actionManager(); + Core::ActionManager *ami = core->actionManager(); Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); Core::ActionContainer *subversionMenu = @@ -306,7 +305,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe } QList<int> globalcontext; - globalcontext << m_coreInstance->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); + globalcontext << core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); Core::Command *command; m_addAction = new QAction(tr("Add"), this); @@ -408,7 +407,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe // Actions of the submit editor QList<int> svncommitcontext; - svncommitcontext << m_coreInstance->uniqueIDManager()->uniqueIdentifier(Constants::SUBVERSIONCOMMITEDITOR); + svncommitcontext << Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::SUBVERSIONCOMMITEDITOR); m_submitCurrentLogAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this); command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext); @@ -423,7 +422,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe m_submitRedoAction = new QAction(tr("&Redo"), this); command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext); - connect(m_coreInstance, SIGNAL(contextChanged(Core::IContext *)), this, SLOT(updateActions())); + connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext *)), this, SLOT(updateActions())); return true; } @@ -461,7 +460,7 @@ bool SubversionPlugin::editorAboutToClose(Core::IEditor *iEditor) // Prompt user. const QMessageBox::StandardButton answer = QMessageBox::question( - m_coreInstance->mainWindow(), tr("Closing Subversion Editor"), + Core::ICore::instance()->mainWindow(), tr("Closing Subversion Editor"), tr("Do you want to commit the change?"), QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes); switch (answer) { @@ -477,9 +476,9 @@ bool SubversionPlugin::editorAboutToClose(Core::IEditor *iEditor) const QStringList fileList = editor->checkedFiles(); if (!fileList.empty()) { // get message & commit - m_coreInstance->fileManager()->blockFileChange(fileIFace); + Core::ICore::instance()->fileManager()->blockFileChange(fileIFace); fileIFace->save(); - m_coreInstance->fileManager()->unblockFileChange(fileIFace); + Core::ICore::instance()->fileManager()->unblockFileChange(fileIFace); commit(m_changeTmpFile->fileName(), fileList); } cleanChangeTmpFile(); @@ -512,9 +511,9 @@ void SubversionPlugin::svnDiff(const QStringList &files, QString diffname) // the common usage pattern of continuously changing and diffing a file if (files.count() == 1) { // Show in the same editor if diff has been executed before - if (Core::IEditor *editor = locateEditor(m_coreInstance, "originalFileName", files.front())) { + if (Core::IEditor *editor = locateEditor("originalFileName", files.front())) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); return; } } @@ -526,7 +525,7 @@ void SubversionPlugin::svnDiff(const QStringList &files, QString diffname) SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName) { - Core::IEditor *editor = m_coreInstance->editorManager()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_KIND)); + Core::IEditor *editor = Core::ICore::instance()->editorManager()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_KIND)); SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor); QTC_ASSERT(submitEditor, /**/); submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction); @@ -597,7 +596,7 @@ void SubversionPlugin::revertCurrentFile() QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) return; - Core::FileManager *fm = m_coreInstance->fileManager(); + Core::FileManager *fm = Core::ICore::instance()->fileManager(); QList<Core::IFile *> files = fm->managedFiles(file); foreach (Core::IFile *file, files) fm->blockFileChange(file); @@ -775,9 +774,9 @@ void SubversionPlugin::filelog(const QString &file) // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file - if (Core::IEditor *editor = locateEditor(m_coreInstance, "logFileName", file)) { + if (Core::IEditor *editor = locateEditor("logFileName", file)) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); } else { const QString title = tr("svn log %1").arg(QFileInfo(file).fileName()); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::LogOutput, file, codec); @@ -818,9 +817,9 @@ void SubversionPlugin::annotate(const QString &file) // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file - if (Core::IEditor *editor = locateEditor(m_coreInstance, "annotateFileName", file)) { + if (Core::IEditor *editor = locateEditor("annotateFileName", file)) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); } else { const QString title = tr("svn annotate %1").arg(QFileInfo(file).fileName()); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, file, codec); @@ -872,9 +871,9 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file const QString id = diffArg + source; - if (Core::IEditor *editor = locateEditor(m_coreInstance, "describeChange", id)) { + if (Core::IEditor *editor = locateEditor("describeChange", id)) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); } else { const QString title = tr("svn describe %1#%2").arg(QFileInfo(source).fileName(), changeNr); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::DiffOutput, source, codec); @@ -884,13 +883,13 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) void SubversionPlugin::submitCurrentLog() { - m_coreInstance->editorManager()->closeEditors(QList<Core::IEditor*>() - << m_coreInstance->editorManager()->currentEditor()); + Core::ICore::instance()->editorManager()->closeEditors(QList<Core::IEditor*>() + << Core::ICore::instance()->editorManager()->currentEditor()); } QString SubversionPlugin::currentFileName() const { - const QString fileName = m_coreInstance->fileManager()->currentFile(); + const QString fileName = Core::ICore::instance()->fileManager()->currentFile(); if (!fileName.isEmpty()) { const QFileInfo fi(fileName); if (fi.exists()) @@ -991,7 +990,7 @@ Core::IEditor * SubversionPlugin::showOutputInEditor(const QString& title, const if (Subversion::Constants::debug) qDebug() << "SubversionPlugin::showOutputInEditor" << title << kind << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec); QString s = title; - Core::IEditor *ediface = m_coreInstance->editorManager()->newFile(kind, &s, output.toLocal8Bit()); + Core::IEditor *ediface = Core::ICore::instance()->editorManager()->newFile(kind, &s, output.toLocal8Bit()); SubversionEditor *e = qobject_cast<SubversionEditor*>(ediface->widget()); if (!e) return 0; @@ -1013,7 +1012,7 @@ void SubversionPlugin::setSettings(const SubversionSettings &s) { if (s != m_settings) { m_settings = s; - if (QSettings *settings = m_coreInstance->settings()) + if (QSettings *settings = Core::ICore::instance()->settings()) m_settings.toSettings(settings); } } |