replace Core::ICore::instance()->pluginManager() by ExtensionSystem::PluginManager::instance()

This commit is contained in:
hjk
2009-01-20 15:31:33 +01:00
parent 67437acf49
commit 897c05f57c
94 changed files with 467 additions and 634 deletions

View File

@@ -346,28 +346,19 @@ void WizardEventLoop::rejected()
// ---------------- BaseFileWizardPrivate
struct BaseFileWizardPrivate
{
explicit BaseFileWizardPrivate(const Core::BaseFileWizardParameters &parameters,
Core::ICore *core);
explicit BaseFileWizardPrivate(const Core::BaseFileWizardParameters &parameters)
: m_parameters(parameters), m_wizardDialog(0)
{}
const Core::BaseFileWizardParameters m_parameters;
QWizard *m_wizardDialog;
Core::ICore *m_core;
};
Core::BaseFileWizardPrivate::BaseFileWizardPrivate(const BaseFileWizardParameters &parameters,
Core::ICore *core) :
m_parameters(parameters),
m_wizardDialog(0),
m_core(core)
{
}
// ---------------- Wizard
BaseFileWizard::BaseFileWizard(const BaseFileWizardParameters &parameters,
Core::ICore *core,
QObject *parent) :
IWizard(parent),
m_d(new BaseFileWizardPrivate(parameters, core))
m_d(new BaseFileWizardPrivate(parameters))
{
}
@@ -518,13 +509,14 @@ bool BaseFileWizard::postGenerateFiles(const GeneratedFiles &l, QString *errorMe
{
// File mode: open the editors in file mode and ensure editor pane
const Core::GeneratedFiles::const_iterator cend = l.constEnd();
Core::EditorManager *em = Core::ICore::instance()->editorManager();
for (Core::GeneratedFiles::const_iterator it = l.constBegin(); it != cend; ++it) {
if (!m_d->m_core->editorManager()->openEditor(it->path(), it->editorKind())) {
if (!em->openEditor(it->path(), it->editorKind())) {
*errorMessage = tr("Failed to open an editor for %1").arg(it->path());
return false;
}
}
m_d->m_core->editorManager()->ensureEditorManagerVisible();
em->ensureEditorManagerVisible();
return true;
}
@@ -535,7 +527,6 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(const QString &l
if (debugWizard)
qDebug() << Q_FUNC_INFO << location << files;
bool existingFilesFound = false;
bool oddStuffFound = false;
@@ -582,7 +573,7 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(const QString &l
const QString messageFormat = tr("The following files already exist in the directory %1:\n"
"%2.\nWould you like to overwrite them?");
const QString message = messageFormat.arg(location).arg(fileNamesMsgPart);
const bool yes = (QMessageBox::question(core()->mainWindow(),
const bool yes = (QMessageBox::question(Core::ICore::instance()->mainWindow(),
tr("Existing files"), message,
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No)
@@ -590,11 +581,6 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(const QString &l
return yes ? OverwriteOk : OverwriteCanceled;
}
Core::ICore *BaseFileWizard::core() const
{
return m_d->m_core;
}
QList<IWizard*> BaseFileWizard::allWizards()
{
return ExtensionSystem::PluginManager::instance()->getObjects<IWizard>();
@@ -637,19 +623,18 @@ QString BaseFileWizard::buildFileName(const QString &path,
QString BaseFileWizard::preferredSuffix(const QString &mimeType) const
{
const QString rc = m_d->m_core->mimeDatabase()->preferredSuffixByType(mimeType);
const QString rc = Core::ICore::instance()->mimeDatabase()->preferredSuffixByType(mimeType);
if (rc.isEmpty())
qWarning("%s: WARNING: Unable to find a preferred suffix for %s.",
Q_FUNC_INFO, mimeType.toUtf8().constData());
return rc;
}
// ------------- StandardFileWizard(
// ------------- StandardFileWizard
StandardFileWizard::StandardFileWizard(const BaseFileWizardParameters &parameters,
Core::ICore *core,
QObject *parent) :
BaseFileWizard(parameters, core, parent)
BaseFileWizard(parameters, parent)
{
}

View File

@@ -50,7 +50,6 @@ QT_END_NAMESPACE
namespace Core {
class ICore;
class IEditor;
class IFileWizardExtension;
@@ -69,7 +68,7 @@ public:
GeneratedFile();
explicit GeneratedFile(const QString &path);
GeneratedFile(const GeneratedFile &);
GeneratedFile &operator=(const GeneratedFile&);
GeneratedFile &operator=(const GeneratedFile &);
~GeneratedFile();
// Full path of the file should be created, or the suggested file name
@@ -107,19 +106,19 @@ public:
void setKind(IWizard::Kind k);
QIcon icon() const;
void setIcon(const QIcon&);
void setIcon(const QIcon &icon);
QString description() const;
void setDescription(const QString &);
void setDescription(const QString &description);
QString name() const;
void setName(const QString &);
void setName(const QString &name);
QString category() const;
void setCategory(const QString &);
void setCategory(const QString &category);
QString trCategory() const;
void setTrCategory(const QString &);
void setTrCategory(const QString &trCategory);
private:
QSharedDataPointer<BaseFileWizardParameterData> m_d;
@@ -172,7 +171,7 @@ public:
protected:
typedef QList<QWizardPage *> WizardPageList;
explicit BaseFileWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent = 0);
explicit BaseFileWizard(const BaseFileWizardParameters &parameters, QObject *parent = 0);
// Overwrite to create the wizard dialog on the parent, adding
// the extension pages.
@@ -197,8 +196,6 @@ protected:
OverwriteResult promptOverwrite(const QString &location,
const QStringList &files,
QString *errorMessage) const;
Core::ICore *core() const;
private:
BaseFileWizardPrivate *m_d;
};
@@ -213,7 +210,7 @@ class CORE_EXPORT StandardFileWizard : public BaseFileWizard
Q_OBJECT
protected:
explicit StandardFileWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent = 0);
explicit StandardFileWizard(const BaseFileWizardParameters &parameters, QObject *parent = 0);
// Implemented to create a Core::Utils::FileWizardDialog
virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -60,7 +60,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
QMap<QString, QTreeWidgetItem *> categories;
QList<IOptionsPage*> pages =
CoreImpl::instance()->pluginManager()->getObjects<IOptionsPage>();
ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPage>();
int index = 0;
foreach (IOptionsPage *page, pages) {

View File

@@ -78,6 +78,11 @@ using namespace Core::Internal;
enum { debugEditorManager=0 };
static inline ExtensionSystem::PluginManager *pluginManager()
{
return ExtensionSystem::PluginManager::instance();
}
//===================EditorManager=====================
EditorManagerPlaceHolder *EditorManagerPlaceHolder::m_current = 0;
@@ -374,11 +379,12 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
EditorManager::~EditorManager()
{
if (m_d->m_core) {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
if (m_d->m_coreListener) {
m_d->m_core->pluginManager()->removeObject(m_d->m_coreListener);
pm->removeObject(m_d->m_coreListener);
delete m_d->m_coreListener;
}
m_d->m_core->pluginManager()->removeObject(m_d->m_openEditorsFactory);
pm->removeObject(m_d->m_openEditorsFactory);
delete m_d->m_openEditorsFactory;
}
delete m_d;
@@ -390,10 +396,11 @@ void EditorManager::init()
context << m_d->m_core->uniqueIDManager()->uniqueIdentifier("QtCreator.OpenDocumentsView");
m_d->m_coreListener = new EditorClosingCoreListener(this);
m_d->m_core->pluginManager()->addObject(m_d->m_coreListener);
pluginManager()->addObject(m_d->m_coreListener);
m_d->m_openEditorsFactory = new OpenEditorsViewFactory();
m_d->m_core->pluginManager()->addObject(m_d->m_openEditorsFactory);
pluginManager()->addObject(m_d->m_openEditorsFactory);
}
QSize EditorManager::minimumSizeHint() const
@@ -624,7 +631,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA
QList<IEditor*> acceptedEditors;
//ask all core listeners to check whether the editor can be closed
const QList<ICoreListener *> listeners =
m_d->m_core->pluginManager()->getObjects<ICoreListener>();
pluginManager()->getObjects<ICoreListener>();
foreach (IEditor *editor, editorsToClose) {
bool editorAccepted = true;
foreach (ICoreListener *listener, listeners) {
@@ -740,7 +747,7 @@ EditorManager::EditorFactoryList
EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly) const
{
EditorFactoryList rc;
const EditorFactoryList allFactories = m_d->m_core->pluginManager()->getObjects<IEditorFactory>();
const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>();
mimeTypeFactoryRecursion(m_d->m_core->mimeDatabase(), mimeType, allFactories, bestMatchOnly, &rc);
if (debugEditorManager)
qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc;
@@ -767,7 +774,7 @@ IEditor *EditorManager::createEditor(const QString &editorKind,
factories = editorFactories(mimeType, true);
} else {
// Find by editor kind
const EditorFactoryList allFactories = m_d->m_core->pluginManager()->getObjects<IEditorFactory>();
const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>();
const EditorFactoryList::const_iterator acend = allFactories.constEnd();
for (EditorFactoryList::const_iterator ait = allFactories.constBegin(); ait != acend; ++ait) {
if (editorKind == (*ait)->kind()) {

View File

@@ -44,12 +44,6 @@ class QSettings;
template <class T> class QList;
QT_END_NAMESPACE
namespace ExtensionSystem {
class PluginManager;
} // namespace ExtensionSystem
namespace Core {
class ActionManager;
@@ -87,7 +81,6 @@ public:
virtual FileManager *fileManager() const = 0;
virtual UniqueIDManager *uniqueIDManager() const = 0;
virtual MessageManager *messageManager() const = 0;
virtual ExtensionSystem::PluginManager *pluginManager() const = 0;
virtual EditorManager *editorManager() const = 0;
virtual ProgressManager *progressManager() const = 0;
virtual ScriptManager *scriptManager() const = 0;

View File

@@ -698,8 +698,8 @@ void MainWindow::openFile()
static QList<IFileFactory*> getNonEditorFileFactories()
{
const ICore *core = CoreImpl::instance();
const QList<IFileFactory*> allFileFactories = core->pluginManager()->getObjects<IFileFactory>();
const QList<IFileFactory*> allFileFactories =
ExtensionSystem::PluginManager::instance()->getObjects<IFileFactory>();
QList<IFileFactory*> nonEditorFileFactories;
foreach (IFileFactory *factory, allFileFactories) {
if (!qobject_cast<IEditorFactory *>(factory))

View File

@@ -42,9 +42,6 @@
#include <QtCore/QDir>
#include <QtCore/QTextStream>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QLabel>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWizard>
@@ -124,8 +121,8 @@ CppClassWizardParameters CppClassWizardDialog::parameters() const
// ========= CppClassWizard =========
CppClassWizard::CppClassWizard(const Core::BaseFileWizardParameters &parameters,
Core::ICore *core, QObject *parent) :
Core::BaseFileWizard(parameters, core, parent)
QObject *parent)
: Core::BaseFileWizard(parameters, parent)
{
}

View File

@@ -40,16 +40,13 @@
#include <QtGui/QWizardPage>
#include <QtGui/QWizard>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QComboBox;
QT_END_NAMESPACE
namespace Core {
namespace Utils {
class NewClassWidget;
}
}
class NewClassWidget;
} // namespace Utils
} // namespace Core
namespace CppEditor {
namespace Internal {
@@ -75,7 +72,8 @@ private:
};
struct CppClassWizardParameters {
struct CppClassWizardParameters
{
QString className;
QString headerFile;
QString sourceFile;
@@ -83,9 +81,10 @@ struct CppClassWizardParameters {
QString path;
};
class CppClassWizardDialog : public QWizard {
Q_DISABLE_COPY(CppClassWizardDialog)
class CppClassWizardDialog : public QWizard
{
Q_OBJECT
Q_DISABLE_COPY(CppClassWizardDialog)
public:
explicit CppClassWizardDialog(const QString &sourceSuffix,
const QString &headerSuffix,
@@ -104,7 +103,7 @@ class CppClassWizard : public Core::BaseFileWizard
Q_OBJECT
public:
explicit CppClassWizard(const Core::BaseFileWizardParameters &parameters,
Core::ICore *core, QObject *parent = 0);
QObject *parent = 0);
protected:
virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -38,10 +38,9 @@
using namespace CppEditor::Internal;
CPPEditorActionHandler::CPPEditorActionHandler(Core::ICore *core,
const QString &context,
CPPEditorActionHandler::CPPEditorActionHandler(const QString &context,
uint optionalActions)
: TextEditor::TextEditorActionHandler(core, context, optionalActions)
: TextEditor::TextEditorActionHandler(context, optionalActions)
{ }
CPPEditorActionHandler::~CPPEditorActionHandler()

View File

@@ -44,8 +44,7 @@ class CPPEditorActionHandler : public TextEditor::TextEditorActionHandler
Q_OBJECT
public:
CPPEditorActionHandler(Core::ICore *core,
const QString &context,
CPPEditorActionHandler(const QString &context,
uint optionalActions = None);
virtual ~CPPEditorActionHandler();

View File

@@ -46,9 +46,8 @@ enum { debugWizard = 0 };
CppFileWizard::CppFileWizard(const BaseFileWizardParameters &parameters,
FileType type,
Core::ICore *core,
QObject *parent) :
Core::StandardFileWizard(parameters, core, parent),
Core::StandardFileWizard(parameters, parent),
m_type(type)
{
}

View File

@@ -48,9 +48,9 @@ class CppFileWizard : public Core::StandardFileWizard
public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
explicit CppFileWizard(const BaseFileWizardParameters &parameters,
FileType type,
Core::ICore *core, QObject *parent = 0);
CppFileWizard(const BaseFileWizardParameters &parameters,
FileType type,
QObject *parent = 0);
protected:
static QString toAlphaNum(const QString &s);

View File

@@ -40,6 +40,7 @@
#include "cppfilewizard.h"
#include "cpphoverhandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/uniqueidmanager.h>
@@ -47,7 +48,6 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/completionsupport.h>
#include <texteditor/fontsettings.h>
#include <texteditor/storagesettings.h>
@@ -211,8 +211,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
m_actionHandler = new CPPEditorActionHandler(core,
CppEditor::Constants::C_CPPEDITOR,
m_actionHandler = new CPPEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);

View File

@@ -48,8 +48,8 @@ enum { debugFormClassWizard = 0 };
using namespace Designer;
using namespace Designer::Internal;
FormClassWizard::FormClassWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent) :
Core::BaseFileWizard(parameters, core, parent)
FormClassWizard::FormClassWizard(const BaseFileWizardParameters &parameters, QObject *parent)
: Core::BaseFileWizard(parameters, parent)
{
}

View File

@@ -38,10 +38,6 @@
#include <coreplugin/basefilewizard.h>
QT_BEGIN_NAMESPACE
class QWizard;
QT_END_NAMESPACE
namespace Designer {
namespace Internal {
@@ -55,7 +51,7 @@ class FormClassWizard : public Core::BaseFileWizard
public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
FormClassWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent);
FormClassWizard(const BaseFileWizardParameters &parameters, QObject *parent);
QString headerSuffix() const;
QString sourceSuffix() const;

View File

@@ -127,21 +127,20 @@ void FormEditorPlugin::extensionsInitialized()
bool FormEditorPlugin::initializeTemplates(QString *error)
{
Q_UNUSED(error);
Core::ICore *core = Core::ICore::instance();
FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
wizardParameters.setCategory(QLatin1String("Qt"));
wizardParameters.setTrCategory(tr("Qt"));
const QString formFileType = QLatin1String(Constants::FORM_FILE_TYPE);
wizardParameters.setName(tr("Qt Designer Form"));
wizardParameters.setDescription(tr("This creates a new Qt Designer form file."));
m_formWizard = new FormWizard(wizardParameters, core, this);
m_formWizard = new FormWizard(wizardParameters, this);
addObject(m_formWizard);
#ifdef CPP_ENABLED
wizardParameters.setKind(Core::IWizard::ClassWizard);
wizardParameters.setName(tr("Qt Designer Form Class"));
wizardParameters.setDescription(tr("This creates a new Qt Designer form class."));
m_formClassWizard = new FormClassWizard(wizardParameters, core, this);
m_formClassWizard = new FormClassWizard(wizardParameters, this);
addObject(m_formClassWizard);
#endif
return true;

View File

@@ -36,8 +36,6 @@
#include "formwindoweditor.h"
#include "designerconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QFile>
#include <QtCore/QDebug>
@@ -46,8 +44,8 @@ enum { debugFormWizard = 0 };
using namespace Designer;
using namespace Designer::Internal;
FormWizard::FormWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent) :
Core::BaseFileWizard(parameters, core, parent)
FormWizard::FormWizard(const BaseFileWizardParameters &parameters, QObject *parent)
: Core::BaseFileWizard(parameters, parent)
{
}
@@ -55,7 +53,7 @@ QWizard *FormWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const
{
FormFileWizardDialog *wizardDialog = new FormFileWizardDialog(core(), extensionPages, parent);
FormFileWizardDialog *wizardDialog = new FormFileWizardDialog(extensionPages, parent);
wizardDialog->setPath(defaultPath);
return wizardDialog;
}

View File

@@ -36,15 +36,9 @@
#include <coreplugin/basefilewizard.h>
QT_BEGIN_NAMESPACE
class QWizard;
QT_END_NAMESPACE
namespace Designer {
namespace Internal {
class FormFileWizardDialog;
class FormWizard : public Core::BaseFileWizard
{
Q_DISABLE_COPY(FormWizard)
@@ -53,7 +47,7 @@ class FormWizard : public Core::BaseFileWizard
public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
explicit FormWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent);
FormWizard(const BaseFileWizardParameters &parameters, QObject *parent);
protected:
virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -50,12 +50,10 @@ namespace Designer {
namespace Internal {
// ----------------- FormWizardDialog
FormWizardDialog::FormWizardDialog(Core::ICore *core,
const WizardPageList &extensionPages,
QWidget *parent) :
QWizard(parent),
m_formPage(new FormTemplateWizardPagePage),
m_core(core)
FormWizardDialog::FormWizardDialog(const WizardPageList &extensionPages,
QWidget *parent)
: QWizard(parent),
m_formPage(new FormTemplateWizardPagePage)
{
init(extensionPages);
}
@@ -82,10 +80,9 @@ QString FormWizardDialog::templateContents() const
}
// ----------------- FormFileWizardDialog
FormFileWizardDialog::FormFileWizardDialog(Core::ICore *core,
const WizardPageList &extensionPages,
QWidget *parent) :
FormWizardDialog(core, extensionPages, parent),
FormFileWizardDialog::FormFileWizardDialog(const WizardPageList &extensionPages,
QWidget *parent)
: FormWizardDialog(extensionPages, parent),
m_filePage(new Core::Utils::FileWizardPage)
{
setPage(FilePageId, m_filePage);

View File

@@ -37,10 +37,9 @@
#include <QtGui/QWizard>
namespace Core {
class ICore;
namespace Utils {
class FileWizardPage;
}
namespace Utils {
class FileWizardPage;
}
}
namespace Designer {
@@ -58,8 +57,7 @@ class FormWizardDialog : public QWizard
public:
typedef QList<QWizardPage *> WizardPageList;
explicit FormWizardDialog(Core::ICore *core,
const WizardPageList &extensionPages,
explicit FormWizardDialog(const WizardPageList &extensionPages,
QWidget *parent = 0);
QString templateContents() const;
@@ -68,7 +66,6 @@ private:
void init(const WizardPageList &extensionPages);
FormTemplateWizardPagePage *m_formPage;
Core::ICore *m_core;
mutable QString m_templateContents;
};
@@ -82,8 +79,7 @@ class FormFileWizardDialog : public FormWizardDialog
Q_OBJECT
public:
explicit FormFileWizardDialog(Core::ICore *core,
const WizardPageList &extensionPages,
explicit FormFileWizardDialog(const WizardPageList &extensionPages,
QWidget *parent = 0);
QString path() const;

View File

@@ -97,10 +97,10 @@ static QString formatCommand(const QString &binary, const QStringList &args)
}
// ---------------- GitClient
GitClient::GitClient(GitPlugin* plugin, Core::ICore *core) :
m_msgWait(tr("Waiting for data...")),
GitClient::GitClient(GitPlugin* plugin)
: m_msgWait(tr("Waiting for data...")),
m_plugin(plugin),
m_core(core)
m_core(Core::ICore::instance())
{
if (QSettings *s = m_core->settings())
m_settings.fromSettings(s);

View File

@@ -68,7 +68,7 @@ class GitClient : public QObject
Q_OBJECT
public:
explicit GitClient(GitPlugin *plugin, Core::ICore *core);
explicit GitClient(GitPlugin *plugin);
~GitClient();
bool managesDirectory(const QString &) const { return false; }

View File

@@ -233,7 +233,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
Q_UNUSED(error_message);
m_core = Core::ICore::instance();
m_gitClient = new GitClient(this, m_core);
m_gitClient = new GitClient(this);
// Create the globalcontext list to register actions accordingly
QList<int> globalcontext;
globalcontext << m_core->uniqueIDManager()->
@@ -250,7 +250,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
static const char *describeSlot = SLOT(show(QString,QString));
const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters);
for (int i = 0; i < editorCount; i++) {
m_editorFactories.push_back(new GitEditorFactory(editorParameters + i, m_core, m_gitClient, describeSlot));
m_editorFactories.push_back(new GitEditorFactory(editorParameters + i, m_gitClient, describeSlot));
addObject(m_editorFactories.back());
}
@@ -622,7 +622,7 @@ void GitPlugin::startCommit()
Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)
{
Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, QLatin1String(Constants::GITSUBMITEDITOR_KIND));
Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, QLatin1String(Constants::GITSUBMITEDITOR_KIND));
if (Git::Constants::debug)
qDebug() << Q_FUNC_INFO << fileName << editor;
m_core->editorManager()->ensureEditorManagerVisible();

View File

@@ -211,7 +211,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess
static const char *describeSlot = SLOT(describe(QString,QString));
const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters);
for (int i = 0; i < editorCount; i++) {
m_editorFactories.push_back(new PerforceEditorFactory(editorParameters + i, core, this, describeSlot));
m_editorFactories.push_back(new PerforceEditorFactory(editorParameters + i, this, describeSlot));
addObject(m_editorFactories.back());
}
@@ -596,7 +596,8 @@ void PerforcePlugin::annotate(const QString &fileName)
CommandToWindow|StdErrToWindow|ErrorToWindow, codec);
if (!result.error) {
const QFileInfo fi(fileName);
showOutputInEditor(tr("p4 annotate %1").arg(fi.fileName()), result.stdOut, VCSBase::AnnotateOutput, codec);
showOutputInEditor(tr("p4 annotate %1").arg(fi.fileName()),
result.stdOut, VCSBase::AnnotateOutput, codec);
}
}
@@ -623,7 +624,8 @@ void PerforcePlugin::filelog(const QString &fileName)
CommandToWindow|StdErrToWindow|ErrorToWindow, codec);
if (!result.error) {
const QFileInfo fi(fileName);
showOutputInEditor(tr("p4 filelog %1").arg(fi.fileName()), result.stdOut, VCSBase::LogOutput, codec);
showOutputInEditor(tr("p4 filelog %1").arg(fi.fileName()),
result.stdOut, VCSBase::LogOutput, codec);
}
}

View File

@@ -43,8 +43,7 @@ using namespace QuickOpen;
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe, ICore *core)
: BaseFileFilter(core)
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
{
m_projectExplorer = pe;
connect(m_projectExplorer, SIGNAL(fileListChanged()),

View File

@@ -36,13 +36,10 @@
#include <quickopen/basefilefilter.h>
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QByteArray>
#include <QtCore/QFutureInterface>
#include <QtCore/QString>
#include <QtGui/QWidget>
namespace ProjectExplorer {
class ProjectExplorerPlugin;
@@ -54,7 +51,7 @@ class AllProjectsFilter : public QuickOpen::BaseFileFilter
Q_OBJECT
public:
AllProjectsFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
explicit AllProjectsFilter(ProjectExplorerPlugin *pe);
QString trName() const { return tr("Files in any project"); }
QString name() const { return "Files in any project"; }
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }

View File

@@ -47,8 +47,8 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
using namespace TextEditor;
AllProjectsFind::AllProjectsFind(ProjectExplorerPlugin *plugin, Core::ICore *core, SearchResultWindow *resultWindow)
: BaseFileFind(core, resultWindow),
AllProjectsFind::AllProjectsFind(ProjectExplorerPlugin *plugin, SearchResultWindow *resultWindow)
: BaseFileFind(resultWindow),
m_plugin(plugin),
m_configWidget(0)
{

View File

@@ -34,15 +34,11 @@
#ifndef ALLPROJECTSFIND_H
#define ALLPROJECTSFIND_H
#include <coreplugin/icore.h>
#include <find/ifindfilter.h>
#include <find/searchresultwindow.h>
#include <texteditor/basefilefind.h>
#include <QtCore/QPointer>
#include <QtGui/QLabel>
#include <QtGui/QComboBox>
#include <QtGui/QStringListModel>
namespace ProjectExplorer {
@@ -56,7 +52,7 @@ class AllProjectsFind : public TextEditor::BaseFileFind
Q_OBJECT
public:
AllProjectsFind(ProjectExplorerPlugin *plugin, Core::ICore *core, Find::SearchResultWindow *resultWindow);
AllProjectsFind(ProjectExplorerPlugin *plugin, Find::SearchResultWindow *resultWindow);
QString name() const;

View File

@@ -36,20 +36,18 @@
#include "project.h"
#include "session.h"
#include <QtCore/QVariant>
#include <QtCore/QTimer>
#include <QtCore/QtDebug>
#include <QtCore/QThread>
#include <QtDebug>
#include <QtCore/QTimer>
#include <QtCore/QVariant>
using namespace Core;
using namespace QuickOpen;
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe,
ICore *core)
: BaseFileFilter(core),
m_project(0)
CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe)
: BaseFileFilter(), m_project(0)
{
m_projectExplorer = pe;
@@ -73,12 +71,12 @@ void CurrentProjectFilter::currentProjectChanged(ProjectExplorer::Project *proje
{
if (project == m_project)
return;
if (m_project) {
if (m_project)
disconnect(m_project, SIGNAL(fileListChanged()), this, SLOT(refreshInternally()));
}
if (project) {
if (project)
connect(project, SIGNAL(fileListChanged()), this, SLOT(refreshInternally()));
}
m_project = project;
refreshInternally();
}

View File

@@ -54,7 +54,7 @@ class CurrentProjectFilter : public QuickOpen::BaseFileFilter
Q_OBJECT
public:
CurrentProjectFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
CurrentProjectFilter(ProjectExplorerPlugin *pe);
QString trName() const { return tr("Files in current project"); }
QString name() const { return "Files in current project"; }
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }

View File

@@ -47,8 +47,8 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
using namespace TextEditor;
CurrentProjectFind::CurrentProjectFind(ProjectExplorerPlugin *plugin, Core::ICore *core, SearchResultWindow *resultWindow)
: BaseFileFind(core, resultWindow),
CurrentProjectFind::CurrentProjectFind(ProjectExplorerPlugin *plugin, SearchResultWindow *resultWindow)
: BaseFileFind(resultWindow),
m_plugin(plugin),
m_configWidget(0)
{

View File

@@ -34,7 +34,6 @@
#ifndef CURRENTPROJECTFIND_H
#define CURRENTPROJECTFIND_H
#include <coreplugin/icore.h>
#include <find/ifindfilter.h>
#include <find/searchresultwindow.h>
#include <texteditor/basefilefind.h>
@@ -51,7 +50,7 @@ namespace Internal {
class CurrentProjectFind : public TextEditor::BaseFileFind
{
public:
CurrentProjectFind(ProjectExplorerPlugin *plugin, Core::ICore *core, Find::SearchResultWindow *resultWindow);
CurrentProjectFind(ProjectExplorerPlugin *plugin, Find::SearchResultWindow *resultWindow);
QString name() const;

View File

@@ -46,10 +46,9 @@
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
ProjectFileFactory::ProjectFileFactory(const Core::ICore* core, IProjectManager *manager) :
m_mimeTypes(manager->mimeType()),
ProjectFileFactory::ProjectFileFactory(IProjectManager *manager)
: m_mimeTypes(manager->mimeType()),
m_kind(Constants::FILE_FACTORY_KIND),
m_core(core),
m_manager(manager)
{
}
@@ -70,7 +69,7 @@ Core::IFile *ProjectFileFactory::open(const QString &fileName)
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (!pe->openProject(fileName)) {
m_core->messageManager()->printToOutputPane(tr("Could not open the following project: '%1'").arg(fileName));
Core::ICore::instance()->messageManager()->printToOutputPane(tr("Could not open the following project: '%1'").arg(fileName));
} else if (pe->session()) {
SessionManager *session = pe->session();
if (session->projects().count() == 1)
@@ -81,21 +80,21 @@ Core::IFile *ProjectFileFactory::open(const QString &fileName)
return fIFace;
}
QList<ProjectFileFactory*> ProjectFileFactory::createFactories(const Core::ICore* core,
QString *filterString)
QList<ProjectFileFactory *> ProjectFileFactory::createFactories(QString *filterString)
{
// Register factories for all project managers
QList<Internal::ProjectFileFactory*> rc;
QList<IProjectManager*> projectManagers = core->pluginManager()->getObjects<IProjectManager>();
QList<IProjectManager*> projectManagers =
ExtensionSystem::PluginManager::instance()->getObjects<IProjectManager>();
const QString filterSeparator = QLatin1String(";;");
filterString->clear();
foreach (IProjectManager *manager, projectManagers) {
rc.push_back(new ProjectFileFactory(core, manager));
rc.push_back(new ProjectFileFactory(manager));
if (!filterString->isEmpty())
*filterString += filterSeparator;
const QString mimeType = manager->mimeType();
const QString pFilterString = core->mimeDatabase()->findByType(mimeType).filterString();
const QString pFilterString = Core::ICore::instance()->mimeDatabase()->findByType(mimeType).filterString();
*filterString += pFilterString;
}
return rc;

View File

@@ -35,16 +35,14 @@
#define PLUGINFILEFACTORY_H
#include <coreplugin/ifilefactory.h>
#include <QtCore/QObject>
#include <QtCore/QStringList>
namespace Core {
class ICore;
}
namespace ProjectExplorer {
class IProjectManager;
class ProjectExplorerPlugin;
class IProjectManager;
class ProjectExplorerPlugin;
namespace Internal {
@@ -53,20 +51,20 @@ namespace Internal {
class ProjectFileFactory : public Core::IFileFactory
{
Q_OBJECT
explicit ProjectFileFactory(const Core::ICore* core, ProjectExplorer::IProjectManager *manager);
public:
explicit ProjectFileFactory(ProjectExplorer::IProjectManager *manager);
public:
virtual QStringList mimeTypes() const;
bool canOpen(const QString &fileName);
QString kind() const;
Core::IFile *open(const QString &fileName);
static QList<ProjectFileFactory*> createFactories(const Core::ICore* core, QString *filterString);
static QList<ProjectFileFactory*> createFactories(QString *filterString);
private:
const QStringList m_mimeTypes;
const QString m_kind;
const Core::ICore* m_core;
ProjectExplorer::IProjectManager *m_manager;
};

View File

@@ -152,15 +152,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
Q_UNUSED(arguments);
Q_UNUSED(error);
m_core = Core::ICore::instance();
Core::ActionManager *am = m_core->actionManager();
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
addObject(this);
connect(m_core->fileManager(), SIGNAL(currentFileChanged(const QString&)),
connect(core->fileManager(), SIGNAL(currentFileChanged(const QString&)),
this, SLOT(setCurrentFile(const QString&)));
m_session = new SessionManager(m_core, this);
m_session = new SessionManager(core, this);
connect(m_session, SIGNAL(projectAdded(ProjectExplorer::Project *)),
this, SIGNAL(fileListChanged()));
@@ -171,13 +171,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
this, SLOT(startupProjectChanged()));
m_proWindow = new ProjectWindow(m_core);
m_proWindow = new ProjectWindow;
QList<int> globalcontext;
globalcontext.append(Core::Constants::C_GLOBAL_ID);
QList<int> pecontext;
pecontext << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_PROJECTEXPLORER);
pecontext << core->uniqueIDManager()->uniqueIdentifier(Constants::C_PROJECTEXPLORER);
Core::BaseMode *mode = new Core::BaseMode;
mode->setName(tr("Projects"));
@@ -199,15 +199,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new CoreListenerCheckingForRunningBuild(m_buildManager));
m_outputPane = new OutputPane(m_core);
m_outputPane = new OutputPane(core);
addAutoReleasedObject(m_outputPane);
connect(m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)),
m_outputPane, SLOT(projectRemoved()));
AllProjectsFilter *allProjectsFilter = new AllProjectsFilter(this, m_core);
AllProjectsFilter *allProjectsFilter = new AllProjectsFilter(this);
addAutoReleasedObject(allProjectsFilter);
CurrentProjectFilter *currentProjectFilter = new CurrentProjectFilter(this, m_core);
CurrentProjectFilter *currentProjectFilter = new CurrentProjectFilter(this);
addAutoReleasedObject(currentProjectFilter);
addAutoReleasedObject(new BuildSettingsPanelFactory);
@@ -218,18 +218,19 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
ProcessStepFactory *processStepFactory = new ProcessStepFactory;
addAutoReleasedObject(processStepFactory);
AllProjectsFind *allProjectsFind = new AllProjectsFind(this, m_core,
m_core->pluginManager()->getObject<Find::SearchResultWindow>());
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
AllProjectsFind *allProjectsFind = new AllProjectsFind(this,
pm->getObject<Find::SearchResultWindow>());
addAutoReleasedObject(allProjectsFind);
CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this, m_core,
m_core->pluginManager()->getObject<Find::SearchResultWindow>());
CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this,
pm->getObject<Find::SearchResultWindow>());
addAutoReleasedObject(currentProjectFind);
addAutoReleasedObject(new ApplicationRunConfigurationRunner);
addAutoReleasedObject(new CustomExecutableRunConfigurationFactory);
addAutoReleasedObject(new ProjectFileWizardExtension(m_core));
addAutoReleasedObject(new ProjectFileWizardExtension);
// context menus
Core::ActionContainer *msessionContextMenu =
@@ -255,7 +256,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
am->actionContainer(Core::Constants::MENU_BAR);
// mode manager (for fancy actions)
Core::ModeManager *modeManager = m_core->modeManager();
Core::ModeManager *modeManager = core->modeManager();
// build menu
Core::ActionContainer *mbuild =
@@ -585,13 +586,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
m_renameFileAction->setEnabled(false);
m_renameFileAction->setVisible(false);
connect(m_core, SIGNAL(saveSettingsRequested()),
connect(core, SIGNAL(saveSettingsRequested()),
this, SLOT(savePersistentSettings()));
addAutoReleasedObject(new ProjectTreeWidgetFactory(m_core));
addAutoReleasedObject(new FolderNavigationWidgetFactory(m_core));
addAutoReleasedObject(new ProjectTreeWidgetFactory(core));
addAutoReleasedObject(new FolderNavigationWidgetFactory(core));
if (QSettings *s = m_core->settings())
if (QSettings *s = core->settings())
m_recentProjects = s->value("ProjectExplorer/RecentProjects/Files", QStringList()).toStringList();
for (QStringList::iterator it = m_recentProjects.begin(); it != m_recentProjects.end(); ) {
if (QFileInfo(*it).isFile()) {
@@ -627,7 +628,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
updateActions();
connect(m_core, SIGNAL(coreOpened()), this, SLOT(restoreSession()));
connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
return true;
}
@@ -647,7 +648,7 @@ template <class Factory, class Iterator>
ProjectFileFactory * ProjectExplorerPlugin::findProjectFileFactory(const QString &filename) const
{
// Find factory
if (const Core::MimeType mt = m_core->mimeDatabase()->findByFile(QFileInfo(filename)))
if (const Core::MimeType mt = Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(filename)))
if (ProjectFileFactory *pf = findFactory<ProjectFileFactory>(mt.type(), m_fileFactories.constBegin(), m_fileFactories.constEnd()))
return pf;
qWarning("Unable to find project file factory for '%s'", filename.toUtf8().constData());
@@ -705,9 +706,9 @@ void ProjectExplorerPlugin::unloadProject()
bool success = false;
if (readonlycount > 0)
success = m_core->fileManager()->saveModifiedFiles(filesToSave).isEmpty();
success = Core::ICore::instance()->fileManager()->saveModifiedFiles(filesToSave).isEmpty();
else
success = m_core->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty();
success = Core::ICore::instance()->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty();
if (!success)
return;
@@ -729,7 +730,7 @@ void ProjectExplorerPlugin::clearSession()
void ProjectExplorerPlugin::extensionsInitialized()
{
m_fileFactories = ProjectFileFactory::createFactories(m_core, &m_projectFilterString);
m_fileFactories = ProjectFileFactory::createFactories(&m_projectFilterString);
foreach (ProjectFileFactory *pf, m_fileFactories) {
m_profileMimeTypes += pf->mimeTypes();
addAutoReleasedObject(pf);
@@ -755,7 +756,7 @@ void ProjectExplorerPlugin::newProject()
defaultLocation = dir.absolutePath();
}
m_core->showNewItemDialog(tr("New Project", "Title of dialog"),
Core::ICore::instance()->showNewItemDialog(tr("New Project", "Title of dialog"),
Core::BaseFileWizard::findWizardsOfKind(Core::IWizard::ProjectWizard),
defaultLocation);
updateActions();
@@ -805,7 +806,7 @@ void ProjectExplorerPlugin::savePersistentSettings()
m_session->save();
}
QSettings *s = m_core->settings();
QSettings *s = Core::ICore::instance()->settings();
if (s) {
s->setValue("ProjectExplorer/StartupSession", m_session->file()->fileName());
s->setValue("ProjectExplorer/RecentProjects/Files", m_recentProjects);
@@ -829,14 +830,14 @@ bool ProjectExplorerPlugin::openProjects(const QStringList &fileNames)
if (debug)
qDebug() << "ProjectExplorerPlugin - opening projects " << fileNames;
QList<IProjectManager*> projectManagers =
m_core->pluginManager()->getObjects<IProjectManager>();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
QList<IProjectManager*> projectManagers = pm->getObjects<IProjectManager>();
//QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
// bool blocked = blockSignals(true);
QList<Project*> openedPro;
foreach (QString fileName, fileNames)
if (const Core::MimeType mt = m_core->mimeDatabase()->findByFile(QFileInfo(fileName))) {
foreach (const QString &fileName, fileNames) {
if (const Core::MimeType mt = Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName))) {
foreach (IProjectManager *manager, projectManagers)
if (manager->mimeType() == mt.type()) {
if (Project *pro = manager->openProject(fileName))
@@ -845,6 +846,7 @@ bool ProjectExplorerPlugin::openProjects(const QStringList &fileNames)
break;
}
}
}
//blockSignals(blocked);
if (openedPro.isEmpty()) {
@@ -868,7 +870,7 @@ bool ProjectExplorerPlugin::openProjects(const QStringList &fileNames)
updateActions();
m_core->modeManager()->activateMode(Core::Constants::MODE_EDIT);
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT);
QApplication::restoreOverrideCursor();
return true;
@@ -984,7 +986,7 @@ void ProjectExplorerPlugin::restoreSession()
}
// update welcome page
Core::ModeManager *modeManager = m_core->modeManager();
Core::ModeManager *modeManager = Core::ICore::instance()->modeManager();
connect(modeManager, SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(currentModeChanged(Core::IMode*)));
if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast<Core::Internal::WelcomeMode*>(modeManager->mode(Core::Constants::MODE_WELCOME))) {
updateWelcomePage(welcomeMode);
@@ -992,7 +994,7 @@ void ProjectExplorerPlugin::restoreSession()
connect(welcomeMode, SIGNAL(requestProject(QString)), this, SLOT(loadProject(QString)));
}
m_core->openFiles(arguments);
Core::ICore::instance()->openFiles(arguments);
updateActions();
}
@@ -1119,6 +1121,8 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
else
node = m_session->nodeForFile(filePath);
Core::ICore *core = Core::ICore::instance();
bool projectChanged = false;
if (m_currentProject != project) {
int oldContext = -1;
@@ -1133,11 +1137,11 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
newContext = project->projectManager()->projectContext();
newLanguageID = project->projectManager()->projectLanguage();
}
m_core->removeAdditionalContext(oldContext);
m_core->removeAdditionalContext(oldLanguageID);
m_core->addAdditionalContext(newContext);
m_core->addAdditionalContext(newLanguageID);
m_core->updateContext();
core->removeAdditionalContext(oldContext);
core->removeAdditionalContext(oldLanguageID);
core->addAdditionalContext(newContext);
core->addAdditionalContext(newLanguageID);
core->updateContext();
m_currentProject = project;
@@ -1155,16 +1159,16 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
qDebug() << "ProjectExplorer - currentProjectChanged(" << (project ? project->name() : "0") << ")";
// Enable the right VCS
if (const Core::IFile *projectFile = project ? project->file() : static_cast<const Core::IFile *>(0)) {
m_core->vcsManager()->setVCSEnabled(QFileInfo(projectFile->fileName()).absolutePath());
core->vcsManager()->setVCSEnabled(QFileInfo(projectFile->fileName()).absolutePath());
} else {
m_core->vcsManager()->setAllVCSEnabled();
core->vcsManager()->setAllVCSEnabled();
}
emit currentProjectChanged(project);
updateActions();
}
m_core->fileManager()->setCurrentFile(filePath);
core->fileManager()->setCurrentFile(filePath);
}
void ProjectExplorerPlugin::updateActions()
@@ -1225,7 +1229,7 @@ bool ProjectExplorerPlugin::saveModifiedFiles(const QList<Project *> & projects)
if (debug)
qDebug() << "ProjectExplorerPlugin::saveModifiedFiles";
QList<Core::IFile *> modifiedFi = m_core->fileManager()->modifiedFiles();
QList<Core::IFile *> modifiedFi = Core::ICore::instance()->fileManager()->modifiedFiles();
QMap<QString, Core::IFile *> modified;
QStringList allFiles;
@@ -1256,7 +1260,7 @@ bool ProjectExplorerPlugin::saveModifiedFiles(const QList<Project *> & projects)
if (!filesToSave.isEmpty()) {
bool cancelled;
m_core->fileManager()->saveModifiedFiles(filesToSave, &cancelled,
Core::ICore::instance()->fileManager()->saveModifiedFiles(filesToSave, &cancelled,
tr("The following dependencies are modified, do you want to save them?"));
if (cancelled) {
return false;
@@ -1430,7 +1434,8 @@ void ProjectExplorerPlugin::startupProjectChanged()
// NBS TODO implement more than one runner
IRunConfigurationRunner *ProjectExplorerPlugin::findRunner(QSharedPointer<RunConfiguration> config, const QString &mode)
{
const QList<IRunConfigurationRunner *> runners = m_core->pluginManager()->getObjects<IRunConfigurationRunner>();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
const QList<IRunConfigurationRunner *> runners = pm->getObjects<IRunConfigurationRunner>();
foreach (IRunConfigurationRunner *runner, runners)
if (runner->canRun(config, mode))
return runner;
@@ -1482,7 +1487,7 @@ void ProjectExplorerPlugin::updateRecentProjectMenu()
qDebug() << "ProjectExplorerPlugin::updateRecentProjectMenu";
Core::ActionContainer *aci =
m_core->actionManager()->actionContainer(Constants::M_RECENTPROJECTS);
Core::ICore::instance()->actionManager()->actionContainer(Constants::M_RECENTPROJECTS);
QMenu *menu = aci->menu();
menu->clear();
m_recentProjectsActions.clear();
@@ -1549,7 +1554,7 @@ void ProjectExplorerPlugin::addNewFile()
if (!m_currentNode && m_currentNode->nodeType() == ProjectNodeType)
return;
const QString location = QFileInfo(m_currentNode->path()).dir().absolutePath();
m_core->showNewItemDialog(tr("New File", "Title of dialog"),
Core::ICore::instance()->showNewItemDialog(tr("New File", "Title of dialog"),
Core::BaseFileWizard::findWizardsOfKind(Core::IWizard::FileWizard)
+ Core::BaseFileWizard::findWizardsOfKind(Core::IWizard::ClassWizard),
location);
@@ -1560,14 +1565,15 @@ void ProjectExplorerPlugin::addExistingFiles()
if (!m_currentNode && m_currentNode->nodeType() == ProjectNodeType)
return;
ProjectNode *projectNode = qobject_cast<ProjectNode*>(m_currentNode);
Core::ICore *core = Core::ICore::instance();
const QString dir = QFileInfo(m_currentNode->path()).dir().absolutePath();
QStringList fileNames = QFileDialog::getOpenFileNames(m_core->mainWindow(), tr("Add Existing Files"), dir);
QStringList fileNames = QFileDialog::getOpenFileNames(core->mainWindow(), tr("Add Existing Files"), dir);
if (fileNames.isEmpty())
return;
QHash<FileType, QString> fileTypeToFiles;
foreach (const QString &fileName, fileNames) {
FileType fileType = typeForFileName(m_core->mimeDatabase(), QFileInfo(fileName));
FileType fileType = typeForFileName(core->mimeDatabase(), QFileInfo(fileName));
fileTypeToFiles.insertMulti(fileType, fileName);
}
@@ -1578,17 +1584,17 @@ void ProjectExplorerPlugin::addExistingFiles()
if (!notAdded.isEmpty()) {
QString message = tr("Could not add following files to project %1:\n").arg(projectNode->name());
QString files = notAdded.join("\n");
QMessageBox::warning(m_core->mainWindow(), tr("Add files to project failed"),
QMessageBox::warning(core->mainWindow(), tr("Add files to project failed"),
message + files);
foreach (const QString &file, notAdded)
fileNames.removeOne(file);
}
if (Core::IVersionControl *vcManager = m_core->vcsManager()->findVersionControlForDirectory(dir))
if (Core::IVersionControl *vcManager = core->vcsManager()->findVersionControlForDirectory(dir))
if (vcManager->supportsOperation(Core::IVersionControl::AddOperation)) {
const QString files = fileNames.join(QString(QLatin1Char('\n')));
QMessageBox::StandardButton button =
QMessageBox::question(m_core->mainWindow(), tr("Add to Version Control"),
QMessageBox::question(core->mainWindow(), tr("Add to Version Control"),
tr("Add files\n%1\nto version control (%2)?").arg(files, vcManager->name()),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) {
@@ -1601,7 +1607,7 @@ void ProjectExplorerPlugin::addExistingFiles()
if (!notAddedToVc.isEmpty()) {
const QString message = tr("Could not add following files to version control (%1)\n").arg(vcManager->name());
const QString filesNotAdded = notAddedToVc.join(QString(QLatin1Char('\n')));
QMessageBox::warning(m_core->mainWindow(), tr("Add files to version control failed"),
QMessageBox::warning(core->mainWindow(), tr("Add files to version control failed"),
message + filesNotAdded);
}
}
@@ -1612,19 +1618,22 @@ void ProjectExplorerPlugin::openFile()
{
if (m_currentNode)
return;
m_core->editorManager()->openEditor(m_currentNode->path());
m_core->editorManager()->ensureEditorManagerVisible();
Core::ICore *core = Core::ICore::instance();
core->editorManager()->openEditor(m_currentNode->path());
core->editorManager()->ensureEditorManagerVisible();
}
void ProjectExplorerPlugin::removeFile()
{
if (!m_currentNode && m_currentNode->nodeType() == FileNodeType)
return;
FileNode *fileNode = qobject_cast<FileNode*>(m_currentNode);
Core::ICore *core = Core::ICore::instance();
const QString filePath = m_currentNode->path();
const QString fileDir = QFileInfo(filePath).dir().absolutePath();
RemoveFileDialog removeFileDialog(filePath, m_core->mainWindow());
RemoveFileDialog removeFileDialog(filePath, core->mainWindow());
if (removeFileDialog.exec() == QDialog::Accepted) {
const bool deleteFile = removeFileDialog.isDeleteFileChecked();
@@ -1634,13 +1643,13 @@ void ProjectExplorerPlugin::removeFile()
Q_ASSERT(projectNode);
if (!projectNode->removeFiles(fileNode->fileType(), QStringList(filePath))) {
QMessageBox::warning(m_core->mainWindow(), tr("Remove file failed"),
QMessageBox::warning(core->mainWindow(), tr("Remove file failed"),
tr("Could not remove file %1 from project %2.").arg(filePath).arg(projectNode->name()));
return;
}
// remove from version control
m_core->vcsManager()->showDeleteDialog(filePath);
core->vcsManager()->showDeleteDialog(filePath);
// remove from file system
if (deleteFile) {
@@ -1649,7 +1658,7 @@ void ProjectExplorerPlugin::removeFile()
if (file.exists()) {
// could have been deleted by vc
if (!file.remove())
QMessageBox::warning(m_core->mainWindow(), tr("Delete file failed"),
QMessageBox::warning(core->mainWindow(), tr("Delete file failed"),
tr("Could not delete file %1.").arg(filePath));
}
}
@@ -1753,11 +1762,12 @@ void ProjectExplorerPlugin::populateOpenWithMenu()
bool anyMatches = false;
const QString fileName = currentNode()->path();
if (const Core::MimeType mt = m_core->mimeDatabase()->findByFile(QFileInfo(fileName))) {
const EditorFactoryList factories = m_core->editorManager()->editorFactories(mt, false);
Core::ICore *core = Core::ICore::instance();
if (const Core::MimeType mt = core->mimeDatabase()->findByFile(QFileInfo(fileName))) {
const EditorFactoryList factories = core->editorManager()->editorFactories(mt, false);
anyMatches = !factories.empty();
if (anyMatches) {
const QList<Core::IEditor *> editorsOpenForFile = m_core->editorManager()->editorsForFileName(fileName);
const QList<Core::IEditor *> editorsOpenForFile = core->editorManager()->editorsForFileName(fileName);
// Add all suitable editors
foreach (Core::IEditorFactory *editorFactory, factories) {
// Add action to open with this very editor factory
@@ -1792,8 +1802,9 @@ void ProjectExplorerPlugin::openWithMenuTriggered(QAction *action)
qWarning() << "Editor Factory not attached to action, can't happen"<<editorFactory;
return;
}
m_core->editorManager()->openEditor(currentNode()->path(), editorFactory->kind());
m_core->editorManager()->ensureEditorManagerVisible();
Core::EditorManager *em = Core::ICore::instance()->editorManager();
em->openEditor(currentNode()->path(), editorFactory->kind());
em->ensureEditorManagerVisible();
}
void ProjectExplorerPlugin::updateSessionMenu()

View File

@@ -54,7 +54,6 @@
namespace Core {
class IContext;
class ICore;
class IMode;
class IFileFactory;
namespace Internal {
@@ -239,7 +238,6 @@ private:
QMenu *m_runConfigurationMenu;
QActionGroup *m_runConfigurationActionGroup;
Core::ICore *m_core;
Internal::ProjectWindow *m_proWindow;
SessionManager *m_session;
@@ -264,6 +262,7 @@ private:
};
namespace Internal {
class CoreListenerCheckingForRunningBuild : public Core::ICoreListener
{
Q_OBJECT
@@ -275,7 +274,8 @@ public:
private:
BuildManager *m_manager;
};
}
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -87,16 +87,16 @@ void AllProjectNodesVisitor::visitProjectNode(ProjectNode *node)
}
// --------- ProjectWizardContext
struct ProjectWizardContext {
struct ProjectWizardContext
{
Core::IVersionControl *versionControl;
ProjectNodeList projects;
ProjectWizardPage *page;
};
// ---- ProjectFileWizardExtension
ProjectFileWizardExtension::ProjectFileWizardExtension(Core::ICore *core) :
m_core(core),
m_context(0)
ProjectFileWizardExtension::ProjectFileWizardExtension()
: m_context(0)
{
}
@@ -115,7 +115,7 @@ void ProjectFileWizardExtension::firstExtensionPageShown(const QList<Core::Gener
fileNames.push_back(f.path());
const QString directory = QFileInfo(fileNames.front()).absolutePath();
m_context->versionControl = m_core->vcsManager()->findVersionControlForDirectory(directory);
m_context->versionControl = Core::ICore::instance()->vcsManager()->findVersionControlForDirectory(directory);
m_context->page->setFilesDisplay(fileNames);
@@ -175,7 +175,7 @@ bool ProjectFileWizardExtension::process(const QList<Core::GeneratedFile> &files
TypeFileMap typeFileMap;
foreach (const Core::GeneratedFile &generatedFile, files) {
const QString path = generatedFile.path();
typeFileMap.insert(typeForFileName(m_core->mimeDatabase(), path), path);
typeFileMap.insert(typeForFileName(Core::ICore::instance()->mimeDatabase(), path), path);
}
foreach (FileType type, typeFileMap.uniqueKeys()) {
const QStringList files = typeFileMap.values(type);

View File

@@ -36,10 +36,6 @@
#include <coreplugin/ifilewizardextension.h>
namespace Core {
class ICore;
}
namespace ProjectExplorer {
namespace Internal {
@@ -54,7 +50,7 @@ class ProjectFileWizardExtension : public Core::IFileWizardExtension
{
Q_OBJECT
public:
explicit ProjectFileWizardExtension(Core::ICore *core);
explicit ProjectFileWizardExtension();
virtual ~ProjectFileWizardExtension();
virtual QList<QWizardPage *> extensionPages(const Core::IWizard *wizard);
@@ -64,7 +60,6 @@ public slots:
virtual void firstExtensionPageShown(const QList<Core::GeneratedFile> &);
private:
Core::ICore *m_core;
ProjectWizardContext *m_context;
};

View File

@@ -61,14 +61,12 @@ namespace {
bool debug = false;
}
ProjectWindow::ProjectWindow(Core::ICore *core, QWidget *parent) :
QWidget(parent),
m_core(core)
ProjectWindow::ProjectWindow(QWidget *parent) : QWidget(parent)
{
setWindowTitle(tr("Project Explorer"));
setWindowIcon(QIcon(":/projectexplorer/images/projectexplorer.png"));
ExtensionSystem::PluginManager *pm = m_core->pluginManager();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *projectExplorer = m_projectExplorer = pm->getObject<ProjectExplorerPlugin>();
m_session = projectExplorer->session();

View File

@@ -43,10 +43,6 @@ class QTreeWidget;
class QTreeWidgetItem;
QT_END_NAMESPACE
namespace Core {
class ICore;
}
namespace ProjectExplorer {
class Project;
@@ -56,13 +52,12 @@ class SessionManager;
namespace Internal {
class ProjectWindow : public QWidget
{
Q_OBJECT
public:
ProjectWindow(Core::ICore *core, QWidget *parent = 0);
explicit ProjectWindow(QWidget *parent = 0);
~ProjectWindow();
private slots:
@@ -75,7 +70,6 @@ private slots:
void handleCurrentItemChanged(QTreeWidgetItem *);
private:
Core::ICore *m_core;
SessionManager *m_session;
ProjectExplorerPlugin *m_projectExplorer;

View File

@@ -381,9 +381,10 @@ void Qt4Project::updateCodeModel()
qDebug()<<"Qt4Project::updateCodeModel()";
CppTools::CppModelManagerInterface *modelmanager =
m_manager->pluginManager()->getObject<CppTools::CppModelManagerInterface>();
ExtensionSystem::PluginManager::instance()
->getObject<CppTools::CppModelManagerInterface>();
if (! modelmanager)
if (!modelmanager)
return;
QStringList allIncludePaths;
@@ -644,7 +645,7 @@ void Qt4Project::newBuildConfiguration(const QString &buildConfiguration)
void Qt4Project::proFileParseError(const QString &errorMessage)
{
m_manager->core()->messageManager()->printToOutputPane(errorMessage);
Core::ICore::instance()->messageManager()->printToOutputPane(errorMessage);
}
Qt4ProFileNode *Qt4Project::rootProjectNode() const

View File

@@ -54,13 +54,13 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/listutils.h>
#include <QtCore/QVariant>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QLinkedList>
#include <QtGui/QMenu>
#include <QtCore/QVariant>
#include <QtGui/QFileDialog>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
using namespace Qt4ProjectManager;
@@ -82,15 +82,14 @@ static const char* qt4FileTypes[] = {
"Qt4ResourceFiles"
};
Qt4Manager::Qt4Manager(Qt4ProjectManagerPlugin *plugin, Core::ICore *core) :
m_mimeType(QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)),
Qt4Manager::Qt4Manager(Qt4ProjectManagerPlugin *plugin)
: m_mimeType(QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)),
m_plugin(plugin),
m_core(core),
m_projectExplorer(0),
m_contextProject(0),
m_languageID(0)
{
m_languageID = m_core->uniqueIDManager()->
m_languageID = Core::ICore::instance()->uniqueIDManager()->
uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
}
@@ -116,7 +115,8 @@ void Qt4Manager::notifyChanged(const QString &name)
void Qt4Manager::init()
{
m_projectExplorer = m_core->pluginManager()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
m_projectExplorer = ExtensionSystem::PluginManager::instance()
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
}
int Qt4Manager::projectContext() const
@@ -143,7 +143,8 @@ ProjectExplorer::Project* Qt4Manager::openProject(const QString &fileName)
QString errorMessage;
m_core->messageManager()->displayStatusBarMessage(tr("Loading project %1 ...").arg(fileName), 50000);
Core::MessageManager *messageManager = Core::ICore::instance()->messageManager();
messageManager->displayStatusBarMessage(tr("Loading project %1 ...").arg(fileName), 50000);
// TODO Make all file paths relative & remove this hack
// We convert the path to an absolute one here because qt4project.cpp
@@ -152,25 +153,25 @@ ProjectExplorer::Project* Qt4Manager::openProject(const QString &fileName)
QString canonicalFilePath = QFileInfo(fileName).canonicalFilePath();
if (canonicalFilePath.isEmpty()) {
m_core->messageManager()->printToOutputPane(tr("Failed opening project '%1': Project file does not exist").arg(canonicalFilePath));
m_core->messageManager()->displayStatusBarMessage(tr("Failed opening project"), 5000);
messageManager->printToOutputPane(tr("Failed opening project '%1': Project file does not exist").arg(canonicalFilePath));
messageManager->displayStatusBarMessage(tr("Failed opening project"), 5000);
return 0;
}
foreach (ProjectExplorer::Project *pi, projectExplorer()->session()->projects()) {
if (canonicalFilePath == pi->file()->fileName()) {
m_core->messageManager()->printToOutputPane(tr("Failed opening project '%1': Project already open").arg(canonicalFilePath));
m_core->messageManager()->displayStatusBarMessage(tr("Failed opening project"), 5000);
messageManager->printToOutputPane(tr("Failed opening project '%1': Project already open").arg(canonicalFilePath));
messageManager->displayStatusBarMessage(tr("Failed opening project"), 5000);
return 0;
}
}
m_core->messageManager()->displayStatusBarMessage(tr("Opening %1 ...").arg(fileName));
messageManager->displayStatusBarMessage(tr("Opening %1 ...").arg(fileName));
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
Qt4Project *pro = new Qt4Project(this, canonicalFilePath);
m_core->messageManager()->displayStatusBarMessage(tr("Done opening project"), 5000);
messageManager->displayStatusBarMessage(tr("Done opening project"), 5000);
return pro;
}
@@ -179,16 +180,6 @@ ProjectExplorer::ProjectExplorerPlugin *Qt4Manager::projectExplorer() const
return m_projectExplorer;
}
Core::ICore *Qt4Manager::core() const
{
return m_core;
}
ExtensionSystem::PluginManager *Qt4Manager::pluginManager() const
{
return m_core->pluginManager();
}
ProjectExplorer::Node *Qt4Manager::contextNode() const
{
return m_contextNode;

View File

@@ -44,10 +44,6 @@ namespace ExtensionSystem {
class PluginManager;
}
namespace Core {
class ICore;
}
namespace ProjectExplorer {
class Project;
class ProjectExplorerPlugin;
@@ -64,13 +60,12 @@ class QtVersionManager;
class Qt4Project;
class Qt4Manager
: public ProjectExplorer::IProjectManager
class Qt4Manager : public ProjectExplorer::IProjectManager
{
Q_OBJECT
public:
Qt4Manager(Internal::Qt4ProjectManagerPlugin *plugin, Core::ICore *core);
Qt4Manager(Internal::Qt4ProjectManagerPlugin *plugin);
~Qt4Manager();
void init();
@@ -80,10 +75,8 @@ public:
void notifyChanged(const QString &name);
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
ExtensionSystem::PluginManager *pluginManager() const;
Core::ICore *core() const;
//ProjectExplorer::IProjectManager
// ProjectExplorer::IProjectManager
int projectContext() const;
int projectLanguage() const;
@@ -111,7 +104,6 @@ private:
const QString m_mimeType;
Internal::Qt4ProjectManagerPlugin *m_plugin;
Core::ICore *m_core;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
ProjectExplorer::Node *m_contextNode;

View File

@@ -48,6 +48,7 @@
#include "profilereader.h"
#include "gdbmacrosbuildstep.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/project.h>
@@ -59,9 +60,9 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <texteditor/texteditoractionhandler.h>
#include <QtCore/qplugin.h>
#include <QtCore/QDebug>
#include <QtCore/QtPlugin>
#include <QtGui/QMenu>
#include <QDebug>
#ifdef WITH_TESTS
#include <QTest>
@@ -95,33 +96,37 @@ static Core::Command *createSeparator(Core::ActionManager *am,
return am->registerAction(tmpaction, name, context);
}
*/
bool Qt4ProjectManagerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage))
return false;
m_projectExplorer = core->pluginManager()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
m_projectExplorer = ExtensionSystem::PluginManager::instance()
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
Core::ActionManager *am = core->actionManager();
//create and register objects
m_qt4ProjectManager = new Qt4Manager(this, core);
m_qt4ProjectManager = new Qt4Manager(this);
addObject(m_qt4ProjectManager);
TextEditor::TextEditorActionHandler *editorHandler
= new TextEditor::TextEditorActionHandler(core, Constants::C_PROFILEEDITOR);
= new TextEditor::TextEditorActionHandler(Constants::C_PROFILEEDITOR);
m_proFileEditorFactory = new ProFileEditorFactory(m_qt4ProjectManager, editorHandler);
addObject(m_proFileEditorFactory);
GuiAppWizard *guiWizard = new GuiAppWizard(core);
GuiAppWizard *guiWizard = new GuiAppWizard;
addAutoReleasedObject(guiWizard);
ConsoleAppWizard *consoleWizard = new ConsoleAppWizard(core);
ConsoleAppWizard *consoleWizard = new ConsoleAppWizard;
addAutoReleasedObject(consoleWizard);
LibraryWizard *libWizard = new LibraryWizard(core);
LibraryWizard *libWizard = new LibraryWizard;
addAutoReleasedObject(libWizard);
addAutoReleasedObject(new QMakeBuildStepFactory);

View File

@@ -58,8 +58,8 @@ static const char *mainSourceFileC = "main";
namespace Qt4ProjectManager {
namespace Internal {
ConsoleAppWizard::ConsoleAppWizard(Core::ICore *core) :
QtWizard(core, tr("Qt4 Console Application"),
ConsoleAppWizard::ConsoleAppWizard()
: QtWizard(tr("Qt4 Console Application"),
tr("Creates a Qt4 console application."),
QIcon(":/wizards/images/console.png"))
{

View File

@@ -46,7 +46,7 @@ class ConsoleAppWizard : public QtWizard
Q_OBJECT
public:
explicit ConsoleAppWizard(Core::ICore *core);
ConsoleAppWizard();
protected:
virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -70,12 +70,10 @@ static inline QStringList baseClasses()
}
namespace Qt4ProjectManager {
namespace Internal {
GuiAppWizard::GuiAppWizard(Core::ICore *core) :
QtWizard(core,
tr("Qt4 Gui Application"),
GuiAppWizard::GuiAppWizard()
: QtWizard(tr("Qt4 Gui Application"),
tr("Creates a Qt4 Gui Application with one form."),
QIcon(":/wizards/images/gui.png"))
{

View File

@@ -47,7 +47,7 @@ class GuiAppWizard : public QtWizard
Q_OBJECT
public:
explicit GuiAppWizard(Core::ICore *core);
GuiAppWizard();
protected:
virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -91,7 +91,7 @@ void GuiAppWizardDialog::setBaseClasses(const QStringList &baseClasses)
m_filesPage->setBaseClassName(baseClasses.front());
}
void GuiAppWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form)
void GuiAppWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form)
{
m_filesPage->setSuffixes(header, source, form);
}

View File

@@ -37,10 +37,12 @@
#include <QtGui/QWizard>
namespace Core {
namespace Utils {
class ProjectIntroPage;
}
}
namespace Utils {
class ProjectIntroPage;
} // namespace Utils
} // namespace Core
namespace Qt4ProjectManager {
namespace Internal {
@@ -50,7 +52,8 @@ class ModulesPage;
class FilesPage;
// Additional parameters required besides QtProjectParameters
struct GuiAppParameters {
struct GuiAppParameters
{
GuiAppParameters();
QString className;
QString baseClassName;

View File

@@ -50,8 +50,8 @@ namespace Qt4ProjectManager {
namespace Internal {
LibraryWizard::LibraryWizard(Core::ICore *core) :
QtWizard(core, tr("C++ Library"),
LibraryWizard::LibraryWizard()
: QtWizard(tr("C++ Library"),
tr("Creates a C++ Library."),
QIcon(":/wizards/images/lib.png"))
{
@@ -69,8 +69,9 @@ QWizard *LibraryWizard::createWizardDialog(QWidget *parent,
Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
QString * /*errorMessage*/) const
QString *errorMessage) const
{
Q_UNUSED(errorMessage);
const LibraryWizardDialog *dialog = qobject_cast<const LibraryWizardDialog *>(w);
const QtProjectParameters projectParams = dialog->parameters();
const QString projectPath = projectParams.projectPath();

View File

@@ -48,7 +48,7 @@ class LibraryWizard : public QtWizard
Q_OBJECT
public:
explicit LibraryWizard(Core::ICore *core);
LibraryWizard();
protected:
virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -63,9 +63,8 @@ static inline Core::BaseFileWizardParameters
}
// -------------------- QtWizard
QtWizard::QtWizard(Core::ICore *core, const QString &name,
const QString &description, const QIcon &icon) :
Core::BaseFileWizard(wizardParameters(name, description, icon), core),
QtWizard::QtWizard(const QString &name, const QString &description, const QIcon &icon) :
Core::BaseFileWizard(wizardParameters(name, description, icon)),
m_projectExplorer(ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>())
{
}
@@ -103,7 +102,7 @@ bool QtWizard::postGenerateFiles(const Core::GeneratedFiles &l, QString *errorMe
QString QtWizard::templateDir() const
{
QString rc = core()->resourcePath();
QString rc = Core::ICore::instance()->resourcePath();
rc += QLatin1String("/templates/qt4project");
return rc;
}

View File

@@ -38,13 +38,8 @@
#include <coreplugin/basefilewizard.h>
QT_BEGIN_NAMESPACE
class QTextStream;
class QDir;
QT_END_NAMESPACE
namespace ProjectExplorer {
class ProjectExplorerPlugin;
class ProjectExplorerPlugin;
}
namespace Qt4ProjectManager {
@@ -60,14 +55,11 @@ namespace Internal {
class QtWizard : public Core::BaseFileWizard
{
Q_DISABLE_COPY(QtWizard)
Q_OBJECT
public:
Q_DISABLE_COPY(QtWizard)
protected:
explicit QtWizard(Core::ICore *core, const QString &name,
const QString &description, const QIcon &icon);
QtWizard(const QString &name, const QString &description, const QIcon &icon);
QString templateDir() const;

View File

@@ -57,12 +57,10 @@ ScriptEditorEditable::ScriptEditorEditable(ScriptEditor *editor, const QList<int
}
ScriptEditor::ScriptEditor(const Context &context,
Core::ICore *core,
TextEditor::TextEditorActionHandler *ah,
QWidget *parent) :
TextEditor::BaseTextEditor(parent),
m_context(context),
m_core(core),
m_ah(ah)
{
setParenthesesMatchingEnabled(true);
@@ -84,7 +82,7 @@ Core::IEditor *ScriptEditorEditable::duplicate(QWidget *parent)
ScriptEditor *ScriptEditor::duplicate(QWidget *parent)
{
ScriptEditor *editor = new ScriptEditor(m_context, m_core, m_ah, parent);
ScriptEditor *editor = new ScriptEditor(m_context, m_ah, parent);
editor->duplicateFrom(this);
QtScriptEditorPlugin::initializeEditor(editor);
return editor;
@@ -157,7 +155,7 @@ void ScriptEditor::contextMenuEvent(QContextMenuEvent *e)
{
QMenu *menu = createStandardContextMenu();
if (Core::ActionContainer *mcontext = m_core->actionManager()->actionContainer(QtScriptEditor::Constants::M_CONTEXT)) {
if (Core::ActionContainer *mcontext = Core::ICore::instance()->actionManager()->actionContainer(QtScriptEditor::Constants::M_CONTEXT)) {
QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions())
menu->addAction(action);

View File

@@ -50,7 +50,7 @@ class ScriptEditor;
class ScriptEditorEditable : public TextEditor::BaseTextEditorEditable
{
public:
ScriptEditorEditable(ScriptEditor *, const QList<int>&);
ScriptEditorEditable(ScriptEditor *, const QList<int> &);
QList<int> context() const;
bool duplicateSupported() const { return true; }
@@ -71,9 +71,8 @@ public:
typedef QList<int> Context;
ScriptEditor(const Context &context,
Core::ICore *core,
TextEditor::TextEditorActionHandler *ah,
QWidget *parent = 0);
TextEditor::TextEditorActionHandler *ah,
QWidget *parent = 0);
~ScriptEditor();
ScriptEditor *duplicate(QWidget *parent);
@@ -90,7 +89,6 @@ private:
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
const Context m_context;
Core::ICore *m_core;
TextEditor::TextEditorActionHandler *m_ah;
};

View File

@@ -35,17 +35,18 @@
#include "qtscripteditorconstants.h"
#include "qtscripteditor.h"
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/scriptmanager/scriptmanager.h>
#include <QtGui/QAction>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtCore/QDebug>
#include <QtGui/QAction>
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
static QAction *actionFromId(Core::ICore *core, const QString &id)
static QAction *actionFromId(const QString &id)
{
Core::Command *cmd = core->actionManager()->command(id);
Core::Command *cmd = Core::ICore::instance()->actionManager()->command(id);
if (!cmd)
return 0;
return cmd->action();
@@ -54,9 +55,8 @@ static QAction *actionFromId(Core::ICore *core, const QString &id)
namespace QtScriptEditor {
namespace Internal {
QtScriptEditorActionHandler::QtScriptEditorActionHandler(Core::ICore *core) :
TextEditor::TextEditorActionHandler(core,
QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR),
QtScriptEditorActionHandler::QtScriptEditorActionHandler()
: TextEditor::TextEditorActionHandler(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR),
Format),
m_runAction(0)
{
@@ -65,7 +65,7 @@ QtScriptEditorActionHandler::QtScriptEditorActionHandler(Core::ICore *core) :
void QtScriptEditorActionHandler::createActions()
{
TextEditor::TextEditorActionHandler::createActions();
m_runAction = actionFromId(core(), QLatin1String(QtScriptEditor::Constants::RUN));
m_runAction = actionFromId(QLatin1String(QtScriptEditor::Constants::RUN));
connect(m_runAction, SIGNAL(triggered()), this, SLOT(run()));
}
@@ -88,7 +88,7 @@ void QtScriptEditorActionHandler::run()
// run
Stack errorStack;
QString errorMessage;
if (core()->scriptManager()->runScript(script, &errorMessage, &errorStack))
if (Core::ICore::instance()->scriptManager()->runScript(script, &errorMessage, &errorStack))
return;
// try to find a suitable error line in the stack
@@ -104,7 +104,7 @@ void QtScriptEditorActionHandler::run()
}
if (errorLineNumber)
currentEditor()->gotoLine(errorLineNumber);
QMessageBox::critical(core()->mainWindow(), tr("Qt Script Error"), errorMessage);
QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("Qt Script Error"), errorMessage);
}
} // namespace Internal

View File

@@ -44,7 +44,7 @@ class QtScriptEditorActionHandler : public TextEditor::TextEditorActionHandler
Q_OBJECT
public:
QtScriptEditorActionHandler(Core::ICore *core);
QtScriptEditorActionHandler();
private:
virtual void createActions();

View File

@@ -37,23 +37,21 @@
#include "qtscripteditorconstants.h"
#include "qtscripteditorplugin.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <QtCore/QFileInfo>
#include <QtCore/qdebug.h>
#include <QtCore/QDebug>
using namespace QtScriptEditor::Internal;
using namespace QtScriptEditor::Constants;
QtScriptEditorFactory::QtScriptEditorFactory(Core::ICore *core,
const Context &context,
QObject *parent) :
Core::IEditorFactory(parent),
QtScriptEditorFactory::QtScriptEditorFactory(const Context &context, QObject *parent)
: Core::IEditorFactory(parent),
m_kind(QLatin1String(C_QTSCRIPTEDITOR)),
m_mimeTypes(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE)),
m_context(context),
m_core(core),
m_actionHandler(new QtScriptEditorActionHandler(core))
m_actionHandler(new QtScriptEditorActionHandler)
{
}
@@ -69,7 +67,7 @@ QString QtScriptEditorFactory::kind() const
Core::IFile *QtScriptEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = m_core->editorManager()->openEditor(fileName, kind());
Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind());
if (!iface) {
qWarning() << "QtScriptEditorFactory::open: openEditor failed for " << fileName;
return 0;
@@ -79,7 +77,7 @@ Core::IFile *QtScriptEditorFactory::open(const QString &fileName)
Core::IEditor *QtScriptEditorFactory::createEditor(QWidget *parent)
{
ScriptEditor *rc = new ScriptEditor(m_context, m_core, m_actionHandler, parent);
ScriptEditor *rc = new ScriptEditor(m_context, m_actionHandler, parent);
QtScriptEditorPlugin::initializeEditor(rc);
return rc->editableInterface();
}

View File

@@ -38,10 +38,6 @@
#include <QtCore/QStringList>
namespace Core {
class ICore;
}
namespace TextEditor {
class TextEditorActionHandler;
}
@@ -58,13 +54,11 @@ class QtScriptEditorFactory : public Core::IEditorFactory
public:
typedef QList<int> Context;
QtScriptEditorFactory(Core::ICore *core,
const Context &context,
QObject *parent);
QtScriptEditorFactory(const Context &context, QObject *parent);
~QtScriptEditorFactory();
virtual QStringList mimeTypes() const;
//EditorFactory
// IEditorFactory
QString kind() const;
Core::IFile *open(const QString &fileName);
Core::IEditor *createEditor(QWidget *parent);
@@ -74,7 +68,6 @@ private:
const QStringList m_mimeTypes;
const Context m_context;
Core::ICore *m_core;
TextEditor::TextEditorActionHandler *m_actionHandler;
};

View File

@@ -87,7 +87,7 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString
registerActions(core);
m_editor = new QtScriptEditorFactory(core, m_context, this);
m_editor = new QtScriptEditorFactory(m_context, this);
addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
@@ -98,7 +98,7 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString
m_wizard = new TextEditor::TextFileWizard(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE),
QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR),
QLatin1String("qtscript$"),
wizardParameters, core, this);
wizardParameters, this);
addObject(m_wizard);
error_message->clear();

View File

@@ -33,6 +33,7 @@
#include "basefilefilter.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <QtCore/QDir>
@@ -40,11 +41,8 @@
using namespace Core;
using namespace QuickOpen;
BaseFileFilter::BaseFileFilter(ICore *core)
: m_core(core),
m_files(QStringList()),
m_fileNames(QStringList()),
m_forceNewSearchList(false)
BaseFileFilter::BaseFileFilter()
: m_forceNewSearchList(false)
{
}
@@ -91,8 +89,9 @@ QList<FilterEntry> BaseFileFilter::matchesFor(const QString &origEntry)
void BaseFileFilter::accept(QuickOpen::FilterEntry selection) const
{
m_core->editorManager()->openEditor(selection.internalData.toString());
m_core->editorManager()->ensureEditorManagerVisible();
Core::EditorManager *em = Core::ICore::instance()->editorManager();
em->openEditor(selection.internalData.toString());
em->ensureEditorManagerVisible();
}
void BaseFileFilter::generateFileNames()

View File

@@ -37,12 +37,8 @@
#include "quickopen_global.h"
#include "iquickopenfilter.h"
#include <coreplugin/icore.h>
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QByteArray>
#include <QtGui/QWidget>
namespace QuickOpen {
@@ -51,14 +47,13 @@ class QUICKOPEN_EXPORT BaseFileFilter : public QuickOpen::IQuickOpenFilter
Q_OBJECT
public:
BaseFileFilter(Core::ICore *core);
BaseFileFilter();
QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
void accept(QuickOpen::FilterEntry selection) const;
protected:
void generateFileNames();
Core::ICore *m_core;
QStringList m_files;
QStringList m_fileNames;
QStringList m_previousResultPaths;

View File

@@ -35,20 +35,18 @@
#include <QtCore/QDir>
#include <QtCore/QStack>
#include <QtGui/QDirModel>
#include <QtGui/QCompleter>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
using namespace Core;
#include <qtconcurrent/QtConcurrentTools>
using namespace QuickOpen;
using namespace QuickOpen::Internal;
DirectoryFilter::DirectoryFilter(ICore *core)
: BaseFileFilter(core),
m_name(tr("Generic Directory Filter")),
m_directories(QStringList()),
m_filters(QStringList() << "*.h" << "*.cpp" << "*.ui" << "*.qrc")
DirectoryFilter::DirectoryFilter()
: m_name(tr("Generic Directory Filter")),
m_filters(QStringList() << "*.h" << "*.cpp" << "*.ui" << "*.qrc")
{
setIncludedByDefault(true);
}

View File

@@ -45,9 +45,6 @@
#include <QtGui/QWidget>
#include <QtGui/QDialog>
#include <coreplugin/icore.h>
#include <qtconcurrent/QtConcurrentTools>
namespace QuickOpen {
namespace Internal {
@@ -56,7 +53,7 @@ class DirectoryFilter : public BaseFileFilter
Q_OBJECT
public:
DirectoryFilter(Core::ICore *core);
DirectoryFilter();
QString trName() const { return m_name; }
QString name() const { return m_name; }
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }

View File

@@ -136,7 +136,6 @@ void QuickOpenPlugin::startSettingsLoad()
void QuickOpenPlugin::loadSettings()
{
Core::ICore *core = Core::ICore::instance();
QSettings settings;
settings.beginGroup("QuickOpen");
m_refreshTimer.setInterval(settings.value("RefreshInterval", 60).toInt()*60000);
@@ -150,7 +149,7 @@ void QuickOpenPlugin::loadSettings()
settings.beginGroup("CustomFilters");
QList<IQuickOpenFilter *> customFilters;
foreach (const QString &key, settings.childKeys()) {
IQuickOpenFilter *filter = new DirectoryFilter(core);
IQuickOpenFilter *filter = new DirectoryFilter;
filter->restoreState(settings.value(key).toByteArray());
m_filters.append(filter);
customFilters.append(filter);

View File

@@ -173,7 +173,7 @@ void SettingsPage::configureFilter(QListWidgetItem *item)
void SettingsPage::addCustomFilter()
{
IQuickOpenFilter *filter = new DirectoryFilter(m_core);
IQuickOpenFilter *filter = new DirectoryFilter;
bool needsRefresh = false;
if (filter->openConfigDialog(m_page, needsRefresh)) {
m_filters.append(filter);

View File

@@ -47,14 +47,13 @@
using namespace ResourceEditor::Internal;
using namespace ResourceEditor::Constants;
ResourceEditorFactory::ResourceEditorFactory(Core::ICore *core, ResourceEditorPlugin *plugin) :
ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
Core::IEditorFactory(plugin),
m_mimeTypes(QStringList(QLatin1String("application/vnd.nokia.xml.qt.resource"))),
m_kind(QLatin1String(C_RESOURCEEDITOR)),
m_core(core),
m_plugin(plugin)
{
m_context += m_core->uniqueIDManager()
m_context += Core::ICore::instance()->uniqueIDManager()
->uniqueIdentifier(QLatin1String(ResourceEditor::Constants::C_RESOURCEEDITOR));
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
iconProvider->registerIconForSuffix(QIcon(":/resourceeditor/images/qt_qrc.png"),
@@ -68,7 +67,7 @@ QString ResourceEditorFactory::kind() const
Core::IFile *ResourceEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = m_core->editorManager()->openEditor(fileName, kind());
Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind());
if (!iface) {
qWarning() << "ResourceEditorFactory::open: openEditor failed for " << fileName;
return 0;
@@ -78,7 +77,7 @@ Core::IFile *ResourceEditorFactory::open(const QString &fileName)
Core::IEditor *ResourceEditorFactory::createEditor(QWidget *parent)
{
return new ResourceEditorW(m_context, m_core, m_plugin, parent);
return new ResourceEditorW(m_context, m_plugin, parent);
}
QStringList ResourceEditorFactory::mimeTypes() const

View File

@@ -38,10 +38,6 @@
#include <QtCore/QStringList>
namespace Core {
class ICore;
} // namespace Core
namespace ResourceEditor {
namespace Internal {
@@ -54,11 +50,11 @@ class ResourceEditorFactory : public Core::IEditorFactory
public:
typedef QList<int> Context;
ResourceEditorFactory(Core::ICore *core, ResourceEditorPlugin *plugin);
explicit ResourceEditorFactory(ResourceEditorPlugin *plugin);
virtual QStringList mimeTypes() const;
//EditorFactory
// IEditorFactory
QString kind() const;
Core::IFile *open(const QString &fileName);
Core::IEditor *createEditor(QWidget *parent);
@@ -68,7 +64,6 @@ private:
const QString m_kind;
Context m_context;
Core::ICore *m_core;
ResourceEditorPlugin *m_plugin;
};

View File

@@ -74,7 +74,7 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage))
return false;
m_editor = new ResourceEditorFactory(core, this);
m_editor = new ResourceEditorFactory(this);
addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
@@ -83,7 +83,7 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
wizardParameters.setCategory(QLatin1String("Qt"));
wizardParameters.setTrCategory(tr("Qt"));
m_wizard = new ResourceWizard(wizardParameters, core, this);
m_wizard = new ResourceWizard(wizardParameters, this);
addObject(m_wizard);
errorMessage->clear();

View File

@@ -70,11 +70,9 @@ QString ResourceEditorFile::mimeType() const
ResourceEditorW::ResourceEditorW(const QList<int> &context,
Core::ICore *core,
ResourceEditorPlugin *plugin,
QWidget *parent)
: m_context(context),
m_core(core),
m_resourceEditor(new SharedTools::QrcEditor(parent)),
m_resourceFile(new ResourceEditorFile(this)),
m_plugin(plugin)
@@ -207,7 +205,7 @@ void ResourceEditorFile::modified(Core::IFile::ReloadBehavior *behavior)
break;
}
switch (Core::Utils::reloadPrompt(fileName, m_parent->m_core->mainWindow())) {
switch (Core::Utils::reloadPrompt(fileName, Core::ICore::instance()->mainWindow())) {
case Core::Utils::ReloadCurrent:
m_parent->open(fileName);
break;

View File

@@ -40,11 +40,6 @@
#include <QtGui/QWidget>
#include <QtCore/QPointer>
namespace Core {
class ICore;
}
namespace SharedTools {
class QrcEditor;
}
@@ -92,7 +87,6 @@ public:
typedef QList<int> Context;
ResourceEditorW(const Context &context,
Core::ICore *core,
ResourceEditorPlugin *plugin,
QWidget *parent = 0);
~ResourceEditorW();
@@ -126,7 +120,6 @@ private:
QString m_displayName;
QString m_suggestedName;
const Context m_context;
Core::ICore *m_core;
QPointer<SharedTools::QrcEditor> m_resourceEditor;
ResourceEditorFile *m_resourceFile;
ResourceEditorPlugin *m_plugin;

View File

@@ -38,16 +38,17 @@
using namespace ResourceEditor;
using namespace ResourceEditor::Internal;
ResourceWizard::ResourceWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent) :
Core::StandardFileWizard(parameters, core, parent)
ResourceWizard::ResourceWizard(const BaseFileWizardParameters &parameters, QObject *parent)
: Core::StandardFileWizard(parameters, parent)
{
}
Core::GeneratedFiles
ResourceWizard::generateFilesFromPath(const QString &path,
const QString &name,
QString * /*errorMessage*/) const
QString *errorMessage) const
{
Q_UNUSED(errorMessage);
const QString suffix = preferredSuffix(QLatin1String(Constants::C_RESOURCE_MIMETYPE));
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, suffix);
Core::GeneratedFile file(fileName);

View File

@@ -45,7 +45,7 @@ class ResourceWizard : public Core::StandardFileWizard
public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
explicit ResourceWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent);
explicit ResourceWizard(const BaseFileWizardParameters &parameters, QObject *parent);
protected:
virtual Core::GeneratedFiles

View File

@@ -284,7 +284,8 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe
static const char *describeSlot = SLOT(describe(QString,QString));
const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters);
for (int i = 0; i < editorCount; i++) {
m_editorFactories.push_back(new SubversionEditorFactory(editorParameters + i, m_coreInstance, this, describeSlot));
m_editorFactories.push_back(
new SubversionEditorFactory(editorParameters + i, this, describeSlot));
addObject(m_editorFactories.back());
}

View File

@@ -49,9 +49,8 @@ using namespace Core::Utils;
using namespace Find;
using namespace TextEditor;
BaseFileFind::BaseFileFind(Core::ICore *core, SearchResultWindow *resultWindow)
: m_core(core),
m_resultWindow(resultWindow),
BaseFileFind::BaseFileFind(SearchResultWindow *resultWindow)
: m_resultWindow(resultWindow),
m_isSearching(false),
m_resultLabel(0),
m_filterCombo(0),
@@ -95,7 +94,8 @@ void BaseFileFind::findAll(const QString &txt, QTextDocument::FindFlags findFlag
m_watcher.setFuture(Core::Utils::findInFilesRegExp(txt, files(), findFlags));
else
m_watcher.setFuture(Core::Utils::findInFiles(txt, files(), findFlags));
Core::FutureProgress *progress = m_core->progressManager()->addTask(m_watcher.future(),
Core::FutureProgress *progress =
Core::ICore::instance()->progressManager()->addTask(m_watcher.future(),
"Search",
Constants::TASK_SEARCH);
progress->setWidget(createProgressWidget());

View File

@@ -36,7 +36,6 @@
#include "texteditor_global.h"
#include <coreplugin/icore.h>
#include <find/ifindfilter.h>
#include <find/searchresultwindow.h>
#include <utils/filesearch.h>
@@ -55,7 +54,7 @@ class TEXTEDITOR_EXPORT BaseFileFind : public Find::IFindFilter
Q_OBJECT
public:
BaseFileFind(Core::ICore *core, Find::SearchResultWindow *resultWindow);
explicit BaseFileFind(Find::SearchResultWindow *resultWindow);
bool isEnabled() const;
void findAll(const QString &txt, QTextDocument::FindFlags findFlags);
@@ -79,7 +78,6 @@ private slots:
private:
QWidget *createProgressWidget();
Core::ICore *m_core;
Find::SearchResultWindow *m_resultWindow;
QFutureWatcher<Core::Utils::FileSearchResult> m_watcher;
bool m_isSearching;

View File

@@ -42,8 +42,8 @@
using namespace Find;
using namespace TextEditor::Internal;
FindInFiles::FindInFiles(Core::ICore *core, SearchResultWindow *resultWindow)
: BaseFileFind(core, resultWindow),
FindInFiles::FindInFiles(SearchResultWindow *resultWindow)
: BaseFileFind(resultWindow),
m_configWidget(0),
m_directory(0)
{

View File

@@ -36,7 +36,6 @@
#include "basefilefind.h"
#include <coreplugin/icore.h>
#include <find/ifindfilter.h>
#include <find/searchresultwindow.h>
@@ -54,12 +53,10 @@ class FindInFiles : public BaseFileFind
Q_OBJECT
public:
FindInFiles(Core::ICore *core, Find::SearchResultWindow *resultWindow);
explicit FindInFiles(Find::SearchResultWindow *resultWindow);
QString name() const;
QKeySequence defaultShortcut() const;
void findAll(const QString &txt, QTextDocument::FindFlags findFlags);
QWidget *createConfigWidget();
void writeSettings(QSettings *settings);

View File

@@ -36,20 +36,21 @@
#include "texteditorconstants.h"
#include "ui_fontsettingspage.h"
#include <coreplugin/icore.h>
#include <utils/settingsutils.h>
#include <QtCore/QSettings>
#include <QtCore/QTimer>
#include <QtGui/QListWidget>
#include <QtGui/QToolButton>
#include <QtGui/QPalette>
#include <QtGui/QCheckBox>
#include <QtGui/QColorDialog>
#include <QtGui/QTextEdit>
#include <QtGui/QTextCharFormat>
#include <QtGui/QComboBox>
#include <QtGui/QFontDatabase>
#include <QtGui/QListWidget>
#include <QtGui/QPalette>
#include <QtGui/QPalette>
#include <QtGui/QTextCharFormat>
#include <QtGui/QTextEdit>
#include <QtGui/QToolButton>
static inline QString colorButtonStyleSheet(const QColor &bgColor)
{
@@ -70,10 +71,9 @@ public:
FontSettingsPagePrivate(const TextEditor::FormatDescriptions &fd,
const QString &name,
const QString &category,
const QString &trCategory,
Core::ICore *core);
const QString &trCategory);
Core::ICore *m_core;
public:
const QString m_name;
const QString m_settingsGroup;
const QString m_category;
@@ -89,9 +89,7 @@ public:
FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescriptions &fd,
const QString &name,
const QString &category,
const QString &trCategory,
Core::ICore *core) :
m_core(core),
const QString &trCategory) :
m_name(name),
m_settingsGroup(Core::Utils::settingsKey(category)),
m_category(category),
@@ -102,9 +100,8 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescrip
m_curItem(-1)
{
bool settingsFound = false;
if (m_core)
if (const QSettings *settings = m_core->settings())
settingsFound = m_value.fromSettings(m_settingsGroup, m_descriptions, settings);
if (const QSettings *settings = Core::ICore::instance()->settings())
settingsFound = m_value.fromSettings(m_settingsGroup, m_descriptions, settings);
if (!settingsFound) { // Apply defaults
foreach (const FormatDescription &f, m_descriptions) {
const QString name = f.name();
@@ -200,10 +197,9 @@ QColor FormatDescription::background() const
FontSettingsPage::FontSettingsPage(const FormatDescriptions &fd,
const QString &category,
const QString &trCategory,
Core::ICore *core,
QObject *parent) :
Core::IOptionsPage(parent),
d_ptr(new FontSettingsPagePrivate(fd, tr("Font & Colors"), category, trCategory, core))
d_ptr(new FontSettingsPagePrivate(fd, tr("Font & Colors"), category, trCategory))
{
}
@@ -232,7 +228,6 @@ QWidget *FontSettingsPage::createPage(QWidget *parent)
QWidget *w = new QWidget(parent);
d_ptr->ui.setupUi(w);
d_ptr->ui.itemListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
foreach (const FormatDescription &d, d_ptr->m_descriptions)
@@ -447,9 +442,8 @@ void FontSettingsPage::apply()
if (d_ptr->m_value != d_ptr->m_lastValue) {
d_ptr->m_lastValue = d_ptr->m_value;
if (d_ptr->m_core)
if (QSettings *settings = d_ptr->m_core->settings())
d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, d_ptr->m_descriptions, settings);
if (QSettings *settings = Core::ICore::instance()->settings())
d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, d_ptr->m_descriptions, settings);
QTimer::singleShot(0, this, SLOT(delayedChange()));
}

View File

@@ -38,7 +38,6 @@
#include "fontsettings.h"
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtGui/QColor>
@@ -89,7 +88,6 @@ public:
FontSettingsPage(const FormatDescriptions &fd,
const QString &category,
const QString &trCategory,
Core::ICore *core,
QObject *parent = 0);
~FontSettingsPage();

View File

@@ -37,16 +37,17 @@
#include "tabsettings.h"
#include "ui_generalsettingspage.h"
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
#include <QtCore/QDebug>
using namespace TextEditor;
struct GeneralSettingsPage::GeneralSettingsPagePrivate {
GeneralSettingsPagePrivate(Core::ICore *core,
const GeneralSettingsPageParameters &p);
struct GeneralSettingsPage::GeneralSettingsPagePrivate
{
explicit GeneralSettingsPagePrivate(const GeneralSettingsPageParameters &p);
Core::ICore *m_core;
const GeneralSettingsPageParameters m_parameters;
Ui::generalSettingsPage m_page;
TabSettings m_tabSettings;
@@ -54,24 +55,21 @@ struct GeneralSettingsPage::GeneralSettingsPagePrivate {
DisplaySettings m_displaySettings;
};
GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate(Core::ICore *core,
const GeneralSettingsPageParameters &p) :
m_core(core),
m_parameters(p)
GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate
(const GeneralSettingsPageParameters &p)
: m_parameters(p)
{
if (m_core)
if (const QSettings *s = m_core->settings()) {
m_tabSettings.fromSettings(m_parameters.settingsPrefix, s);
m_storageSettings.fromSettings(m_parameters.settingsPrefix, s);
m_displaySettings.fromSettings(m_parameters.settingsPrefix, s);
}
if (const QSettings *s = Core::ICore::instance()->settings()) {
m_tabSettings.fromSettings(m_parameters.settingsPrefix, s);
m_storageSettings.fromSettings(m_parameters.settingsPrefix, s);
m_displaySettings.fromSettings(m_parameters.settingsPrefix, s);
}
}
GeneralSettingsPage::GeneralSettingsPage(Core::ICore *core,
const GeneralSettingsPageParameters &p,
QObject *parent) :
Core::IOptionsPage(parent),
m_d(new GeneralSettingsPagePrivate(core, p))
GeneralSettingsPage::GeneralSettingsPage(const GeneralSettingsPageParameters &p,
QObject *parent)
: Core::IOptionsPage(parent),
m_d(new GeneralSettingsPagePrivate(p))
{
}
@@ -99,9 +97,7 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_d->m_page.setupUi(w);
settingsToUI();
return w;
}
@@ -112,30 +108,28 @@ void GeneralSettingsPage::apply()
DisplaySettings newDisplaySettings;
settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings);
Core::ICore *core = Core::ICore::instance();
if (newTabSettings != m_d->m_tabSettings) {
m_d->m_tabSettings = newTabSettings;
if (m_d->m_core)
if (QSettings *s = m_d->m_core->settings())
m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
if (QSettings *s = core->settings())
m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit tabSettingsChanged(newTabSettings);
}
if (newStorageSettings != m_d->m_storageSettings) {
m_d->m_storageSettings = newStorageSettings;
if (m_d->m_core)
if (QSettings *s = m_d->m_core->settings())
m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
if (QSettings *s = core->settings())
m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit storageSettingsChanged(newStorageSettings);
}
if (newDisplaySettings != m_d->m_displaySettings) {
m_d->m_displaySettings = newDisplaySettings;
if (m_d->m_core)
if (QSettings *s = m_d->m_core->settings())
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
if (QSettings *s = core->settings())
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit displaySettingsChanged(newDisplaySettings);
}
@@ -207,9 +201,9 @@ void GeneralSettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySe
{
if (newDisplaySettings != m_d->m_displaySettings) {
m_d->m_displaySettings = newDisplaySettings;
if (m_d->m_core)
if (QSettings *s = m_d->m_core->settings())
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
Core::ICore *core = Core::ICore::instance();
if (QSettings *s = core->settings())
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit displaySettingsChanged(newDisplaySettings);
}

View File

@@ -36,7 +36,6 @@
#include "texteditor_global.h"
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QObject>
@@ -47,26 +46,23 @@ struct TabSettings;
struct StorageSettings;
struct DisplaySettings;
struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters {
struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters
{
QString name;
QString category;
QString trCategory;
QString settingsPrefix;
};
class Ui_generalSettingsPage;
class TEXTEDITOR_EXPORT GeneralSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
GeneralSettingsPage(Core::ICore *core,
const GeneralSettingsPageParameters &p,
QObject *parent);
GeneralSettingsPage(const GeneralSettingsPageParameters &p, QObject *parent);
virtual ~GeneralSettingsPage();
//IOptionsPage
// IOptionsPage
QString name() const;
QString category() const;
QString trCategory() const;

View File

@@ -45,7 +45,7 @@ using namespace TextEditor::Internal;
PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor)
:BaseTextEditorEditable(editor)
{
Core::ICore *core = TextEditorPlugin::core();
Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->
uniqueIdentifier(Core::Constants::K_DEFAULT_TEXT_EDITOR);
m_context << core->uniqueIDManager()->
@@ -55,7 +55,6 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor)
PlainTextEditor::PlainTextEditor(QWidget *parent) :
BaseTextEditor(parent)
{
setRevisionsVisible(true);
setMarksVisible(true);
setRequestMarkEnabled(false);
@@ -69,7 +68,6 @@ QList<int> PlainTextEditorEditable::context() const
return m_context;
}
Core::IEditor *PlainTextEditorEditable::duplicate(QWidget *parent)
{
PlainTextEditor *newEditor = new PlainTextEditor(parent);
@@ -103,8 +101,10 @@ const char *PlainTextEditorEditable::kind() const
// to do in 2 steps (indenting/wrapping)}
//
void PlainTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar /* typedChar */)
void PlainTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
{
Q_UNUSED(typedChar);
// At beginning: Leave as is.
if (block == doc->begin())
return;

View File

@@ -37,19 +37,20 @@
#include "texteditorplugin.h"
#include "texteditoractionhandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
using namespace TextEditor;
using namespace TextEditor::Internal;
PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent) :
Core::IEditorFactory(parent),
PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
: Core::IEditorFactory(parent),
m_kind(Core::Constants::K_DEFAULT_TEXT_EDITOR)
{
m_actionHandler = new TextEditorActionHandler(TextEditorPlugin::core(),
QLatin1String(TextEditor::Constants::C_TEXTEDITOR),
TextEditorActionHandler::Format);
m_actionHandler = new TextEditorActionHandler(
QLatin1String(TextEditor::Constants::C_TEXTEDITOR),
TextEditorActionHandler::Format);
m_mimeTypes << QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT)
<< QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_XML);
}
@@ -66,14 +67,14 @@ QString PlainTextEditorFactory::kind() const
Core::IFile *PlainTextEditorFactory::open(const QString &fileName)
{
Core::ICore *core = TextEditorPlugin::core();
Core::ICore *core = Core::ICore::instance();
Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind());
return iface ? iface->file() : 0;
}
Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent)
{
PlainTextEditor *rc = new PlainTextEditor(parent);
PlainTextEditor *rc = new PlainTextEditor(parent);
TextEditorPlugin::instance()->initializeEditor(rc);
return rc->editableInterface();
}

View File

@@ -38,6 +38,7 @@
#include "linenumberfilter.h"
#include <quickopen/quickopenmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -52,31 +53,45 @@
using namespace TextEditor;
using namespace TextEditor::Internal;
TextEditorActionHandler::TextEditorActionHandler(Core::ICore *core,
const QString &context,
uint optionalActions) :
QObject(core),
TextEditorActionHandler::TextEditorActionHandler(const QString &context,
uint optionalActions)
: QObject(Core::ICore::instance()),
m_optionalActions(optionalActions),
m_currentEditor(0),
m_core(core),
m_initialized(false)
{
m_undoAction = m_redoAction = m_copyAction = m_cutAction = m_pasteAction
= m_selectAllAction = m_gotoAction = m_printAction = m_formatAction
= m_visualizeWhitespaceAction = m_cleanWhitespaceAction = m_textWrappingAction
= m_unCommentSelectionAction = m_unCollapseAllAction
= m_collapseAction = m_expandAction
= m_deleteLineAction = m_selectEncodingAction
= m_increaseFontSizeAction = m_decreaseFontSizeAction
= m_gotoBlockStartAction = m_gotoBlockStartWithSelectionAction
= m_gotoBlockEndAction = m_gotoBlockEndWithSelectionAction
= m_selectBlockUpAction = m_selectBlockDownAction
= m_moveLineUpAction = m_moveLineDownAction
= 0;
m_undoAction = 0;
m_redoAction = 0;
m_copyAction = 0;
m_cutAction = 0;
m_pasteAction = 0;
m_selectAllAction = 0;
m_gotoAction = 0;
m_printAction = 0;
m_formatAction = 0;
m_visualizeWhitespaceAction = 0;
m_cleanWhitespaceAction = 0;
m_textWrappingAction = 0;
m_unCommentSelectionAction = 0;
m_unCollapseAllAction = 0;
m_collapseAction = 0;
m_expandAction = 0;
m_deleteLineAction = 0;
m_selectEncodingAction = 0;
m_increaseFontSizeAction = 0;
m_decreaseFontSizeAction = 0;
m_gotoBlockStartAction = 0;
m_gotoBlockStartWithSelectionAction = 0;
m_gotoBlockEndAction = 0;
m_gotoBlockEndWithSelectionAction = 0;
m_selectBlockUpAction = 0;
m_selectBlockDownAction = 0;
m_moveLineUpAction = 0;
m_moveLineDownAction = 0;
m_contextId << m_core->uniqueIDManager()->uniqueIdentifier(context);
m_contextId << Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(context);
connect(m_core, SIGNAL(contextAboutToChange(Core::IContext *)),
connect(Core::ICore::instance(), SIGNAL(contextAboutToChange(Core::IContext *)),
this, SLOT(updateCurrentEditor(Core::IContext *)));
}
@@ -111,7 +126,7 @@ void TextEditorActionHandler::createActions()
m_gotoAction = registerNewAction(QLatin1String(Core::Constants::GOTO), this, SLOT(gotoAction()));
m_printAction = registerNewAction(QLatin1String(Core::Constants::PRINT), this, SLOT(printAction()));
Core::ActionManager *am = m_core->actionManager();
Core::ActionManager *am = Core::ICore::instance()->actionManager();
Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED);
@@ -248,7 +263,7 @@ QAction *TextEditorActionHandler::registerNewAction(const QString &id, const QSt
return 0;
QAction *result = new QAction(title, this);
m_core->actionManager()->registerAction(result, id, m_contextId);
Core::ICore::instance()->actionManager()->registerAction(result, id, m_contextId);
return result;
}
@@ -349,7 +364,7 @@ void TextEditorActionHandler::gotoAction()
void TextEditorActionHandler::printAction()
{
if (m_currentEditor)
m_currentEditor->print(m_core->printer());
m_currentEditor->print(Core::ICore::instance()->printer());
}
void TextEditorActionHandler::setVisualizeWhitespace(bool checked)
@@ -445,9 +460,3 @@ const QPointer<BaseTextEditor> &TextEditorActionHandler::currentEditor() const
{
return m_currentEditor;
}
Core::ICore *TextEditorActionHandler::core() const
{
return m_core;
}

View File

@@ -38,11 +38,10 @@
#include "basetexteditor.h"
#include "coreplugin/icontext.h"
#include "coreplugin/icore.h"
#include <QtCore/QList>
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QList>
namespace TextEditor {
@@ -62,9 +61,7 @@ public:
UnCollapseAll = 4
};
TextEditorActionHandler(Core::ICore *core,
const QString &context,
uint optionalActions = None);
TextEditorActionHandler(const QString &context, uint optionalActions = None);
void setupActions(BaseTextEditor *editor);
void initializeActions();
@@ -80,7 +77,6 @@ protected:
QAction *registerNewAction(const QString &id, const QString &title = QString());
QAction *registerNewAction(const QString &id, QObject *receiver, const char *slot,
const QString &title = QString());
Core::ICore *core() const;
enum UpdateMode { NoEditor , ReadOnlyMode, WriteMode };
UpdateMode updateMode() const;
@@ -152,7 +148,6 @@ private:
uint m_optionalActions;
QPointer<BaseTextEditor> m_currentEditor;
Core::ICore *m_core;
QList<int> m_contextId;
bool m_initialized;
};

View File

@@ -62,9 +62,8 @@ using namespace TextEditor::Internal;
TextEditorPlugin *TextEditorPlugin::m_instance = 0;
TextEditorPlugin::TextEditorPlugin() :
m_core(0),
m_settings(0),
TextEditorPlugin::TextEditorPlugin()
: m_settings(0),
m_wizard(0),
m_editorFactory(0),
m_lineNumberFilter(0)
@@ -83,19 +82,12 @@ TextEditorPlugin *TextEditorPlugin::instance()
return m_instance;
}
Core::ICore *TextEditorPlugin::core()
{
return m_instance->m_core;
}
// ExtensionSystem::PluginInterface
bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
m_core = Core::ICore::instance();
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage))
if (!Core::ICore::instance()->mimeDatabase()->addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage))
return false;
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
@@ -106,7 +98,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
m_wizard = new TextFileWizard(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT),
QLatin1String(Core::Constants::K_DEFAULT_TEXT_EDITOR),
QLatin1String("text$"),
wizardParameters, m_core);
wizardParameters);
// Add text file wizard
addAutoReleasedObject(m_wizard);
@@ -118,15 +110,16 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
addAutoReleasedObject(m_editorFactory);
// Goto line functionality for quick open
m_lineNumberFilter = new LineNumberFilter(m_core->editorManager());
Core::ICore *core = Core::ICore::instance();
m_lineNumberFilter = new LineNumberFilter(core->editorManager());
addAutoReleasedObject(m_lineNumberFilter);
int contextId = m_core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
int contextId = core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
QList<int> context = QList<int>() << contextId;
Core::ActionManager *am = m_core->actionManager();
Core::ActionManager *am = core->actionManager();
// Add shortcut for invoking automatic completion
QShortcut *completionShortcut = new QShortcut(m_core->mainWindow());
QShortcut *completionShortcut = new QShortcut(core->mainWindow());
completionShortcut->setWhatsThis(tr("Triggers a completion in this scope"));
// Make sure the shortcut still works when the completion widget is active
completionShortcut->setContext(Qt::ApplicationShortcut);
@@ -138,7 +131,8 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
#endif
connect(completionShortcut, SIGNAL(activated()), this, SLOT(invokeCompletion()));
addAutoReleasedObject(new FindInFiles(m_core, m_core->pluginManager()->getObject<Find::SearchResultWindow>()));
addAutoReleasedObject(new FindInFiles(
ExtensionSystem::PluginManager::instance()->getObject<Find::SearchResultWindow>()));
return true;
}
@@ -172,7 +166,7 @@ void TextEditorPlugin::initializeEditor(TextEditor::PlainTextEditor *editor)
void TextEditorPlugin::invokeCompletion()
{
Core::IEditor *iface = m_core->editorManager()->currentEditor();
Core::IEditor *iface = Core::ICore::instance()->editorManager()->currentEditor();
ITextEditor *editor = qobject_cast<ITextEditor *>(iface);
if (editor)
editor->triggerCompletions();

View File

@@ -36,22 +36,13 @@
#include <extensionsystem/iplugin.h>
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
namespace Core {
class ICore;
class IEditor;
}
namespace TextEditor {
class FontSettings;
class FontSettingsPage;
class PlainTextEditor;
class TextEditorSettings;
class TextFileWizard;
class PlainTextEditor;
namespace Internal {
@@ -67,10 +58,9 @@ public:
virtual ~TextEditorPlugin();
static TextEditorPlugin *instance();
static Core::ICore *core();
// ExtensionSystem::PluginInterface
bool initialize(const QStringList &arguments, QString *);
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
void initializeEditor(PlainTextEditor *editor);
@@ -82,7 +72,6 @@ private slots:
private:
static TextEditorPlugin *m_instance;
Core::ICore *m_core;
TextEditorSettings *m_settings;
TextFileWizard *m_wizard;
PlainTextEditorFactory *m_editorFactory;

View File

@@ -94,8 +94,7 @@ TextEditorSettings::TextEditorSettings(Internal::TextEditorPlugin *plugin,
m_fontSettingsPage = new FontSettingsPage(formatDescriptions,
QLatin1String("TextEditor"),
tr("Text Editor"),
plugin->core());
tr("Text Editor"));
pm->addObject(m_fontSettingsPage);
// Add the GUI used to configure the tab, storage and display settings
@@ -104,7 +103,7 @@ TextEditorSettings::TextEditorSettings(Internal::TextEditorPlugin *plugin,
generalSettingsPageParameters.category = QLatin1String("TextEditor");
generalSettingsPageParameters.trCategory = tr("Text Editor");
generalSettingsPageParameters.settingsPrefix = QLatin1String("text");
m_generalSettingsPage = new GeneralSettingsPage(plugin->core(), generalSettingsPageParameters, this);
m_generalSettingsPage = new GeneralSettingsPage(generalSettingsPageParameters, this);
pm->addObject(m_generalSettingsPage);
connect(m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)),

View File

@@ -41,9 +41,8 @@ TextFileWizard::TextFileWizard(const QString &mimeType,
const QString &editorKind,
const QString &suggestedFileName,
const BaseFileWizardParameters &parameters,
Core::ICore *core,
QObject *parent) :
Core::StandardFileWizard(parameters, core, parent),
Core::StandardFileWizard(parameters, parent),
m_mimeType(mimeType),
m_editorKind(editorKind),
m_suggestedFileName(suggestedFileName)

View File

@@ -50,7 +50,6 @@ public:
const QString &editorKind,
const QString &suggestedFileName,
const BaseFileWizardParameters &parameters,
Core::ICore *core,
QObject *parent = 0);
protected:

View File

@@ -43,28 +43,26 @@
namespace VCSBase {
struct BaseVCSEditorFactoryPrivate {
BaseVCSEditorFactoryPrivate(const VCSBaseEditorParameters *t, Core::ICore *core);
struct BaseVCSEditorFactoryPrivate
{
BaseVCSEditorFactoryPrivate(const VCSBaseEditorParameters *t);
const VCSBaseEditorParameters *m_type;
const QString m_kind;
const QStringList m_mimeTypes;
Core::ICore *m_core;
TextEditor::TextEditorActionHandler *m_editorHandler;
};
BaseVCSEditorFactoryPrivate::BaseVCSEditorFactoryPrivate(const VCSBaseEditorParameters *t, Core::ICore *core) :
BaseVCSEditorFactoryPrivate::BaseVCSEditorFactoryPrivate(const VCSBaseEditorParameters *t) :
m_type(t),
m_kind(QLatin1String(t->kind)),
m_mimeTypes(QStringList(QLatin1String(t->mimeType))),
m_core(core),
m_editorHandler(new TextEditor::TextEditorActionHandler(core, t->kind))
m_editorHandler(new TextEditor::TextEditorActionHandler(t->kind))
{
}
BaseVCSEditorFactory::BaseVCSEditorFactory(const VCSBaseEditorParameters *t,
Core::ICore *core) :
m_d(new BaseVCSEditorFactoryPrivate(t, core))
BaseVCSEditorFactory::BaseVCSEditorFactory(const VCSBaseEditorParameters *t)
: m_d(new BaseVCSEditorFactoryPrivate(t))
{
}
@@ -85,7 +83,7 @@ QString BaseVCSEditorFactory::kind() const
Core::IFile *BaseVCSEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = m_d->m_core->editorManager()->openEditor(fileName, kind());
Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind());
return iface ? iface->file() : 0;
}

View File

@@ -41,14 +41,6 @@
#include <QtCore/QStringList>
namespace TextEditor {
class TextEditorActionHandler;
}
namespace Core {
class ICore;
}
namespace VCSBase {
struct BaseVCSEditorFactoryPrivate;
@@ -59,8 +51,7 @@ class VCSBASE_EXPORT BaseVCSEditorFactory : public Core::IEditorFactory
{
Q_OBJECT
public:
explicit BaseVCSEditorFactory(const VCSBaseEditorParameters *type,
Core::ICore *core);
explicit BaseVCSEditorFactory(const VCSBaseEditorParameters *type);
virtual ~BaseVCSEditorFactory();
virtual QStringList mimeTypes() const;
@@ -85,7 +76,6 @@ class VCSEditorFactory : public BaseVCSEditorFactory
{
public:
explicit VCSEditorFactory(const VCSBaseEditorParameters *type,
Core::ICore *core,
QObject *describeReceiver = 0,
const char *describeSlot = 0);
@@ -98,10 +88,9 @@ private:
template <class Editor>
VCSEditorFactory<Editor>::VCSEditorFactory(const VCSBaseEditorParameters *type,
Core::ICore *core,
QObject *describeReceiver,
const char *describeSlot) :
BaseVCSEditorFactory(type, core),
BaseVCSEditorFactory(type),
m_describeReceiver(describeReceiver),
m_describeSlot(describeSlot)
{