Rename IRunConfigurationRunner -> IRunControlFactory...

and ApplicationRunConfiguration to LocalApplicationRunConfiguration,
preparing remote debugging. Change the interface canRun() to be const,
run() to create() (since it does not run anything), use references
to the QSharedPointer<Foo>. Introduce d-Pointer and remove
unneeded headers from ProjectExplorerPlugin and add missing includes
everywhere.
This commit is contained in:
Friedemann Kleint
2009-09-25 11:35:44 +02:00
parent e7cef7ef22
commit 978cf4bda8
54 changed files with 868 additions and 719 deletions
@@ -37,6 +37,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -158,8 +158,7 @@ QString CMakeManager::qtVersionForQMake(const QString &qmakePath)
CMakeSettingsPage::CMakeSettingsPage() CMakeSettingsPage::CMakeSettingsPage()
: m_process(0), : m_pathchooser(0), m_process(0)
m_pathchooser(0)
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
QSettings * settings = core->settings(); QSettings * settings = core->settings();
@@ -47,7 +47,7 @@ using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal; using namespace CMakeProjectManager::Internal;
CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory, const QString &title) CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory, const QString &title)
: ProjectExplorer::ApplicationRunConfiguration(pro) : ProjectExplorer::LocalApplicationRunConfiguration(pro)
, m_runMode(Gui) , m_runMode(Gui)
, m_target(target) , m_target(target)
, m_workingDirectory(workingDirectory) , m_workingDirectory(workingDirectory)
@@ -77,7 +77,7 @@ QString CMakeRunConfiguration::executable() const
return m_target; return m_target;
} }
ProjectExplorer::ApplicationRunConfiguration::RunMode CMakeRunConfiguration::runMode() const ProjectExplorer::LocalApplicationRunConfiguration::RunMode CMakeRunConfiguration::runMode() const
{ {
return m_runMode; return m_runMode;
} }
@@ -128,7 +128,7 @@ void CMakeRunConfiguration::setUserWorkingDirectory(const QString &wd)
void CMakeRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const void CMakeRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const
{ {
ProjectExplorer::ApplicationRunConfiguration::save(writer); ProjectExplorer::LocalApplicationRunConfiguration::save(writer);
writer.saveValue("CMakeRunConfiguration.Target", m_target); writer.saveValue("CMakeRunConfiguration.Target", m_target);
writer.saveValue("CMakeRunConfiguration.WorkingDirectory", m_workingDirectory); writer.saveValue("CMakeRunConfiguration.WorkingDirectory", m_workingDirectory);
writer.saveValue("CMakeRunConfiguration.UserWorkingDirectory", m_userWorkingDirectory); writer.saveValue("CMakeRunConfiguration.UserWorkingDirectory", m_userWorkingDirectory);
@@ -142,7 +142,7 @@ void CMakeRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writ
void CMakeRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReader &reader) void CMakeRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReader &reader)
{ {
ProjectExplorer::ApplicationRunConfiguration::restore(reader); ProjectExplorer::LocalApplicationRunConfiguration::restore(reader);
m_target = reader.restoreValue("CMakeRunConfiguration.Target").toString(); m_target = reader.restoreValue("CMakeRunConfiguration.Target").toString();
m_workingDirectory = reader.restoreValue("CMakeRunConfiguration.WorkingDirectory").toString(); m_workingDirectory = reader.restoreValue("CMakeRunConfiguration.WorkingDirectory").toString();
m_userWorkingDirectory = reader.restoreValue("CMakeRunConfiguration.UserWorkingDirectory").toString(); m_userWorkingDirectory = reader.restoreValue("CMakeRunConfiguration.UserWorkingDirectory").toString();
@@ -45,7 +45,7 @@ namespace Internal {
class CMakeProject; class CMakeProject;
class CMakeRunConfiguration : public ProjectExplorer::ApplicationRunConfiguration class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
{ {
friend class CMakeRunConfigurationWidget; friend class CMakeRunConfigurationWidget;
Q_OBJECT Q_OBJECT
+2
View File
@@ -41,6 +41,8 @@
#include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseoutputwindow.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
+17 -17
View File
@@ -773,8 +773,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
//addAutoReleasedObject(m_debugMode); //addAutoReleasedObject(m_debugMode);
// register factory of DebuggerRunControl // register factory of DebuggerRunControl
m_debuggerRunner = new DebuggerRunner(m_manager); m_debuggerRunControlFactory = new DebuggerRunControlFactory(m_manager);
addAutoReleasedObject(m_debuggerRunner); addAutoReleasedObject(m_debuggerRunControlFactory);
QList<int> context; QList<int> context;
context.append(uidm->uniqueIdentifier(Core::Constants::C_EDITORMANAGER)); context.append(uidm->uniqueIdentifier(Core::Constants::C_EDITORMANAGER));
@@ -1231,10 +1231,10 @@ void DebuggerPlugin::startExternalApplication()
RunConfigurationPtr rc = activeRunConfiguration(); RunConfigurationPtr rc = activeRunConfiguration();
if (rc.isNull()) if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration(sp->executable); rc = DebuggerRunControlFactory::createDefaultRunConfiguration(sp->executable);
if (RunControl *runControl = m_debuggerRunner if (RunControl *runControl = m_debuggerRunControlFactory
->run(rc, ProjectExplorer::Constants::DEBUGMODE, sp)) ->create(rc, ProjectExplorer::Constants::DEBUGMODE, sp))
runControl->start(); runControl->start();
} }
@@ -1257,9 +1257,9 @@ void DebuggerPlugin::attachExternalApplication(qint64 pid, const QString &crashP
sp->startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal; sp->startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
RunConfigurationPtr rc = activeRunConfiguration(); RunConfigurationPtr rc = activeRunConfiguration();
if (rc.isNull()) if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration(); rc = DebuggerRunControlFactory::createDefaultRunConfiguration();
if (RunControl *runControl = m_debuggerRunner if (RunControl *runControl = m_debuggerRunControlFactory
->run(rc, ProjectExplorer::Constants::DEBUGMODE, sp)) ->create(rc, ProjectExplorer::Constants::DEBUGMODE, sp))
runControl->start(); runControl->start();
} }
@@ -1282,9 +1282,9 @@ void DebuggerPlugin::attachCore()
sp->startMode = AttachCore; sp->startMode = AttachCore;
RunConfigurationPtr rc = activeRunConfiguration(); RunConfigurationPtr rc = activeRunConfiguration();
if (rc.isNull()) if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration(); rc = DebuggerRunControlFactory::createDefaultRunConfiguration();
if (RunControl *runControl = m_debuggerRunner if (RunControl *runControl = m_debuggerRunControlFactory
->run(rc, ProjectExplorer::Constants::DEBUGMODE, sp)) ->create(rc, ProjectExplorer::Constants::DEBUGMODE, sp))
runControl->start(); runControl->start();
} }
@@ -1318,9 +1318,9 @@ void DebuggerPlugin::startRemoteApplication()
RunConfigurationPtr rc = activeRunConfiguration(); RunConfigurationPtr rc = activeRunConfiguration();
if (rc.isNull()) if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration(); rc = DebuggerRunControlFactory::createDefaultRunConfiguration();
if (RunControl *runControl = m_debuggerRunner if (RunControl *runControl = m_debuggerRunControlFactory
->run(rc, ProjectExplorer::Constants::DEBUGMODE, sp)) ->create(rc, ProjectExplorer::Constants::DEBUGMODE, sp))
runControl->start(); runControl->start();
} }
@@ -1354,9 +1354,9 @@ void DebuggerPlugin::attachRemoteTcf()
RunConfigurationPtr rc = activeRunConfiguration(); RunConfigurationPtr rc = activeRunConfiguration();
if (rc.isNull()) if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration(); rc = DebuggerRunControlFactory::createDefaultRunConfiguration();
if (RunControl *runControl = m_debuggerRunner if (RunControl *runControl = m_debuggerRunControlFactory
->run(rc, ProjectExplorer::Constants::DEBUGMODE, sp)) ->create(rc, ProjectExplorer::Constants::DEBUGMODE, sp))
runControl->start(); runControl->start();
} }
+2 -2
View File
@@ -59,7 +59,7 @@ namespace Internal {
class BreakpointData; class BreakpointData;
class DebuggerManager; class DebuggerManager;
class DebuggerRunner; class DebuggerRunControlFactory;
class DebugMode; class DebugMode;
class DisassemblerViewAgent; class DisassemblerViewAgent;
struct StackFrame; struct StackFrame;
@@ -126,7 +126,7 @@ private:
DebuggerManager *m_manager; DebuggerManager *m_manager;
DebugMode *m_debugMode; DebugMode *m_debugMode;
DebuggerRunner *m_debuggerRunner; DebuggerRunControlFactory *m_debuggerRunControlFactory;
QString m_previousMode; QString m_previousMode;
TextEditor::BaseTextMark *m_locationMark; TextEditor::BaseTextMark *m_locationMark;
+21 -21
View File
@@ -48,61 +48,61 @@ namespace Internal {
using ProjectExplorer::RunConfiguration; using ProjectExplorer::RunConfiguration;
using ProjectExplorer::RunControl; using ProjectExplorer::RunControl;
using ProjectExplorer::ApplicationRunConfiguration; using ProjectExplorer::LocalApplicationRunConfiguration;
DefaultApplicationRunConfiguration::DefaultApplicationRunConfiguration(const QString &executable) : DefaultLocalApplicationRunConfiguration::DefaultLocalApplicationRunConfiguration(const QString &executable) :
ProjectExplorer::ApplicationRunConfiguration(0), ProjectExplorer::LocalApplicationRunConfiguration(0),
m_executable(executable) m_executable(executable)
{ {
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// //
// DebuggerRunner // DebuggerRunControlFactory
// //
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// A factory to create DebuggerRunControls // A factory to create DebuggerRunControls
DebuggerRunner::DebuggerRunner(DebuggerManager *manager) DebuggerRunControlFactory::DebuggerRunControlFactory(DebuggerManager *manager)
: m_manager(manager) : m_manager(manager)
{} {}
bool DebuggerRunner::canRun(RunConfigurationPtr runConfiguration, const QString &mode) bool DebuggerRunControlFactory::canRun(const RunConfigurationPtr &runConfiguration, const QString &mode) const
{ {
return mode == ProjectExplorer::Constants::DEBUGMODE return mode == ProjectExplorer::Constants::DEBUGMODE
&& !runConfiguration.objectCast<ApplicationRunConfiguration>().isNull(); && !runConfiguration.objectCast<LocalApplicationRunConfiguration>().isNull();
} }
QString DebuggerRunner::displayName() const QString DebuggerRunControlFactory::displayName() const
{ {
return tr("Debug"); return tr("Debug");
} }
RunConfigurationPtr DebuggerRunner::createDefaultRunConfiguration(const QString &executable) RunConfigurationPtr DebuggerRunControlFactory::createDefaultRunConfiguration(const QString &executable)
{ {
return RunConfigurationPtr(new DefaultApplicationRunConfiguration(executable)); return RunConfigurationPtr(new DefaultLocalApplicationRunConfiguration(executable));
} }
RunControl *DebuggerRunner::run(RunConfigurationPtr runConfiguration, RunControl *DebuggerRunControlFactory::create(const RunConfigurationPtr &runConfiguration,
const QString &mode, const QString &mode,
const DebuggerStartParametersPtr &sp) const DebuggerStartParametersPtr &sp)
{ {
QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0); QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
ApplicationRunConfigurationPtr rc = LocalApplicationRunConfigurationPtr rc =
runConfiguration.objectCast<ApplicationRunConfiguration>(); runConfiguration.objectCast<LocalApplicationRunConfiguration>();
QTC_ASSERT(!rc.isNull(), return 0); QTC_ASSERT(!rc.isNull(), return 0);
return new DebuggerRunControl(m_manager, sp, rc); return new DebuggerRunControl(m_manager, sp, rc);
} }
RunControl *DebuggerRunner::run(RunConfigurationPtr runConfiguration, RunControl *DebuggerRunControlFactory::create(const RunConfigurationPtr &runConfiguration,
const QString &mode) const QString &mode)
{ {
const DebuggerStartParametersPtr sp(new DebuggerStartParameters); const DebuggerStartParametersPtr sp(new DebuggerStartParameters);
sp->startMode = StartInternal; sp->startMode = StartInternal;
return run(runConfiguration, mode, sp); return create(runConfiguration, mode, sp);
} }
QWidget *DebuggerRunner::configurationWidget(RunConfigurationPtr runConfiguration) QWidget *DebuggerRunControlFactory::configurationWidget(const RunConfigurationPtr &runConfiguration)
{ {
// NBS TODO: Add GDB-specific configuration widget // NBS TODO: Add GDB-specific configuration widget
Q_UNUSED(runConfiguration) Q_UNUSED(runConfiguration)
@@ -120,7 +120,7 @@ QWidget *DebuggerRunner::configurationWidget(RunConfigurationPtr runConfiguratio
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
const DebuggerStartParametersPtr &startParameters, const DebuggerStartParametersPtr &startParameters,
QSharedPointer<ApplicationRunConfiguration> runConfiguration) QSharedPointer<LocalApplicationRunConfiguration> runConfiguration)
: RunControl(runConfiguration), : RunControl(runConfiguration),
m_startParameters(startParameters), m_startParameters(startParameters),
m_manager(manager), m_manager(manager),
@@ -164,7 +164,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
project->buildDirectory(project->activeBuildConfiguration()); project->buildDirectory(project->activeBuildConfiguration());
} }
m_startParameters->useTerminal = m_startParameters->useTerminal =
runConfiguration->runMode() == ApplicationRunConfiguration::Console; runConfiguration->runMode() == LocalApplicationRunConfiguration::Console;
m_startParameters->dumperLibrary = m_startParameters->dumperLibrary =
runConfiguration->dumperLibrary(); runConfiguration->dumperLibrary();
m_startParameters->dumperLibraryLocations = m_startParameters->dumperLibraryLocations =
+18 -18
View File
@@ -36,7 +36,7 @@
#include <projectexplorer/applicationrunconfiguration.h> #include <projectexplorer/applicationrunconfiguration.h>
namespace ProjectExplorer { namespace ProjectExplorer {
class ApplicationRunConfiguration; class LocalApplicationRunConfiguration;
} }
namespace Debugger { namespace Debugger {
@@ -48,28 +48,28 @@ class StartData;
typedef QSharedPointer<ProjectExplorer::RunConfiguration> typedef QSharedPointer<ProjectExplorer::RunConfiguration>
RunConfigurationPtr; RunConfigurationPtr;
typedef QSharedPointer<ProjectExplorer::ApplicationRunConfiguration> typedef QSharedPointer<ProjectExplorer::LocalApplicationRunConfiguration>
ApplicationRunConfigurationPtr; LocalApplicationRunConfigurationPtr;
class DebuggerRunner class DebuggerRunControlFactory
: public ProjectExplorer::IRunConfigurationRunner : public ProjectExplorer::IRunControlFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DebuggerRunner(DebuggerManager *manager); explicit DebuggerRunControlFactory(DebuggerManager *manager);
// ProjectExplorer::IRunConfigurationRunner // ProjectExplorer::IRunControlFactory
bool canRun(RunConfigurationPtr runConfiguration, const QString &mode); bool canRun(const RunConfigurationPtr &runConfiguration, const QString &mode) const;
virtual ProjectExplorer::RunControl *run(RunConfigurationPtr runConfiguration, virtual ProjectExplorer::RunControl *create(const RunConfigurationPtr &runConfiguration,
const QString &mode); const QString &mode);
virtual QString displayName() const; virtual QString displayName() const;
virtual QWidget *configurationWidget(RunConfigurationPtr runConfiguration); virtual QWidget *configurationWidget(const RunConfigurationPtr &runConfiguration);
virtual ProjectExplorer::RunControl *run(RunConfigurationPtr runConfiguration, virtual ProjectExplorer::RunControl *create(const RunConfigurationPtr &runConfiguration,
const QString &mode, const QString &mode,
const DebuggerStartParametersPtr &sp); const DebuggerStartParametersPtr &sp);
static RunConfigurationPtr createDefaultRunConfiguration(const QString &executable = QString()); static RunConfigurationPtr createDefaultRunConfiguration(const QString &executable = QString());
@@ -87,7 +87,7 @@ class DebuggerRunControl
public: public:
DebuggerRunControl(DebuggerManager *manager, DebuggerRunControl(DebuggerManager *manager,
const DebuggerStartParametersPtr &startParamters, const DebuggerStartParametersPtr &startParamters,
ApplicationRunConfigurationPtr runConfiguration); LocalApplicationRunConfigurationPtr runConfiguration);
// ProjectExplorer::RunControl // ProjectExplorer::RunControl
virtual void start(); virtual void start();
@@ -111,12 +111,12 @@ private:
// A default run configuration for external executables or attaching to // A default run configuration for external executables or attaching to
// running processes by id. // running processes by id.
class DefaultApplicationRunConfiguration class DefaultLocalApplicationRunConfiguration
: public ProjectExplorer::ApplicationRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DefaultApplicationRunConfiguration(const QString &executable = QString()); explicit DefaultLocalApplicationRunConfiguration(const QString &executable = QString());
virtual QString executable() const { return m_executable; } virtual QString executable() const { return m_executable; }
virtual RunMode runMode() const { return Gui; } virtual RunMode runMode() const { return Gui; }
@@ -37,6 +37,8 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <projectexplorer/nodesvisitor.h> #include <projectexplorer/nodesvisitor.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
+4
View File
@@ -48,9 +48,13 @@
#include <vcsbase/vcsbaseeditor.h> #include <vcsbase/vcsbaseeditor.h>
#include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseoutputwindow.h>
#include <projectexplorer/environment.h>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
#include <QtCore/QTemporaryFile> #include <QtCore/QTemporaryFile>
#include <QtCore/QTime> #include <QtCore/QTime>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtGui/QMainWindow> // for msg box parent #include <QtGui/QMainWindow> // for msg box parent
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
+10 -9
View File
@@ -56,6 +56,9 @@
#include <vcsbase/basevcssubmiteditorfactory.h> #include <vcsbase/basevcssubmiteditorfactory.h>
#include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseoutputwindow.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
@@ -138,7 +141,6 @@ GitPlugin::GitPlugin() :
m_stashPopAction(0), m_stashPopAction(0),
m_stashListAction(0), m_stashListAction(0),
m_branchListAction(0), m_branchListAction(0),
m_projectExplorer(0),
m_gitClient(0), m_gitClient(0),
m_changeSelectionDialog(0), m_changeSelectionDialog(0),
m_submitActionTriggered(false) m_submitActionTriggered(false)
@@ -418,7 +420,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
void GitPlugin::extensionsInitialized() void GitPlugin::extensionsInitialized()
{ {
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
} }
void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged) void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged)
@@ -452,9 +453,10 @@ QFileInfo GitPlugin::currentFile() const
QString GitPlugin::getWorkingDirectory() QString GitPlugin::getWorkingDirectory()
{ {
QString workingDirectory; QString workingDirectory;
if (m_projectExplorer && m_projectExplorer->currentNode()) { if (const ProjectExplorer::ProjectExplorerPlugin *p = ProjectExplorer::ProjectExplorerPlugin::instance())
workingDirectory = QFileInfo(m_projectExplorer->currentNode()->path()).absolutePath(); if (p && p->currentNode())
} workingDirectory = QFileInfo(p->currentNode()->path()).absolutePath();
if (Git::Constants::debug > 1) if (Git::Constants::debug > 1)
qDebug() << Q_FUNC_INFO << "Project" << workingDirectory; qDebug() << Q_FUNC_INFO << "Project" << workingDirectory;
@@ -795,11 +797,10 @@ void GitPlugin::updateActions()
// We only know the file is in some repository, we do not know // We only know the file is in some repository, we do not know
// anything about any project so far. // anything about any project so far.
using namespace ProjectExplorer;
QString project; QString project;
if (m_projectExplorer) { if (const ProjectExplorer::ProjectExplorerPlugin *p = ProjectExplorer::ProjectExplorerPlugin::instance()) {
if (const Node *node = m_projectExplorer->currentNode()) if (const ProjectExplorer::Node *node = p->currentNode())
if (const Node *projectNode = node->projectNode()) if (const ProjectExplorer::Node *projectNode = node->projectNode())
project = QFileInfo(projectNode->path()).completeBaseName(); project = QFileInfo(projectNode->path()).completeBaseName();
} }
+3 -4
View File
@@ -35,7 +35,6 @@
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/icorelistener.h> #include <coreplugin/icorelistener.h>
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <projectexplorer/projectexplorer.h>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QProcess> #include <QtCore/QProcess>
@@ -44,6 +43,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QFile; class QFile;
class QAction; class QAction;
class QFileInfo;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
@@ -87,8 +87,8 @@ public:
static GitPlugin *instance(); static GitPlugin *instance();
bool initialize(const QStringList &arguments, QString *error_message); virtual bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized(); virtual void extensionsInitialized();
QString getWorkingDirectory(); QString getWorkingDirectory();
@@ -160,7 +160,6 @@ private:
QAction *m_stashListAction; QAction *m_stashListAction;
QAction *m_branchListAction; QAction *m_branchListAction;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
GitClient *m_gitClient; GitClient *m_gitClient;
ChangeSelectionDialog *m_changeSelectionDialog; ChangeSelectionDialog *m_changeSelectionDialog;
QString m_submitRepository; QString m_submitRepository;
+1
View File
@@ -34,6 +34,7 @@
#include <vcsbase/vcsbaseconstants.h> #include <vcsbase/vcsbaseconstants.h>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
+2
View File
@@ -52,6 +52,8 @@
#include <vcsbase/basevcssubmiteditorfactory.h> #include <vcsbase/basevcssubmiteditorfactory.h>
#include <vcsbase/vcsbaseeditor.h> #include <vcsbase/vcsbaseeditor.h>
#include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseoutputwindow.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -30,6 +30,7 @@
#include "allprojectsfind.h" #include "allprojectsfind.h"
#include "project.h" #include "project.h"
#include "session.h"
#include "projectexplorer.h" #include "projectexplorer.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -42,64 +42,60 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal; using namespace ProjectExplorer::Internal;
/// ApplicationRunConfiguration /// LocalApplicationRunConfiguration
ApplicationRunConfiguration::ApplicationRunConfiguration(Project *pro) LocalApplicationRunConfiguration::LocalApplicationRunConfiguration(Project *pro)
: RunConfiguration(pro) : RunConfiguration(pro)
{ {
} }
ApplicationRunConfiguration::~ApplicationRunConfiguration() LocalApplicationRunConfiguration::~LocalApplicationRunConfiguration()
{ {
} }
QString ApplicationRunConfiguration::type() const QString LocalApplicationRunConfiguration::type() const
{ {
return "ProjectExplorer.ApplicationRunConfiguration"; return "ProjectExplorer.LocalApplicationRunConfiguration";
} }
void ApplicationRunConfiguration::save(PersistentSettingsWriter &writer) const void LocalApplicationRunConfiguration::save(PersistentSettingsWriter &writer) const
{ {
RunConfiguration::save(writer); RunConfiguration::save(writer);
} }
void ApplicationRunConfiguration::restore(const PersistentSettingsReader &reader) void LocalApplicationRunConfiguration::restore(const PersistentSettingsReader &reader)
{ {
RunConfiguration::restore(reader); RunConfiguration::restore(reader);
} }
/// ApplicationRunConfigurationRunner /// LocalApplicationRunControlFactory
ApplicationRunConfigurationRunner::ApplicationRunConfigurationRunner() LocalApplicationRunControlFactory::LocalApplicationRunControlFactory()
{ {
} }
ApplicationRunConfigurationRunner::~ApplicationRunConfigurationRunner() LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
{ {
} }
bool ApplicationRunConfigurationRunner::canRun(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) bool LocalApplicationRunControlFactory::canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const
{ {
return (mode == ProjectExplorer::Constants::RUNMODE) return (mode == ProjectExplorer::Constants::RUNMODE)
&& (!runConfiguration.objectCast<ApplicationRunConfiguration>().isNull()); && (!runConfiguration.objectCast<LocalApplicationRunConfiguration>().isNull());
} }
QString ApplicationRunConfigurationRunner::displayName() const QString LocalApplicationRunControlFactory::displayName() const
{ {
return tr("Run"); return tr("Run");
} }
RunControl *ApplicationRunConfigurationRunner::run(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) RunControl *LocalApplicationRunControlFactory::create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode)
{ {
QSharedPointer<ApplicationRunConfiguration> rc = runConfiguration.objectCast<ApplicationRunConfiguration>(); QTC_ASSERT(canRun(runConfiguration, mode), return 0);
Q_ASSERT(!rc.isNull()); return new LocalApplicationRunControl(runConfiguration.objectCast<LocalApplicationRunConfiguration>());
Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE);
ApplicationRunControl *runControl = new ApplicationRunControl(rc);
return runControl;
} }
QWidget *ApplicationRunConfigurationRunner::configurationWidget(QSharedPointer<RunConfiguration> runConfiguration) QWidget *LocalApplicationRunControlFactory::configurationWidget(const QSharedPointer<RunConfiguration> &runConfiguration)
{ {
Q_UNUSED(runConfiguration) Q_UNUSED(runConfiguration)
return new QLabel("TODO add Configuration widget"); return new QLabel("TODO add Configuration widget");
@@ -107,7 +103,7 @@ QWidget *ApplicationRunConfigurationRunner::configurationWidget(QSharedPointer<R
// ApplicationRunControl // ApplicationRunControl
ApplicationRunControl::ApplicationRunControl(QSharedPointer<ApplicationRunConfiguration> runConfiguration) LocalApplicationRunControl::LocalApplicationRunControl(const QSharedPointer<LocalApplicationRunConfiguration> &runConfiguration)
: RunControl(runConfiguration) : RunControl(runConfiguration)
{ {
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)), connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
@@ -120,13 +116,13 @@ ApplicationRunControl::ApplicationRunControl(QSharedPointer<ApplicationRunConfig
this, SLOT(bringApplicationToForeground(qint64))); this, SLOT(bringApplicationToForeground(qint64)));
} }
ApplicationRunControl::~ApplicationRunControl() LocalApplicationRunControl::~LocalApplicationRunControl()
{ {
} }
void ApplicationRunControl::start() void LocalApplicationRunControl::start()
{ {
QSharedPointer<ApplicationRunConfiguration> rc = runConfiguration().objectCast<ApplicationRunConfiguration>(); QSharedPointer<LocalApplicationRunConfiguration> rc = runConfiguration().objectCast<LocalApplicationRunConfiguration>();
Q_ASSERT(!rc.isNull()); Q_ASSERT(!rc.isNull());
m_applicationLauncher.setEnvironment(rc->environment().toStringList()); m_applicationLauncher.setEnvironment(rc->environment().toStringList());
@@ -141,28 +137,28 @@ void ApplicationRunControl::start()
emit addToOutputWindow(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable))); emit addToOutputWindow(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)));
} }
void ApplicationRunControl::stop() void LocalApplicationRunControl::stop()
{ {
m_applicationLauncher.stop(); m_applicationLauncher.stop();
} }
bool ApplicationRunControl::isRunning() const bool LocalApplicationRunControl::isRunning() const
{ {
return m_applicationLauncher.isRunning(); return m_applicationLauncher.isRunning();
} }
void ApplicationRunControl::slotError(const QString & err) void LocalApplicationRunControl::slotError(const QString & err)
{ {
emit error(this, err); emit error(this, err);
emit finished(); emit finished();
} }
void ApplicationRunControl::slotAddToOutputWindow(const QString &line) void LocalApplicationRunControl::slotAddToOutputWindow(const QString &line)
{ {
emit addToOutputWindowInline(this, line); emit addToOutputWindowInline(this, line);
} }
void ApplicationRunControl::processExited(int exitCode) void LocalApplicationRunControl::processExited(int exitCode)
{ {
emit addToOutputWindow(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode)); emit addToOutputWindow(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode));
emit finished(); emit finished();
@@ -39,7 +39,7 @@ namespace ProjectExplorer {
class Environment; class Environment;
class PROJECTEXPLORER_EXPORT ApplicationRunConfiguration : public RunConfiguration class PROJECTEXPLORER_EXPORT LocalApplicationRunConfiguration : public RunConfiguration
{ {
Q_OBJECT Q_OBJECT
public: public:
@@ -48,8 +48,8 @@ public:
Gui Gui
}; };
ApplicationRunConfiguration(Project *pro); LocalApplicationRunConfiguration(Project *pro);
virtual ~ApplicationRunConfiguration(); virtual ~LocalApplicationRunConfiguration();
virtual QString type() const; virtual QString type() const;
virtual QString executable() const = 0; virtual QString executable() const = 0;
virtual RunMode runMode() const = 0; virtual RunMode runMode() const = 0;
@@ -66,24 +66,24 @@ public:
namespace Internal { namespace Internal {
class ApplicationRunConfigurationRunner : public IRunConfigurationRunner class LocalApplicationRunControlFactory : public IRunControlFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
ApplicationRunConfigurationRunner(); LocalApplicationRunControlFactory ();
virtual ~ApplicationRunConfigurationRunner(); virtual ~LocalApplicationRunControlFactory();
virtual bool canRun(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode); virtual bool canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const;
virtual QString displayName() const; virtual QString displayName() const;
virtual RunControl* run(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode); virtual RunControl* create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode);
virtual QWidget *configurationWidget(QSharedPointer<RunConfiguration> runConfiguration); virtual QWidget *configurationWidget(const QSharedPointer<RunConfiguration> &runConfiguration);
}; };
class ApplicationRunControl : public RunControl class LocalApplicationRunControl : public RunControl
{ {
Q_OBJECT Q_OBJECT
public: public:
ApplicationRunControl(QSharedPointer<ApplicationRunConfiguration> runConfiguration); LocalApplicationRunControl(const QSharedPointer<LocalApplicationRunConfiguration> &runConfiguration);
virtual ~ApplicationRunControl(); virtual ~LocalApplicationRunControl();
virtual void start(); virtual void start();
virtual void stop(); virtual void stop();
virtual bool isRunning() const; virtual bool isRunning() const;
@@ -34,6 +34,7 @@
#include "compileoutputwindow.h" #include "compileoutputwindow.h"
#include "projectexplorerconstants.h" #include "projectexplorerconstants.h"
#include "projectexplorer.h" #include "projectexplorer.h"
#include "projectexplorersettings.h"
#include "taskwindow.h" #include "taskwindow.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -28,6 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "cesdkhandler.h" #include "cesdkhandler.h"
#include "environment.h"
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -39,6 +39,7 @@
#define VSINSTALL_MACRO "$(VSInstallDir)" #define VSINSTALL_MACRO "$(VSInstallDir)"
namespace ProjectExplorer { namespace ProjectExplorer {
class Environment;
class PROJECTEXPLORER_EXPORT CeSdkInfo class PROJECTEXPLORER_EXPORT CeSdkInfo
{ {
@@ -0,0 +1,61 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "corelistenercheckingforrunningbuild.h"
#include "buildmanager.h"
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
namespace ProjectExplorer {
namespace Internal {
CoreListenerCheckingForRunningBuild::CoreListenerCheckingForRunningBuild(BuildManager *manager)
: Core::ICoreListener(0), m_manager(manager)
{
}
bool CoreListenerCheckingForRunningBuild::coreAboutToClose()
{
if (m_manager->isBuilding()) {
QMessageBox box;
QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Close"), QMessageBox::AcceptRole);
QPushButton *cancelClose = box.addButton(tr("Don't Close"), QMessageBox::RejectRole);
box.setDefaultButton(cancelClose);
box.setWindowTitle(tr("Close Qt Creator?"));
box.setText(tr("A project is currently being built."));
box.setInformativeText(tr("Do you want to cancel the build process and close Qt Creator anyway?"));
box.exec();
return (box.clickedButton() == closeAnyway);
}
return true;
}
}
}
@@ -0,0 +1,56 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef CORELISTENERCHECKINGFORRUNNINGBUILD_H
#define CORELISTENERCHECKINGFORRUNNINGBUILD_H
#include <coreplugin/icorelistener.h>
namespace ProjectExplorer {
class BuildManager;
namespace Internal {
class CoreListenerCheckingForRunningBuild : public Core::ICoreListener
{
Q_OBJECT
public:
explicit CoreListenerCheckingForRunningBuild(BuildManager *manager);
bool coreAboutToClose();
private:
BuildManager *m_manager;
};
} // namespace Internal
} // namespace ProjectExplorer
#endif // CORELISTENERCHECKINGFORRUNNINGBUILD_H
@@ -225,8 +225,8 @@ void CustomExecutableConfigurationWidget::setUserName(const QString &name)
void CustomExecutableConfigurationWidget::termToggled(bool on) void CustomExecutableConfigurationWidget::termToggled(bool on)
{ {
m_ignoreChange = true; m_ignoreChange = true;
m_runConfiguration->setRunMode(on ? ApplicationRunConfiguration::Console m_runConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console
: ApplicationRunConfiguration::Gui); : LocalApplicationRunConfiguration::Gui);
m_ignoreChange = false; m_ignoreChange = false;
} }
@@ -246,12 +246,12 @@ void CustomExecutableConfigurationWidget::changed()
m_executableChooser->setPath(executable); m_executableChooser->setPath(executable);
m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments())); m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory()); m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == ApplicationRunConfiguration::Console); m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console);
m_userName->setText(m_runConfiguration->userName()); m_userName->setText(m_runConfiguration->userName());
} }
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro) CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)
: ApplicationRunConfiguration(pro), : LocalApplicationRunConfiguration(pro),
m_runMode(Gui), m_runMode(Gui),
m_userSetName(false), m_userSetName(false),
m_baseEnvironmentBase(CustomExecutableRunConfiguration::BuildEnvironmentBase) m_baseEnvironmentBase(CustomExecutableRunConfiguration::BuildEnvironmentBase)
@@ -326,7 +326,7 @@ QString CustomExecutableRunConfiguration::executable() const
return exec; return exec;
} }
ApplicationRunConfiguration::RunMode CustomExecutableRunConfiguration::runMode() const LocalApplicationRunConfiguration::RunMode CustomExecutableRunConfiguration::runMode() const
{ {
return m_runMode; return m_runMode;
} }
@@ -405,7 +405,7 @@ void CustomExecutableRunConfiguration::save(PersistentSettingsWriter &writer) co
writer.saveValue("UserName", m_userName); writer.saveValue("UserName", m_userName);
writer.saveValue("UserEnvironmentChanges", ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges)); writer.saveValue("UserEnvironmentChanges", ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges));
writer.saveValue("BaseEnvironmentBase", m_baseEnvironmentBase); writer.saveValue("BaseEnvironmentBase", m_baseEnvironmentBase);
ApplicationRunConfiguration::save(writer); LocalApplicationRunConfiguration::save(writer);
} }
void CustomExecutableRunConfiguration::restore(const PersistentSettingsReader &reader) void CustomExecutableRunConfiguration::restore(const PersistentSettingsReader &reader)
@@ -417,7 +417,7 @@ void CustomExecutableRunConfiguration::restore(const PersistentSettingsReader &r
m_userSetName = reader.restoreValue("UserSetName").toBool(); m_userSetName = reader.restoreValue("UserSetName").toBool();
m_userName = reader.restoreValue("UserName").toString(); m_userName = reader.restoreValue("UserName").toString();
m_userEnvironmentChanges = ProjectExplorer::EnvironmentItem::fromStringList(reader.restoreValue("UserEnvironmentChanges").toStringList()); m_userEnvironmentChanges = ProjectExplorer::EnvironmentItem::fromStringList(reader.restoreValue("UserEnvironmentChanges").toStringList());
ApplicationRunConfiguration::restore(reader); LocalApplicationRunConfiguration::restore(reader);
QVariant tmp = reader.restoreValue("BaseEnvironmentBase"); QVariant tmp = reader.restoreValue("BaseEnvironmentBase");
m_baseEnvironmentBase = tmp.isValid() ? BaseEnvironmentBase(tmp.toInt()) : CustomExecutableRunConfiguration::BuildEnvironmentBase; m_baseEnvironmentBase = tmp.isValid() ? BaseEnvironmentBase(tmp.toInt()) : CustomExecutableRunConfiguration::BuildEnvironmentBase;
} }
@@ -49,7 +49,7 @@ namespace Internal {
class CustomExecutableConfigurationWidget; class CustomExecutableConfigurationWidget;
} }
class PROJECTEXPLORER_EXPORT CustomExecutableRunConfiguration : public ApplicationRunConfiguration class PROJECTEXPLORER_EXPORT CustomExecutableRunConfiguration : public LocalApplicationRunConfiguration
{ {
// the configuration widget needs to setExecutable setWorkingDirectory and setCommandLineArguments // the configuration widget needs to setExecutable setWorkingDirectory and setCommandLineArguments
friend class Internal::CustomExecutableConfigurationWidget; friend class Internal::CustomExecutableConfigurationWidget;
@@ -78,7 +78,7 @@ public:
*/ */
QString userName() const; QString userName() const;
virtual ApplicationRunConfiguration::RunMode runMode() const; virtual LocalApplicationRunConfiguration::RunMode runMode() const;
virtual QString workingDirectory() const; virtual QString workingDirectory() const;
QString baseWorkingDirectory() const; QString baseWorkingDirectory() const;
virtual QStringList commandLineArguments() const; virtual QStringList commandLineArguments() const;
@@ -29,8 +29,10 @@
#include "pluginfilefactory.h" #include "pluginfilefactory.h"
#include "projectexplorer.h" #include "projectexplorer.h"
#include "project.h"
#include "projectexplorerconstants.h" #include "projectexplorerconstants.h"
#include "iprojectmanager.h" #include "iprojectmanager.h"
#include "session.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
File diff suppressed because it is too large Load Diff
+15 -121
View File
@@ -30,21 +30,16 @@
#ifndef PROJECTEXPLORER_H #ifndef PROJECTEXPLORER_H
#define PROJECTEXPLORER_H #define PROJECTEXPLORER_H
#include "project.h"
#include "session.h"
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <coreplugin/icorelistener.h>
#include <QtCore/QObject>
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
#include <QtCore/QList>
#include <QtCore/QQueue> QT_BEGIN_NAMESPACE
#include <QtCore/QModelIndex> class QPoint;
#include <QtGui/QMenu> class QAction;
#include <QtGui/QTreeWidget> QT_END_NAMESPACE
#include <QtGui/QTreeWidgetItem>
namespace Core { namespace Core {
class IContext; class IContext;
@@ -55,42 +50,22 @@ class IFileFactory;
} }
} }
namespace Welcome {
class WelcomeMode;
}
namespace ProjectExplorer { namespace ProjectExplorer {
class BuildManager; class BuildManager;
class PersistentSettings;
class RunConfiguration;
class RunControl; class RunControl;
class SessionManager; class SessionManager;
class IRunConfigurationRunner; class RunConfiguration;
class IRunControlFactory;
class Project;
class Node;
namespace Internal { namespace Internal {
class ApplicationOutput;
class OutputPane;
class ProjectWindow;
class ProjectFileFactory; class ProjectFileFactory;
class ProjectWelcomePage; struct ProjectExplorerSettings;
class ProjectWelcomePageWidget;
struct ProjectExplorerSettings
{
bool buildBeforeRun;
bool saveBeforeBuild;
bool showCompilerOutput;
bool useJom;
bool operator==(const ProjectExplorerSettings &other) {
return this->buildBeforeRun == other.buildBeforeRun
&& this->saveBeforeBuild == other.saveBeforeBuild
&& this->showCompilerOutput == other.showCompilerOutput
&& this->useJom == other.useJom;
}
};
} // namespace Internal } // namespace Internal
struct ProjectExplorerPluginPrivate;
class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin
: public ExtensionSystem::IPlugin : public ExtensionSystem::IPlugin
{ {
@@ -210,11 +185,11 @@ private slots:
private: private:
void runProjectImpl(Project *pro); void runProjectImpl(Project *pro);
void executeRunConfiguration(QSharedPointer<RunConfiguration>, const QString &mode); void executeRunConfiguration(const QSharedPointer<RunConfiguration> &, const QString &mode);
void setCurrent(Project *project, QString filePath, Node *node); void setCurrent(Project *project, QString filePath, Node *node);
QStringList allFilesWithDependencies(Project *pro); QStringList allFilesWithDependencies(Project *pro);
IRunConfigurationRunner *findRunner(QSharedPointer<RunConfiguration> config, const QString &mode); IRunControlFactory *findRunControlFactory(const QSharedPointer<RunConfiguration> &config, const QString &mode);
void updateActions(); void updateActions();
void addToRecentProjects(const QString &fileName, const QString &displayName); void addToRecentProjects(const QString &fileName, const QString &displayName);
@@ -222,90 +197,9 @@ private:
Internal::ProjectFileFactory *findProjectFileFactory(const QString &filename) const; Internal::ProjectFileFactory *findProjectFileFactory(const QString &filename) const;
static ProjectExplorerPlugin *m_instance; static ProjectExplorerPlugin *m_instance;
ProjectExplorerPluginPrivate *d;
QMenu *m_sessionContextMenu;
QMenu *m_sessionMenu;
QMenu *m_projectMenu;
QMenu *m_subProjectMenu;
QMenu *m_folderMenu;
QMenu *m_fileMenu;
QMenu *m_openWithMenu;
QMultiMap<int, QObject*> m_actionMap;
QAction *m_sessionManagerAction;
QAction *m_newAction;
#if 0
QAction *m_loadAction;
#endif
Core::Utils::ParameterAction *m_unloadAction;
QAction *m_clearSession;
QAction *m_buildProjectOnlyAction;
Core::Utils::ParameterAction *m_buildAction;
QAction *m_buildSessionAction;
QAction *m_rebuildProjectOnlyAction;
Core::Utils::ParameterAction *m_rebuildAction;
QAction *m_rebuildSessionAction;
QAction *m_cleanProjectOnlyAction;
Core::Utils::ParameterAction *m_cleanAction;
QAction *m_cleanSessionAction;
QAction *m_runAction;
QAction *m_runActionContextMenu;
QAction *m_cancelBuildAction;
QAction *m_debugAction;
QAction *m_addNewFileAction;
QAction *m_addExistingFilesAction;
QAction *m_openFileAction;
QAction *m_showInGraphicalShell;
QAction *m_removeFileAction;
QAction *m_renameFileAction;
QMenu *m_buildConfigurationMenu;
QActionGroup *m_buildConfigurationActionGroup;
QMenu *m_runConfigurationMenu;
QActionGroup *m_runConfigurationActionGroup;
Internal::ProjectWindow *m_proWindow;
SessionManager *m_session;
QString m_sessionToRestoreAtStartup;
Project *m_currentProject;
Node *m_currentNode;
BuildManager *m_buildManager;
QList<Internal::ProjectFileFactory*> m_fileFactories;
QStringList m_profileMimeTypes;
Internal::OutputPane *m_outputPane;
QList<QPair<QString, QString> > m_recentProjects; // pair of filename, displayname
static const int m_maxRecentProjects = 7;
QString m_lastOpenDirectory;
QSharedPointer<RunConfiguration> m_delayedRunConfiguration;
RunControl *m_debuggingRunControl;
QString m_runMode;
QString m_projectFilterString;
Internal::ProjectExplorerSettings m_projectExplorerSettings;
Internal::ProjectWelcomePage *m_welcomePlugin;
Internal::ProjectWelcomePageWidget *m_welcomePage;
}; };
namespace Internal {
class CoreListenerCheckingForRunningBuild : public Core::ICoreListener
{
Q_OBJECT
public:
CoreListenerCheckingForRunningBuild(BuildManager *manager);
bool coreAboutToClose();
private:
BuildManager *m_manager;
};
} // namespace Internal
} // namespace ProjectExplorer } // namespace ProjectExplorer
#endif // PROJECTEXPLORER_H #endif // PROJECTEXPLORER_H
@@ -21,6 +21,8 @@ HEADERS += projectexplorer.h \
allprojectsfilter.h \ allprojectsfilter.h \
buildparserinterface.h \ buildparserinterface.h \
projectexplorerconstants.h \ projectexplorerconstants.h \
projectexplorersettings.h \
corelistenercheckingforrunningbuild.h \
project.h \ project.h \
pluginfilefactory.h \ pluginfilefactory.h \
iprojectmanager.h \ iprojectmanager.h \
@@ -115,7 +117,9 @@ SOURCES += projectexplorer.cpp \
abstractmakestep.cpp \ abstractmakestep.cpp \
projectexplorersettingspage.cpp \ projectexplorersettingspage.cpp \
projectwelcomepage.cpp \ projectwelcomepage.cpp \
projectwelcomepagewidget.cpp projectwelcomepagewidget.cpp \
corelistenercheckingforrunningbuild.cpp
FORMS += processstep.ui \ FORMS += processstep.ui \
editorsettingspropertiespage.ui \ editorsettingspropertiespage.ui \
runsettingspropertiespage.ui \ runsettingspropertiespage.ui \
@@ -0,0 +1,53 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef PROJECTEXPLORERSETTINGS_H
#define PROJECTEXPLORERSETTINGS_H
namespace ProjectExplorer {
namespace Internal {
struct ProjectExplorerSettings
{
bool buildBeforeRun;
bool saveBeforeBuild;
bool showCompilerOutput;
bool useJom;
bool operator==(const ProjectExplorerSettings &other) const {
return this->buildBeforeRun == other.buildBeforeRun
&& this->saveBeforeBuild == other.saveBeforeBuild
&& this->showCompilerOutput == other.showCompilerOutput
&& this->useJom == other.useJom;
}
};
} // namespace ProjectExplorer
} // namespace Internal
#endif // PROJECTEXPLORERSETTINGS_H
@@ -28,6 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "projectexplorersettingspage.h" #include "projectexplorersettingspage.h"
#include "projectexplorersettings.h"
#include "projectexplorerconstants.h" #include "projectexplorerconstants.h"
#include "projectexplorer.h" #include "projectexplorer.h"
@@ -29,6 +29,7 @@
#include "projectfilewizardextension.h" #include "projectfilewizardextension.h"
#include "projectexplorer.h" #include "projectexplorer.h"
#include "session.h"
#include "projectnodes.h" #include "projectnodes.h"
#include "nodesvisitor.h" #include "nodesvisitor.h"
#include "projectwizardpage.h" #include "projectwizardpage.h"
@@ -30,6 +30,8 @@
#include "projecttreewidget.h" #include "projecttreewidget.h"
#include "projectexplorer.h" #include "projectexplorer.h"
#include "project.h"
#include "session.h"
#include "projectexplorerconstants.h" #include "projectexplorerconstants.h"
#include "projectmodels.h" #include "projectmodels.h"
@@ -44,6 +46,7 @@
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QToolButton> #include <QtGui/QToolButton>
#include <QtGui/QFocusEvent> #include <QtGui/QFocusEvent>
#include <QtGui/QAction>
#include <QtGui/QPalette> #include <QtGui/QPalette>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -88,21 +88,21 @@ IRunConfigurationFactory::~IRunConfigurationFactory()
{ {
} }
IRunConfigurationRunner::IRunConfigurationRunner(QObject *parent) IRunControlFactory::IRunControlFactory(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
} }
IRunConfigurationRunner::~IRunConfigurationRunner() IRunControlFactory::~IRunControlFactory()
{ {
} }
RunControl::RunControl(QSharedPointer<RunConfiguration> runConfiguration) RunControl::RunControl(const QSharedPointer<RunConfiguration> &runConfiguration)
: m_runConfiguration(runConfiguration) : m_runConfiguration(runConfiguration)
{ {
} }
QSharedPointer<RunConfiguration> RunControl::runConfiguration() QSharedPointer<RunConfiguration> RunControl::runConfiguration() const
{ {
return m_runConfiguration; return m_runConfiguration;
} }
+13 -12
View File
@@ -65,11 +65,11 @@ class PROJECTEXPLORER_EXPORT RunConfiguration : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
RunConfiguration(Project *project); explicit RunConfiguration(Project *project);
virtual ~RunConfiguration(); virtual ~RunConfiguration();
Project *project() const; Project *project() const;
// The type of this RunConfiguration, e.g. "ProjectExplorer.ApplicationRunConfiguration" // The type of this RunConfiguration, e.g. "ProjectExplorer.LocalApplicationRunConfiguration"
virtual QString type() const = 0; virtual QString type() const = 0;
// Name shown to the user // Name shown to the user
QString name() const; QString name() const;
@@ -102,7 +102,7 @@ class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
IRunConfigurationFactory(QObject *parent = 0); explicit IRunConfigurationFactory(QObject *parent = 0);
virtual ~IRunConfigurationFactory(); virtual ~IRunConfigurationFactory();
// used to recreate the runConfigurations when restoring settings // used to recreate the runConfigurations when restoring settings
virtual bool canRestore(const QString &type) const = 0; virtual bool canRestore(const QString &type) const = 0;
@@ -114,19 +114,20 @@ public:
virtual QSharedPointer<RunConfiguration> create(Project *project, const QString &type) = 0; virtual QSharedPointer<RunConfiguration> create(Project *project, const QString &type) = 0;
}; };
class PROJECTEXPLORER_EXPORT IRunConfigurationRunner : public QObject class PROJECTEXPLORER_EXPORT IRunControlFactory : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
IRunConfigurationRunner(QObject *parent = 0); explicit IRunControlFactory(QObject *parent = 0);
virtual ~IRunConfigurationRunner(); virtual ~IRunControlFactory();
virtual bool canRun(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) = 0;
virtual RunControl* run(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) = 0; virtual bool canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const = 0;
virtual RunControl* create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) = 0;
virtual QString displayName() const = 0; virtual QString displayName() const = 0;
// Returns the widget used to configure this runner. Ownership is transferred to the caller // Returns the widget used to configure this runner. Ownership is transferred to the caller
virtual QWidget *configurationWidget(QSharedPointer<RunConfiguration> runConfiguration) = 0; virtual QWidget *configurationWidget(const QSharedPointer<RunConfiguration> &runConfiguration) = 0;
}; };
/* Each instance of this class represents one item that is run. /* Each instance of this class represents one item that is run.
@@ -134,12 +135,12 @@ public:
class PROJECTEXPLORER_EXPORT RunControl : public QObject { class PROJECTEXPLORER_EXPORT RunControl : public QObject {
Q_OBJECT Q_OBJECT
public: public:
RunControl(QSharedPointer<RunConfiguration> runConfiguration); explicit RunControl(const QSharedPointer<RunConfiguration> &runConfiguration);
virtual ~RunControl(); virtual ~RunControl();
virtual void start() = 0; virtual void start() = 0;
virtual void stop() = 0; virtual void stop() = 0;
virtual bool isRunning() const = 0; virtual bool isRunning() const = 0;
QSharedPointer<RunConfiguration> runConfiguration(); QSharedPointer<RunConfiguration> runConfiguration() const;
signals: signals:
void addToOutputWindow(RunControl *, const QString &line); void addToOutputWindow(RunControl *, const QString &line);
void addToOutputWindowInline(RunControl *, const QString &line); void addToOutputWindowInline(RunControl *, const QString &line);
@@ -152,7 +153,7 @@ private slots:
void bringApplicationToForegroundInternal(); void bringApplicationToForegroundInternal();
private: private:
QSharedPointer<RunConfiguration> m_runConfiguration; const QSharedPointer<RunConfiguration> m_runConfiguration;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
//these two are used to bring apps in the foreground on Mac //these two are used to bring apps in the foreground on Mac
@@ -206,8 +206,8 @@ RunSettingsWidget::RunSettingsWidget(Project *project)
// TODO: Add support for custom runner configuration widgets once we have some // TODO: Add support for custom runner configuration widgets once we have some
/* /*
QList<IRunConfigurationRunner *> runners = PluginManager::instance()->getObjects<IRunConfigurationRunner>(); QList<IRunControlFactory *> runners = PluginManager::instance()->getObjects<IRunControlFactory>();
foreach (IRunConfigurationRunner * runner, runners) { foreach (IRunControlFactory * runner, runners) {
if (runner->canRun(activeRunConfiguration)) if (runner->canRun(activeRunConfiguration))
m_ui->layout->addWidget(runner->configurationWidget(activeRunConfiguration)); m_ui->layout->addWidget(runner->configurationWidget(activeRunConfiguration));
} }
@@ -29,6 +29,7 @@
#include "toolchain.h" #include "toolchain.h"
#include "cesdkhandler.h" #include "cesdkhandler.h"
#include "projectexplorersettings.h"
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QProcess> #include <QtCore/QProcess>
+3 -3
View File
@@ -325,7 +325,7 @@ void QmlProjectFile::modified(ReloadBehavior *)
} }
QmlRunConfiguration::QmlRunConfiguration(QmlProject *pro) QmlRunConfiguration::QmlRunConfiguration(QmlProject *pro)
: ProjectExplorer::ApplicationRunConfiguration(pro), : ProjectExplorer::LocalApplicationRunConfiguration(pro),
m_project(pro), m_project(pro),
m_type(Constants::QMLRUNCONFIGURATION) m_type(Constants::QMLRUNCONFIGURATION)
{ {
@@ -455,7 +455,7 @@ void QmlRunConfiguration::onQmlViewerChanged()
void QmlRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const void QmlRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const
{ {
ProjectExplorer::ApplicationRunConfiguration::save(writer); ProjectExplorer::LocalApplicationRunConfiguration::save(writer);
writer.saveValue(QLatin1String("qmlviewer"), m_qmlViewer); writer.saveValue(QLatin1String("qmlviewer"), m_qmlViewer);
writer.saveValue(QLatin1String("mainscript"), m_scriptFile); writer.saveValue(QLatin1String("mainscript"), m_scriptFile);
@@ -463,7 +463,7 @@ void QmlRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer
void QmlRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReader &reader) void QmlRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReader &reader)
{ {
ProjectExplorer::ApplicationRunConfiguration::restore(reader); ProjectExplorer::LocalApplicationRunConfiguration::restore(reader);
m_qmlViewer = reader.restoreValue(QLatin1String("qmlviewer")).toString(); m_qmlViewer = reader.restoreValue(QLatin1String("qmlviewer")).toString();
m_scriptFile = reader.restoreValue(QLatin1String("mainscript")).toString(); m_scriptFile = reader.restoreValue(QLatin1String("mainscript")).toString();
+1 -1
View File
@@ -141,7 +141,7 @@ private:
QString m_fileName; QString m_fileName;
}; };
class QmlRunConfiguration : public ProjectExplorer::ApplicationRunConfiguration class QmlRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
{ {
Q_OBJECT Q_OBJECT
public: public:
@@ -37,7 +37,7 @@ const char *const PROJECTCONTEXT = "QmlProject.ProjectContext";
const char *const LANG_QML = "QML"; const char *const LANG_QML = "QML";
const char *const QMLMIMETYPE = "text/x-qml-project"; // ### FIXME const char *const QMLMIMETYPE = "text/x-qml-project"; // ### FIXME
const char *const QMLRUNCONFIGURATION = "QmlProject.QmlApplicationRunConfiguration"; const char *const QMLRUNCONFIGURATION = "QmlProject.QmlLocalApplicationRunConfiguration";
const char *const MAKESTEP = "QmlProject.QmlMakeStep"; const char *const MAKESTEP = "QmlProject.QmlMakeStep";
// contexts // contexts
@@ -166,7 +166,7 @@ void DeployHelperRunStep::cleanup()
void DeployHelperRunStep::readyRead() void DeployHelperRunStep::readyRead()
{ {
// TODO Unbreak the application output (this whole thing should be moved to a IRunConfigurationRunner) // TODO Unbreak the application output (this whole thing should be moved to a IRunControlFactory)
QProcess * proc = qobject_cast<QProcess *>(sender()); QProcess * proc = qobject_cast<QProcess *>(sender());
while (proc->canReadLine()) { while (proc->canReadLine()) {
QString line = proc->readLine().trimmed(); QString line = proc->readLine().trimmed();
@@ -481,42 +481,39 @@ QSharedPointer<RunConfiguration> S60DeviceRunConfigurationFactory::create(Projec
return rc; return rc;
} }
// ======== S60DeviceRunConfigurationRunner // ======== S60DeviceRunControlFactory
S60DeviceRunConfigurationRunner::S60DeviceRunConfigurationRunner(QObject *parent) S60DeviceRunControlFactory::S60DeviceRunControlFactory(QObject *parent)
: IRunConfigurationRunner(parent) : IRunControlFactory(parent)
{ {
} }
bool S60DeviceRunConfigurationRunner::canRun(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) bool S60DeviceRunControlFactory::canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const
{ {
return (mode == ProjectExplorer::Constants::RUNMODE) return (mode == ProjectExplorer::Constants::RUNMODE)
&& (!runConfiguration.objectCast<S60DeviceRunConfiguration>().isNull()); && (!runConfiguration.objectCast<S60DeviceRunConfiguration>().isNull());
} }
RunControl* S60DeviceRunConfigurationRunner::run(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) RunControl* S60DeviceRunControlFactory::create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode)
{ {
QSharedPointer<S60DeviceRunConfiguration> rc = runConfiguration.objectCast<S60DeviceRunConfiguration>(); QSharedPointer<S60DeviceRunConfiguration> rc = runConfiguration.objectCast<S60DeviceRunConfiguration>();
Q_ASSERT(!rc.isNull()); QTC_ASSERT(!rc.isNull() && mode == ProjectExplorer::Constants::RUNMODE, return 0);
Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE); return new S60DeviceRunControl(rc);
S60DeviceRunControl *runControl = new S60DeviceRunControl(rc);
return runControl;
} }
QString S60DeviceRunConfigurationRunner::displayName() const QString S60DeviceRunControlFactory::displayName() const
{ {
return tr("Run on Device"); return tr("Run on Device");
} }
QWidget *S60DeviceRunConfigurationRunner::configurationWidget(QSharedPointer<ProjectExplorer::RunConfiguration> /* runConfiguration */) QWidget *S60DeviceRunControlFactory::configurationWidget(const QSharedPointer<ProjectExplorer::RunConfiguration> & /* runConfiguration */)
{ {
return 0; return 0;
} }
// ======== S60DeviceRunControl // ======== S60DeviceRunControl
S60DeviceRunControl::S60DeviceRunControl(QSharedPointer<RunConfiguration> runConfiguration) S60DeviceRunControl::S60DeviceRunControl(const QSharedPointer<RunConfiguration> &runConfiguration)
: RunControl(runConfiguration), m_launcher(0) : RunControl(runConfiguration), m_launcher(0)
{ {
m_makesis = new QProcess(this); m_makesis = new QProcess(this);
@@ -52,7 +52,7 @@ public:
SignCustom SignCustom
}; };
S60DeviceRunConfiguration(ProjectExplorer::Project *project, const QString &proFilePath); explicit S60DeviceRunConfiguration(ProjectExplorer::Project *project, const QString &proFilePath);
~S60DeviceRunConfiguration(); ~S60DeviceRunConfiguration();
QString type() const; QString type() const;
@@ -98,7 +98,7 @@ class S60DeviceRunConfigurationWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
S60DeviceRunConfigurationWidget(S60DeviceRunConfiguration *runConfiguration, explicit S60DeviceRunConfigurationWidget(S60DeviceRunConfiguration *runConfiguration,
QWidget *parent = 0); QWidget *parent = 0);
private slots: private slots:
@@ -122,7 +122,7 @@ class S60DeviceRunConfigurationFactory : public ProjectExplorer::IRunConfigurati
{ {
Q_OBJECT Q_OBJECT
public: public:
S60DeviceRunConfigurationFactory(QObject *parent); explicit S60DeviceRunConfigurationFactory(QObject *parent);
~S60DeviceRunConfigurationFactory(); ~S60DeviceRunConfigurationFactory();
bool canRestore(const QString &type) const; bool canRestore(const QString &type) const;
QStringList availableCreationTypes(ProjectExplorer::Project *pro) const; QStringList availableCreationTypes(ProjectExplorer::Project *pro) const;
@@ -131,22 +131,22 @@ public:
QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project, const QString &type); QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project, const QString &type);
}; };
class S60DeviceRunConfigurationRunner : public ProjectExplorer::IRunConfigurationRunner class S60DeviceRunControlFactory : public ProjectExplorer::IRunControlFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
S60DeviceRunConfigurationRunner(QObject *parent = 0); explicit S60DeviceRunControlFactory(QObject *parent = 0);
bool canRun(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration, const QString &mode); bool canRun(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration, const QString &mode) const;
ProjectExplorer::RunControl* run(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration, const QString &mode); ProjectExplorer::RunControl* create(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration, const QString &mode);
QString displayName() const; QString displayName() const;
QWidget *configurationWidget(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration); QWidget *configurationWidget(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration);
}; };
class S60DeviceRunControl : public ProjectExplorer::RunControl class S60DeviceRunControl : public ProjectExplorer::RunControl
{ {
Q_OBJECT Q_OBJECT
public: public:
S60DeviceRunControl(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration); explicit S60DeviceRunControl(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration);
~S60DeviceRunControl() {} ~S60DeviceRunControl() {}
void start(); void start();
void stop(); void stop();
@@ -254,42 +254,39 @@ QSharedPointer<RunConfiguration> S60EmulatorRunConfigurationFactory::create(Proj
return rc; return rc;
} }
// ======== S60EmulatorRunConfigurationRunner // ======== S60EmulatorRunControlFactory
S60EmulatorRunConfigurationRunner::S60EmulatorRunConfigurationRunner(QObject *parent) S60EmulatorRunControlFactory::S60EmulatorRunControlFactory(QObject *parent)
: IRunConfigurationRunner(parent) : IRunControlFactory(parent)
{ {
} }
bool S60EmulatorRunConfigurationRunner::canRun(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) bool S60EmulatorRunControlFactory::canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const
{ {
return (mode == ProjectExplorer::Constants::RUNMODE) return (mode == ProjectExplorer::Constants::RUNMODE)
&& (!runConfiguration.objectCast<S60EmulatorRunConfiguration>().isNull()); && (!runConfiguration.objectCast<S60EmulatorRunConfiguration>().isNull());
} }
RunControl* S60EmulatorRunConfigurationRunner::run(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode) RunControl* S60EmulatorRunControlFactory::create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode)
{ {
QSharedPointer<S60EmulatorRunConfiguration> rc = runConfiguration.objectCast<S60EmulatorRunConfiguration>(); QSharedPointer<S60EmulatorRunConfiguration> rc = runConfiguration.objectCast<S60EmulatorRunConfiguration>();
Q_ASSERT(!rc.isNull()); QTC_ASSERT(!rc.isNull() && mode == ProjectExplorer::Constants::RUNMODE, return 0);
Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE); return new S60EmulatorRunControl(rc);
S60EmulatorRunControl *runControl = new S60EmulatorRunControl(rc);
return runControl;
} }
QString S60EmulatorRunConfigurationRunner::displayName() const QString S60EmulatorRunControlFactory::displayName() const
{ {
return tr("Run in Emulator"); return tr("Run in Emulator");
} }
QWidget *S60EmulatorRunConfigurationRunner::configurationWidget(QSharedPointer<ProjectExplorer::RunConfiguration> /* runConfiguration */) QWidget *S60EmulatorRunControlFactory::configurationWidget(const QSharedPointer<ProjectExplorer::RunConfiguration> & /* runConfiguration */)
{ {
return 0; return 0;
} }
// ======== S60EmulatorRunControl // ======== S60EmulatorRunControl
S60EmulatorRunControl::S60EmulatorRunControl(QSharedPointer<RunConfiguration> runConfiguration) S60EmulatorRunControl::S60EmulatorRunControl(const QSharedPointer<RunConfiguration> &runConfiguration)
: RunControl(runConfiguration) : RunControl(runConfiguration)
{ {
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)), connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
@@ -90,7 +90,7 @@ class S60EmulatorRunConfigurationFactory : public ProjectExplorer::IRunConfigura
{ {
Q_OBJECT Q_OBJECT
public: public:
S60EmulatorRunConfigurationFactory(QObject *parent); explicit S60EmulatorRunConfigurationFactory(QObject *parent);
~S60EmulatorRunConfigurationFactory(); ~S60EmulatorRunConfigurationFactory();
bool canRestore(const QString &type) const; bool canRestore(const QString &type) const;
QStringList availableCreationTypes(ProjectExplorer::Project *pro) const; QStringList availableCreationTypes(ProjectExplorer::Project *pro) const;
@@ -99,22 +99,22 @@ public:
QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project, const QString &type); QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project, const QString &type);
}; };
class S60EmulatorRunConfigurationRunner : public ProjectExplorer::IRunConfigurationRunner class S60EmulatorRunControlFactory : public ProjectExplorer::IRunControlFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
S60EmulatorRunConfigurationRunner(QObject *parent = 0); explicit S60EmulatorRunControlFactory(QObject *parent = 0);
bool canRun(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration, const QString &mode); bool canRun(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration, const QString &mode) const;
ProjectExplorer::RunControl* run(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration, const QString &mode); ProjectExplorer::RunControl* create(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration, const QString &mode);
QString displayName() const; QString displayName() const;
QWidget *configurationWidget(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration); QWidget *configurationWidget(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration);
}; };
class S60EmulatorRunControl : public ProjectExplorer::RunControl class S60EmulatorRunControl : public ProjectExplorer::RunControl
{ {
Q_OBJECT Q_OBJECT
public: public:
S60EmulatorRunControl(QSharedPointer<ProjectExplorer::RunConfiguration> runConfiguration); explicit S60EmulatorRunControl(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration);
~S60EmulatorRunControl() {} ~S60EmulatorRunControl() {}
void start(); void start();
void stop(); void stop();
@@ -57,9 +57,9 @@ S60Manager::S60Manager(QObject *parent)
m_devices(new S60Devices(this)), m_devices(new S60Devices(this)),
m_devicesPreferencePane(new S60DevicesPreferencePane(m_devices, this)), m_devicesPreferencePane(new S60DevicesPreferencePane(m_devices, this)),
m_s60EmulatorRunConfigurationFactory(new S60EmulatorRunConfigurationFactory(this)), m_s60EmulatorRunConfigurationFactory(new S60EmulatorRunConfigurationFactory(this)),
m_s60EmulatorRunConfigurationRunner(new S60EmulatorRunConfigurationRunner(this)), m_s60EmulatorRunConfigurationRunner(new S60EmulatorRunControlFactory(this)),
m_s60DeviceRunConfigurationFactory(new S60DeviceRunConfigurationFactory(this)), m_s60DeviceRunConfigurationFactory(new S60DeviceRunConfigurationFactory(this)),
m_s60DeviceRunConfigurationRunner(new S60DeviceRunConfigurationRunner(this)), m_s60DeviceRunConfigurationRunner(new S60DeviceRunControlFactory(this)),
m_serialDeviceLister(new SerialDeviceLister(this)) m_serialDeviceLister(new SerialDeviceLister(this))
{ {
m_instance = this; m_instance = this;
@@ -44,9 +44,9 @@ namespace Internal {
class S60DevicesPreferencePane; class S60DevicesPreferencePane;
class S60EmulatorRunConfigurationFactory; class S60EmulatorRunConfigurationFactory;
class S60EmulatorRunConfigurationRunner; class S60EmulatorRunControlFactory;
class S60DeviceRunConfigurationFactory; class S60DeviceRunConfigurationFactory;
class S60DeviceRunConfigurationRunner; class S60DeviceRunControlFactory;
class S60Manager : public QObject class S60Manager : public QObject
{ {
@@ -75,9 +75,9 @@ private:
S60Devices *m_devices; S60Devices *m_devices;
S60DevicesPreferencePane *m_devicesPreferencePane; S60DevicesPreferencePane *m_devicesPreferencePane;
S60EmulatorRunConfigurationFactory *m_s60EmulatorRunConfigurationFactory; S60EmulatorRunConfigurationFactory *m_s60EmulatorRunConfigurationFactory;
S60EmulatorRunConfigurationRunner *m_s60EmulatorRunConfigurationRunner; S60EmulatorRunControlFactory *m_s60EmulatorRunConfigurationRunner;
S60DeviceRunConfigurationFactory *m_s60DeviceRunConfigurationFactory; S60DeviceRunConfigurationFactory *m_s60DeviceRunConfigurationFactory;
S60DeviceRunConfigurationRunner *m_s60DeviceRunConfigurationRunner; S60DeviceRunControlFactory *m_s60DeviceRunConfigurationRunner;
SerialDeviceLister *m_serialDeviceLister; SerialDeviceLister *m_serialDeviceLister;
}; };
@@ -44,6 +44,7 @@
#include <coreplugin/iversioncontrol.h> #include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h> #include <coreplugin/vcsmanager.h>
#include <projectexplorer/buildmanager.h> #include <projectexplorer/buildmanager.h>
#include <projectexplorer/session.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/listutils.h> #include <utils/listutils.h>
@@ -55,6 +55,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildmanager.h> #include <projectexplorer/buildmanager.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/session.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
@@ -52,12 +52,12 @@
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using ProjectExplorer::ApplicationRunConfiguration; using ProjectExplorer::LocalApplicationRunConfiguration;
using ProjectExplorer::PersistentSettingsReader; using ProjectExplorer::PersistentSettingsReader;
using ProjectExplorer::PersistentSettingsWriter; using ProjectExplorer::PersistentSettingsWriter;
Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath) Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath)
: ApplicationRunConfiguration(pro), : LocalApplicationRunConfiguration(pro),
m_proFilePath(proFilePath), m_proFilePath(proFilePath),
m_runMode(Gui), m_runMode(Gui),
m_userSetName(false), m_userSetName(false),
@@ -152,7 +152,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
toplayout->addRow(argumentsLabel, m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
m_useTerminalCheck = new QCheckBox(tr("Run in Terminal")); m_useTerminalCheck = new QCheckBox(tr("Run in Terminal"));
m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::ApplicationRunConfiguration::Console); m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console);
toplayout->addRow(QString(), m_useTerminalCheck); toplayout->addRow(QString(), m_useTerminalCheck);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@@ -237,8 +237,8 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
this, SLOT(commandLineArgumentsChanged(QString))); this, SLOT(commandLineArgumentsChanged(QString)));
connect(qt4RunConfiguration, SIGNAL(nameChanged(QString)), connect(qt4RunConfiguration, SIGNAL(nameChanged(QString)),
this, SLOT(nameChanged(QString))); this, SLOT(nameChanged(QString)));
connect(qt4RunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::ApplicationRunConfiguration::RunMode)), connect(qt4RunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)),
this, SLOT(runModeChanged(ProjectExplorer::ApplicationRunConfiguration::RunMode))); this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)));
connect(qt4RunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)), connect(qt4RunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)),
this, SLOT(usingDyldImageSuffixChanged(bool))); this, SLOT(usingDyldImageSuffixChanged(bool)));
connect(qt4RunConfiguration, SIGNAL(effectiveTargetInformationChanged()), connect(qt4RunConfiguration, SIGNAL(effectiveTargetInformationChanged()),
@@ -263,7 +263,7 @@ void Qt4RunConfigurationWidget::updateSummary()
QString text = tr("Running executable: <b>%1</b> %2 %3").arg( QString text = tr("Running executable: <b>%1</b> %2 %3").arg(
filename, filename,
arguments, arguments,
m_qt4RunConfiguration->runMode() == ApplicationRunConfiguration::Console ? tr("(in terminal)") : ""); m_qt4RunConfiguration->runMode() == LocalApplicationRunConfiguration::Console ? tr("(in terminal)") : "");
m_summaryLabel->setText(text); m_summaryLabel->setText(text);
} }
@@ -332,8 +332,8 @@ void Qt4RunConfigurationWidget::nameEdited(const QString &name)
void Qt4RunConfigurationWidget::termToggled(bool on) void Qt4RunConfigurationWidget::termToggled(bool on)
{ {
m_ignoreChange = true; m_ignoreChange = true;
m_qt4RunConfiguration->setRunMode(on ? ApplicationRunConfiguration::Console m_qt4RunConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console
: ApplicationRunConfiguration::Gui); : LocalApplicationRunConfiguration::Gui);
m_ignoreChange = false; m_ignoreChange = false;
} }
@@ -364,11 +364,11 @@ void Qt4RunConfigurationWidget::nameChanged(const QString &name)
m_nameLineEdit->setText(name); m_nameLineEdit->setText(name);
} }
void Qt4RunConfigurationWidget::runModeChanged(ApplicationRunConfiguration::RunMode runMode) void Qt4RunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode)
{ {
updateSummary(); updateSummary();
if (!m_ignoreChange) if (!m_ignoreChange)
m_useTerminalCheck->setChecked(runMode == ApplicationRunConfiguration::Console); m_useTerminalCheck->setChecked(runMode == LocalApplicationRunConfiguration::Console);
} }
void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state) void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state)
@@ -419,12 +419,12 @@ void Qt4RunConfiguration::save(PersistentSettingsWriter &writer) const
writer.saveValue("BaseEnvironmentBase", m_baseEnvironmentBase); writer.saveValue("BaseEnvironmentBase", m_baseEnvironmentBase);
writer.saveValue("UserSetWorkingDirectory", m_userSetWokingDirectory); writer.saveValue("UserSetWorkingDirectory", m_userSetWokingDirectory);
writer.saveValue("UserWorkingDirectory", m_userWorkingDirectory); writer.saveValue("UserWorkingDirectory", m_userWorkingDirectory);
ApplicationRunConfiguration::save(writer); LocalApplicationRunConfiguration::save(writer);
} }
void Qt4RunConfiguration::restore(const PersistentSettingsReader &reader) void Qt4RunConfiguration::restore(const PersistentSettingsReader &reader)
{ {
ApplicationRunConfiguration::restore(reader); LocalApplicationRunConfiguration::restore(reader);
const QDir projectDir = QFileInfo(project()->file()->fileName()).absoluteDir(); const QDir projectDir = QFileInfo(project()->file()->fileName()).absoluteDir();
m_commandLineArguments = reader.restoreValue("CommandLineArguments").toStringList(); m_commandLineArguments = reader.restoreValue("CommandLineArguments").toStringList();
m_proFilePath = projectDir.filePath(reader.restoreValue("ProFile").toString()); m_proFilePath = projectDir.filePath(reader.restoreValue("ProFile").toString());
@@ -450,7 +450,7 @@ QString Qt4RunConfiguration::executable() const
return m_executable; return m_executable;
} }
ApplicationRunConfiguration::RunMode Qt4RunConfiguration::runMode() const LocalApplicationRunConfiguration::RunMode Qt4RunConfiguration::runMode() const
{ {
return m_runMode; return m_runMode;
} }
@@ -55,7 +55,7 @@ namespace Internal {
class Qt4PriFileNode; class Qt4PriFileNode;
class Qt4RunConfiguration : public ProjectExplorer::ApplicationRunConfiguration class Qt4RunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
{ {
Q_OBJECT Q_OBJECT
// to change the name and arguments and set the userenvironmentchanges // to change the name and arguments and set the userenvironmentchanges
@@ -97,7 +97,7 @@ signals:
void nameChanged(const QString&); void nameChanged(const QString&);
void commandLineArgumentsChanged(const QString&); void commandLineArgumentsChanged(const QString&);
void workingDirectoryChanged(const QString&); void workingDirectoryChanged(const QString&);
void runModeChanged(ProjectExplorer::ApplicationRunConfiguration::RunMode runMode); void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
void usingDyldImageSuffixChanged(bool); void usingDyldImageSuffixChanged(bool);
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &diff); void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &diff);
@@ -130,7 +130,7 @@ private:
QStringList m_targets; QStringList m_targets;
QString m_executable; QString m_executable;
QString m_workingDir; QString m_workingDir;
ProjectExplorer::ApplicationRunConfiguration::RunMode m_runMode; ProjectExplorer::LocalApplicationRunConfiguration::RunMode m_runMode;
bool m_userSetName; bool m_userSetName;
bool m_cachedTargetInformationValid; bool m_cachedTargetInformationValid;
bool m_isUsingDyldImageSuffix; bool m_isUsingDyldImageSuffix;
@@ -158,7 +158,7 @@ private slots:
void workingDirectoryChanged(const QString &workingDirectory); void workingDirectoryChanged(const QString &workingDirectory);
void commandLineArgumentsChanged(const QString &args); void commandLineArgumentsChanged(const QString &args);
void nameChanged(const QString &name); void nameChanged(const QString &name);
void runModeChanged(ProjectExplorer::ApplicationRunConfiguration::RunMode runMode); void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges); void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges);
void baseEnvironmentChanged(); void baseEnvironmentChanged();
@@ -53,6 +53,8 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
+1
View File
@@ -39,6 +39,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/editorconfiguration.h> #include <projectexplorer/editorconfiguration.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
@@ -48,6 +48,7 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QDir> #include <QtCore/QDir>