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