Core: Static pattern for ProgressManager, clean up all users

Change-Id: I4af8793ca69a3af9e99baeb7c31dad3864266f91
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
hjk
2013-08-30 09:22:42 +02:00
parent ba1d8e2c4d
commit df36184371
37 changed files with 409 additions and 385 deletions

View File

@@ -38,7 +38,6 @@
#include <projectexplorer/session.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cpptoolsconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
@@ -48,6 +47,8 @@
#include <QMutex>
#include <QMutexLocker>
using namespace Core;
namespace ClassView {
namespace Internal {
@@ -234,9 +235,9 @@ void Manager::initialize()
SLOT(onProjectListChanged()), Qt::QueuedConnection);
// connect to the progress manager for signals about Parsing tasks
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),
connect(ProgressManager::instance(), SIGNAL(taskStarted(QString)),
SLOT(onTaskStarted(QString)), Qt::QueuedConnection);
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
SLOT(onAllTasksFinished(QString)), Qt::QueuedConnection);
// when we signals that really document is updated - sent it to the parser
@@ -440,7 +441,7 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc)
void Manager::gotoLocation(const QString &fileName, int line, int column)
{
Core::EditorManager::openEditorAt(fileName, line, column);
EditorManager::openEditorAt(fileName, line, column);
}
/*!
@@ -462,9 +463,9 @@ void Manager::gotoLocations(const QList<QVariant> &list)
bool currentPositionAvailable = false;
// what is open now?
if (Core::IEditor *editor = Core::EditorManager::currentEditor()) {
if (IEditor *editor = EditorManager::currentEditor()) {
// get current file name
if (Core::IDocument *document = editor->document())
if (IDocument *document = editor->document())
fileName = document->filePath();
// if text file - what is current position?

View File

@@ -100,6 +100,9 @@
#include <QTest>
#endif
using namespace Core;
using namespace ProjectExplorer;
namespace ClearCase {
namespace Internal {
@@ -367,17 +370,17 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
initializeVcs(new ClearCaseControl(this));
m_clearcasePluginInstance = this;
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(closing()));
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(closing()));
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
this, SLOT(tasksFinished(QString)));
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/clearcase/ClearCase.mimetypes.xml"), errorMessage))
if (!ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/clearcase/ClearCase.mimetypes.xml"), errorMessage))
return false;
m_settings.fromSettings(Core::ICore::settings());
m_settings.fromSettings(ICore::settings());
// update view name when changing active project
if (ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance())
if (ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance())
connect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
this, SLOT(projectChanged(ProjectExplorer::Project*)));
@@ -398,44 +401,44 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
addAutoReleasedObject(m_commandLocator);
//register actions
Core::ActionContainer *toolsContainer = Core::ActionManager::actionContainer(M_TOOLS);
ActionContainer *toolsContainer = ActionManager::actionContainer(M_TOOLS);
Core::ActionContainer *clearcaseMenu = Core::ActionManager::createMenu(Core::Id(CMD_ID_CLEARCASE_MENU));
ActionContainer *clearcaseMenu = ActionManager::createMenu(CMD_ID_CLEARCASE_MENU);
clearcaseMenu->menu()->setTitle(tr("C&learCase"));
toolsContainer->addMenu(clearcaseMenu);
m_menuAction = clearcaseMenu->menu()->menuAction();
Core::Context globalcontext(C_GLOBAL);
Core::Command *command;
Context globalcontext(C_GLOBAL);
Command *command;
m_checkOutAction = new Utils::ParameterAction(tr("Check Out..."), tr("Check &Out \"%1\"..."), Utils::ParameterAction::AlwaysEnabled, this);
command = Core::ActionManager::registerAction(m_checkOutAction, CMD_ID_CHECKOUT,
command = ActionManager::registerAction(m_checkOutAction, CMD_ID_CHECKOUT,
globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+O") : tr("Alt+L,Alt+O")));
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+O") : tr("Alt+L,Alt+O")));
connect(m_checkOutAction, SIGNAL(triggered()), this, SLOT(checkOutCurrentFile()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_checkInCurrentAction = new Utils::ParameterAction(tr("Check &In..."), tr("Check &In \"%1\"..."), Utils::ParameterAction::AlwaysEnabled, this);
command = Core::ActionManager::registerAction(m_checkInCurrentAction, CMD_ID_CHECKIN, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+I") : tr("Alt+L,Alt+I")));
command = ActionManager::registerAction(m_checkInCurrentAction, CMD_ID_CHECKIN, globalcontext);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+I") : tr("Alt+L,Alt+I")));
connect(m_checkInCurrentAction, SIGNAL(triggered()), this, SLOT(startCheckInCurrentFile()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_undoCheckOutAction = new Utils::ParameterAction(tr("Undo Check Out"), tr("&Undo Check Out \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
command = Core::ActionManager::registerAction(m_undoCheckOutAction, CMD_ID_UNDOCHECKOUT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+U") : tr("Alt+L,Alt+U")));
command = ActionManager::registerAction(m_undoCheckOutAction, CMD_ID_UNDOCHECKOUT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+U") : tr("Alt+L,Alt+U")));
connect(m_undoCheckOutAction, SIGNAL(triggered()), this, SLOT(undoCheckOutCurrent()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_undoHijackAction = new Utils::ParameterAction(tr("Undo Hijack"), tr("Undo Hi&jack \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
command = Core::ActionManager::registerAction(m_undoHijackAction, CMD_ID_UNDOHIJACK, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+R") : tr("Alt+L,Alt+R")));
command = ActionManager::registerAction(m_undoHijackAction, CMD_ID_UNDOHIJACK, globalcontext);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+R") : tr("Alt+L,Alt+R")));
connect(m_undoHijackAction, SIGNAL(triggered()), this, SLOT(undoHijackCurrent()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
@@ -443,100 +446,100 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
clearcaseMenu->addSeparator(globalcontext);
m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("&Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = Core::ActionManager::registerAction(m_diffCurrentAction,
command = ActionManager::registerAction(m_diffCurrentAction,
CMD_ID_DIFF_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+D") : tr("Alt+L,Alt+D")));
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+D") : tr("Alt+L,Alt+D")));
connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_historyCurrentAction = new Utils::ParameterAction(tr("History Current File"), tr("&History \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = Core::ActionManager::registerAction(m_historyCurrentAction,
command = ActionManager::registerAction(m_historyCurrentAction,
CMD_ID_HISTORY_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+H") : tr("Alt+L,Alt+H")));
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+H") : tr("Alt+L,Alt+H")));
connect(m_historyCurrentAction, SIGNAL(triggered()), this,
SLOT(historyCurrentFile()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("&Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = Core::ActionManager::registerAction(m_annotateCurrentAction,
command = ActionManager::registerAction(m_annotateCurrentAction,
CMD_ID_ANNOTATE, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+A") : tr("Alt+L,Alt+A")));
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+A") : tr("Alt+L,Alt+A")));
connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
SLOT(annotateCurrentFile()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_addFileAction = new Utils::ParameterAction(tr("Add File..."), tr("Add File \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = Core::ActionManager::registerAction(m_addFileAction, CMD_ID_ADD_FILE, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command = ActionManager::registerAction(m_addFileAction, CMD_ID_ADD_FILE, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_addFileAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
clearcaseMenu->addAction(command);
clearcaseMenu->addSeparator(globalcontext);
m_diffActivityAction = new QAction(tr("Diff A&ctivity..."), this);
command = Core::ActionManager::registerAction(m_diffActivityAction, CMD_ID_DIFF_ACTIVITY, globalcontext);
command = ActionManager::registerAction(m_diffActivityAction, CMD_ID_DIFF_ACTIVITY, globalcontext);
connect(m_diffActivityAction, SIGNAL(triggered()), this, SLOT(diffActivity()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_checkInActivityAction = new Utils::ParameterAction(tr("Ch&eck In Activity"), tr("Chec&k In Activity \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = Core::ActionManager::registerAction(m_checkInActivityAction, CMD_ID_CHECKIN_ACTIVITY, globalcontext);
command = ActionManager::registerAction(m_checkInActivityAction, CMD_ID_CHECKIN_ACTIVITY, globalcontext);
connect(m_checkInActivityAction, SIGNAL(triggered()), this, SLOT(startCheckInActivity()));
command->setAttribute(Core::Command::CA_UpdateText);
command->setAttribute(Command::CA_UpdateText);
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
clearcaseMenu->addSeparator(globalcontext);
m_updateIndexAction = new QAction(tr("Update Index"), this);
command = Core::ActionManager::registerAction(m_updateIndexAction, CMD_ID_UPDATEINDEX, globalcontext);
command = ActionManager::registerAction(m_updateIndexAction, CMD_ID_UPDATEINDEX, globalcontext);
connect(m_updateIndexAction, SIGNAL(triggered()), this, SLOT(updateIndex()));
clearcaseMenu->addAction(command);
m_updateViewAction = new Utils::ParameterAction(tr("Update View"), tr("U&pdate View \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = Core::ActionManager::registerAction(m_updateViewAction, CMD_ID_UPDATE_VIEW, globalcontext);
command = ActionManager::registerAction(m_updateViewAction, CMD_ID_UPDATE_VIEW, globalcontext);
connect(m_updateViewAction, SIGNAL(triggered()), this, SLOT(updateView()));
command->setAttribute(Core::Command::CA_UpdateText);
command->setAttribute(Command::CA_UpdateText);
clearcaseMenu->addAction(command);
clearcaseMenu->addSeparator(globalcontext);
m_checkInAllAction = new QAction(tr("Check In All &Files..."), this);
command = Core::ActionManager::registerAction(m_checkInAllAction, CMD_ID_CHECKIN_ALL, globalcontext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+F") : tr("Alt+L,Alt+F")));
command = ActionManager::registerAction(m_checkInAllAction, CMD_ID_CHECKIN_ALL, globalcontext);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+F") : tr("Alt+L,Alt+F")));
connect(m_checkInAllAction, SIGNAL(triggered()), this, SLOT(startCheckInAll()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_statusAction = new QAction(tr("View &Status"), this);
command = Core::ActionManager::registerAction(m_statusAction, CMD_ID_STATUS, globalcontext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+L,Meta+S") : tr("Alt+L,Alt+S")));
command = ActionManager::registerAction(m_statusAction, CMD_ID_STATUS, globalcontext);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+S") : tr("Alt+L,Alt+S")));
connect(m_statusAction, SIGNAL(triggered()), this, SLOT(viewStatus()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
// Actions of the submit editor
Core::Context clearcasecheckincontext(Constants::CLEARCASECHECKINEDITOR);
Context clearcasecheckincontext(Constants::CLEARCASECHECKINEDITOR);
m_checkInSelectedAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Check In"), this);
command = Core::ActionManager::registerAction(m_checkInSelectedAction, Constants::CHECKIN_SELECTED, clearcasecheckincontext);
command->setAttribute(Core::Command::CA_UpdateText);
command = ActionManager::registerAction(m_checkInSelectedAction, Constants::CHECKIN_SELECTED, clearcasecheckincontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_checkInSelectedAction, SIGNAL(triggered()), this, SLOT(checkInSelected()));
m_checkInDiffAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff Selected Files"), this);
command = Core::ActionManager::registerAction(m_checkInDiffAction , Constants::DIFF_SELECTED, clearcasecheckincontext);
command = ActionManager::registerAction(m_checkInDiffAction , Constants::DIFF_SELECTED, clearcasecheckincontext);
m_submitUndoAction = new QAction(tr("&Undo"), this);
command = Core::ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, clearcasecheckincontext);
command = ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, clearcasecheckincontext);
m_submitRedoAction = new QAction(tr("&Redo"), this);
command = Core::ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, clearcasecheckincontext);
command = ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, clearcasecheckincontext);
return true;
}
@@ -549,7 +552,7 @@ bool ClearCasePlugin::submitEditorAboutToClose()
ClearCaseSubmitEditor *editor = qobject_cast<ClearCaseSubmitEditor *>(submitEditor());
QTC_ASSERT(editor, return true);
Core::IDocument *editorDocument = editor->document();
IDocument *editorDocument = editor->document();
QTC_ASSERT(editorDocument, return true);
// Submit editor closing. Make it write out the check in message
@@ -580,14 +583,14 @@ bool ClearCasePlugin::submitEditorAboutToClose()
// If user changed
if (prompt != m_settings.promptToCheckIn) {
m_settings.promptToCheckIn = prompt;
m_settings.toSettings(Core::ICore::settings());
m_settings.toSettings(ICore::settings());
}
const QStringList fileList = editor->checkedFiles();
bool closeEditor = true;
if (!fileList.empty()) {
// get message & check in
closeEditor = Core::DocumentManager::saveDocument(editorDocument);
closeEditor = DocumentManager::saveDocument(editorDocument);
if (closeEditor) {
ClearCaseSubmitEditorWidget *widget = editor->submitEditorWidget();
closeEditor = vcsCheckIn(m_checkInMessageFileName, fileList, widget->activity(),
@@ -609,7 +612,7 @@ void ClearCasePlugin::diffCheckInFiles(const QStringList &files)
ccDiffWithPred(m_checkInView, files);
}
static inline void setDiffBaseDirectory(Core::IEditor *editor, const QString &db)
static inline void setDiffBaseDirectory(IEditor *editor, const QString &db)
{
if (VcsBase::VcsBaseEditorWidget *ve = qobject_cast<VcsBase::VcsBaseEditorWidget*>(editor->widget()))
ve->setDiffBaseDirectory(db);
@@ -686,8 +689,8 @@ QString ClearCasePlugin::ccGetFileActivity(const QString &workingDir, const QStr
ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString &fileName, bool isUcm)
{
Core::IEditor *editor =
Core::EditorManager::openEditor(fileName, Constants::CLEARCASECHECKINEDITOR_ID);
IEditor *editor =
EditorManager::openEditor(fileName, Constants::CLEARCASECHECKINEDITOR_ID);
ClearCaseSubmitEditor *submitEditor = qobject_cast<ClearCaseSubmitEditor*>(editor);
QTC_CHECK(submitEditor);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction);
@@ -802,7 +805,7 @@ bool ClearCasePlugin::vcsUndoCheckOut(const QString &workingDir, const QString &
if (ClearCase::Constants::debug)
qDebug() << Q_FUNC_INFO << workingDir << fileName << keep;
Core::FileChangeBlocker fcb(fileName);
FileChangeBlocker fcb(fileName);
// revert
QStringList args(QLatin1String("uncheckout"));
@@ -877,7 +880,7 @@ void ClearCasePlugin::undoHijackCurrent()
keep = unhijackUi.chkKeep->isChecked();
}
Core::FileChangeBlocker fcb(state.currentFile());
FileChangeBlocker fcb(state.currentFile());
// revert
if (vcsUndoHijack(state.currentFileTopLevel(), fileName, keep))
@@ -928,16 +931,16 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, workingDir, files);
if (files.count() == 1) {
// Show in the same editor if diff has been executed before
if (Core::IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
if (IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
existingEditor->document()->setContents(result.toUtf8());
Core::EditorManager::activateEditor(existingEditor);
EditorManager::activateEditor(existingEditor);
setDiffBaseDirectory(existingEditor, workingDir);
return;
}
diffname = QDir::toNativeSeparators(files.first());
}
const QString title = QString::fromLatin1("cc diff %1").arg(diffname);
Core::IEditor *editor = showOutputInEditor(title, result, VcsBase::DiffOutput, source, codec);
IEditor *editor = showOutputInEditor(title, result, VcsBase::DiffOutput, source, codec);
setDiffBaseDirectory(editor, workingDir);
VcsBase::VcsBaseEditorWidget::tagEditor(editor, tag);
ClearCaseEditor *diffEditorWidget = qobject_cast<ClearCaseEditor *>(editor->widget());
@@ -1033,7 +1036,7 @@ void ClearCasePlugin::diffActivity()
}
m_diffPrefix.clear();
const QString title = QString::fromLatin1("%1.patch").arg(activity);
Core::IEditor *editor = showOutputInEditor(title, result, VcsBase::DiffOutput, activity, 0);
IEditor *editor = showOutputInEditor(title, result, VcsBase::DiffOutput, activity, 0);
setDiffBaseDirectory(editor, topLevel);
}
@@ -1188,13 +1191,13 @@ void ClearCasePlugin::history(const QString &workingDir,
const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, files);
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::LogOutput, workingDir, files);
if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
if (IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->document()->setContents(response.stdOut.toUtf8());
Core::EditorManager::activateEditor(editor);
EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cc history %1").arg(id);
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VcsBase::LogOutput, source, codec);
IEditor *newEditor = showOutputInEditor(title, response.stdOut, VcsBase::LogOutput, source, codec);
VcsBase::VcsBaseEditorWidget::tagEditor(newEditor, tag);
if (enableAnnotationContextMenu)
VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
@@ -1300,13 +1303,13 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file
<< headerSep << QLatin1Char('\n') << response.stdOut.left(pos);
const QStringList files = QStringList(file);
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::AnnotateOutput, workingDir, files);
if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
if (IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->document()->setContents(res.toUtf8());
VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber);
Core::EditorManager::activateEditor(editor);
EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cc annotate %1").arg(id);
Core::IEditor *newEditor = showOutputInEditor(title, res, VcsBase::AnnotateOutput, source, codec);
IEditor *newEditor = showOutputInEditor(title, res, VcsBase::AnnotateOutput, source, codec);
VcsBase::VcsBaseEditorWidget::tagEditor(newEditor, tag);
VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(newEditor, lineNumber);
}
@@ -1337,12 +1340,12 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
// Re-use an existing view if possible to support
// the common usage pattern of continuously changing and diffing a file
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, source, QStringList(), changeNr);
if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
if (IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->document()->setContents(description.toUtf8());
Core::EditorManager::activateEditor(editor);
EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cc describe %1").arg(id);
Core::IEditor *newEditor = showOutputInEditor(title, description, VcsBase::DiffOutput, source, codec);
IEditor *newEditor = showOutputInEditor(title, description, VcsBase::DiffOutput, source, codec);
VcsBase::VcsBaseEditorWidget::tagEditor(newEditor, tag);
}
}
@@ -1350,7 +1353,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
void ClearCasePlugin::checkInSelected()
{
m_submitActionTriggered = true;
Core::EditorManager::closeEditor();
EditorManager::closeEditor();
}
QString ClearCasePlugin::runCleartoolSync(const QString &workingDir,
@@ -1387,18 +1390,18 @@ ClearCaseResponse
return response;
}
Core::IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const QString &output,
IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const QString &output,
int editorType, const QString &source,
QTextCodec *codec) const
{
const VcsBase::VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
const Core::Id id = params->id;
const Id id = params->id;
if (ClearCase::Constants::debug)
qDebug() << "ClearCasePlugin::showOutputInEditor" << title << id.name()
<< "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title;
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(id, &s, output.toUtf8());
IEditor *editor = EditorManager::openEditorWithContents(id, &s, output.toUtf8());
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,int)),
this, SLOT(annotateVersion(QString,QString,int)));
ClearCaseEditor *e = qobject_cast<ClearCaseEditor*>(editor->widget());
@@ -1411,8 +1414,8 @@ Core::IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const Q
e->setSource(source);
if (codec)
e->setCodec(codec);
Core::IEditor *ie = e->editor();
Core::EditorManager::activateEditor(ie);
IEditor *ie = e->editor();
EditorManager::activateEditor(ie);
return ie;
}
@@ -1425,7 +1428,7 @@ void ClearCasePlugin::setSettings(const ClearCaseSettings &s)
{
if (s != m_settings) {
m_settings = s;
m_settings.toSettings(Core::ICore::settings());
m_settings.toSettings(ICore::settings());
clearCaseControl()->emitConfigurationChanged();
}
}
@@ -1467,7 +1470,7 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
if (m_viewData.isUcm && !vcsSetActivity(topLevel, title, coDialog.activity()))
return false;
Core::FileChangeBlocker fcb(absPath);
FileChangeBlocker fcb(absPath);
QStringList args(QLatin1String("checkout"));
QString comment = coDialog.comment();
if (comment.isEmpty())
@@ -1555,7 +1558,7 @@ bool ClearCasePlugin::vcsCheckIn(const QString &messageFile, const QStringList &
if (files.isEmpty())
return true;
const QString title = QString::fromLatin1("Checkin %1").arg(files.join(QLatin1String("; ")));
typedef QSharedPointer<Core::FileChangeBlocker> FCBPointer;
typedef QSharedPointer<FileChangeBlocker> FCBPointer;
replaceActivity &= (activity != QLatin1String(Constants::KEEP_ACTIVITY));
if (replaceActivity && !vcsSetActivity(m_checkInView, title, activity))
return false;
@@ -1576,7 +1579,7 @@ bool ClearCasePlugin::vcsCheckIn(const QString &messageFile, const QStringList &
args << files;
QList<FCBPointer> blockers;
foreach (const QString &fileName, files) {
FCBPointer fcb(new Core::FileChangeBlocker(QFileInfo(m_checkInView, fileName).canonicalFilePath()));
FCBPointer fcb(new FileChangeBlocker(QFileInfo(m_checkInView, fileName).canonicalFilePath()));
blockers.append(fcb);
}
const ClearCaseResponse response =
@@ -1880,22 +1883,22 @@ void ClearCasePlugin::updateStreamAndView()
m_updateViewAction->setParameter(m_viewData.isDynamic ? QString() : m_viewData.name);
}
void ClearCasePlugin::projectChanged(ProjectExplorer::Project *project)
void ClearCasePlugin::projectChanged(Project *project)
{
if (m_viewData.name == ccGetView(m_topLevel).name) // New project on same view as old project
return;
m_viewData = ViewData();
m_stream.clear();
m_intStream.clear();
disconnect(Core::ICore::mainWindow(), SIGNAL(windowActivated()), this, SLOT(syncSlot()));
Core::ICore::progressManager()->cancelTasks(QLatin1String(ClearCase::Constants::TASK_INDEX));
disconnect(ICore::mainWindow(), SIGNAL(windowActivated()), this, SLOT(syncSlot()));
ProgressManager::cancelTasks(QLatin1String(ClearCase::Constants::TASK_INDEX));
if (project) {
QString projDir = project->projectDirectory();
QString topLevel = findTopLevel(projDir);
m_topLevel = topLevel;
if (topLevel.isEmpty())
return;
connect(Core::ICore::mainWindow(), SIGNAL(windowActivated()), this, SLOT(syncSlot()));
connect(ICore::mainWindow(), SIGNAL(windowActivated()), this, SLOT(syncSlot()));
updateStreamAndView();
if (m_viewData.name.isEmpty())
return;
@@ -1914,16 +1917,16 @@ void ClearCasePlugin::tasksFinished(const QString &type)
void ClearCasePlugin::updateIndex()
{
QTC_ASSERT(currentState().hasTopLevel(), return);
Core::ICore::progressManager()->cancelTasks(QLatin1String(ClearCase::Constants::TASK_INDEX));
ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::currentProject();
ProgressManager::cancelTasks(QLatin1String(ClearCase::Constants::TASK_INDEX));
Project *project = ProjectExplorerPlugin::currentProject();
if (!project)
return;
m_checkInAllAction->setEnabled(false);
m_statusMap->clear();
QFuture<void> result = QtConcurrent::run(&sync,
project->files(ProjectExplorer::Project::ExcludeGeneratedFiles));
project->files(Project::ExcludeGeneratedFiles));
if (!m_settings.disableIndexer)
Core::ICore::progressManager()->addTask(result, tr("CC Indexing"),
ProgressManager::addTask(result, tr("CC Indexing"),
QLatin1String(ClearCase::Constants::TASK_INDEX));
}
@@ -2066,8 +2069,8 @@ void ClearCasePlugin::syncSlot()
void ClearCasePlugin::closing()
{
// prevent syncSlot from being called on shutdown
Core::ICore::progressManager()->cancelTasks(QLatin1String(ClearCase::Constants::TASK_INDEX));
disconnect(Core::ICore::mainWindow(), SIGNAL(windowActivated()), this, SLOT(syncSlot()));
ProgressManager::cancelTasks(QLatin1String(ClearCase::Constants::TASK_INDEX));
disconnect(ICore::mainWindow(), SIGNAL(windowActivated()), this, SLOT(syncSlot()));
}
void ClearCasePlugin::sync(QFutureInterface<void> &future, QStringList files)

View File

@@ -356,11 +356,6 @@ bool ICore::showWarningWithOptions(const QString &title, const QString &text,
settingsId, parent);
}
ProgressManager *ICore::progressManager()
{
return m_mainwindow->progressManager();
}
VcsManager *ICore::vcsManager()
{
return m_mainwindow->vcsManager();

View File

@@ -85,7 +85,6 @@ public:
Id settingsId = Id(),
QWidget *parent = 0);
static ProgressManager *progressManager();
static VcsManager *vcsManager();
static MimeDatabase *mimeDatabase();

View File

@@ -348,7 +348,7 @@ void ProgressManagerPrivate::init()
initInternal();
}
void ProgressManagerPrivate::cancelTasks(const QString &type)
void ProgressManagerPrivate::doCancelTasks(const QString &type)
{
bool found = false;
QMap<QFutureWatcher<void> *, QString>::iterator task = m_runningTasks.begin();
@@ -412,7 +412,7 @@ void ProgressManagerPrivate::cancelAllRunningTasks()
updateSummaryProgressBar();
}
FutureProgress *ProgressManagerPrivate::addTask(const QFuture<void> &future, const QString &title,
FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags)
{
// watch
@@ -717,3 +717,36 @@ void ToggleButton::paintEvent(QPaintEvent *event)
arrowOpt.rect = QRect(rect().center().x() - 3, rect().center().y() - 6, 9, 9);
s->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, &p, this);
}
static ProgressManager *m_instance = 0;
ProgressManager::ProgressManager(QObject *parent)
{
m_instance = this;
}
ProgressManager::~ProgressManager()
{
m_instance = 0;
}
QObject *ProgressManager::instance()
{
return m_instance;
}
FutureProgress *ProgressManager::addTask(const QFuture<void> &future, const QString &title, const QString &type, ProgressFlags flags)
{
return m_instance->doAddTask(future, title, type, flags);
}
void ProgressManager::setApplicationLabel(const QString &text)
{
m_instance->doSetApplicationLabel(text);
}
void ProgressManager::cancelTasks(const QString &type)
{
m_instance->doCancelTasks(type);
}

View File

@@ -50,20 +50,28 @@ public:
};
Q_DECLARE_FLAGS(ProgressFlags, ProgressFlag)
virtual FutureProgress *addTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags = 0) = 0;
virtual void setApplicationLabel(const QString &text) = 0;
static QObject *instance();
static FutureProgress *addTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags = 0);
static void setApplicationLabel(const QString &text);
public slots:
virtual void cancelTasks(const QString &type) = 0;
static void cancelTasks(const QString &type);
signals:
void taskStarted(const QString &type);
void allTasksFinished(const QString &type);
protected:
virtual void doCancelTasks(const QString &type) = 0;
virtual FutureProgress *doAddTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags = 0) = 0;
virtual void doSetApplicationLabel(const QString &text) = 0;
private:
ProgressManager(QObject *parent = 0) : QObject(parent) {}
virtual ~ProgressManager() {}
ProgressManager(QObject *parent = 0);
~ProgressManager();
friend class Core::Internal::ProgressManagerPrivate;
};

View File

@@ -125,7 +125,7 @@ static ApplicationProgressView *sharedProgressView = nil;
@end
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString &text)
{
NSString *cocoaString = [[NSString alloc] initWithUTF8String:text.toUtf8().constData()];
[[NSApp dockTile] setBadgeLabel:cocoaString];

View File

@@ -58,14 +58,14 @@ public:
void init();
void cleanup();
FutureProgress *addTask(const QFuture<void> &future, const QString &title, const QString &type,
FutureProgress *doAddTask(const QFuture<void> &future, const QString &title, const QString &type,
ProgressFlags flags);
void setApplicationLabel(const QString &text);
void doSetApplicationLabel(const QString &text);
ProgressView *progressView();
public slots:
void cancelTasks(const QString &type);
void doCancelTasks(const QString &type);
protected:
bool eventFilter(QObject *obj, QEvent *event);

View File

@@ -174,7 +174,7 @@ void Core::Internal::ProgressManagerPrivate::cleanup()
{
}
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString &text)
{
Q_UNUSED(text)
}

View File

@@ -37,7 +37,7 @@ void Core::Internal::ProgressManagerPrivate::cleanup()
{
}
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString &text)
{
Q_UNUSED(text)
}

View File

@@ -57,6 +57,7 @@
#include <QCoreApplication>
#include <QStringList>
using namespace Core;
using namespace CppEditor;
using namespace CppEditor::Internal;
@@ -77,8 +78,8 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
FileIconProvider *iconProvider = FileIconProvider::instance();
MimeDatabase *mimeDatabase = ICore::mimeDatabase();
iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_cpp.png")),
mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)));
iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_c.png")),
@@ -88,7 +89,7 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
}
}
Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
IEditor *CppEditorFactory::createEditor(QWidget *parent)
{
CPPEditorWidget *editor = new CPPEditorWidget(parent);
editor->setRevisionsVisible(true);
@@ -153,7 +154,7 @@ CppQuickFixAssistProvider *CppEditorPlugin::quickFixProvider() const
bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
if (!ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
return false;
addAutoReleasedObject(new CppEditorFactory(this));
@@ -167,19 +168,19 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
addAutoReleasedObject(m_quickFixProvider);
CppEditor::Internal::registerQuickFixes(this);
QObject *core = Core::ICore::instance();
CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
QObject *core = ICore::instance();
CppFileWizard::BaseFileWizardParameters wizardParameters(IWizard::FileWizard);
wizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
wizardParameters.setDisplayCategory(QCoreApplication::translate(Constants::WIZARD_CATEGORY,
Constants::WIZARD_TR_CATEGORY));
wizardParameters.setDisplayName(tr("C++ Class"));
wizardParameters.setId(QLatin1String("A.Class"));
wizardParameters.setKind(Core::IWizard::ClassWizard);
wizardParameters.setKind(IWizard::ClassWizard);
wizardParameters.setDescription(tr("Creates a C++ header and a source file for a new class that you can add to a C++ project."));
addAutoReleasedObject(new CppClassWizard(wizardParameters, core));
wizardParameters.setKind(Core::IWizard::FileWizard);
wizardParameters.setKind(IWizard::FileWizard);
wizardParameters.setDescription(tr("Creates a C++ source file that you can add to a C++ project."));
wizardParameters.setDisplayName(tr("C++ Source File"));
wizardParameters.setId(QLatin1String("B.Source"));
@@ -190,22 +191,22 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
wizardParameters.setId(QLatin1String("C.Header"));
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
Core::Context context(CppEditor::Constants::C_CPPEDITOR);
Context context(CppEditor::Constants::C_CPPEDITOR);
Core::ActionContainer *contextMenu= Core::ActionManager::createMenu(CppEditor::Constants::M_CONTEXT);
ActionContainer *contextMenu = ActionManager::createMenu(CppEditor::Constants::M_CONTEXT);
Core::Command *cmd;
Core::ActionContainer *cppToolsMenu = Core::ActionManager::actionContainer(Core::Id(CppTools::Constants::M_TOOLS_CPP));
Command *cmd;
ActionContainer *cppToolsMenu = ActionManager::actionContainer(CppTools::Constants::M_TOOLS_CPP);
cmd = Core::ActionManager::command(Core::Id(CppTools::Constants::SWITCH_HEADER_SOURCE));
cmd = ActionManager::command(CppTools::Constants::SWITCH_HEADER_SOURCE);
contextMenu->addAction(cmd);
cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR);
cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR);
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Method Declaration/Definition"), this);
cmd = Core::ActionManager::registerAction(switchDeclarationDefinition,
cmd = ActionManager::registerAction(switchDeclarationDefinition,
Constants::SWITCH_DECLARATION_DEFINITION, context, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2")));
connect(switchDeclarationDefinition, SIGNAL(triggered()),
@@ -213,12 +214,12 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT);
cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT);
cppToolsMenu->addAction(cmd);
QAction *openDeclarationDefinitionInNextSplit =
new QAction(tr("Open Method Declaration/Definition in Next Split"), this);
cmd = Core::ActionManager::registerAction(openDeclarationDefinitionInNextSplit,
cmd = ActionManager::registerAction(openDeclarationDefinitionInNextSplit,
Constants::OPEN_DECLARATION_DEFINITION_IN_NEXT_SPLIT, context, true);
cmd->setDefaultKeySequence(QKeySequence(Utils::HostOsInfo::isMacHost()
? tr("Meta+E, Shift+F2")
@@ -228,28 +229,28 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
cppToolsMenu->addAction(cmd);
m_findUsagesAction = new QAction(tr("Find Usages"), this);
cmd = Core::ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
cmd = ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this);
cmd = Core::ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context);
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+T") : tr("Ctrl+Shift+T")));
cmd = ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+T") : tr("Ctrl+Shift+T")));
connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy()));
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
// Refactoring sub-menu
Core::Context globalContext(Core::Constants::C_GLOBAL);
Core::Command *sep = contextMenu->addSeparator(globalContext);
Context globalContext(Core::Constants::C_GLOBAL);
Command *sep = contextMenu->addSeparator(globalContext);
sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT));
contextMenu->addSeparator(globalContext);
m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"),
this);
cmd = Core::ActionManager::registerAction(m_renameSymbolUnderCursorAction,
cmd = ActionManager::registerAction(m_renameSymbolUnderCursorAction,
Constants::RENAME_SYMBOL_UNDER_CURSOR,
context);
cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R")));
@@ -260,7 +261,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
// Update context in global context
cppToolsMenu->addSeparator(globalContext);
m_updateCodeModelAction = new QAction(tr("Update Code Model"), this);
cmd = Core::ActionManager::registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext);
cmd = ActionManager::registerAction(m_updateCodeModelAction, Constants::UPDATE_CODEMODEL, globalContext);
CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance();
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
cppToolsMenu->addAction(cmd);
@@ -275,18 +276,19 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
contextMenu->addSeparator(context);
cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd);
cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
cmd = ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd);
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),
connect(ProgressManager::instance(), SIGNAL(taskStarted(QString)),
this, SLOT(onTaskStarted(QString)));
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
this, SLOT(onAllTasksFinished(QString)));
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
SLOT(currentEditorChanged(Core::IEditor*)));
readSettings();
return true;
@@ -294,12 +296,12 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
void CppEditorPlugin::readSettings()
{
m_sortedOutline = Core::ICore::settings()->value(QLatin1String("CppTools/SortedMethodOverview"), false).toBool();
m_sortedOutline = ICore::settings()->value(QLatin1String("CppTools/SortedMethodOverview"), false).toBool();
}
void CppEditorPlugin::writeSettings()
{
Core::ICore::settings()->setValue(QLatin1String("CppTools/SortedMethodOverview"), m_sortedOutline);
ICore::settings()->setValue(QLatin1String("CppTools/SortedMethodOverview"), m_sortedOutline);
}
void CppEditorPlugin::extensionsInitialized()
@@ -314,28 +316,28 @@ ExtensionSystem::IPlugin::ShutdownFlag CppEditorPlugin::aboutToShutdown()
void CppEditorPlugin::switchDeclarationDefinition()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->switchDeclarationDefinition(/*inNextSplit*/ false);
}
void CppEditorPlugin::openDeclarationDefinitionInNextSplit()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->switchDeclarationDefinition(/*inNextSplit*/ true);
}
void CppEditorPlugin::renameSymbolUnderCursor()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->renameSymbolUnderCursor();
}
void CppEditorPlugin::findUsages()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->findUsages();
}
@@ -360,7 +362,7 @@ void CppEditorPlugin::onAllTasksFinished(const QString &type)
}
}
void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor)
void CppEditorPlugin::currentEditorChanged(IEditor *editor)
{
if (!editor)
return;
@@ -371,10 +373,10 @@ void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor)
void CppEditorPlugin::openTypeHierarchy()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor) {
Core::NavigationWidget *navigation = Core::NavigationWidget::instance();
navigation->activateSubWidget(Core::Id(Constants::TYPE_HIERARCHY_ID));
NavigationWidget *navigation = NavigationWidget::instance();
navigation->activateSubWidget(Constants::TYPE_HIERARCHY_ID);
emit typeHierarchyRequested();
}
}

View File

@@ -192,8 +192,7 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sour
m_synchronizer.addFuture(result);
if (mode == CppModelManagerInterface::ForcedProgressNotification || sourceFiles.count() > 1) {
Core::ICore::progressManager()->addTask(result,
QCoreApplication::translate("CppTools::Internal::BuiltinIndexingSupport", "Parsing"),
Core::ProgressManager::addTask(result, QCoreApplication::translate("CppTools::Internal::BuiltinIndexingSupport", "Parsing"),
QLatin1String(CppTools::Constants::TASK_INDEX));
}

View File

@@ -48,6 +48,7 @@
#include <functional>
using namespace Core;
using namespace CppTools::Internal;
using namespace CppTools;
using namespace CPlusPlus;
@@ -61,7 +62,7 @@ static QString getSource(const QString &fileName,
QString fileContents;
Utils::TextFileFormat format;
QString error;
QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
QTextCodec *defaultCodec = EditorManager::defaultTextCodec();
Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
fileName, defaultCodec, &fileContents, &format, &error);
if (result != Utils::TextFileFormat::ReadSuccess)
@@ -272,15 +273,14 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search)
connect(search, SIGNAL(activated(Find::SearchResultItem)),
this, SLOT(openEditor(Find::SearchResultItem)));
Find::SearchResultWindow::instance()->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus);
Find::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
const CppModelManagerInterface::WorkingCopy workingCopy = _modelManager->workingCopy();
QFuture<Usage> result;
result = QtConcurrent::run(&find_helper, workingCopy,
parameters.context, this, parameters.symbol);
createWatcher(result, search);
Core::ProgressManager *progressManager = Core::ICore::progressManager();
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"),
FutureProgress *progress = ProgressManager::addTask(result, tr("Searching"),
QLatin1String(CppTools::Constants::TASK_SEARCH));
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
@@ -512,10 +512,10 @@ void CppFindReferences::setPaused(bool paused)
void CppFindReferences::openEditor(const Find::SearchResultItem &item)
{
if (item.path.size() > 0) {
Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
item.lineNumber, item.textMarkPos);
} else {
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
}
}
@@ -640,7 +640,7 @@ void CppFindReferences::findMacroUses(const Macro &macro, const QString &replace
connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)),
SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)));
Find::SearchResultWindow::instance()->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus);
Find::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
connect(search, SIGNAL(activated(Find::SearchResultItem)),
this, SLOT(openEditor(Find::SearchResultItem)));
@@ -663,8 +663,7 @@ void CppFindReferences::findMacroUses(const Macro &macro, const QString &replace
result = QtConcurrent::run(&findMacroUses_helper, workingCopy, snapshot, this, macro);
createWatcher(result, search);
Core::ProgressManager *progressManager = Core::ICore::progressManager();
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"),
FutureProgress *progress = ProgressManager::addTask(result, tr("Searching"),
QLatin1String(CppTools::Constants::TASK_SEARCH));
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
}

View File

@@ -828,8 +828,8 @@ void CppModelManager::onAboutToLoadSession()
void CppModelManager::onAboutToUnloadSession()
{
if (Core::ProgressManager *pm = Core::ICore::progressManager())
pm->cancelTasks(QLatin1String(CppTools::Constants::TASK_INDEX));
if (Core::ProgressManager::instance())
Core::ProgressManager::cancelTasks(QLatin1String(CppTools::Constants::TASK_INDEX));
do {
QMutexLocker locker(&m_projectMutex);
m_projectToProjectsInfo.clear();

View File

@@ -45,14 +45,14 @@
#include <QLabel>
#include <QButtonGroup>
using namespace CppTools;
using namespace CppTools::Internal;
using namespace Core;
namespace {
const char * const SETTINGS_GROUP = "CppSymbols";
const char * const SETTINGS_SYMBOLTYPES = "SymbolsToSearchFor";
const char * const SETTINGS_SEARCHSCOPE = "SearchScope";
} // anonymous namespace
namespace CppTools {
namespace Internal {
const char SETTINGS_GROUP[] = "CppSymbols";
const char SETTINGS_SYMBOLTYPES[] = "SymbolsToSearchFor";
const char SETTINGS_SEARCHSCOPE[] = "SearchScope";
SymbolsFindFilter::SymbolsFindFilter(CppModelManager *manager)
: m_manager(manager),
@@ -61,9 +61,9 @@ SymbolsFindFilter::SymbolsFindFilter(CppModelManager *manager)
m_scope(SymbolSearcher::SearchProjectsOnly)
{
// for disabling while parser is running
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),
connect(ProgressManager::instance(), SIGNAL(taskStarted(QString)),
this, SLOT(onTaskStarted(QString)));
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
this, SLOT(onAllTasksFinished(QString)));
}
@@ -117,7 +117,7 @@ void SymbolsFindFilter::findAll(const QString &txt, Find::FindFlags findFlags)
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain()));
connect(this, SIGNAL(enabledChanged(bool)), search, SLOT(setSearchAgainEnabled(bool)));
window->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus);
window->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
SymbolSearcher::Parameters parameters;
parameters.text = txt;
@@ -149,8 +149,7 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search)
connect(watcher, SIGNAL(finished()),
symbolSearcher, SLOT(deleteLater()));
watcher->setFuture(QtConcurrent::run(&SymbolSearcher::runSearch, symbolSearcher));
Core::FutureProgress *progress = Core::ICore::progressManager()->addTask(watcher->future(),
tr("Searching"),
FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Searching"),
QLatin1String(Find::Constants::TASK_SEARCH));
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
}
@@ -187,9 +186,7 @@ void SymbolsFindFilter::openEditor(const Find::SearchResultItem &item)
if (!item.userData.canConvert<ModelItemInfo>())
return;
ModelItemInfo info = item.userData.value<ModelItemInfo>();
Core::EditorManager::openEditorAt(info.fileName,
info.line,
info.column);
EditorManager::openEditorAt(info.fileName, info.line, info.column);
}
QWidget *SymbolsFindFilter::createConfigWidget()
@@ -346,3 +343,6 @@ void SymbolsFindFilterConfigWidget::setState() const
else
m_filter->setSearchScope(SymbolSearcher::SearchGlobal);
}
} // namespace Internal
} // namespace CppTools

View File

@@ -47,7 +47,6 @@
#include "threadshandler.h"
#include "watchhandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/progressmanager/progressmanager.h>
@@ -489,10 +488,9 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
QTC_ASSERT(!d->m_runControl, notifyEngineSetupFailed(); return);
d->m_progress.setProgressRange(0, 1000);
Core::FutureProgress *fp = Core::ICore::progressManager()
->addTask(d->m_progress.future(),
FutureProgress *fp = ProgressManager::addTask(d->m_progress.future(),
tr("Launching"), _("Debugger.Launcher"));
fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish);
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
d->m_progress.reportStarted();
d->m_runControl = runControl;
@@ -539,7 +537,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
const QString file = loc.fileName();
const int line = loc.lineNumber();
bool newEditor = false;
IEditor *editor = EditorManager::openEditor(file, Core::Id(),
IEditor *editor = EditorManager::openEditor(file, Id(),
EditorManager::IgnoreNavigationHistory, &newEditor);
QTC_ASSERT(editor, return); // Unreadable file?
editor->gotoLine(line, 0);
@@ -1408,7 +1406,7 @@ void DebuggerEngine::reloadDebuggingHelpers()
{
}
void DebuggerEngine::addOptionPages(QList<Core::IOptionsPage*> *) const
void DebuggerEngine::addOptionPages(QList<IOptionsPage*> *) const
{
}

View File

@@ -32,7 +32,6 @@
#include "../gitplugin.h"
#include "../gitclient.h"
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/progressmanager/futureprogress.h>
#include <vcsbase/vcsbaseoutputwindow.h>
@@ -323,8 +322,7 @@ QueryContext::~QueryContext()
void QueryContext::start()
{
Core::ProgressManager *pm = Core::ICore::instance()->progressManager();
Core::FutureProgress *fp = pm->addTask(m_progress.future(), tr("Gerrit"),
Core::FutureProgress *fp = Core::ProgressManager::addTask(m_progress.future(), tr("Gerrit"),
QLatin1String("gerrit-query"));
fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish);
m_progress.reportStarted();

View File

@@ -67,6 +67,8 @@
#include <QDir>
#include <QMap>
using namespace Core;
enum { debug = 0 };
namespace Gerrit {
@@ -165,10 +167,9 @@ FetchContext::~FetchContext()
void FetchContext::start()
{
m_progress.setProgressRange(0, 2);
Core::ProgressManager *pm = Core::ICore::instance()->progressManager();
Core::FutureProgress *fp = pm->addTask(m_progress.future(), tr("Gerrit Fetch"),
FutureProgress *fp = ProgressManager::addTask(m_progress.future(), tr("Gerrit Fetch"),
QLatin1String("gerrit-fetch"));
fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish);
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
m_progress.reportStarted();
// Order: initialize future before starting the process in case error handling is invoked.
const QStringList args = m_change->gitFetchArguments(m_parameters);
@@ -247,8 +248,8 @@ void FetchContext::show()
void FetchContext::cherryPick()
{
// Point user to errors.
VcsBase::VcsBaseOutputWindow::instance()->popup(Core::IOutputPane::ModeSwitch
| Core::IOutputPane::WithFocus);
VcsBase::VcsBaseOutputWindow::instance()->popup(IOutputPane::ModeSwitch
| IOutputPane::WithFocus);
Git::Internal::GitPlugin::instance()->gitClient()->synchronousCherryPick(
m_repository, QLatin1String("FETCH_HEAD"));
}
@@ -270,23 +271,23 @@ GerritPlugin::~GerritPlugin()
{
}
bool GerritPlugin::initialize(Core::ActionContainer *ac)
bool GerritPlugin::initialize(ActionContainer *ac)
{
m_parameters->fromSettings(Core::ICore::instance()->settings());
m_parameters->fromSettings(ICore::instance()->settings());
QAction *openViewAction = new QAction(tr("Gerrit..."), this);
m_gerritCommand =
Core::ActionManager::registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW,
Core::Context(Core::Constants::C_GLOBAL));
ActionManager::registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW,
Context(Core::Constants::C_GLOBAL));
connect(openViewAction, SIGNAL(triggered()), this, SLOT(openView()));
ac->addAction(m_gerritCommand);
QAction *pushAction = new QAction(tr("Push to Gerrit..."), this);
Core::Command *pushCommand =
Core::ActionManager::registerAction(pushAction, Constants::GERRIT_PUSH,
Core::Context(Core::Constants::C_GLOBAL));
Command *pushCommand =
ActionManager::registerAction(pushAction, Constants::GERRIT_PUSH,
Context(Core::Constants::C_GLOBAL));
connect(pushAction, SIGNAL(triggered()), this, SLOT(push()));
ac->addAction(pushCommand);
@@ -312,13 +313,13 @@ void GerritPlugin::push()
const QString topLevel = Git::Internal::GitPlugin::instance()->currentState().topLevel();
// QScopedPointer is required to delete the dialog when leaving the function
GerritPushDialog dialog(topLevel, m_reviewers, Core::ICore::mainWindow());
GerritPushDialog dialog(topLevel, m_reviewers, ICore::mainWindow());
if (!dialog.localChangesFound())
return;
if (!dialog.valid()) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Initialization Failed"),
QMessageBox::warning(ICore::mainWindow(), tr("Initialization Failed"),
tr("Failed to initialize dialog. Aborting."));
return;
}
@@ -362,11 +363,11 @@ void GerritPlugin::openView()
while (!m_parameters->isValid()) {
QMessageBox::warning(0, tr("Error"),
tr("Invalid Gerrit configuration. Host, user and ssh binary are mandatory."));
const Core::Id group = VcsBase::Constants::VCS_SETTINGS_CATEGORY;
if (!Core::ICore::instance()->showOptionsDialog(group, Core::Id("Gerrit")))
const Id group = VcsBase::Constants::VCS_SETTINGS_CATEGORY;
if (!ICore::instance()->showOptionsDialog(group, "Gerrit"))
return;
}
GerritDialog *gd = new GerritDialog(m_parameters, Core::ICore::mainWindow());
GerritDialog *gd = new GerritDialog(m_parameters, ICore::mainWindow());
gd->setModal(false);
connect(gd, SIGNAL(fetchDisplay(QSharedPointer<Gerrit::Internal::GerritChange>)),
this, SLOT(fetchDisplay(QSharedPointer<Gerrit::Internal::GerritChange>)));
@@ -467,7 +468,7 @@ void GerritPlugin::fetch(const QSharedPointer<Gerrit::Internal::GerritChange> &c
if (!verifiedRepository) {
QMessageBox::StandardButton answer = QMessageBox::question(
Core::ICore::mainWindow(), tr("Remote Not Verified"),
ICore::mainWindow(), tr("Remote Not Verified"),
tr("Change host %1\nand project %2\n\nwere not verified among remotes"
" in %3. Select different folder?")
.arg(m_parameters->host,
@@ -511,7 +512,7 @@ void GerritPlugin::fetch(const QSharedPointer<Gerrit::Internal::GerritChange> &c
// Try to find a matching repository for a project by asking the VcsManager.
QString GerritPlugin::findLocalRepository(QString project, const QString &branch) const
{
const Core::VcsManager *vcsManager = Core::ICore::instance()->vcsManager();
const Core::VcsManager *vcsManager = ICore::instance()->vcsManager();
const QStringList gitRepositories = vcsManager->repositories(Git::Internal::GitPlugin::instance()->gitVersionControl());
// Determine key (file name) to look for (qt/qtbase->'qtbase').
const int slashPos = project.lastIndexOf(QLatin1Char('/'));
@@ -546,7 +547,7 @@ QString GerritPlugin::findLocalRepository(QString project, const QString &branch
} // for repositories
// No match, do we have a projects folder?
if (Core::DocumentManager::useProjectsDirectory())
return Core::DocumentManager::projectsDirectory();
return DocumentManager::projectsDirectory();
return QDir::currentPath();
}

View File

@@ -194,7 +194,7 @@ void SearchWidget::indexingStarted()
{
Q_ASSERT(!m_progress);
m_progress = new QFutureInterface<void>();
Core::ICore::progressManager() ->addTask(m_progress->future(),
Core::ProgressManager::addTask(m_progress->future(),
tr("Indexing"), QLatin1String("Help.Indexer"));
m_progress->setProgressRange(0, 2);
m_progress->setProgressValueAndText(1, tr("Indexing Documentation..."));

View File

@@ -62,6 +62,7 @@
\internal
*/
using namespace Core;
using namespace Locator;
using namespace Locator::Internal;
@@ -103,21 +104,21 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
m_locatorWidget = new LocatorWidget(this);
m_locatorWidget->setEnabled(false);
Core::StatusBarWidget *view = new Core::StatusBarWidget;
StatusBarWidget *view = new StatusBarWidget;
view->setWidget(m_locatorWidget);
view->setContext(Core::Context("LocatorWidget"));
view->setPosition(Core::StatusBarWidget::First);
view->setContext(Context("LocatorWidget"));
view->setPosition(StatusBarWidget::First);
addAutoReleasedObject(view);
QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this);
Core::Command *cmd = Core::ActionManager::registerAction(action, "QtCreator.Locate",
Core::Context(Core::Constants::C_GLOBAL));
Command *cmd = ActionManager::registerAction(action, "QtCreator.Locate",
Context(Core::Constants::C_GLOBAL));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K")));
connect(action, SIGNAL(triggered()), this, SLOT(openLocator()));
connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText()));
updatePlaceholderText(cmd);
Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
mtools->addAction(cmd);
addObject(new LocatorManager(m_locatorWidget));
@@ -136,10 +137,10 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
return true;
}
void LocatorPlugin::updatePlaceholderText(Core::Command *command)
void LocatorPlugin::updatePlaceholderText(Command *command)
{
if (!command)
command = qobject_cast<Core::Command *>(sender());
command = qobject_cast<Command *>(sender());
QTC_ASSERT(command, return);
if (command->keySequence().isEmpty())
m_locatorWidget->setPlaceholderText(tr("Type to locate"));
@@ -168,13 +169,13 @@ bool LocatorPlugin::delayedInitialize()
void LocatorPlugin::loadSettings()
{
QSettings *qs = Core::ICore::settings();
QSettings *qs = ICore::settings();
// Backwards compatibility to old settings location
if (qs->contains(QLatin1String("QuickOpen/FiltersFilter"))) {
loadSettingsHelper(qs);
} else {
Core::SettingsDatabase *settings = Core::ICore::settingsDatabase();
SettingsDatabase *settings = ICore::settingsDatabase();
loadSettingsHelper(settings);
}
@@ -190,7 +191,7 @@ void LocatorPlugin::loadSettings()
void LocatorPlugin::saveSettings()
{
if (m_settingsInitialized) {
Core::SettingsDatabase *s = Core::ICore::settingsDatabase();
SettingsDatabase *s = ICore::settingsDatabase();
s->beginGroup(QLatin1String("QuickOpen"));
s->remove(QString());
s->setValue(QLatin1String("RefreshInterval"), refreshInterval());
@@ -259,9 +260,8 @@ void LocatorPlugin::refresh(QList<ILocatorFilter *> filters)
if (filters.isEmpty())
filters = m_filters;
QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters);
Core::FutureProgress *progress = Core::ICore::progressManager()
->addTask(task, tr("Indexing"), QLatin1String(Locator::Constants::TASK_INDEX));
connect(progress, SIGNAL(finished()), this, SLOT(saveSettings()));
ProgressManager::addTask(task, tr("Indexing"), QLatin1String(Locator::Constants::TASK_INDEX));
connect(ProgressManager::instance(), SIGNAL(finished()), this, SLOT(saveSettings()));
}
Q_EXPORT_PLUGIN(LocatorPlugin)

View File

@@ -57,13 +57,17 @@
#include <QApplication>
static inline QString msgProgress(int progress, int total)
{
return ProjectExplorer::BuildManager::tr("Finished %1 of %n steps", 0, total).arg(progress);
}
using namespace Core;
namespace ProjectExplorer {
struct BuildManagerPrivate {
static QString msgProgress(int progress, int total)
{
return BuildManager::tr("Finished %1 of %n steps", 0, total).arg(progress);
}
struct BuildManagerPrivate
{
BuildManagerPrivate();
Internal::CompileOutputWindow *m_outputWindow;
@@ -92,7 +96,7 @@ struct BuildManagerPrivate {
int m_maxProgress;
QFutureInterface<void> *m_progressFutureInterface;
QFutureWatcher<void> m_progressWatcher;
QPointer<Core::FutureProgress> m_futureProgress;
QPointer<FutureProgress> m_futureProgress;
QElapsedTimer m_elapsed;
};
@@ -207,12 +211,8 @@ void BuildManager::cancel()
void BuildManager::updateTaskCount()
{
Core::ProgressManager *progressManager = Core::ICore::progressManager();
const int errors = getErrorTaskCount();
if (errors > 0)
progressManager->setApplicationLabel(QString::number(errors));
else
progressManager->setApplicationLabel(QString());
ProgressManager::setApplicationLabel(errors > 0 ? QString::number(errors) : QString());
emit tasksChanged();
}
@@ -224,7 +224,7 @@ void BuildManager::finish()
time.remove(0, 2); // Don't display zero hours
addToOutputWindow(tr("Elapsed time: %1.") .arg(time), BuildStep::MessageOutput);
QApplication::alert(Core::ICore::mainWindow(), 3000);
QApplication::alert(ICore::mainWindow(), 3000);
}
void BuildManager::emitCancelMessage()
@@ -260,17 +260,17 @@ void BuildManager::clearBuildQueue()
void BuildManager::toggleOutputWindow()
{
d->m_outputWindow->toggle(Core::IOutputPane::ModeSwitch);
d->m_outputWindow->toggle(IOutputPane::ModeSwitch);
}
void BuildManager::showTaskWindow()
{
d->m_taskWindow->popup(Core::IOutputPane::NoModeSwitch);
d->m_taskWindow->popup(IOutputPane::NoModeSwitch);
}
void BuildManager::toggleTaskWindow()
{
d->m_taskWindow->toggle(Core::IOutputPane::ModeSwitch);
d->m_taskWindow->toggle(IOutputPane::ModeSwitch);
}
bool BuildManager::tasksAvailable() const
@@ -291,7 +291,6 @@ void BuildManager::startBuildQueue(const QStringList &preambleMessage)
if (!d->m_running) {
d->m_elapsed.start();
// Progress Reporting
Core::ProgressManager *progressManager = Core::ICore::progressManager();
d->m_progressFutureInterface = new QFutureInterface<void>;
d->m_progressWatcher.setFuture(d->m_progressFutureInterface->future());
d->m_outputWindow->clearContents();
@@ -300,11 +299,11 @@ void BuildManager::startBuildQueue(const QStringList &preambleMessage)
TaskHub::clearTasks(Constants::TASK_CATEGORY_COMPILE);
TaskHub::clearTasks(Constants::TASK_CATEGORY_BUILDSYSTEM);
TaskHub::clearTasks(Constants::TASK_CATEGORY_DEPLOYMENT);
progressManager->setApplicationLabel(QString());
d->m_futureProgress = progressManager->addTask(d->m_progressFutureInterface->future(),
ProgressManager::setApplicationLabel(QString());
d->m_futureProgress = ProgressManager::addTask(d->m_progressFutureInterface->future(),
QString(),
QLatin1String(Constants::TASK_BUILD),
Core::ProgressManager::KeepOnFinish | Core::ProgressManager::ShowInApplicationIcon);
ProgressManager::KeepOnFinish | ProgressManager::ShowInApplicationIcon);
connect(d->m_futureProgress.data(), SIGNAL(clicked()), this, SLOT(showBuildResults()));
d->m_futureProgress.data()->setWidget(new Internal::BuildProgress(d->m_taskWindow));
d->m_futureProgress.data()->setStatusBarWidget(new Internal::BuildProgress(d->m_taskWindow,
@@ -530,12 +529,12 @@ bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &st
bool success = buildQueueAppend(steps, names);
if (!success) {
d->m_outputWindow->popup(Core::IOutputPane::NoModeSwitch);
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
return false;
}
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
d->m_outputWindow->popup(Core::IOutputPane::NoModeSwitch);
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
startBuildQueue(preambelMessage);
return true;
}
@@ -544,11 +543,11 @@ void BuildManager::appendStep(BuildStep *step, const QString &name)
{
bool success = buildQueueAppend(QList<BuildStep *>() << step, QStringList() << name);
if (!success) {
d->m_outputWindow->popup(Core::IOutputPane::NoModeSwitch);
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
return;
}
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
d->m_outputWindow->popup(Core::IOutputPane::NoModeSwitch);
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
startBuildQueue();
}

View File

@@ -856,7 +856,7 @@ bool SessionManager::loadSession(const QString &session)
if (fileName.toFileInfo().exists()) {
m_virginSession = false;
ICore::progressManager()->addTask(m_future.future(), tr("Session"),
ProgressManager::addTask(m_future.future(), tr("Session"),
QLatin1String("ProjectExplorer.SessionFile.Load"));
m_future.setProgressRange(0, 1);

View File

@@ -454,7 +454,7 @@ void QbsProject::prepareForParsing()
m_currentProgressBase = 0;
m_qbsUpdateFutureInterface = new QFutureInterface<void>();
m_qbsUpdateFutureInterface->setProgressRange(0, 0);
ICore::progressManager()->addTask(m_qbsUpdateFutureInterface->future(), tr("Evaluating"),
ProgressManager::addTask(m_qbsUpdateFutureInterface->future(), tr("Evaluating"),
QLatin1String(Constants::QBS_EVALUATE));
m_qbsUpdateFutureInterface->reportStarted();
}

View File

@@ -62,6 +62,7 @@
#include <functional>
using namespace Core;
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSEditor;
@@ -937,10 +938,9 @@ void FindReferences::displayResults(int first, int last)
this, SLOT(openEditor(Find::SearchResultItem)));
connect(m_currentSearch, SIGNAL(cancelled()), this, SLOT(cancel()));
connect(m_currentSearch, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
Find::SearchResultWindow::instance()->popup(Core::IOutputPane::Flags(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus));
Find::SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch | IOutputPane::WithFocus));
Core::ProgressManager *progressManager = Core::ICore::progressManager();
Core::FutureProgress *progress = progressManager->addTask(
FutureProgress *progress = ProgressManager::addTask(
m_watcher.future(), tr("Searching"),
QLatin1String(QmlJSEditor::Constants::TASK_SEARCH));
connect(progress, SIGNAL(clicked()), m_currentSearch, SLOT(popup()));
@@ -984,10 +984,10 @@ void FindReferences::setPaused(bool paused)
void FindReferences::openEditor(const Find::SearchResultItem &item)
{
if (item.path.size() > 0) {
Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
item.lineNumber, item.textMarkPos);
} else {
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
}
}
@@ -998,7 +998,7 @@ void FindReferences::onReplaceButtonClicked(const QString &text, const QList<Fin
// files that are opened in an editor are changed, but not saved
QStringList changedOnDisk;
QStringList changedUnsavedEditors;
Core::DocumentModel *documentModel = Core::EditorManager::documentModel();
DocumentModel *documentModel = EditorManager::documentModel();
foreach (const QString &fileName, fileNames) {
if (documentModel->documentForFilePath(fileName))
changedOnDisk += fileName;

View File

@@ -63,6 +63,7 @@
#include <QDebug>
using namespace Core;
using namespace QmlJS;
using namespace QmlJSTools;
using namespace QmlJSTools::Internal;
@@ -74,22 +75,22 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
ModelManagerInterface::ProjectInfo projectInfo(project);
ProjectExplorer::Target *activeTarget = 0;
if (project) {
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
QList<Core::MimeGlobPattern> globs;
QList<Core::MimeType> mimeTypes = db->mimeTypes();
foreach (const Core::MimeType &mimeType, mimeTypes)
MimeDatabase *db = ICore::mimeDatabase();
QList<MimeGlobPattern> globs;
QList<MimeType> mimeTypes = db->mimeTypes();
foreach (const MimeType &mimeType, mimeTypes)
if (mimeType.type() == QLatin1String(Constants::QML_MIMETYPE)
|| mimeType.subClassesOf().contains(QLatin1String(Constants::QML_MIMETYPE)))
globs << mimeType.globPatterns();
if (globs.isEmpty()) {
globs.append(Core::MimeGlobPattern(QLatin1String("*.qbs")));
globs.append(Core::MimeGlobPattern(QLatin1String("*.qml")));
globs.append(Core::MimeGlobPattern(QLatin1String("*.qmltypes")));
globs.append(Core::MimeGlobPattern(QLatin1String("*.qmlproject")));
globs.append(MimeGlobPattern(QLatin1String("*.qbs")));
globs.append(MimeGlobPattern(QLatin1String("*.qml")));
globs.append(MimeGlobPattern(QLatin1String("*.qmltypes")));
globs.append(MimeGlobPattern(QLatin1String("*.qmlproject")));
}
foreach (const QString &filePath
, project->files(ProjectExplorer::Project::ExcludeGeneratedFiles))
foreach (const Core::MimeGlobPattern &glob, globs)
foreach (const MimeGlobPattern &glob, globs)
if (glob.matches(filePath))
projectInfo.sourceFiles << filePath;
activeTarget = project->activeTarget();
@@ -187,17 +188,17 @@ QmlJS::Document::Language QmlJSTools::languageOfFile(const QString &fileName)
QStringList jsonSuffixes(QLatin1String("json"));
QStringList qbsSuffixes(QLatin1String("qbs"));
if (Core::ICore::instance()) {
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
Core::MimeType jsSourceTy = db->findByType(QLatin1String(Constants::JS_MIMETYPE));
if (ICore::instance()) {
MimeDatabase *db = ICore::mimeDatabase();
MimeType jsSourceTy = db->findByType(QLatin1String(Constants::JS_MIMETYPE));
mergeSuffixes(jsSuffixes, jsSourceTy.suffixes());
Core::MimeType qmlSourceTy = db->findByType(QLatin1String(Constants::QML_MIMETYPE));
MimeType qmlSourceTy = db->findByType(QLatin1String(Constants::QML_MIMETYPE));
mergeSuffixes(qmlSuffixes, qmlSourceTy.suffixes());
Core::MimeType qbsSourceTy = db->findByType(QLatin1String(Constants::QBS_MIMETYPE));
MimeType qbsSourceTy = db->findByType(QLatin1String(Constants::QBS_MIMETYPE));
mergeSuffixes(qbsSuffixes, qbsSourceTy.suffixes());
Core::MimeType qmlProjectSourceTy = db->findByType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
MimeType qmlProjectSourceTy = db->findByType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
mergeSuffixes(qmlProjectSuffixes, qmlProjectSourceTy.suffixes());
Core::MimeType jsonSourceTy = db->findByType(QLatin1String(Constants::JSON_MIMETYPE));
MimeType jsonSourceTy = db->findByType(QLatin1String(Constants::JSON_MIMETYPE));
mergeSuffixes(jsonSuffixes, jsonSourceTy.suffixes());
}
@@ -217,15 +218,15 @@ QmlJS::Document::Language QmlJSTools::languageOfFile(const QString &fileName)
QStringList QmlJSTools::qmlAndJsGlobPatterns()
{
QStringList pattern;
if (Core::ICore::instance()) {
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
Core::MimeType jsSourceTy = db->findByType(QLatin1String(Constants::JS_MIMETYPE));
Core::MimeType qmlSourceTy = db->findByType(QLatin1String(Constants::QML_MIMETYPE));
if (ICore::instance()) {
MimeDatabase *db = ICore::mimeDatabase();
MimeType jsSourceTy = db->findByType(QLatin1String(Constants::JS_MIMETYPE));
MimeType qmlSourceTy = db->findByType(QLatin1String(Constants::QML_MIMETYPE));
QStringList pattern;
foreach (const Core::MimeGlobPattern &glob, jsSourceTy.globPatterns())
foreach (const MimeGlobPattern &glob, jsSourceTy.globPatterns())
pattern << glob.pattern();
foreach (const Core::MimeGlobPattern &glob, qmlSourceTy.globPatterns())
foreach (const MimeGlobPattern &glob, qmlSourceTy.globPatterns())
pattern << glob.pattern();
} else {
pattern << QLatin1String("*.qml") << QLatin1String("*.js");
@@ -283,9 +284,9 @@ void ModelManager::delayedInitialization()
void ModelManager::loadQmlTypeDescriptions()
{
if (Core::ICore::instance()) {
loadQmlTypeDescriptions(Core::ICore::resourcePath());
loadQmlTypeDescriptions(Core::ICore::userResourcePath());
if (ICore::instance()) {
loadQmlTypeDescriptions(ICore::resourcePath());
loadQmlTypeDescriptions(ICore::userResourcePath());
}
}
@@ -317,18 +318,18 @@ void ModelManager::loadQmlTypeDescriptions(const QString &resourcePath)
CppQmlTypesLoader::defaultLibraryObjects.unite(
CppQmlTypesLoader::loadQmlTypes(qmlTypesFiles, &errors, &warnings));
Core::MessageManager *messageManager = Core::MessageManager::instance();
MessageManager *messageManager = MessageManager::instance();
foreach (const QString &error, errors)
messageManager->printToOutputPane(error, Core::MessageManager::Flash);
messageManager->printToOutputPane(error, MessageManager::Flash);
foreach (const QString &warning, warnings)
messageManager->printToOutputPane(warning, Core::MessageManager::Flash);
messageManager->printToOutputPane(warning, MessageManager::Flash);
}
ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const
{
WorkingCopy workingCopy;
Core::DocumentModel *documentModel = Core::EditorManager::documentModel();
foreach (Core::IDocument *document, documentModel->openedDocuments()) {
DocumentModel *documentModel = EditorManager::documentModel();
foreach (IDocument *document, documentModel->openedDocuments()) {
const QString key = document->filePath();
if (TextEditor::BaseTextDocument *textDocument = qobject_cast<TextEditor::BaseTextDocument *>(document)) {
// TODO the language should be a property on the document, not the editor
@@ -383,7 +384,7 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
m_synchronizer.addFuture(result);
if (sourceFiles.count() > 1) {
Core::ICore::progressManager()->addTask(result, tr("Indexing"),
ProgressManager::addTask(result, tr("Indexing"),
QLatin1String(Constants::TASK_INDEX));
}
@@ -889,9 +890,9 @@ 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)
bool ModelManager::matchesMimeType(const MimeType &fileMimeType, const MimeType &knownMimeType)
{
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
MimeDatabase *db = ICore::mimeDatabase();
const QStringList knownTypeNames = QStringList(knownMimeType.type()) + knownMimeType.aliases();

View File

@@ -48,6 +48,7 @@
#include <QDebug>
#include <QMenu>
using namespace Core;
using namespace QmlJSTools;
using namespace QmlJSTools::Internal;
@@ -73,8 +74,7 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
Q_UNUSED(arguments)
Q_UNUSED(error)
if (!Core::ICore::mimeDatabase()
->addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"), error))
if (!ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"), error))
return false;
m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings
@@ -83,8 +83,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
m_modelManager = new ModelManager(this);
m_consoleManager = new QmlConsoleManager(this);
// Core::VCSManager *vcsManager = core->vcsManager();
// Core::DocumentManager *fileManager = core->fileManager();
// VCSManager *vcsManager = core->vcsManager();
// DocumentManager *fileManager = core->fileManager();
// connect(vcsManager, SIGNAL(repositoryChanged(QString)),
// m_modelManager, SLOT(updateModifiedSourceFiles()));
// connect(fileManager, SIGNAL(filesChangedInternally(QStringList)),
@@ -97,8 +97,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
addAutoReleasedObject(new BasicBundleProvider);
// Menus
Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mqmljstools = Core::ActionManager::createMenu(Constants::M_TOOLS_QMLJS);
ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
ActionContainer *mqmljstools = ActionManager::createMenu(Constants::M_TOOLS_QMLJS);
QMenu *menu = mqmljstools->menu();
menu->setTitle(tr("&QML/JS"));
menu->setEnabled(true);
@@ -106,16 +106,16 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Update context in global context
m_resetCodeModelAction = new QAction(tr("Reset Code Model"), this);
Core::Context globalContext(Core::Constants::C_GLOBAL);
Core::Command *cmd = Core::ActionManager::registerAction(
m_resetCodeModelAction, Core::Id(Constants::RESET_CODEMODEL), globalContext);
Context globalContext(Core::Constants::C_GLOBAL);
Command *cmd = ActionManager::registerAction(
m_resetCodeModelAction, Constants::RESET_CODEMODEL, globalContext);
connect(m_resetCodeModelAction, SIGNAL(triggered()), m_modelManager, SLOT(resetCodeModel()));
mqmljstools->addAction(cmd);
// watch task progress
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),
connect(ProgressManager::instance(), SIGNAL(taskStarted(QString)),
this, SLOT(onTaskStarted(QString)));
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
this, SLOT(onAllTasksFinished(QString)));
return true;

View File

@@ -40,7 +40,6 @@
#include "qt4projectmanager/wizards/qtquickapp.h"
#include "qt4projectmanager/wizards/html5app.h"
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/documentmanager.h>
@@ -858,10 +857,8 @@ void Qt4Project::asyncUpdate()
Q_ASSERT(!m_asyncUpdateFutureInterface);
m_asyncUpdateFutureInterface = new QFutureInterface<void>();
Core::ProgressManager *progressManager = Core::ICore::progressManager();
m_asyncUpdateFutureInterface->setProgressRange(0, 0);
progressManager->addTask(m_asyncUpdateFutureInterface->future(), tr("Evaluating"),
Core::ProgressManager::addTask(m_asyncUpdateFutureInterface->future(), tr("Evaluating"),
QLatin1String(Constants::PROFILE_EVALUATE));
if (debug)
qDebug()<<" adding task";

View File

@@ -59,6 +59,7 @@
#include <QCoreApplication>
#include <QProcess>
using namespace Core;
using namespace QtSupport;
using namespace QtSupport::Internal;
using namespace ProjectExplorer;
@@ -231,23 +232,23 @@ QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Fi
QCoreApplication::translate("QtVersion", "Qt %1 (%2)").arg(versionString, location);
}
Core::FeatureSet BaseQtVersion::availableFeatures() const
FeatureSet BaseQtVersion::availableFeatures() const
{
Core::FeatureSet features = Core::FeatureSet(Constants::FEATURE_QWIDGETS)
| Core::FeatureSet(Constants::FEATURE_QT)
| Core::FeatureSet(Constants::FEATURE_QT_WEBKIT)
| Core::FeatureSet(Constants::FEATURE_QT_CONSOLE);
FeatureSet features = FeatureSet(Constants::FEATURE_QWIDGETS)
| FeatureSet(Constants::FEATURE_QT)
| FeatureSet(Constants::FEATURE_QT_WEBKIT)
| FeatureSet(Constants::FEATURE_QT_CONSOLE);
if (qtVersion() >= QtVersionNumber(4, 7, 0)) {
features |= Core::FeatureSet(Constants::FEATURE_QT_QUICK);
features |= Core::FeatureSet(Constants::FEATURE_QT_QUICK_1);
features |= FeatureSet(Constants::FEATURE_QT_QUICK);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_1);
}
if (qtVersion() >= QtVersionNumber(4, 7, 1))
features |= Core::FeatureSet(Constants::FEATURE_QT_QUICK_1_1);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_1_1);
if (qtVersion() >= QtVersionNumber(5, 0, 0))
features |= Core::FeatureSet(Constants::FEATURE_QT_QUICK_2);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_2);
if (qtVersion() >= QtVersionNumber(5, 1, 0))
features |= Core::FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS);
return features;
}
@@ -1516,8 +1517,7 @@ void BaseQtVersion::buildDebuggingHelper(ToolChain *tc, int tools)
QFuture<void> task = QtConcurrent::run(&QtSupport::DebuggingHelperBuildTask::run, buildTask);
const QString taskName = QCoreApplication::translate("BaseQtVersion", "Building helpers");
Core::ICore::progressManager()->addTask(task, taskName,
QLatin1String("Qt::BuildHelpers"));
ProgressManager::addTask(task, taskName, QLatin1String("Qt::BuildHelpers"));
}
FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)

View File

@@ -49,8 +49,7 @@
namespace {
using namespace QtSupport;
using QtSupport::DebuggingHelperBuildTask;
using ProjectExplorer::ToolChain;
using namespace ProjectExplorer;
class QmlDumpBuildTask;
@@ -81,7 +80,7 @@ public:
m_buildTask->run(future);
}
void updateProjectWhenDone(QPointer<ProjectExplorer::Project> project, bool preferDebug)
void updateProjectWhenDone(QPointer<Project> project, bool preferDebug)
{
foreach (const ProjectToUpdate &update, m_projectsToUpdate) {
if (update.project == project)
@@ -146,7 +145,7 @@ private slots:
private:
class ProjectToUpdate {
public:
QPointer<ProjectExplorer::Project> project;
QPointer<Project> project;
bool preferDebug;
};
@@ -313,8 +312,8 @@ QStringList QmlDumpTool::installDirectories(const QString &qtInstallData)
return directories;
}
void QmlDumpTool::pathAndEnvironment(ProjectExplorer::Project *project, BaseQtVersion *version,
ProjectExplorer::ToolChain *toolChain,
void QmlDumpTool::pathAndEnvironment(Project *project, BaseQtVersion *version,
ToolChain *toolChain,
bool preferDebug, QString *dumperPath, Utils::Environment *env)
{
QString path;
@@ -328,8 +327,7 @@ void QmlDumpTool::pathAndEnvironment(ProjectExplorer::Project *project, BaseQtVe
buildTask->updateProjectWhenDone(project, preferDebug);
QFuture<void> task = QtConcurrent::run(&QmlDumpBuildTask::run, buildTask);
const QString taskName = QmlDumpBuildTask::tr("Building helper");
Core::ICore::progressManager()->addTask(task, taskName,
QLatin1String("Qt4ProjectManager::BuildHelpers"));
Core::ProgressManager::addTask(task, taskName, QLatin1String("Qt4ProjectManager::BuildHelpers"));
}
return;
}

View File

@@ -40,7 +40,6 @@
#include "qmldebugginglibrary.h"
#include "qmlobservertool.h"
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -459,8 +458,7 @@ void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools t
QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
const QString taskName = tr("Building helpers");
Core::ICore::progressManager()->addTask(task, taskName,
QLatin1String("Qt4ProjectManager::BuildHelpers"));
Core::ProgressManager::addTask(task, taskName, QLatin1String("Qt4ProjectManager::BuildHelpers"));
}
void QtOptionsPageWidget::buildGdbHelper()
{

View File

@@ -71,6 +71,7 @@ public:
} // namespace Internal
} // namespace TextEditor
using namespace Core;
using namespace Utils;
using namespace Find;
using namespace TextEditor;
@@ -163,7 +164,7 @@ void BaseFileFind::runSearch(Find::SearchResult *search)
connect(search, SIGNAL(countChanged(int)), label, SLOT(updateCount(int)));
CountingLabel *statusLabel = new CountingLabel;
connect(search, SIGNAL(countChanged(int)), statusLabel, SLOT(updateCount(int)));
Find::SearchResultWindow::instance()->popup(Core::IOutputPane::Flags(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus));
Find::SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus));
QFutureWatcher<FileSearchResultList> *watcher = new QFutureWatcher<FileSearchResultList>();
d->m_watchers.insert(watcher, search);
watcher->setPendingResultsLimit(1);
@@ -180,11 +181,8 @@ void BaseFileFind::runSearch(Find::SearchResult *search)
textDocumentFlagsForFindFlags(parameters.flags),
ITextEditor::openedTextDocumentContents()));
}
Core::FutureProgress *progress =
Core::ICore::progressManager()->addTask(watcher->future(),
tr("Search"),
QLatin1String(Constants::TASK_SEARCH));
progress->setWidget(label);
FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Search"),
QLatin1String(Constants::TASK_SEARCH)); progress->setWidget(label);
progress->setStatusBarWidget(statusLabel);
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
}
@@ -205,7 +203,7 @@ void BaseFileFind::doReplace(const QString &text,
{
QStringList files = replaceAll(text, items, preserveCase);
if (!files.isEmpty()) {
Core::DocumentManager::notifyFilesChangedInternally(files);
DocumentManager::notifyFilesChangedInternally(files);
Find::SearchResultWindow::instance()->hide();
}
}
@@ -308,13 +306,13 @@ void BaseFileFind::updateComboEntries(QComboBox *combo, bool onTop)
void BaseFileFind::openEditor(const Find::SearchResultItem &item)
{
SearchResult *result = qobject_cast<SearchResult *>(sender());
Core::IEditor *openedEditor = 0;
IEditor *openedEditor = 0;
if (item.path.size() > 0) {
openedEditor = Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
openedEditor = EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
item.lineNumber,
item.textMarkPos);
} else {
openedEditor = Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
openedEditor = EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
}
if (d->m_currentFindSupport)
d->m_currentFindSupport->clearResults();
@@ -378,7 +376,7 @@ QStringList BaseFileFind::replaceAll(const QString &text,
// Query the user for permissions
if (!roFiles.isEmpty()) {
Core::Internal::ReadOnlyFilesDialog roDialog(roFiles.toList(),
Core::ICore::instance()->mainWindow());
ICore::instance()->mainWindow());
roDialog.setShowFailWarning(true, tr("Aborting replace."));
if (roDialog.exec() == Core::Internal::ReadOnlyFilesDialog::RO_Cancel)
return QStringList();

View File

@@ -51,6 +51,8 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <utils/qtcassert.h>
using namespace Core;
namespace TextEditor {
class BaseTextDocumentPrivate
{
@@ -222,7 +224,7 @@ bool BaseTextDocument::save(QString *errorString, const QString &saveFileName, b
// When saving the current editor, make sure to maintain the cursor and scroll bar
// positions for undo
Core::IEditor *currentEditor = Core::EditorManager::currentEditor();
IEditor *currentEditor = EditorManager::currentEditor();
if (BaseTextEditor *editable = qobject_cast<BaseTextEditor*>(currentEditor)) {
if (editable->document() == this) {
editorWidget = editable->editorWidget();
@@ -296,7 +298,7 @@ bool BaseTextDocument::save(QString *errorString, const QString &saveFileName, b
bool BaseTextDocument::setContents(const QByteArray &contents)
{
if (contents.size() > Core::EditorManager::maxTextFileSize()) {
if (contents.size() > EditorManager::maxTextFileSize()) {
document()->setPlainText(BaseTextEditorWidget::msgTextTooLarge(contents.size()));
document()->setModified(false);
return false;
@@ -365,8 +367,8 @@ bool BaseTextDocument::open(QString *errorString, const QString &fileName, const
} else {
QFutureInterface<void> interface;
interface.setProgressRange(0, chunks);
Core::ICore::progressManager()->addTask(
interface.future(), tr("Opening file"), QLatin1String(Constants::TASK_OPEN_FILE));
ProgressManager::addTask(interface.future(),
tr("Opening file"), QLatin1String(Constants::TASK_OPEN_FILE));
interface.reportStarted();
d->m_document->setUndoRedoEnabled(false);
QTextCursor c(d->m_document);

View File

@@ -64,8 +64,10 @@
#include <QNetworkRequest>
#include <QNetworkReply>
using namespace TextEditor;
using namespace Internal;
using namespace Core;
namespace TextEditor {
namespace Internal {
const char kPriority[] = "priority";
const char kName[] = "name";
@@ -157,21 +159,18 @@ bool Manager::isBuildingDefinition(const QString &id) const
return m_isBuildingDefinition.contains(id);
}
namespace TextEditor {
namespace Internal {
class ManagerProcessor : public QObject
{
Q_OBJECT
public:
ManagerProcessor();
void process(QFutureInterface<QPair<Manager::RegisterData,
QList<Core::MimeType> > > &future);
QList<MimeType> > > &future);
QStringList m_definitionsPaths;
QSet<QString> m_knownMimeTypes;
QSet<QString> m_knownSuffixes;
QHash<QString, Core::MimeType> m_userModified;
QHash<QString, MimeType> m_userModified;
static const int kMaxProgress;
};
@@ -184,22 +183,22 @@ bool priorityComp(const QSharedPointer<HighlightDefinitionMetaData> &a,
const int ManagerProcessor::kMaxProgress = 200;
ManagerProcessor::ManagerProcessor()
: m_knownSuffixes(QSet<QString>::fromList(Core::ICore::mimeDatabase()->suffixes()))
: m_knownSuffixes(QSet<QString>::fromList(ICore::mimeDatabase()->suffixes()))
{
const HighlighterSettings &settings = TextEditorSettings::instance()->highlighterSettings();
m_definitionsPaths.append(settings.definitionFilesPath());
if (settings.useFallbackLocation())
m_definitionsPaths.append(settings.fallbackDefinitionFilesPath());
Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
foreach (const Core::MimeType &userMimeType, mimeDatabase->readUserModifiedMimeTypes())
MimeDatabase *mimeDatabase = ICore::mimeDatabase();
foreach (const MimeType &userMimeType, mimeDatabase->readUserModifiedMimeTypes())
m_userModified.insert(userMimeType.type(), userMimeType);
foreach (const Core::MimeType &mimeType, mimeDatabase->mimeTypes())
foreach (const MimeType &mimeType, mimeDatabase->mimeTypes())
m_knownMimeTypes.insert(mimeType.type());
}
void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
QList<Core::MimeType> > > &future)
QList<MimeType> > > &future)
{
future.setProgressRange(0, kMaxProgress);
@@ -215,7 +214,7 @@ void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
// is a change in the generic highlighter settings.
Manager::RegisterData data;
QList<Core::MimeType> newMimeTypes;
QList<MimeType> newMimeTypes;
foreach (const QString &path, m_definitionsPaths) {
if (path.isEmpty())
@@ -253,7 +252,7 @@ void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
// A definition can specify multiple MIME types and file extensions/patterns,
// but all on a single string. So associate all patterns with all MIME types.
QList<Core::MimeGlobPattern> globPatterns;
QList<MimeGlobPattern> globPatterns;
foreach (const QString &type, metaData->mimeTypes) {
if (data.m_idByMimeType.contains(type))
continue;
@@ -262,7 +261,7 @@ void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
if (!m_knownMimeTypes.contains(type)) {
m_knownMimeTypes.insert(type);
Core::MimeType mimeType;
MimeType mimeType;
mimeType.setType(type);
mimeType.setSubClassesOf(textPlain);
mimeType.setComment(metaData->name);
@@ -270,7 +269,7 @@ void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
// If there's a user modification for this mime type, we want to use the
// modified patterns and rule-based matchers. If not, just consider what
// is specified in the definition file.
QHash<QString, Core::MimeType>::const_iterator it =
QHash<QString, MimeType>::const_iterator it =
m_userModified.find(mimeType.type());
if (it == m_userModified.end()) {
if (globPatterns.isEmpty()) {
@@ -283,7 +282,7 @@ void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
else
continue;
}
globPatterns.append(Core::MimeGlobPattern(pattern, 50));
globPatterns.append(MimeGlobPattern(pattern, 50));
}
}
mimeType.setGlobPatterns(globPatterns);
@@ -301,23 +300,18 @@ void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
future.reportResult(qMakePair(data, newMimeTypes));
}
} // Internal
} // TextEditor
void Manager::registerMimeTypes()
{
if (!m_registeringWatcher.isRunning()) {
clear();
ManagerProcessor *processor = new ManagerProcessor;
QFuture<QPair<RegisterData, QList<Core::MimeType> > > future =
QFuture<QPair<RegisterData, QList<MimeType> > > future =
QtConcurrent::run(&ManagerProcessor::process, processor);
connect(&m_registeringWatcher, SIGNAL(finished()), processor, SLOT(deleteLater()));
m_registeringWatcher.setFuture(future);
Core::ICore::progressManager()->addTask(future,
tr("Registering definitions"),
ProgressManager::addTask(future, tr("Registering definitions"),
QLatin1String(Constants::TASK_REGISTER_DEFINITIONS));
} else {
m_hasQueuedRegistration = true;
@@ -331,13 +325,13 @@ void Manager::registerMimeTypesFinished()
m_hasQueuedRegistration = false;
registerMimeTypes();
} else if (!m_registeringWatcher.isCanceled()) {
const QPair<RegisterData, QList<Core::MimeType> > &result = m_registeringWatcher.result();
const QPair<RegisterData, QList<MimeType> > &result = m_registeringWatcher.result();
m_register = result.first;
PlainTextEditorFactory *factory = TextEditorPlugin::instance()->editorFactory();
const QSet<QString> &inFactory = factory->mimeTypes().toSet();
foreach (const Core::MimeType &mimeType, result.second) {
Core::ICore::mimeDatabase()->addMimeType(mimeType);
foreach (const MimeType &mimeType, result.second) {
ICore::mimeDatabase()->addMimeType(mimeType);
if (!inFactory.contains(mimeType.type()))
factory->addMimeType(mimeType.type());
}
@@ -451,8 +445,7 @@ void Manager::downloadDefinitions(const QList<QUrl> &urls, const QString &savePa
m_isDownloadingDefinitionsSpec = true;
QFuture<void> future = QtConcurrent::map(m_downloaders, DownloaderStarter());
m_downloadWatcher.setFuture(future);
Core::ICore::progressManager()->addTask(future,
tr("Downloading definitions"),
ProgressManager::addTask(future, tr("Downloading definitions"),
QLatin1String(Constants::TASK_DOWNLOAD_DEFINITIONS));
}
@@ -497,4 +490,7 @@ void Manager::clear()
m_definitions.clear();
}
} // namespace Internal
} // namespace TextEditor
#include "manager.moc"

View File

@@ -57,6 +57,8 @@ namespace {
static const quint32 OneMinute = 60000;
}
using namespace Core;
namespace UpdateInfo {
namespace Internal {
@@ -79,7 +81,7 @@ public:
QString updaterRunUiArgument;
int currentTimerId;
QFuture<QDomDocument> lastCheckUpdateInfoTask;
QPointer<Core::FutureProgress> updateInfoProgress;
QPointer<FutureProgress> updateInfoProgress;
UpdateInfoButton *progressUpdateInfoButton;
QFutureWatcher<QDomDocument> *checkUpdateInfoWatcher;
};
@@ -120,7 +122,7 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString *
d->checkUpdateInfoWatcher = new QFutureWatcher<QDomDocument>(this);
connect(d->checkUpdateInfoWatcher, SIGNAL(finished()), this, SLOT(reactOnUpdaterOutput()));
QSettings *settings = Core::ICore::settings();
QSettings *settings = ICore::settings();
d->updaterProgram = settings->value(QLatin1String("Updater/Application")).toString();
d->updaterCheckOnlyArgument = settings->value(QLatin1String("Updater/CheckOnlyArgument")).toString();
d->updaterRunUiArgument = settings->value(QLatin1String("Updater/RunUiArgument")).toString();
@@ -137,7 +139,7 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString *
return false;
}
Core::ActionContainer* const helpActionContainer = Core::ActionManager::actionContainer(Core::Constants::M_HELP);
ActionContainer *const helpActionContainer = ActionManager::actionContainer(Core::Constants::M_HELP);
helpActionContainer->menu()->addAction(tr("Start Updater"), this, SLOT(startUpdaterUiApplication()));
//wait some time before we want to have the first check
@@ -181,10 +183,10 @@ void UpdateInfoPlugin::reactOnUpdaterOutput()
startCheckTimer(60 * OneMinute);
} else {
//added the current almost finished task to the progressmanager
d->updateInfoProgress = Core::ICore::progressManager()->addTask(
d->lastCheckUpdateInfoTask, tr("Update"), QLatin1String("Update.GetInfo"), Core::ProgressManager::KeepOnFinish);
d->updateInfoProgress = ProgressManager::addTask(
d->lastCheckUpdateInfoTask, tr("Update"), QLatin1String("Update.GetInfo"), ProgressManager::KeepOnFinish);
d->updateInfoProgress->setKeepOnFinish(Core::FutureProgress::KeepOnFinish);
d->updateInfoProgress->setKeepOnFinish(FutureProgress::KeepOnFinish);
d->progressUpdateInfoButton = new UpdateInfoButton();
//the old widget is deleted inside this function
@@ -201,7 +203,7 @@ void UpdateInfoPlugin::startUpdaterUiApplication()
{
QProcess::startDetached(d->updaterProgram, QStringList() << d->updaterRunUiArgument);
if (!d->updateInfoProgress.isNull())
d->updateInfoProgress->setKeepOnFinish(Core::FutureProgress::HideOnFinish); //this is fading out the last updateinfo
d->updateInfoProgress->setKeepOnFinish(FutureProgress::HideOnFinish); //this is fading out the last updateinfo
startCheckTimer(OneMinute);
}

View File

@@ -85,7 +85,7 @@ bool ValgrindRunControl::startEngine()
{
emit starting(this);
FutureProgress *fp = ICore::progressManager()->addTask(m_progress->future(),
FutureProgress *fp = ProgressManager::addTask(m_progress->future(),
progressTitle(), QLatin1String("valgrind"));
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
m_progress->setProgressRange(0, progressMaximum);

View File

@@ -32,7 +32,6 @@
#include "vcsbaseoutputwindow.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <QStandardItemModel>
@@ -269,8 +268,7 @@ bool CleanDialog::promptToDelete()
QFuture<void> task = QtConcurrent::run(cleanTask, &Internal::CleanFilesTask::run);
const QString taskName = tr("Cleaning %1").
arg(QDir::toNativeSeparators(d->m_workingDirectory));
Core::ICore::progressManager()->addTask(task, taskName,
QLatin1String("VcsBase.cleanRepository"));
Core::ProgressManager::addTask(task, taskName, QLatin1String("VcsBase.cleanRepository"));
return true;
}

View File

@@ -30,7 +30,6 @@
#include "command.h"
#include "vcsbaseplugin.h"
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/vcsmanager.h>
#include <coreplugin/icore.h>
@@ -214,7 +213,7 @@ void Command::execute()
binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter
const QString taskName = binary + QLatin1Char(' ') + d->m_jobs.front().arguments.at(0);
Core::ICore::progressManager()->addTask(task, taskName, binary + QLatin1String(".action"));
Core::ProgressManager::addTask(task, taskName, binary + QLatin1String(".action"));
}
void Command::terminate()