2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-05-06 15:05:37 +02:00
|
|
|
** Nokia at info@qt.nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qt4projectmanagerplugin.h"
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qt4projectmanager.h"
|
2010-03-17 17:45:33 +01:00
|
|
|
#include "qmakestep.h"
|
|
|
|
|
#include "makestep.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "wizards/consoleappwizard.h"
|
|
|
|
|
#include "wizards/guiappwizard.h"
|
2010-09-13 11:20:13 +02:00
|
|
|
#include "wizards/mobileappwizard.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "wizards/librarywizard.h"
|
2009-12-16 14:19:34 +01:00
|
|
|
#include "wizards/testwizard.h"
|
2009-05-07 20:31:12 +02:00
|
|
|
#include "wizards/emptyprojectwizard.h"
|
2010-11-24 15:18:50 +01:00
|
|
|
#include "wizards/subdirsprojectwizard.h"
|
2011-02-06 16:23:02 +01:00
|
|
|
#include "wizards/qtquickappwizard.h"
|
2011-02-05 23:08:59 +01:00
|
|
|
#include "wizards/html5appwizard.h"
|
2009-06-29 14:47:04 +02:00
|
|
|
#include "customwidgetwizard/customwidgetwizard.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "profileeditorfactory.h"
|
|
|
|
|
#include "qt4projectmanagerconstants.h"
|
|
|
|
|
#include "qt4project.h"
|
2010-08-16 18:23:30 +02:00
|
|
|
#include "profileeditor.h"
|
2009-05-19 14:54:52 +02:00
|
|
|
#include "externaleditors.h"
|
2011-04-15 16:19:23 +02:00
|
|
|
#include "profilecompletionassist.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-12-17 18:01:41 +01:00
|
|
|
#include "qt-s60/s60manager.h"
|
2010-12-10 19:02:19 +01:00
|
|
|
#include "qt-desktop/qt4desktoptargetfactory.h"
|
|
|
|
|
#include "qt-desktop/qt4simulatortargetfactory.h"
|
|
|
|
|
#include "qt-desktop/qt4runconfiguration.h"
|
2011-05-04 13:14:46 +02:00
|
|
|
#include "qt-desktop/desktopqtversionfactory.h"
|
|
|
|
|
#include "qt-desktop/simulatorqtversionfactory.h"
|
|
|
|
|
#include "winceqtversionfactory.h"
|
2009-05-26 15:31:29 +02:00
|
|
|
|
2010-07-02 13:43:41 +02:00
|
|
|
#include <coreplugin/uniqueidmanager.h>
|
2009-01-20 15:31:33 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2009-01-20 09:32:59 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2009-01-14 15:08:46 +01:00
|
|
|
#include <projectexplorer/buildmanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/project.h>
|
2009-09-25 11:35:44 +02:00
|
|
|
#include <projectexplorer/session.h>
|
2009-01-14 15:08:46 +01:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/projectnodes.h>
|
|
|
|
|
#include <coreplugin/mimedatabase.h>
|
2009-01-13 13:39:31 +01:00
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
2010-03-18 10:59:06 +01:00
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
|
|
|
|
#include <coreplugin/actionmanager/command.h>
|
2010-08-16 18:23:30 +02:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <texteditor/texteditoractionhandler.h>
|
2010-05-25 16:16:04 +02:00
|
|
|
#include <texteditor/texteditorconstants.h>
|
2010-11-08 14:01:50 +01:00
|
|
|
#include <texteditor/texteditorsettings.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#ifdef WITH_TESTS
|
2009-12-09 13:54:46 +01:00
|
|
|
# include <QTest>
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif
|
|
|
|
|
|
2009-12-09 13:54:46 +01:00
|
|
|
#include <QtCore/QtPlugin>
|
2011-01-20 18:05:58 +01:00
|
|
|
#include <QtGui/QMenu>
|
2009-12-09 13:54:46 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
using namespace Qt4ProjectManager::Internal;
|
|
|
|
|
using namespace Qt4ProjectManager;
|
|
|
|
|
using ProjectExplorer::Project;
|
|
|
|
|
|
|
|
|
|
Qt4ProjectManagerPlugin::~Qt4ProjectManagerPlugin()
|
|
|
|
|
{
|
|
|
|
|
//removeObject(m_embeddedPropertiesPage);
|
|
|
|
|
//delete m_embeddedPropertiesPage;
|
|
|
|
|
|
|
|
|
|
removeObject(m_proFileEditorFactory);
|
|
|
|
|
delete m_proFileEditorFactory;
|
|
|
|
|
removeObject(m_qt4ProjectManager);
|
|
|
|
|
delete m_qt4ProjectManager;
|
|
|
|
|
}
|
2009-01-20 15:31:33 +01:00
|
|
|
|
|
|
|
|
bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-07-13 17:35:17 +02:00
|
|
|
Q_UNUSED(arguments)
|
2011-04-12 12:17:19 +02:00
|
|
|
const Core::Context projectContext(Qt4ProjectManager::Constants::PROJECT_ID);
|
2011-04-13 13:54:15 +02:00
|
|
|
Core::Context projecTreeContext(ProjectExplorer::Constants::C_PROJECT_TREE);
|
2010-01-29 21:33:57 +01:00
|
|
|
|
2009-01-20 11:52:04 +01:00
|
|
|
Core::ICore *core = Core::ICore::instance();
|
|
|
|
|
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage))
|
2008-12-02 12:01:29 +01:00
|
|
|
return false;
|
|
|
|
|
|
2009-03-04 09:38:01 +01:00
|
|
|
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
|
2009-01-20 11:52:04 +01:00
|
|
|
Core::ActionManager *am = core->actionManager();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
//create and register objects
|
2009-01-20 15:31:33 +01:00
|
|
|
m_qt4ProjectManager = new Qt4Manager(this);
|
2008-12-02 12:01:29 +01:00
|
|
|
addObject(m_qt4ProjectManager);
|
|
|
|
|
|
|
|
|
|
TextEditor::TextEditorActionHandler *editorHandler
|
2010-05-25 16:16:04 +02:00
|
|
|
= new TextEditor::TextEditorActionHandler(Constants::C_PROFILEEDITOR,
|
|
|
|
|
TextEditor::TextEditorActionHandler::UnCommentSelection);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
m_proFileEditorFactory = new ProFileEditorFactory(m_qt4ProjectManager, editorHandler);
|
|
|
|
|
addObject(m_proFileEditorFactory);
|
|
|
|
|
|
2009-05-07 20:31:12 +02:00
|
|
|
addAutoReleasedObject(new EmptyProjectWizard);
|
2010-11-24 15:18:50 +01:00
|
|
|
addAutoReleasedObject(new SubdirsProjectWizard);
|
|
|
|
|
addAutoReleasedObject(new GuiAppWizard);
|
|
|
|
|
addAutoReleasedObject(new ConsoleAppWizard);
|
|
|
|
|
addAutoReleasedObject(new MobileAppWizard);
|
2011-02-06 16:23:02 +01:00
|
|
|
addAutoReleasedObject(new QtQuickAppWizard);
|
2011-02-05 23:08:59 +01:00
|
|
|
addAutoReleasedObject(new Html5AppWizard);
|
2010-11-24 15:18:50 +01:00
|
|
|
addAutoReleasedObject(new LibraryWizard);
|
2009-12-16 14:19:34 +01:00
|
|
|
addAutoReleasedObject(new TestWizard);
|
2009-06-29 14:47:04 +02:00
|
|
|
addAutoReleasedObject(new CustomWidgetWizard);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-12 11:20:32 +01:00
|
|
|
CustomQt4ProjectWizard::registerSelf();
|
|
|
|
|
|
2009-04-20 16:25:48 +02:00
|
|
|
addAutoReleasedObject(new QMakeStepFactory);
|
|
|
|
|
addAutoReleasedObject(new MakeStepFactory);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
addAutoReleasedObject(new Qt4RunConfigurationFactory);
|
|
|
|
|
|
2009-05-19 14:54:52 +02:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
|
addAutoReleasedObject(new MacDesignerExternalEditor);
|
|
|
|
|
#else
|
|
|
|
|
addAutoReleasedObject(new DesignerExternalEditor);
|
|
|
|
|
#endif
|
|
|
|
|
addAutoReleasedObject(new LinguistExternalEditor);
|
|
|
|
|
|
2009-05-26 15:31:29 +02:00
|
|
|
addAutoReleasedObject(new S60Manager);
|
2009-10-16 17:33:12 +02:00
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
addAutoReleasedObject(new Qt4DesktopTargetFactory);
|
|
|
|
|
addAutoReleasedObject(new Qt4SimulatorTargetFactory);
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
addAutoReleasedObject(new DesktopQtVersionFactory);
|
|
|
|
|
addAutoReleasedObject(new SimulatorQtVersionFactory);
|
|
|
|
|
addAutoReleasedObject(new WinCeQtVersionFactory);
|
|
|
|
|
|
2011-04-15 16:19:23 +02:00
|
|
|
addAutoReleasedObject(new ProFileCompletionAssistProvider);
|
2010-11-08 14:01:50 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// TODO reenable
|
|
|
|
|
//m_embeddedPropertiesPage = new EmbeddedPropertiesPage;
|
|
|
|
|
//addObject(m_embeddedPropertiesPage);
|
|
|
|
|
|
|
|
|
|
//menus
|
2009-01-14 12:39:59 +01:00
|
|
|
Core::ActionContainer *mbuild =
|
2010-01-13 18:00:02 +01:00
|
|
|
am->actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
|
2009-01-14 12:39:59 +01:00
|
|
|
Core::ActionContainer *mproject =
|
2010-01-13 18:00:02 +01:00
|
|
|
am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
|
|
|
|
|
Core::ActionContainer *msubproject =
|
|
|
|
|
am->actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
//register actions
|
2009-01-14 13:17:53 +01:00
|
|
|
Core::Command *command;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QIcon qmakeIcon(QLatin1String(":/qt4projectmanager/images/run_qmake.png"));
|
|
|
|
|
qmakeIcon.addFile(QLatin1String(":/qt4projectmanager/images/run_qmake_small.png"));
|
|
|
|
|
m_runQMakeAction = new QAction(qmakeIcon, tr("Run qmake"), this);
|
2011-04-12 12:17:19 +02:00
|
|
|
command = am->registerAction(m_runQMakeAction, Constants::RUNQMAKE, projectContext);
|
2011-02-23 15:52:04 +01:00
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
2009-06-23 11:17:06 +02:00
|
|
|
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PROJECT);
|
2008-12-02 12:01:29 +01:00
|
|
|
connect(m_runQMakeAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMake()));
|
|
|
|
|
|
|
|
|
|
m_runQMakeActionContextMenu = new QAction(qmakeIcon, tr("Run qmake"), this);
|
2011-04-12 12:17:19 +02:00
|
|
|
command = am->registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext);
|
2009-09-16 18:37:36 +02:00
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
2008-12-02 12:01:29 +01:00
|
|
|
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
|
2010-01-13 18:00:02 +01:00
|
|
|
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
|
2008-12-02 12:01:29 +01:00
|
|
|
connect(m_runQMakeActionContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMakeContextMenu()));
|
|
|
|
|
|
2010-01-13 18:00:02 +01:00
|
|
|
QIcon buildIcon(ProjectExplorer::Constants::ICON_BUILD);
|
|
|
|
|
buildIcon.addFile(ProjectExplorer::Constants::ICON_BUILD_SMALL);
|
|
|
|
|
m_buildSubProjectContextMenu = new QAction(buildIcon, tr("Build"), this);
|
2011-04-12 12:17:19 +02:00
|
|
|
command = am->registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIR, projectContext);
|
2010-01-13 18:00:02 +01:00
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
|
|
|
|
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
|
|
|
|
|
connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu()));
|
|
|
|
|
|
2010-04-30 11:50:04 +02:00
|
|
|
QIcon rebuildIcon(ProjectExplorer::Constants::ICON_REBUILD);
|
|
|
|
|
rebuildIcon.addFile(ProjectExplorer::Constants::ICON_REBUILD_SMALL);
|
|
|
|
|
m_rebuildSubProjectContextMenu = new QAction(rebuildIcon, tr("Rebuild"), this);
|
2011-04-12 12:17:19 +02:00
|
|
|
command = am->registerAction(m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIR, projectContext);
|
2010-04-30 11:50:04 +02:00
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
|
|
|
|
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
|
|
|
|
|
connect(m_rebuildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(rebuildSubDirContextMenu()));
|
|
|
|
|
|
|
|
|
|
QIcon cleanIcon(ProjectExplorer::Constants::ICON_CLEAN);
|
|
|
|
|
cleanIcon.addFile(ProjectExplorer::Constants::ICON_CLEAN_SMALL);
|
|
|
|
|
m_cleanSubProjectContextMenu = new QAction(cleanIcon, tr("Clean"), this);
|
2011-04-12 12:17:19 +02:00
|
|
|
command = am->registerAction(m_cleanSubProjectContextMenu, Constants::CLEANSUBDIR, projectContext);
|
2010-04-30 11:50:04 +02:00
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
|
|
|
|
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
|
|
|
|
|
connect(m_cleanSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(cleanSubDirContextMenu()));
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
connect(m_projectExplorer,
|
|
|
|
|
SIGNAL(aboutToShowContextMenu(ProjectExplorer::Project*, ProjectExplorer::Node*)),
|
|
|
|
|
this, SLOT(updateContextMenu(ProjectExplorer::Project*, ProjectExplorer::Node*)));
|
|
|
|
|
|
|
|
|
|
connect(m_projectExplorer->buildManager(), SIGNAL(buildStateChanged(ProjectExplorer::Project *)),
|
|
|
|
|
this, SLOT(buildStateChanged(ProjectExplorer::Project *)));
|
|
|
|
|
connect(m_projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project *)),
|
|
|
|
|
this, SLOT(currentProjectChanged()));
|
2011-04-13 13:54:15 +02:00
|
|
|
connect(m_projectExplorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)),
|
|
|
|
|
this, SLOT(currentNodeChanged(ProjectExplorer::Node*)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-25 12:56:16 +02:00
|
|
|
Core::ActionContainer *contextMenu = am->createMenu(Qt4ProjectManager::Constants::M_CONTEXT);
|
2010-05-25 16:16:04 +02:00
|
|
|
|
2010-10-18 12:59:24 +02:00
|
|
|
Core::Context proFileEditorContext = Core::Context(Qt4ProjectManager::Constants::C_PROFILEEDITOR);
|
2010-08-16 18:23:30 +02:00
|
|
|
|
2010-10-14 11:54:29 +02:00
|
|
|
QAction *jumpToFile = new QAction(tr("Jump to File Under Cursor"), this);
|
2011-04-13 13:54:15 +02:00
|
|
|
command = am->registerAction(jumpToFile,
|
2010-10-14 11:54:29 +02:00
|
|
|
Constants::JUMP_TO_FILE, proFileEditorContext);
|
2011-04-13 13:54:15 +02:00
|
|
|
command->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
|
2010-10-14 11:54:29 +02:00
|
|
|
connect(jumpToFile, SIGNAL(triggered()),
|
|
|
|
|
this, SLOT(jumpToFile()));
|
2011-04-13 13:54:15 +02:00
|
|
|
contextMenu->addAction(command);
|
2010-10-14 11:54:29 +02:00
|
|
|
|
2011-04-13 13:54:15 +02:00
|
|
|
m_addLibraryAction = new QAction(tr("Add Library..."), this);
|
|
|
|
|
command = am->registerAction(m_addLibraryAction,
|
2010-08-16 18:23:30 +02:00
|
|
|
Constants::ADDLIBRARY, proFileEditorContext);
|
2011-04-13 13:54:15 +02:00
|
|
|
connect(m_addLibraryAction, SIGNAL(triggered()),
|
|
|
|
|
m_qt4ProjectManager, SLOT(addLibrary()));
|
|
|
|
|
contextMenu->addAction(command);
|
|
|
|
|
|
|
|
|
|
m_addLibraryActionContextMenu = new QAction(tr("Add Library..."), this);
|
|
|
|
|
command = am->registerAction(m_addLibraryActionContextMenu,
|
|
|
|
|
Constants::ADDLIBRARY, projecTreeContext);
|
|
|
|
|
connect(m_addLibraryActionContextMenu, SIGNAL(triggered()),
|
|
|
|
|
m_qt4ProjectManager, SLOT(addLibraryContextMenu()));
|
|
|
|
|
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES);
|
|
|
|
|
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES);
|
2010-08-16 18:23:30 +02:00
|
|
|
|
2010-10-14 11:54:29 +02:00
|
|
|
QAction *separator = new QAction(this);
|
|
|
|
|
separator->setSeparator(true);
|
|
|
|
|
contextMenu->addAction(am->registerAction(separator,
|
|
|
|
|
Core::Id(Constants::SEPARATOR), proFileEditorContext));
|
|
|
|
|
|
2011-04-13 13:54:15 +02:00
|
|
|
command = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
|
|
|
|
|
contextMenu->addAction(command);
|
2010-10-14 11:54:29 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectManagerPlugin::extensionsInitialized()
|
|
|
|
|
{
|
|
|
|
|
m_qt4ProjectManager->init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectManagerPlugin::updateContextMenu(Project *project,
|
|
|
|
|
ProjectExplorer::Node *node)
|
|
|
|
|
{
|
|
|
|
|
m_qt4ProjectManager->setContextProject(project);
|
|
|
|
|
m_qt4ProjectManager->setContextNode(node);
|
|
|
|
|
m_runQMakeActionContextMenu->setEnabled(false);
|
2010-01-13 18:00:02 +01:00
|
|
|
m_buildSubProjectContextMenu->setEnabled(false);
|
2010-04-30 11:50:04 +02:00
|
|
|
m_rebuildSubProjectContextMenu->setEnabled(false);
|
|
|
|
|
m_cleanSubProjectContextMenu->setEnabled(false);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-01-13 18:00:02 +01:00
|
|
|
Qt4ProFileNode *proFileNode = qobject_cast<Qt4ProFileNode *>(node);
|
|
|
|
|
if (qobject_cast<Qt4Project *>(project) && proFileNode) {
|
2009-09-17 13:59:10 +02:00
|
|
|
m_runQMakeActionContextMenu->setVisible(true);
|
2010-01-13 18:00:02 +01:00
|
|
|
m_buildSubProjectContextMenu->setVisible(true);
|
2010-04-30 11:50:04 +02:00
|
|
|
m_rebuildSubProjectContextMenu->setVisible(true);
|
|
|
|
|
m_cleanSubProjectContextMenu->setVisible(true);
|
2010-01-13 18:00:02 +01:00
|
|
|
|
|
|
|
|
if (!m_projectExplorer->buildManager()->isBuilding(project)) {
|
2008-12-02 12:01:29 +01:00
|
|
|
m_runQMakeActionContextMenu->setEnabled(true);
|
2010-01-13 18:00:02 +01:00
|
|
|
m_buildSubProjectContextMenu->setEnabled(true);
|
2010-04-30 11:50:04 +02:00
|
|
|
m_rebuildSubProjectContextMenu->setEnabled(true);
|
|
|
|
|
m_cleanSubProjectContextMenu->setEnabled(true);
|
2010-01-13 18:00:02 +01:00
|
|
|
}
|
2009-09-16 18:37:36 +02:00
|
|
|
} else {
|
|
|
|
|
m_runQMakeActionContextMenu->setVisible(false);
|
2010-01-13 18:00:02 +01:00
|
|
|
m_buildSubProjectContextMenu->setVisible(false);
|
2010-04-30 11:50:04 +02:00
|
|
|
m_rebuildSubProjectContextMenu->setVisible(false);
|
|
|
|
|
m_cleanSubProjectContextMenu->setVisible(false);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectManagerPlugin::currentProjectChanged()
|
|
|
|
|
{
|
|
|
|
|
m_runQMakeAction->setEnabled(!m_projectExplorer->buildManager()->isBuilding(m_projectExplorer->currentProject()));
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-13 13:54:15 +02:00
|
|
|
void Qt4ProjectManagerPlugin::currentNodeChanged(ProjectExplorer::Node *node)
|
|
|
|
|
{
|
|
|
|
|
m_addLibraryActionContextMenu->setEnabled(qobject_cast<Qt4ProFileNode *>(node));
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void Qt4ProjectManagerPlugin::buildStateChanged(ProjectExplorer::Project *pro)
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorer::Project *currentProject = m_projectExplorer->currentProject();
|
|
|
|
|
if (pro == currentProject)
|
|
|
|
|
m_runQMakeAction->setEnabled(!m_projectExplorer->buildManager()->isBuilding(currentProject));
|
|
|
|
|
if (pro == m_qt4ProjectManager->contextProject())
|
|
|
|
|
m_runQMakeActionContextMenu->setEnabled(!m_projectExplorer->buildManager()->isBuilding(pro));
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-14 11:54:29 +02:00
|
|
|
void Qt4ProjectManagerPlugin::jumpToFile()
|
|
|
|
|
{
|
|
|
|
|
Core::EditorManager *em = Core::EditorManager::instance();
|
2011-02-21 16:02:26 +01:00
|
|
|
ProFileEditorWidget *editor = qobject_cast<ProFileEditorWidget*>(em->currentEditor()->widget());
|
2010-10-14 11:54:29 +02:00
|
|
|
if (editor)
|
|
|
|
|
editor->jumpToFile();
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
void Qt4ProjectManagerPlugin::testBasicProjectLoading()
|
|
|
|
|
{
|
|
|
|
|
QString testDirectory = ExtensionSystem::PluginManager::instance()->testDataDirectory() + "/qt4projectmanager/";
|
|
|
|
|
QString test1 = testDirectory + "test1/test1.pro";
|
|
|
|
|
m_projectExplorer->openProject(test1);
|
|
|
|
|
QVERIFY(!m_projectExplorer->session()->projects().isEmpty());
|
|
|
|
|
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_projectExplorer->session()->projects().first());
|
|
|
|
|
QVERIFY(qt4project);
|
|
|
|
|
QVERIFY(qt4project->rootProjectNode()->projectType() == ApplicationTemplate);
|
|
|
|
|
QVERIFY(m_projectExplorer->currentProject() != 0);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Q_EXPORT_PLUGIN(Qt4ProjectManagerPlugin)
|