forked from qt-creator/qt-creator
ProjectExplorer: Apply static pattern to ProjectExplorerPlugin
Adjust caller sites and surroundings. Change-Id: I6c3c80e42f35eabedc1f89c8c42cca1025aca12f Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -85,7 +85,7 @@ void CMakeEditor::finalizeInitialization()
|
||||
foreach (Project *p, SessionManager::projects()) {
|
||||
if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
|
||||
if (cmakeProject->isProjectFile(document->filePath())) {
|
||||
ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
|
||||
ProjectExplorerPlugin::buildProject(cmakeProject);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -118,7 +118,7 @@ void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const
|
||||
makeStep->setBuildTarget(selection.displayName, true);
|
||||
|
||||
// Build
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
|
||||
ProjectExplorerPlugin::buildProject(cmakeProject);
|
||||
makeStep->setBuildTargets(oldTargets);
|
||||
}
|
||||
|
||||
|
@@ -852,7 +852,7 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
||||
|
||||
void CMakeBuildSettingsWidget::runCMake()
|
||||
{
|
||||
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
|
||||
if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
|
||||
return;
|
||||
CMakeProject *project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
|
||||
CMakeBuildInfo info(m_buildConfiguration);
|
||||
|
@@ -94,7 +94,7 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
|
||||
if (!cmakeProject || !cmakeProject->activeTarget() || !cmakeProject->activeTarget()->activeBuildConfiguration())
|
||||
return;
|
||||
|
||||
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
|
||||
if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
|
||||
return;
|
||||
|
||||
CMakeBuildConfiguration *bc
|
||||
|
@@ -117,15 +117,14 @@ public:
|
||||
class ExampleProjectConfigurator
|
||||
{
|
||||
public:
|
||||
ExampleProjectConfigurator(const QString &projectFile,
|
||||
ProjectExplorerPlugin *projectExplorer)
|
||||
ExampleProjectConfigurator(const QString &projectFile)
|
||||
{
|
||||
const QString projectUserFile = projectFile + _(".user");
|
||||
QVERIFY(!QFileInfo(projectUserFile).exists());
|
||||
|
||||
// Open project
|
||||
QString errorOpeningProject;
|
||||
m_project = projectExplorer->openProject(projectFile, &errorOpeningProject);
|
||||
m_project = ProjectExplorerPlugin::openProject(projectFile, &errorOpeningProject);
|
||||
QVERIFY(m_project);
|
||||
QVERIFY(errorOpeningProject.isEmpty());
|
||||
|
||||
@@ -671,8 +670,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
|
||||
const QString projectFile = testDataDirectory.file(_("testdata_guiproject1.pro"));
|
||||
|
||||
// Open project with *.ui file
|
||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||
ExampleProjectConfigurator exampleProjectConfigurator(projectFile, pe);
|
||||
ExampleProjectConfigurator exampleProjectConfigurator(projectFile);
|
||||
Project *project = exampleProjectConfigurator.project();
|
||||
|
||||
// Check working copy.
|
||||
|
@@ -1540,20 +1540,17 @@ void DebuggerPluginPrivate::languagesChanged()
|
||||
|
||||
void DebuggerPluginPrivate::debugProject()
|
||||
{
|
||||
if (Project *pro = SessionManager::startupProject())
|
||||
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunMode);
|
||||
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
|
||||
{
|
||||
if (Project *pro = SessionManager::startupProject())
|
||||
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunMode, true);
|
||||
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode, true);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::debugProjectBreakMain()
|
||||
{
|
||||
if (Project *pro = SessionManager::startupProject())
|
||||
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunModeWithBreakOnMain);
|
||||
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunModeWithBreakOnMain);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::startAndDebugApplication()
|
||||
@@ -3527,13 +3524,12 @@ void DebuggerPlugin::extensionsInitialized()
|
||||
|
||||
void DebuggerPluginPrivate::testLoadProject(const QString &proFile, const TestCallBack &cb)
|
||||
{
|
||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||
connect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
||||
this, SLOT(testProjectLoaded(ProjectExplorer::Project*)));
|
||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::currentProjectChanged,
|
||||
this, &DebuggerPluginPrivate::testProjectLoaded);
|
||||
|
||||
m_testCallbacks.append(cb);
|
||||
QString error;
|
||||
if (pe->openProject(proFile, &error)) {
|
||||
if (ProjectExplorerPlugin::openProject(proFile, &error)) {
|
||||
// Will end up in callback below due to the connections to
|
||||
// signal currentProjectChanged().
|
||||
return;
|
||||
@@ -3563,7 +3559,7 @@ void DebuggerPluginPrivate::testProjectEvaluated()
|
||||
qWarning("Project %s loaded", qPrintable(fileName));
|
||||
connect(BuildManager::instance(), SIGNAL(buildQueueFinished(bool)),
|
||||
SLOT(testProjectBuilt(bool)));
|
||||
ProjectExplorerPlugin::instance()->buildProject(m_testProject);
|
||||
ProjectExplorerPlugin::buildProject(m_testProject);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::testProjectBuilt(bool success)
|
||||
|
@@ -457,11 +457,11 @@ DebuggerRunControl *DebuggerRunControlFactory::createAndScheduleRun(const Debugg
|
||||
QString errorMessage;
|
||||
DebuggerRunControl *rc = doCreate(sp, 0, &errorMessage);
|
||||
if (!rc) {
|
||||
ProjectExplorer::ProjectExplorerPlugin::showRunErrorMessage(errorMessage);
|
||||
ProjectExplorerPlugin::showRunErrorMessage(errorMessage);
|
||||
return 0;
|
||||
}
|
||||
debuggerCore()->showMessage(sp.startMessage, 0);
|
||||
ProjectExplorerPlugin::instance()->startRunControl(rc, DebugRunMode);
|
||||
ProjectExplorerPlugin::startRunControl(rc, DebugRunMode);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@@ -54,9 +54,6 @@ namespace {
|
||||
class ProjectExplorerHelper
|
||||
{
|
||||
public:
|
||||
static ProjectExplorerPlugin *getInstance()
|
||||
{ return ProjectExplorerPlugin::instance(); }
|
||||
|
||||
ProjectExplorerHelper()
|
||||
{
|
||||
QVERIFY(!SessionManager::hasProjects());
|
||||
@@ -65,13 +62,13 @@ public:
|
||||
~ProjectExplorerHelper()
|
||||
{
|
||||
foreach (Project *project, m_openProjects)
|
||||
getInstance()->unloadProject(project);
|
||||
ProjectExplorerPlugin::unloadProject(project);
|
||||
}
|
||||
|
||||
Project *openProject(const QString &projectFile)
|
||||
{
|
||||
QString error;
|
||||
Project *project = getInstance()->openProject(projectFile, &error);
|
||||
Project *project = ProjectExplorerPlugin::openProject(projectFile, &error);
|
||||
if (!error.isEmpty())
|
||||
qWarning() << error;
|
||||
if (!project)
|
||||
|
@@ -39,7 +39,7 @@ CoreListener::CoreListener()
|
||||
|
||||
bool CoreListener::coreAboutToClose()
|
||||
{
|
||||
return ProjectExplorerPlugin::instance()->coreAboutToClose();
|
||||
return ProjectExplorerPlugin::coreAboutToClose();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -524,7 +524,7 @@ bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QStrin
|
||||
// Post-Generate: Open the project and the editors as desired
|
||||
foreach (const Core::GeneratedFile &file, l) {
|
||||
if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) {
|
||||
if (!ProjectExplorerPlugin::instance()->openProject(file.path(), errorMessage))
|
||||
if (!ProjectExplorerPlugin::openProject(file.path(), errorMessage))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -39,7 +39,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPoint;
|
||||
class QMenu;
|
||||
class QAction;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -54,14 +53,10 @@ class RunConfiguration;
|
||||
class IRunControlFactory;
|
||||
class Project;
|
||||
class Node;
|
||||
class BuildConfiguration;
|
||||
class FolderNode;
|
||||
class TaskHub;
|
||||
|
||||
namespace Internal { class ProjectExplorerSettings; }
|
||||
|
||||
struct ProjectExplorerPluginPrivate;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin
|
||||
: public ExtensionSystem::IPlugin
|
||||
{
|
||||
@@ -74,20 +69,20 @@ public:
|
||||
|
||||
static ProjectExplorerPlugin *instance();
|
||||
|
||||
Project *openProject(const QString &fileName, QString *error);
|
||||
QList<Project *> openProjects(const QStringList &fileNames, QString *error);
|
||||
static Project *openProject(const QString &fileName, QString *error);
|
||||
static QList<Project *> openProjects(const QStringList &fileNames, QString *error);
|
||||
Q_SLOT void openProjectWelcomePage(const QString &fileName);
|
||||
void unloadProject(Project *project);
|
||||
static void unloadProject(Project *project);
|
||||
|
||||
static Project *currentProject();
|
||||
Node *currentNode() const;
|
||||
static Node *currentNode();
|
||||
|
||||
void setCurrentFile(Project *project, const QString &file);
|
||||
void setCurrentNode(Node *node);
|
||||
static void setCurrentFile(Project *project, const QString &file);
|
||||
static void setCurrentNode(Node *node);
|
||||
|
||||
bool saveModifiedFiles();
|
||||
static bool saveModifiedFiles();
|
||||
|
||||
void showContextMenu(QWidget *view, const QPoint &globalPos, Node *node);
|
||||
static void showContextMenu(QWidget *view, const QPoint &globalPos, Node *node);
|
||||
|
||||
//PluginInterface
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage);
|
||||
@@ -97,34 +92,33 @@ public:
|
||||
static void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
|
||||
static Internal::ProjectExplorerSettings projectExplorerSettings();
|
||||
|
||||
void startRunControl(RunControl *runControl, RunMode runMode);
|
||||
static void startRunControl(RunControl *runControl, RunMode runMode);
|
||||
static void showRunErrorMessage(const QString &errorMessage);
|
||||
|
||||
// internal public for FlatModel
|
||||
void renameFile(Node *node, const QString &to);
|
||||
static void renameFile(Node *node, const QString &to);
|
||||
static QStringList projectFilePatterns();
|
||||
bool coreAboutToClose();
|
||||
QList<QPair<QString, QString> > recentProjects();
|
||||
static bool coreAboutToClose();
|
||||
static QList<QPair<QString, QString> > recentProjects();
|
||||
|
||||
static bool canRun(Project *pro, RunMode runMode, QString *whyNot = 0);
|
||||
void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false);
|
||||
void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, RunMode runMode,
|
||||
static void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false);
|
||||
static void runRunConfiguration(RunConfiguration *rc, RunMode runMode,
|
||||
const bool forceSkipDeploy = false);
|
||||
|
||||
void addExistingFiles(ProjectExplorer::FolderNode *projectNode, const QStringList &filePaths);
|
||||
void addExistingFiles(const QStringList &filePaths);
|
||||
static void addExistingFiles(FolderNode *projectNode, const QStringList &filePaths);
|
||||
static void addExistingFiles(const QStringList &filePaths);
|
||||
|
||||
void buildProject(ProjectExplorer::Project *p);
|
||||
static void buildProject(Project *p);
|
||||
/// Normally there's no need to call this function.
|
||||
/// This function needs to be called, only if the pages that support a project changed.
|
||||
void requestProjectModeUpdate(ProjectExplorer::Project *p);
|
||||
static void requestProjectModeUpdate(Project *p);
|
||||
|
||||
void initiateInlineRenaming();
|
||||
static void initiateInlineRenaming();
|
||||
|
||||
static QString displayNameForStepId(Core::Id stepId);
|
||||
|
||||
static QString directoryFor(Node *node);
|
||||
static QString pathFor(Node *node);
|
||||
static QStringList projectFileGlobs();
|
||||
|
||||
signals:
|
||||
@@ -147,7 +141,7 @@ signals:
|
||||
void updateRunActions();
|
||||
|
||||
public slots:
|
||||
void openOpenProjectDialog();
|
||||
static void openOpenProjectDialog();
|
||||
|
||||
private slots:
|
||||
void buildStateChanged(ProjectExplorer::Project * pro);
|
||||
@@ -220,17 +214,15 @@ private slots:
|
||||
void activeTargetChanged();
|
||||
void activeRunConfigurationChanged();
|
||||
|
||||
void updateDeployActions();
|
||||
void slotUpdateRunActions();
|
||||
|
||||
void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
|
||||
void updateActions();
|
||||
void loadCustomWizards();
|
||||
void updateRunWithoutDeployMenu();
|
||||
|
||||
void updateWelcomePage();
|
||||
void updateExternalFileWarning();
|
||||
|
||||
void updateActions();
|
||||
void updateContext();
|
||||
void runConfigurationConfigurationFinished();
|
||||
|
||||
@@ -275,27 +267,6 @@ private slots:
|
||||
void testCustomWizardPreprocessor_data();
|
||||
void testCustomWizardPreprocessor();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void deploy(QList<Project *>);
|
||||
int queue(QList<Project *>, QList<Core::Id> stepIds);
|
||||
void updateContextMenuActions();
|
||||
bool parseArguments(const QStringList &arguments, QString *error);
|
||||
void executeRunConfiguration(RunConfiguration *, RunMode mode);
|
||||
bool hasBuildSettings(Project *pro);
|
||||
QPair<bool, QString> buildSettingsEnabledForSession();
|
||||
QPair<bool, QString> buildSettingsEnabled(Project *pro);
|
||||
bool hasDeploySettings(Project *pro);
|
||||
|
||||
void setCurrent(Project *project, QString filePath, Node *node);
|
||||
|
||||
QStringList allFilesWithDependencies(Project *pro);
|
||||
IRunControlFactory *findRunControlFactory(RunConfiguration *config, RunMode mode);
|
||||
|
||||
void addToRecentProjects(const QString &fileName, const QString &displayName);
|
||||
|
||||
static ProjectExplorerPlugin *m_instance;
|
||||
ProjectExplorerPluginPrivate *d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -348,7 +348,7 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol
|
||||
if (role != Qt::EditRole)
|
||||
return false;
|
||||
|
||||
ProjectExplorerPlugin::instance()->renameFile(nodeForIndex(index), value.toString());
|
||||
ProjectExplorerPlugin::renameFile(nodeForIndex(index), value.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -111,7 +111,6 @@ private:
|
||||
*/
|
||||
ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_explorer(ProjectExplorerPlugin::instance()),
|
||||
m_view(0),
|
||||
m_model(0),
|
||||
m_filterProjectsAction(0),
|
||||
@@ -282,7 +281,7 @@ void ProjectTreeWidget::recursiveSaveExpandData(const QModelIndex &index, QStrin
|
||||
|
||||
void ProjectTreeWidget::foldersAboutToBeRemoved(FolderNode *, const QList<FolderNode*> &list)
|
||||
{
|
||||
Node *n = m_explorer->currentNode();
|
||||
Node *n = ProjectExplorerPlugin::currentNode();
|
||||
while (n) {
|
||||
if (FolderNode *fn = qobject_cast<FolderNode *>(n)) {
|
||||
if (list.contains(fn)) {
|
||||
@@ -290,7 +289,7 @@ void ProjectTreeWidget::foldersAboutToBeRemoved(FolderNode *, const QList<Folder
|
||||
// Make sure the node we are switching too isn't going to be removed also
|
||||
while (list.contains(pn))
|
||||
pn = pn->parentFolderNode()->projectNode();
|
||||
m_explorer->setCurrentNode(pn);
|
||||
ProjectExplorerPlugin::setCurrentNode(pn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -300,9 +299,9 @@ void ProjectTreeWidget::foldersAboutToBeRemoved(FolderNode *, const QList<Folder
|
||||
|
||||
void ProjectTreeWidget::filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &list)
|
||||
{
|
||||
if (FileNode *fileNode = qobject_cast<FileNode *>(m_explorer->currentNode())) {
|
||||
if (FileNode *fileNode = qobject_cast<FileNode *>(ProjectExplorerPlugin::currentNode())) {
|
||||
if (list.contains(fileNode))
|
||||
m_explorer->setCurrentNode(fileNode->projectNode());
|
||||
ProjectExplorerPlugin::setCurrentNode(fileNode->projectNode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,13 +331,13 @@ void ProjectTreeWidget::setAutoSynchronization(bool sync, bool syncNow)
|
||||
if (debug)
|
||||
qDebug() << (m_autoSync ? "Enabling auto synchronization" : "Disabling auto synchronization");
|
||||
if (m_autoSync) {
|
||||
connect(m_explorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)),
|
||||
this, SLOT(setCurrentItem(ProjectExplorer::Node*,ProjectExplorer::Project*)));
|
||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::currentNodeChanged,
|
||||
this, &ProjectTreeWidget::setCurrentItem);
|
||||
if (syncNow)
|
||||
setCurrentItem(m_explorer->currentNode(), ProjectExplorerPlugin::currentProject());
|
||||
setCurrentItem(ProjectExplorerPlugin::currentNode(), ProjectExplorerPlugin::currentProject());
|
||||
} else {
|
||||
disconnect(m_explorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)),
|
||||
this, SLOT(setCurrentItem(ProjectExplorer::Node*,ProjectExplorer::Project*)));
|
||||
disconnect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::currentNodeChanged,
|
||||
this, &ProjectTreeWidget::setCurrentItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +382,7 @@ void ProjectTreeWidget::handleCurrentItemChange(const QModelIndex ¤t)
|
||||
// node might be 0. that's okay
|
||||
bool autoSync = autoSynchronization();
|
||||
setAutoSynchronization(false);
|
||||
m_explorer->setCurrentNode(node);
|
||||
ProjectExplorerPlugin::setCurrentNode(node);
|
||||
setAutoSynchronization(autoSync, false);
|
||||
}
|
||||
|
||||
@@ -391,7 +390,7 @@ void ProjectTreeWidget::showContextMenu(const QPoint &pos)
|
||||
{
|
||||
QModelIndex index = m_view->indexAt(pos);
|
||||
Node *node = m_model->nodeForIndex(index);
|
||||
m_explorer->showContextMenu(this, m_view->mapToGlobal(pos), node);
|
||||
ProjectExplorerPlugin::showContextMenu(this, m_view->mapToGlobal(pos), node);
|
||||
}
|
||||
|
||||
void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project)
|
||||
@@ -427,7 +426,7 @@ void ProjectTreeWidget::initView()
|
||||
for (int i = 0; i < m_model->rowCount(sessionIndex); ++i)
|
||||
m_view->expand(m_model->index(i, 0, sessionIndex));
|
||||
|
||||
setCurrentItem(m_explorer->currentNode(), ProjectExplorerPlugin::currentProject());
|
||||
setCurrentItem(ProjectExplorerPlugin::currentNode(), ProjectExplorerPlugin::currentProject());
|
||||
}
|
||||
|
||||
void ProjectTreeWidget::openItem(const QModelIndex &mainIndex)
|
||||
|
@@ -39,7 +39,6 @@ QT_FORWARD_DECLARE_CLASS(QTreeView)
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class ProjectExplorerPlugin;
|
||||
class Project;
|
||||
class Node;
|
||||
class FolderNode;
|
||||
@@ -92,7 +91,6 @@ private:
|
||||
void recursiveLoadExpandData(const QModelIndex &index, const QSet<QString> &data);
|
||||
void recursiveSaveExpandData(const QModelIndex &index, QStringList *data);
|
||||
static int expandedCount(Node *node);
|
||||
ProjectExplorerPlugin *m_explorer;
|
||||
QTreeView *m_view;
|
||||
FlatModel *m_model;
|
||||
QAction *m_filterProjectsAction;
|
||||
|
@@ -165,20 +165,21 @@ void SessionModel::renameSession(const QString &session)
|
||||
}
|
||||
}
|
||||
|
||||
ProjectModel::ProjectModel(ProjectExplorerPlugin *plugin, QObject *parent)
|
||||
: QAbstractListModel(parent), m_plugin(plugin)
|
||||
ProjectModel::ProjectModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
connect(plugin, SIGNAL(recentProjectsChanged()), SLOT(resetProjects()));
|
||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::recentProjectsChanged,
|
||||
this, &ProjectModel::resetProjects);
|
||||
}
|
||||
|
||||
int ProjectModel::rowCount(const QModelIndex &) const
|
||||
{
|
||||
return m_plugin->recentProjects().count();
|
||||
return ProjectExplorerPlugin::recentProjects().count();
|
||||
}
|
||||
|
||||
QVariant ProjectModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
QPair<QString,QString> data = m_plugin->recentProjects().at(index.row());
|
||||
QPair<QString,QString> data = ProjectExplorerPlugin::recentProjects().at(index.row());
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return data.second;
|
||||
@@ -219,7 +220,7 @@ ProjectWelcomePage::ProjectWelcomePage() :
|
||||
void ProjectWelcomePage::facilitateQml(QQmlEngine *engine)
|
||||
{
|
||||
m_sessionModel = new SessionModel(this);
|
||||
m_projectModel = new ProjectModel(ProjectExplorerPlugin::instance(), this);
|
||||
m_projectModel = new ProjectModel(this);
|
||||
|
||||
QQmlContext *ctx = engine->rootContext();
|
||||
ctx->setContextProperty(QLatin1String("sessionList"), m_sessionModel);
|
||||
@@ -255,7 +256,7 @@ void ProjectWelcomePage::newProject()
|
||||
|
||||
void ProjectWelcomePage::openProject()
|
||||
{
|
||||
ProjectExplorerPlugin::instance()->openOpenProjectDialog();
|
||||
ProjectExplorerPlugin::openOpenProjectDialog();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -39,9 +39,6 @@ class QQmlEngine;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class ProjectExplorerPlugin;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class SessionModel : public QAbstractListModel
|
||||
@@ -71,16 +68,13 @@ class ProjectModel : public QAbstractListModel
|
||||
public:
|
||||
enum { FilePathRole = Qt::UserRole+1, PrettyFilePathRole };
|
||||
|
||||
ProjectModel(ProjectExplorerPlugin* plugin, QObject* parent = 0);
|
||||
ProjectModel(QObject *parent = 0);
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QHash<int, QByteArray> roleNames() const;
|
||||
|
||||
public slots:
|
||||
void resetProjects();
|
||||
|
||||
private:
|
||||
ProjectExplorerPlugin *m_plugin;
|
||||
};
|
||||
|
||||
class ProjectWelcomePage : public Utils::IWelcomePage
|
||||
|
@@ -860,7 +860,7 @@ void SessionManagerPrivate::restoreProjects(const QStringList &fileList)
|
||||
m_failedProjects = fileList;
|
||||
if (!fileList.isEmpty()) {
|
||||
QString errors;
|
||||
QList<Project *> projects = ProjectExplorerPlugin::instance()->openProjects(fileList, &errors);
|
||||
QList<Project *> projects = ProjectExplorerPlugin::openProjects(fileList, &errors);
|
||||
if (!errors.isEmpty())
|
||||
QMessageBox::critical(Core::ICore::mainWindow(), SessionManager::tr("Failed to open project"), errors);
|
||||
foreach (Project *p, projects)
|
||||
@@ -1005,12 +1005,12 @@ void SessionManager::projectDisplayNameChanged()
|
||||
if (pro) {
|
||||
Node *currentNode = 0;
|
||||
if (ProjectExplorerPlugin::currentProject() == pro)
|
||||
currentNode = ProjectExplorerPlugin::instance()->currentNode();
|
||||
currentNode = ProjectExplorerPlugin::currentNode();
|
||||
|
||||
d->m_sessionNode->projectDisplayNameChanged(pro->rootProjectNode());
|
||||
|
||||
if (currentNode)
|
||||
ProjectExplorerPlugin::instance()->setCurrentNode(currentNode);
|
||||
ProjectExplorerPlugin::setCurrentNode(currentNode);
|
||||
|
||||
emit m_instance->projectDisplayNameChanged(pro);
|
||||
}
|
||||
|
@@ -165,7 +165,7 @@ void TargetSetupPageWrapper::cancel()
|
||||
void TargetSetupPageWrapper::done()
|
||||
{
|
||||
m_targetSetupPage->setupProject(m_project);
|
||||
ProjectExplorerPlugin::instance()->requestProjectModeUpdate(m_project);
|
||||
ProjectExplorerPlugin::requestProjectModeUpdate(m_project);
|
||||
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||
}
|
||||
|
||||
|
@@ -442,7 +442,7 @@ void QbsProjectManagerPlugin::buildFiles(QbsProject *project, const QStringList
|
||||
if (!bc)
|
||||
return;
|
||||
|
||||
if (!ProjectExplorerPlugin::instance()->saveModifiedFiles())
|
||||
if (!ProjectExplorerPlugin::saveModifiedFiles())
|
||||
return;
|
||||
|
||||
bc->setChangedFiles(files);
|
||||
@@ -476,7 +476,7 @@ void QbsProjectManagerPlugin::buildProducts(QbsProject *project, const QStringLi
|
||||
if (!bc)
|
||||
return;
|
||||
|
||||
if (!ProjectExplorerPlugin::instance()->saveModifiedFiles())
|
||||
if (!ProjectExplorerPlugin::saveModifiedFiles())
|
||||
return;
|
||||
|
||||
bc->setChangedFiles(QStringList());
|
||||
|
@@ -1413,7 +1413,7 @@ bool QmakeProject::needsConfiguration() const
|
||||
void QmakeProject::configureAsExampleProject(const QStringList &platforms)
|
||||
{
|
||||
QList<const BuildInfo *> infoList;
|
||||
QList<Kit *> kits = ProjectExplorer::KitManager::kits();
|
||||
QList<Kit *> kits = KitManager::kits();
|
||||
foreach (Kit *k, kits) {
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
||||
if (!version)
|
||||
@@ -1429,7 +1429,7 @@ void QmakeProject::configureAsExampleProject(const QStringList &platforms)
|
||||
}
|
||||
setup(infoList);
|
||||
qDeleteAll(infoList);
|
||||
ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
|
||||
ProjectExplorerPlugin::requestProjectModeUpdate(this);
|
||||
}
|
||||
|
||||
bool QmakeProject::requiresTargetPanel() const
|
||||
|
@@ -138,7 +138,7 @@ void QmakeManager::addLibrary()
|
||||
|
||||
void QmakeManager::addLibraryContextMenu()
|
||||
{
|
||||
ProjectExplorer::Node *node = ProjectExplorerPlugin::instance()->currentNode();
|
||||
Node *node = ProjectExplorerPlugin::currentNode();
|
||||
if (qobject_cast<QmakeProFileNode *>(node))
|
||||
addLibrary(node->path());
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void QmakeManager::runQMakeContextMenu()
|
||||
|
||||
void QmakeManager::runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *node)
|
||||
{
|
||||
if (!ProjectExplorerPlugin::instance()->saveModifiedFiles())
|
||||
if (!ProjectExplorerPlugin::saveModifiedFiles())
|
||||
return;
|
||||
QmakeProject *qmakeProject = qobject_cast<QmakeProject *>(p);
|
||||
QTC_ASSERT(qmakeProject, return);
|
||||
@@ -272,7 +272,7 @@ void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isF
|
||||
|
||||
if (isFileBuild)
|
||||
bc->setFileNodeBuild(contextFile);
|
||||
if (ProjectExplorerPlugin::instance()->saveModifiedFiles()) {
|
||||
if (ProjectExplorerPlugin::saveModifiedFiles()) {
|
||||
const Core::Id buildStep = ProjectExplorer::Constants::BUILDSTEPS_BUILD;
|
||||
const Core::Id cleanStep = ProjectExplorer::Constants::BUILDSTEPS_CLEAN;
|
||||
if (action == BUILD) {
|
||||
|
@@ -397,7 +397,7 @@ void QmakeProjectManagerPlugin::buildStateChanged(ProjectExplorer::Project *pro)
|
||||
ProjectExplorer::Project *currentProject = m_projectExplorer->currentProject();
|
||||
if (pro == currentProject) {
|
||||
updateRunQMakeAction();
|
||||
updateContextActions(m_projectExplorer->currentNode(), pro);
|
||||
updateContextActions(ProjectExplorerPlugin::currentNode(), pro);
|
||||
updateBuildFileAction();
|
||||
}
|
||||
}
|
||||
|
@@ -131,9 +131,9 @@ bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w,
|
||||
if (success) {
|
||||
const QString fileToOpen = fileToOpenPostGeneration();
|
||||
if (!fileToOpen.isEmpty()) {
|
||||
Core::EditorManager::openEditor(fileToOpen);
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(fileToOpen);
|
||||
ProjectExplorerPlugin::instance()->setCurrentFile(project, fileToOpen);
|
||||
EditorManager::openEditor(fileToOpen);
|
||||
Project *project = SessionManager::projectForFile(fileToOpen);
|
||||
ProjectExplorerPlugin::setCurrentFile(project, fileToOpen);
|
||||
}
|
||||
}
|
||||
return success;
|
||||
|
@@ -441,7 +441,7 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
||||
AnalyzerRunControl *rc = tool->createRunControl(sp, 0);
|
||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||
|
||||
ProjectExplorerPlugin::instance()->startRunControl(rc, tool->runMode());
|
||||
ProjectExplorerPlugin::startRunControl(rc, tool->runMode());
|
||||
}
|
||||
|
||||
void QmlProfilerTool::startTool(StartMode mode)
|
||||
|
@@ -141,7 +141,7 @@ void QnxAttachDebugSupport::attachToProcess()
|
||||
}
|
||||
m_engine = runControl->engine();
|
||||
connect(m_engine, SIGNAL(stateChanged(Debugger::DebuggerState)), this, SLOT(handleDebuggerStateChanged(Debugger::DebuggerState)));
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(runControl, ProjectExplorer::DebugRunMode);
|
||||
ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::DebugRunMode);
|
||||
}
|
||||
|
||||
void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState state)
|
||||
|
@@ -62,7 +62,10 @@
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
|
||||
using namespace ResourceEditor::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace ResourceEditor {
|
||||
namespace Internal {
|
||||
|
||||
static const char resourcePrefix[] = ":";
|
||||
static const char urlPrefix[] = "qrc:";
|
||||
@@ -242,7 +245,7 @@ void ResourceEditorPlugin::addPrefixContextMenu()
|
||||
QString prefix = dialog.prefix();
|
||||
if (prefix.isEmpty())
|
||||
return;
|
||||
ResourceTopLevelNode *topLevel = static_cast<ResourceTopLevelNode *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentNode());
|
||||
ResourceTopLevelNode *topLevel = static_cast<ResourceTopLevelNode *>(ProjectExplorer::ProjectExplorerPlugin::currentNode());
|
||||
topLevel->addPrefix(prefix, dialog.lang());
|
||||
}
|
||||
|
||||
@@ -260,7 +263,7 @@ void ResourceEditorPlugin::removePrefixContextMenu()
|
||||
|
||||
void ResourceEditorPlugin::renameFileContextMenu()
|
||||
{
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()->initiateInlineRenaming();
|
||||
ProjectExplorerPlugin::initiateInlineRenaming();
|
||||
}
|
||||
|
||||
void ResourceEditorPlugin::removeFileContextMenu()
|
||||
@@ -283,35 +286,35 @@ void ResourceEditorPlugin::openEditorContextMenu()
|
||||
|
||||
void ResourceEditorPlugin::openTextEditorContextMenu()
|
||||
{
|
||||
ResourceTopLevelNode *topLevel = static_cast<ResourceTopLevelNode *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentNode());
|
||||
ResourceTopLevelNode *topLevel = static_cast<ResourceTopLevelNode *>(ProjectExplorerPlugin::currentNode());
|
||||
QString path = topLevel->path();
|
||||
Core::EditorManager::openEditor(path, Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
|
||||
}
|
||||
|
||||
void ResourceEditorPlugin::copyPathContextMenu()
|
||||
{
|
||||
ResourceFileNode *node = static_cast<ResourceFileNode *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentNode());
|
||||
ResourceFileNode *node = static_cast<ResourceFileNode *>(ProjectExplorerPlugin::currentNode());
|
||||
QApplication::clipboard()->setText(QLatin1String(resourcePrefix) + node->qrcPath());
|
||||
}
|
||||
|
||||
void ResourceEditorPlugin::copyUrlContextMenu()
|
||||
{
|
||||
ResourceFileNode *node = static_cast<ResourceFileNode *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentNode());
|
||||
ResourceFileNode *node = static_cast<ResourceFileNode *>(ProjectExplorerPlugin::currentNode());
|
||||
QApplication::clipboard()->setText(QLatin1String(urlPrefix) + node->qrcPath());
|
||||
}
|
||||
|
||||
void ResourceEditorPlugin::renamePrefixContextMenu()
|
||||
{
|
||||
ResourceFolderNode *rfn = static_cast<ResourceFolderNode *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentNode());
|
||||
ResourceFolderNode *node = static_cast<ResourceFolderNode *>(ProjectExplorerPlugin::currentNode());
|
||||
|
||||
PrefixLangDialog dialog(tr("Rename Prefix"), rfn->prefix(), rfn->lang(), Core::ICore::mainWindow());
|
||||
PrefixLangDialog dialog(tr("Rename Prefix"), node->prefix(), node->lang(), Core::ICore::mainWindow());
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
QString prefix = dialog.prefix();
|
||||
if (prefix.isEmpty())
|
||||
return;
|
||||
|
||||
rfn->renamePrefix(prefix, dialog.lang());
|
||||
node->renamePrefix(prefix, dialog.lang());
|
||||
}
|
||||
|
||||
void ResourceEditorPlugin::updateContextActions(ProjectExplorer::Node *node, ProjectExplorer::Project *)
|
||||
@@ -377,4 +380,7 @@ ResourceEditorW * ResourceEditorPlugin::currentEditor() const
|
||||
return focusEditor;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ResourceEditor
|
||||
|
||||
#include "resourceeditorplugin.moc"
|
||||
|
@@ -151,7 +151,7 @@ static void startRemoteTool(IAnalyzerTool *tool)
|
||||
AnalyzerRunControl *rc = tool->createRunControl(sp, 0);
|
||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||
|
||||
ProjectExplorerPlugin::instance()->startRunControl(rc, tool->runMode());
|
||||
ProjectExplorerPlugin::startRunControl(rc, tool->runMode());
|
||||
}
|
||||
|
||||
void ValgrindTool::startTool(StartMode mode)
|
||||
|
Reference in New Issue
Block a user