forked from qt-creator/qt-creator
Cleaned up usages of CoreImpl::instance
The instance method has been moved to ICore, so there is generally no need to include coreimpl.h anymore. Many objects accessed through this core instance also had their own static instance methods.
This commit is contained in:
@@ -35,7 +35,6 @@
|
||||
#include "actionmanager_p.h"
|
||||
|
||||
#include "command_p.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include "coreconstants.h"
|
||||
#include "uniqueidmanager.h"
|
||||
@@ -150,15 +149,13 @@ bool ActionContainerPrivate::hasState(ContainerState state) const
|
||||
|
||||
void ActionContainerPrivate::appendGroup(const QString &group)
|
||||
{
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
int gid = idmanager->uniqueIdentifier(group);
|
||||
int gid = UniqueIDManager::instance()->uniqueIdentifier(group);
|
||||
m_groups << gid;
|
||||
}
|
||||
|
||||
QAction *ActionContainerPrivate::insertLocation(const QString &group) const
|
||||
{
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
int grpid = idmanager->uniqueIdentifier(group);
|
||||
int grpid = UniqueIDManager::instance()->uniqueIdentifier(group);
|
||||
int prevKey = 0;
|
||||
int pos = ((grpid << 16) | 0xFFFF);
|
||||
return beforeAction(pos, &prevKey);
|
||||
@@ -181,7 +178,7 @@ void ActionContainerPrivate::addAction(Command *action, const QString &group)
|
||||
}
|
||||
a->setStateFlags(a->stateFlags() | CommandPrivate::CS_Initialized);
|
||||
} else {
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
UniqueIDManager *idmanager = UniqueIDManager::instance();
|
||||
int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO);
|
||||
if (!group.isEmpty())
|
||||
grpid = idmanager->uniqueIdentifier(group);
|
||||
@@ -208,7 +205,7 @@ void ActionContainerPrivate::addMenu(ActionContainer *menu, const QString &group
|
||||
}
|
||||
mc->setState(ActionContainerPrivate::CS_Initialized);
|
||||
} else {
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
UniqueIDManager *idmanager = UniqueIDManager::instance();
|
||||
int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO);
|
||||
if (!group.isEmpty())
|
||||
grpid = idmanager->uniqueIdentifier(group);
|
||||
|
@@ -31,7 +31,6 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "coreimpl.h"
|
||||
#include "commandsfile.h"
|
||||
#include "shortcutsettings.h"
|
||||
#include "command_p.h"
|
||||
@@ -100,7 +99,7 @@ QMap<QString, QKeySequence> CommandsFile::importCommands() const
|
||||
*/
|
||||
bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
|
||||
{
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
UniqueIDManager *idmanager = UniqueIDManager::instance();
|
||||
|
||||
QFile file(m_filename);
|
||||
if (!file.open(QIODevice::WriteOnly))
|
||||
@@ -110,7 +109,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
|
||||
QDomElement root = doc.createElement("mapping");
|
||||
doc.appendChild(root);
|
||||
|
||||
for (int i=0; i<items.count(); ++i) {
|
||||
for (int i = 0; i < items.count(); ++i) {
|
||||
ShortcutItem *item = items.at(i);
|
||||
QDomElement ctag = doc.createElement("shortcut");
|
||||
ctag.setAttribute(QLatin1String("id"), idmanager->stringForUniqueIdentifier(item->m_cmd->id()));
|
||||
|
@@ -32,7 +32,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "settingsdialog.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include "editmode.h"
|
||||
#include "editormanager.h"
|
||||
#include "coreconstants.h"
|
||||
#include "coreimpl.h"
|
||||
#include "modemanager.h"
|
||||
#include "uniqueidmanager.h"
|
||||
#include "minisplitter.h"
|
||||
@@ -122,9 +121,9 @@ const char* EditMode::uniqueModeName() const
|
||||
QList<int> EditMode::context() const
|
||||
{
|
||||
static QList<int> contexts = QList<int>() <<
|
||||
CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_EDIT_MODE) <<
|
||||
CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER) <<
|
||||
CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_NAVIGATION_PANE);
|
||||
UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDIT_MODE) <<
|
||||
UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDITORMANAGER) <<
|
||||
UniqueIDManager::instance()->uniqueIdentifier(Constants::C_NAVIGATION_PANE);
|
||||
return contexts;
|
||||
}
|
||||
|
||||
|
@@ -32,19 +32,19 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "editormanager.h"
|
||||
#include "editorgroup.h"
|
||||
#include "editorsplitter.h"
|
||||
#include "openeditorsview.h"
|
||||
#include "openeditorswindow.h"
|
||||
#include "openwithdialog.h"
|
||||
#include "filemanager.h"
|
||||
#include "tabpositionindicator.h"
|
||||
#include "saveitemsdialog.h"
|
||||
#include "vcsmanager.h"
|
||||
#include "icore.h"
|
||||
#include "iversioncontrol.h"
|
||||
#include "openeditorsview.h"
|
||||
#include "editorgroup.h"
|
||||
#include "mimedatabase.h"
|
||||
#include "saveitemsdialog.h"
|
||||
#include "tabpositionindicator.h"
|
||||
#include "vcsmanager.h"
|
||||
|
||||
#include <coreplugin/coreimpl.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
@@ -68,6 +68,7 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPushButton>
|
||||
@@ -649,7 +650,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA
|
||||
//ask whether to save modified files
|
||||
if (askAboutModifiedEditors) {
|
||||
bool cancelled = false;
|
||||
QList<IFile*> list = CoreImpl::instance()->fileManager()->
|
||||
QList<IFile*> list = ICore::instance()->fileManager()->
|
||||
saveModifiedFiles(filesForEditors(acceptedEditors), &cancelled);
|
||||
if (cancelled)
|
||||
return false;
|
||||
@@ -1549,7 +1550,7 @@ void EditorManager::openInExternalEditor()
|
||||
return;
|
||||
if (editor->file()->isModified()) {
|
||||
bool cancelled = false;
|
||||
QList<IFile*> list = CoreImpl::instance()->fileManager()->
|
||||
QList<IFile*> list = ICore::instance()->fileManager()->
|
||||
saveModifiedFiles(QList<IFile*>() << editor->file(), &cancelled);
|
||||
if (cancelled)
|
||||
return;
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "openeditorsview.h"
|
||||
#include "editorgroup.h"
|
||||
#include "editormanager.h"
|
||||
#include "coreimpl.h"
|
||||
#include "icore.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
@@ -218,7 +218,7 @@ void OpenEditorsWidget::closeEditors()
|
||||
selectedEditors.append(item->data(0, Qt::UserRole).value<IEditor *>());
|
||||
selectedFiles.append(item->data(0, Qt::UserRole).value<IEditor *>()->file());
|
||||
}
|
||||
ICore *core = CoreImpl::instance();
|
||||
ICore *core = ICore::instance();
|
||||
bool cancelled = false;
|
||||
core->fileManager()->saveModifiedFiles(selectedFiles, &cancelled);
|
||||
if (cancelled)
|
||||
|
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "stackededitorgroup.h"
|
||||
#include "editormanager.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -355,7 +354,7 @@ QList<IEditor *> StackedEditorGroup::editorsInNaturalOrder() const
|
||||
|
||||
void StackedEditorGroup::makeEditorWritable()
|
||||
{
|
||||
CoreImpl::instance()->editorManager()->makeEditorWritable(currentEditor());
|
||||
EditorManager::instance()->makeEditorWritable(currentEditor());
|
||||
}
|
||||
|
||||
void StackedEditorGroup::listSelectionChanged(int index)
|
||||
|
@@ -94,7 +94,7 @@
|
||||
extern "C" void handleSigInt(int sig)
|
||||
{
|
||||
Q_UNUSED(sig);
|
||||
Core::Internal::CoreImpl::instance()->exit();
|
||||
Core::ICore::instance()->exit();
|
||||
qDebug() << "SIGINT caught. Shutting down.";
|
||||
}
|
||||
#endif
|
||||
|
@@ -42,7 +42,6 @@
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/coreimpl.h>
|
||||
#include <coreplugin/imode.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
|
@@ -33,10 +33,9 @@
|
||||
|
||||
#include "progressmanager_p.h"
|
||||
#include "progressview.h"
|
||||
#include "coreimpl.h"
|
||||
#include "baseview.h"
|
||||
|
||||
#include "coreconstants.h"
|
||||
#include "icore.h"
|
||||
#include "uniqueidmanager.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -48,7 +47,7 @@ ProgressManagerPrivate::ProgressManagerPrivate(QObject *parent)
|
||||
: ProgressManager(parent)
|
||||
{
|
||||
m_progressView = new ProgressView;
|
||||
ICore *core = CoreImpl::instance();
|
||||
ICore *core = ICore::instance();
|
||||
connect(core, SIGNAL(coreAboutToClose()), this, SLOT(cancelAllRunningTasks()));
|
||||
}
|
||||
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
UniqueIDManager();
|
||||
~UniqueIDManager();
|
||||
|
||||
static UniqueIDManager* instance() { return m_instance; }
|
||||
static UniqueIDManager *instance() { return m_instance; }
|
||||
|
||||
bool hasUniqueIdentifier(const QString &id) const;
|
||||
int uniqueIdentifier(const QString &id);
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "versiondialog.h"
|
||||
|
||||
#include "coreconstants.h"
|
||||
#include "coreimpl.h"
|
||||
#include "icore.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -121,7 +121,7 @@ void VersionDialog::popupLicense()
|
||||
layout->addWidget(buttonBox);
|
||||
|
||||
// Read file into string
|
||||
ICore * core = CoreImpl::instance();
|
||||
ICore *core = ICore::instance();
|
||||
QTC_ASSERT(core, return);
|
||||
QString fileName = core->resourcePath() + "/license.txt";
|
||||
QFile file(fileName);
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include "welcomemode.h"
|
||||
#include "coreconstants.h"
|
||||
#include "uniqueidmanager.h"
|
||||
#include "coreimpl.h"
|
||||
#include "modemanager.h"
|
||||
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
@@ -193,7 +192,7 @@ const char* WelcomeMode::uniqueModeName() const
|
||||
QList<int> WelcomeMode::context() const
|
||||
{
|
||||
static QList<int> contexts = QList<int>()
|
||||
<< CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_WELCOME_MODE);
|
||||
<< UniqueIDManager::instance()->uniqueIdentifier(Constants::C_WELCOME_MODE);
|
||||
return contexts;
|
||||
}
|
||||
|
||||
@@ -250,7 +249,7 @@ void WelcomeMode::updateWelcomePage(const WelcomePageData &welcomePageData)
|
||||
void WelcomeMode::linkClicked(const QUrl &url)
|
||||
{
|
||||
QString scheme = url.scheme();
|
||||
Core::ModeManager *modeManager = CoreImpl::instance()->modeManager();
|
||||
Core::ModeManager *modeManager = ModeManager::instance();
|
||||
if (scheme.startsWith(QLatin1String("gh"))) {
|
||||
QString s = url.toString(QUrl::RemoveScheme);
|
||||
if (scheme == QLatin1String("gh")) {
|
||||
|
Reference in New Issue
Block a user