Use new static ICore interface.

Change-Id: I9b690d9b150c8d162b15370f9f8986267c9128f1
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
hjk
2012-01-24 15:36:40 +01:00
committed by hjk
parent c14a4756a9
commit 4a21f0c3c8
254 changed files with 848 additions and 1007 deletions

View File

@@ -219,7 +219,7 @@ QWidget *QmlJSCodeStyleSettingsPage::createPage(QWidget *parent)
void QmlJSCodeStyleSettingsPage::apply()
{
if (m_widget) {
QSettings *s = Core::ICore::instance()->settings();
QSettings *s = Core::ICore::settings();
TextEditor::SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::instance()->qmlJSCodeStyle();
if (originalTabPreferences->tabSettings() != m_pageTabPreferences->tabSettings()) {

View File

@@ -78,7 +78,7 @@ QmlJS::Document::Language QmlJSTools::languageOfFile(const QString &fileName)
QStringList jsonSuffixes("json");
if (Core::ICore::instance()) {
Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase();
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
Core::MimeType jsSourceTy = db->findByType(Constants::JS_MIMETYPE);
jsSuffixes = jsSourceTy.suffixes();
Core::MimeType qmlSourceTy = db->findByType(Constants::QML_MIMETYPE);
@@ -102,7 +102,7 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns()
{
QStringList pattern;
if (Core::ICore::instance()) {
Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase();
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
Core::MimeType jsSourceTy = db->findByType(Constants::JS_MIMETYPE);
Core::MimeType qmlSourceTy = db->findByType(Constants::QML_MIMETYPE);
@@ -119,7 +119,6 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns()
ModelManager::ModelManager(QObject *parent):
ModelManagerInterface(parent),
m_core(Core::ICore::instance()),
m_pluginDumper(new PluginDumper(this))
{
m_synchronizer.setCancelOnWait(true);
@@ -165,8 +164,8 @@ void ModelManager::delayedInitialization()
void ModelManager::loadQmlTypeDescriptions()
{
if (Core::ICore::instance()) {
loadQmlTypeDescriptions(Core::ICore::instance()->resourcePath());
loadQmlTypeDescriptions(Core::ICore::instance()->userResourcePath());
loadQmlTypeDescriptions(Core::ICore::resourcePath());
loadQmlTypeDescriptions(Core::ICore::userResourcePath());
}
}
@@ -208,12 +207,10 @@ void ModelManager::loadQmlTypeDescriptions(const QString &resourcePath)
ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const
{
WorkingCopy workingCopy;
if (!m_core)
if (!Core::ICore::instance())
return workingCopy;
Core::EditorManager *editorManager = m_core->editorManager();
foreach (Core::IEditor *editor, editorManager->openedEditors()) {
foreach (Core::IEditor *editor, Core::ICore::editorManager()->openedEditors()) {
const QString key = editor->file()->fileName();
if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) {
@@ -272,7 +269,7 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
m_synchronizer.addFuture(result);
if (sourceFiles.count() > 1) {
m_core->progressManager()->addTask(result, tr("Indexing"),
Core::ICore::progressManager()->addTask(result, tr("Indexing"),
Constants::TASK_INDEX);
}
@@ -631,7 +628,7 @@ void ModelManager::parse(QFutureInterface<void> &future,
// Check whether fileMimeType is the same or extends knownMimeType
bool ModelManager::matchesMimeType(const Core::MimeType &fileMimeType, const Core::MimeType &knownMimeType)
{
Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase();
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
const QStringList knownTypeNames = QStringList(knownMimeType.type()) + knownMimeType.aliases();

View File

@@ -46,7 +46,6 @@
QT_FORWARD_DECLARE_CLASS(QTimer)
namespace Core {
class ICore;
class MimeType;
}
@@ -136,7 +135,6 @@ private:
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents);
mutable QMutex m_mutex;
Core::ICore *m_core;
QmlJS::Snapshot _validSnapshot;
QmlJS::Snapshot _newestSnapshot;
QStringList m_allImportPaths;

View File

@@ -58,7 +58,7 @@ void QmlJSTools::Internal::QmlJSToolsPlugin::test_basic()
{
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
const QString welcomescreenRootPath = Core::ICore::instance()->resourcePath() + "/welcomescreen/welcomescreen.qml";
const QString welcomescreenRootPath = Core::ICore::resourcePath() + "/welcomescreen/welcomescreen.qml";
modelManager->updateSourceFiles(QStringList(welcomescreenRootPath), false);
modelManager->joinAllThreads();

View File

@@ -77,8 +77,7 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
Q_UNUSED(arguments)
Q_UNUSED(error)
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
Core::ActionManager *am = Core::ICore::actionManager();
m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings
@@ -113,9 +112,9 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
mqmljstools->addAction(cmd);
// watch task progress
connect(core->progressManager(), SIGNAL(taskStarted(QString)),
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),
this, SLOT(onTaskStarted(QString)));
connect(core->progressManager(), SIGNAL(allTasksFinished(QString)),
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
this, SLOT(onAllTasksFinished(QString)));
return true;

View File

@@ -109,7 +109,7 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
pool->loadCustomCodeStyles();
// load global settings (after built-in settings are added to the pool)
if (QSettings *s = Core::ICore::instance()->settings()) {
if (QSettings *s = Core::ICore::settings()) {
d->m_globalCodeStyle->fromSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
// legacy handling start (Qt Creator Version < 2.4)