forked from qt-creator/qt-creator
ProjectExplorer: Remove internal classes from exported headers.
This commit is contained in:
@@ -29,16 +29,7 @@
|
||||
|
||||
#include "applicationrunconfiguration.h"
|
||||
|
||||
#include "environment.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
namespace ProjectExplorer {
|
||||
|
||||
/// LocalApplicationRunConfiguration
|
||||
|
||||
@@ -56,102 +47,5 @@ LocalApplicationRunConfiguration::~LocalApplicationRunConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
/// LocalApplicationRunControlFactory
|
||||
|
||||
LocalApplicationRunControlFactory::LocalApplicationRunControlFactory()
|
||||
{
|
||||
}
|
||||
|
||||
LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool LocalApplicationRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const
|
||||
{
|
||||
return (mode == ProjectExplorer::Constants::RUNMODE)
|
||||
&& (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) != 0);
|
||||
}
|
||||
|
||||
QString LocalApplicationRunControlFactory::displayName() const
|
||||
{
|
||||
return tr("Run");
|
||||
}
|
||||
|
||||
RunControl *LocalApplicationRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
return new LocalApplicationRunControl(qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration), mode);
|
||||
}
|
||||
|
||||
QWidget *LocalApplicationRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
|
||||
{
|
||||
Q_UNUSED(runConfiguration)
|
||||
return new QLabel("TODO add Configuration widget");
|
||||
}
|
||||
|
||||
// ApplicationRunControl
|
||||
|
||||
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, QString mode)
|
||||
: RunControl(rc, mode)
|
||||
{
|
||||
Utils::Environment env = rc->environment();
|
||||
QString dir = rc->workingDirectory();
|
||||
m_applicationLauncher.setEnvironment(env.toStringList());
|
||||
m_applicationLauncher.setWorkingDirectory(dir);
|
||||
|
||||
m_executable = rc->executable();
|
||||
m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode());
|
||||
m_commandLineArguments = rc->commandLineArguments();
|
||||
|
||||
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
|
||||
this, SLOT(slotAppendMessage(QString,bool)));
|
||||
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
|
||||
this, SLOT(slotAddToOutputWindow(QString, bool)));
|
||||
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
|
||||
this, SLOT(processExited(int)));
|
||||
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
|
||||
this, SLOT(bringApplicationToForeground(qint64)));
|
||||
}
|
||||
|
||||
LocalApplicationRunControl::~LocalApplicationRunControl()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::start()
|
||||
{
|
||||
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
|
||||
emit started();
|
||||
|
||||
emit appendMessage(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)), false);
|
||||
}
|
||||
|
||||
LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
|
||||
{
|
||||
m_applicationLauncher.stop();
|
||||
return StoppedSynchronously;
|
||||
}
|
||||
|
||||
bool LocalApplicationRunControl::isRunning() const
|
||||
{
|
||||
return m_applicationLauncher.isRunning();
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::slotAppendMessage(const QString &err,
|
||||
bool isError)
|
||||
{
|
||||
emit appendMessage(this, err, isError);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::slotAddToOutputWindow(const QString &line,
|
||||
bool isError)
|
||||
{
|
||||
emit addToOutputWindowInline(this, line, isError);
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::processExited(int exitCode)
|
||||
{
|
||||
emit appendMessage(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode), false);
|
||||
emit finished();
|
||||
}
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
|
||||
@@ -61,45 +61,10 @@ public:
|
||||
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0;
|
||||
|
||||
protected:
|
||||
LocalApplicationRunConfiguration(Target *target, const QString &id);
|
||||
LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc);
|
||||
explicit LocalApplicationRunConfiguration(Target *target, const QString &id);
|
||||
explicit LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc);
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class LocalApplicationRunControlFactory : public IRunControlFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocalApplicationRunControlFactory ();
|
||||
virtual ~LocalApplicationRunControlFactory();
|
||||
virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
|
||||
virtual QString displayName() const;
|
||||
virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode);
|
||||
virtual QWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
|
||||
};
|
||||
|
||||
class LocalApplicationRunControl : public RunControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, QString mode);
|
||||
virtual ~LocalApplicationRunControl();
|
||||
virtual void start();
|
||||
virtual StopResult stop();
|
||||
virtual bool isRunning() const;
|
||||
private slots:
|
||||
void processExited(int exitCode);
|
||||
void slotAddToOutputWindow(const QString &line, bool isError);
|
||||
void slotAppendMessage(const QString &err, bool isError);
|
||||
private:
|
||||
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
||||
QString m_executable;
|
||||
QStringList m_commandLineArguments;
|
||||
ProjectExplorer::ApplicationLauncher::Mode m_runMode;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // APPLICATIONRUNCONFIGURATION_H
|
||||
|
||||
@@ -31,15 +31,14 @@
|
||||
#define BUILDCONFIGURATION_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
#include "projectconfiguration.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include "projectconfiguration.h"
|
||||
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "iprojectproperties.h"
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 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 "customexecutableconfigurationwidget.h"
|
||||
#include "customexecutablerunconfiguration.h"
|
||||
#include "target.h"
|
||||
#include "project.h"
|
||||
#include "environmenteditmodel.h"
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/debuggerlanguagechooser.h>
|
||||
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLineEdit>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class CustomDirectoryPathChooser : public Utils::PathChooser
|
||||
{
|
||||
public:
|
||||
CustomDirectoryPathChooser(QWidget *parent)
|
||||
: Utils::PathChooser(parent)
|
||||
{
|
||||
}
|
||||
virtual bool validatePath(const QString &path, QString *errorMessage = 0)
|
||||
{
|
||||
Q_UNUSED(path)
|
||||
Q_UNUSED(errorMessage)
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc)
|
||||
: m_ignoreChange(false), m_runConfiguration(rc)
|
||||
{
|
||||
QFormLayout *layout = new QFormLayout;
|
||||
layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
layout->setMargin(0);
|
||||
|
||||
m_executableChooser = new Utils::PathChooser(this);
|
||||
m_executableChooser->setEnvironment(rc->environment());
|
||||
m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
|
||||
layout->addRow(tr("Executable:"), m_executableChooser);
|
||||
|
||||
m_commandLineArgumentsLineEdit = new QLineEdit(this);
|
||||
m_commandLineArgumentsLineEdit->setMinimumWidth(200); // this shouldn't be fixed here...
|
||||
layout->addRow(tr("Arguments:"), m_commandLineArgumentsLineEdit);
|
||||
|
||||
m_workingDirectory = new CustomDirectoryPathChooser(this);
|
||||
m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_workingDirectory->setBaseDirectory(rc->target()->project()->projectDirectory());
|
||||
m_workingDirectory->setEnvironment(rc->environment());
|
||||
layout->addRow(tr("Working directory:"), m_workingDirectory);
|
||||
|
||||
m_useTerminalCheck = new QCheckBox(tr("Run in &Terminal"), this);
|
||||
layout->addRow(QString(), m_useTerminalCheck);
|
||||
|
||||
QWidget *debuggerLabelWidget = new QWidget(this);
|
||||
QVBoxLayout *debuggerLabelLayout = new QVBoxLayout(debuggerLabelWidget);
|
||||
debuggerLabelLayout->setMargin(0);
|
||||
debuggerLabelLayout->setSpacing(0);
|
||||
debuggerLabelWidget->setLayout(debuggerLabelLayout);
|
||||
QLabel *debuggerLabel = new QLabel(tr("Debugger:"), this);
|
||||
debuggerLabelLayout->addWidget(debuggerLabel);
|
||||
debuggerLabelLayout->addStretch(10);
|
||||
|
||||
m_debuggerLanguageChooser = new Utils::DebuggerLanguageChooser(this);
|
||||
layout->addRow(debuggerLabelWidget, m_debuggerLanguageChooser);
|
||||
|
||||
m_debuggerLanguageChooser->setCppChecked(m_runConfiguration->useCppDebugger());
|
||||
m_debuggerLanguageChooser->setQmlChecked(m_runConfiguration->useQmlDebugger());
|
||||
m_debuggerLanguageChooser->setQmlDebugServerPort(m_runConfiguration->qmlDebugServerPort());
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
|
||||
m_detailsContainer = new Utils::DetailsWidget(this);
|
||||
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
|
||||
vbox->addWidget(m_detailsContainer);
|
||||
|
||||
QWidget *detailsWidget = new QWidget(m_detailsContainer);
|
||||
m_detailsContainer->setWidget(detailsWidget);
|
||||
detailsWidget->setLayout(layout);
|
||||
|
||||
QLabel *environmentLabel = new QLabel(this);
|
||||
environmentLabel->setText(tr("Run Environment"));
|
||||
QFont f = environmentLabel->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() *1.2);
|
||||
environmentLabel->setFont(f);
|
||||
vbox->addWidget(environmentLabel);
|
||||
|
||||
QWidget *baseEnvironmentWidget = new QWidget;
|
||||
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
|
||||
baseEnvironmentLayout->setMargin(0);
|
||||
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
|
||||
baseEnvironmentLayout->addWidget(label);
|
||||
m_baseEnvironmentComboBox = new QComboBox(this);
|
||||
m_baseEnvironmentComboBox->addItems(QStringList()
|
||||
<< tr("Clean Environment")
|
||||
<< tr("System Environment")
|
||||
<< tr("Build Environment"));
|
||||
m_baseEnvironmentComboBox->setCurrentIndex(rc->baseEnvironmentBase());
|
||||
connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(baseEnvironmentSelected(int)));
|
||||
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
|
||||
baseEnvironmentLayout->addStretch(10);
|
||||
|
||||
m_environmentWidget = new EnvironmentWidget(this, baseEnvironmentWidget);
|
||||
m_environmentWidget->setBaseEnvironment(rc->baseEnvironment());
|
||||
m_environmentWidget->setBaseEnvironmentText(rc->baseEnvironmentText());
|
||||
m_environmentWidget->setUserChanges(rc->userEnvironmentChanges());
|
||||
vbox->addWidget(m_environmentWidget);
|
||||
|
||||
changed();
|
||||
|
||||
connect(m_executableChooser, SIGNAL(changed(QString)),
|
||||
this, SLOT(executableEdited()));
|
||||
connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
|
||||
this, SLOT(argumentsEdited(const QString&)));
|
||||
connect(m_workingDirectory, SIGNAL(changed(QString)),
|
||||
this, SLOT(workingDirectoryEdited()));
|
||||
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
|
||||
this, SLOT(termToggled(bool)));
|
||||
|
||||
connect(m_debuggerLanguageChooser, SIGNAL(cppLanguageToggled(bool)),
|
||||
this, SLOT(useCppDebuggerToggled(bool)));
|
||||
connect(m_debuggerLanguageChooser, SIGNAL(qmlLanguageToggled(bool)),
|
||||
this, SLOT(useQmlDebuggerToggled(bool)));
|
||||
connect(m_debuggerLanguageChooser, SIGNAL(qmlDebugServerPortChanged(uint)),
|
||||
this, SLOT(qmlDebugServerPortChanged(uint)));
|
||||
|
||||
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
connect(m_environmentWidget, SIGNAL(userChangesChanged()),
|
||||
this, SLOT(userChangesChanged()));
|
||||
|
||||
connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()),
|
||||
this, SLOT(baseEnvironmentChanged()));
|
||||
connect(m_runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
|
||||
this, SLOT(userEnvironmentChangesChanged()));
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::userChangesChanged()
|
||||
{
|
||||
m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::baseEnvironmentSelected(int index)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setBaseEnvironmentBase(CustomExecutableRunConfiguration::BaseEnvironmentBase(index));
|
||||
|
||||
m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
|
||||
m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::useCppDebuggerToggled(bool toggled)
|
||||
{
|
||||
m_runConfiguration->setUseCppDebugger(toggled);
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::useQmlDebuggerToggled(bool toggled)
|
||||
{
|
||||
m_runConfiguration->setUseQmlDebugger(toggled);
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::qmlDebugServerPortChanged(uint port)
|
||||
{
|
||||
m_runConfiguration->setQmlDebugServerPort(port);
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::baseEnvironmentChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
|
||||
int index = CustomExecutableRunConfiguration::BaseEnvironmentBase(
|
||||
m_runConfiguration->baseEnvironmentBase());
|
||||
m_baseEnvironmentComboBox->setCurrentIndex(index);
|
||||
m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
|
||||
m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::userEnvironmentChangesChanged()
|
||||
{
|
||||
m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges());
|
||||
}
|
||||
|
||||
|
||||
void CustomExecutableConfigurationWidget::executableEdited()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setExecutable(m_executableChooser->rawPath());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
void CustomExecutableConfigurationWidget::argumentsEdited(const QString &arguments)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setBaseCommandLineArguments(arguments);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
void CustomExecutableConfigurationWidget::workingDirectoryEdited()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setBaseWorkingDirectory(m_workingDirectory->rawPath());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::termToggled(bool on)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console
|
||||
: LocalApplicationRunConfiguration::Gui);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::changed()
|
||||
{
|
||||
// We triggered the change, don't update us
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
|
||||
m_executableChooser->setPath(m_runConfiguration->rawExecutable());
|
||||
m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->baseCommandLineArguments()));
|
||||
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
|
||||
m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
@@ -0,0 +1,95 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 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 CUSTOMEXECUTABLECONFIGURATIONWIDGET_H
|
||||
#define CUSTOMEXECUTABLECONFIGURATIONWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QAbstractButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class DetailsWidget;
|
||||
class PathChooser;
|
||||
class DebuggerLanguageChooser;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class CustomExecutableRunConfiguration;
|
||||
class EnvironmentWidget;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CustomExecutableConfigurationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc);
|
||||
|
||||
private slots:
|
||||
void changed();
|
||||
|
||||
void executableEdited();
|
||||
void argumentsEdited(const QString &arguments);
|
||||
void workingDirectoryEdited();
|
||||
void termToggled(bool);
|
||||
|
||||
void userChangesChanged();
|
||||
void baseEnvironmentChanged();
|
||||
void userEnvironmentChangesChanged();
|
||||
void baseEnvironmentSelected(int index);
|
||||
void useCppDebuggerToggled(bool toggled);
|
||||
void useQmlDebuggerToggled(bool toggled);
|
||||
void qmlDebugServerPortChanged(uint port);
|
||||
|
||||
private:
|
||||
bool m_ignoreChange;
|
||||
CustomExecutableRunConfiguration *m_runConfiguration;
|
||||
Utils::PathChooser *m_executableChooser;
|
||||
QLineEdit *m_userName;
|
||||
QLineEdit *m_commandLineArgumentsLineEdit;
|
||||
Utils::PathChooser *m_workingDirectory;
|
||||
QCheckBox *m_useTerminalCheck;
|
||||
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
||||
QComboBox *m_baseEnvironmentComboBox;
|
||||
Utils::DetailsWidget *m_detailsContainer;
|
||||
Utils::DebuggerLanguageChooser *m_debuggerLanguageChooser;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // CUSTOMEXECUTABLECONFIGURATIONWIDGET_H
|
||||
@@ -28,28 +28,20 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "customexecutablerunconfiguration.h"
|
||||
#include "customexecutableconfigurationwidget.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/environmenteditmodel.h>
|
||||
#include <projectexplorer/debugginghelper.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/debuggerlanguagechooser.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
@@ -67,219 +59,6 @@ const char * const BASE_ENVIRONMENT_BASE_KEY("ProjectExplorer.CustomExecutableRu
|
||||
const char * const DEFAULT_WORKING_DIR("$BUILDDIR");
|
||||
}
|
||||
|
||||
class CustomDirectoryPathChooser : public Utils::PathChooser
|
||||
{
|
||||
public:
|
||||
CustomDirectoryPathChooser(QWidget *parent)
|
||||
: Utils::PathChooser(parent)
|
||||
{
|
||||
}
|
||||
virtual bool validatePath(const QString &path, QString *errorMessage = 0)
|
||||
{
|
||||
Q_UNUSED(path)
|
||||
Q_UNUSED(errorMessage)
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc)
|
||||
: m_ignoreChange(false), m_runConfiguration(rc)
|
||||
{
|
||||
QFormLayout *layout = new QFormLayout;
|
||||
layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
layout->setMargin(0);
|
||||
|
||||
m_executableChooser = new Utils::PathChooser(this);
|
||||
m_executableChooser->setEnvironment(rc->environment());
|
||||
m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
|
||||
layout->addRow(tr("Executable:"), m_executableChooser);
|
||||
|
||||
m_commandLineArgumentsLineEdit = new QLineEdit(this);
|
||||
m_commandLineArgumentsLineEdit->setMinimumWidth(200); // this shouldn't be fixed here...
|
||||
layout->addRow(tr("Arguments:"), m_commandLineArgumentsLineEdit);
|
||||
|
||||
m_workingDirectory = new CustomDirectoryPathChooser(this);
|
||||
m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_workingDirectory->setBaseDirectory(rc->target()->project()->projectDirectory());
|
||||
m_workingDirectory->setEnvironment(rc->environment());
|
||||
layout->addRow(tr("Working directory:"), m_workingDirectory);
|
||||
|
||||
m_useTerminalCheck = new QCheckBox(tr("Run in &Terminal"), this);
|
||||
layout->addRow(QString(), m_useTerminalCheck);
|
||||
|
||||
QWidget *debuggerLabelWidget = new QWidget(this);
|
||||
QVBoxLayout *debuggerLabelLayout = new QVBoxLayout(debuggerLabelWidget);
|
||||
debuggerLabelLayout->setMargin(0);
|
||||
debuggerLabelLayout->setSpacing(0);
|
||||
debuggerLabelWidget->setLayout(debuggerLabelLayout);
|
||||
QLabel *debuggerLabel = new QLabel(tr("Debugger:"), this);
|
||||
debuggerLabelLayout->addWidget(debuggerLabel);
|
||||
debuggerLabelLayout->addStretch(10);
|
||||
|
||||
m_debuggerLanguageChooser = new Utils::DebuggerLanguageChooser(this);
|
||||
layout->addRow(debuggerLabelWidget, m_debuggerLanguageChooser);
|
||||
|
||||
m_debuggerLanguageChooser->setCppChecked(m_runConfiguration->useCppDebugger());
|
||||
m_debuggerLanguageChooser->setQmlChecked(m_runConfiguration->useQmlDebugger());
|
||||
m_debuggerLanguageChooser->setQmlDebugServerPort(m_runConfiguration->qmlDebugServerPort());
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
|
||||
m_detailsContainer = new Utils::DetailsWidget(this);
|
||||
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
|
||||
vbox->addWidget(m_detailsContainer);
|
||||
|
||||
QWidget *detailsWidget = new QWidget(m_detailsContainer);
|
||||
m_detailsContainer->setWidget(detailsWidget);
|
||||
detailsWidget->setLayout(layout);
|
||||
|
||||
QLabel *environmentLabel = new QLabel(this);
|
||||
environmentLabel->setText(tr("Run Environment"));
|
||||
QFont f = environmentLabel->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() *1.2);
|
||||
environmentLabel->setFont(f);
|
||||
vbox->addWidget(environmentLabel);
|
||||
|
||||
QWidget *baseEnvironmentWidget = new QWidget;
|
||||
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
|
||||
baseEnvironmentLayout->setMargin(0);
|
||||
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
|
||||
baseEnvironmentLayout->addWidget(label);
|
||||
m_baseEnvironmentComboBox = new QComboBox(this);
|
||||
m_baseEnvironmentComboBox->addItems(QStringList()
|
||||
<< tr("Clean Environment")
|
||||
<< tr("System Environment")
|
||||
<< tr("Build Environment"));
|
||||
m_baseEnvironmentComboBox->setCurrentIndex(rc->baseEnvironmentBase());
|
||||
connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(baseEnvironmentSelected(int)));
|
||||
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
|
||||
baseEnvironmentLayout->addStretch(10);
|
||||
|
||||
m_environmentWidget = new EnvironmentWidget(this, baseEnvironmentWidget);
|
||||
m_environmentWidget->setBaseEnvironment(rc->baseEnvironment());
|
||||
m_environmentWidget->setBaseEnvironmentText(rc->baseEnvironmentText());
|
||||
m_environmentWidget->setUserChanges(rc->userEnvironmentChanges());
|
||||
vbox->addWidget(m_environmentWidget);
|
||||
|
||||
changed();
|
||||
|
||||
connect(m_executableChooser, SIGNAL(changed(QString)),
|
||||
this, SLOT(executableEdited()));
|
||||
connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
|
||||
this, SLOT(argumentsEdited(const QString&)));
|
||||
connect(m_workingDirectory, SIGNAL(changed(QString)),
|
||||
this, SLOT(workingDirectoryEdited()));
|
||||
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
|
||||
this, SLOT(termToggled(bool)));
|
||||
|
||||
connect(m_debuggerLanguageChooser, SIGNAL(cppLanguageToggled(bool)),
|
||||
this, SLOT(useCppDebuggerToggled(bool)));
|
||||
connect(m_debuggerLanguageChooser, SIGNAL(qmlLanguageToggled(bool)),
|
||||
this, SLOT(useQmlDebuggerToggled(bool)));
|
||||
connect(m_debuggerLanguageChooser, SIGNAL(qmlDebugServerPortChanged(uint)),
|
||||
this, SLOT(qmlDebugServerPortChanged(uint)));
|
||||
|
||||
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
connect(m_environmentWidget, SIGNAL(userChangesChanged()),
|
||||
this, SLOT(userChangesChanged()));
|
||||
|
||||
connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()),
|
||||
this, SLOT(baseEnvironmentChanged()));
|
||||
connect(m_runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
|
||||
this, SLOT(userEnvironmentChangesChanged()));
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::userChangesChanged()
|
||||
{
|
||||
m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::baseEnvironmentSelected(int index)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setBaseEnvironmentBase(CustomExecutableRunConfiguration::BaseEnvironmentBase(index));
|
||||
|
||||
m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
|
||||
m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::useCppDebuggerToggled(bool toggled)
|
||||
{
|
||||
m_runConfiguration->setUseCppDebugger(toggled);
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::useQmlDebuggerToggled(bool toggled)
|
||||
{
|
||||
m_runConfiguration->setUseQmlDebugger(toggled);
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::qmlDebugServerPortChanged(uint port)
|
||||
{
|
||||
m_runConfiguration->setQmlDebugServerPort(port);
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::baseEnvironmentChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
|
||||
int index = CustomExecutableRunConfiguration::BaseEnvironmentBase(
|
||||
m_runConfiguration->baseEnvironmentBase());
|
||||
m_baseEnvironmentComboBox->setCurrentIndex(index);
|
||||
m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
|
||||
m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::userEnvironmentChangesChanged()
|
||||
{
|
||||
m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges());
|
||||
}
|
||||
|
||||
|
||||
void CustomExecutableConfigurationWidget::executableEdited()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setExecutable(m_executableChooser->rawPath());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
void CustomExecutableConfigurationWidget::argumentsEdited(const QString &arguments)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setBaseCommandLineArguments(arguments);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
void CustomExecutableConfigurationWidget::workingDirectoryEdited()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setBaseWorkingDirectory(m_workingDirectory->rawPath());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::termToggled(bool on)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console
|
||||
: LocalApplicationRunConfiguration::Gui);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::changed()
|
||||
{
|
||||
// We triggered the change, don't update us
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
|
||||
m_executableChooser->setPath(m_runConfiguration->rawExecutable());
|
||||
m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->baseCommandLineArguments()));
|
||||
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
|
||||
m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console);
|
||||
}
|
||||
|
||||
void CustomExecutableRunConfiguration::ctor()
|
||||
{
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
|
||||
@@ -33,25 +33,8 @@
|
||||
#include "applicationrunconfiguration.h"
|
||||
|
||||
#include <QtCore/QVariantMap>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QAbstractButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class DetailsWidget;
|
||||
class PathChooser;
|
||||
class DebuggerLanguageChooser;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class EnvironmentWidget;
|
||||
class Target;
|
||||
|
||||
namespace Internal {
|
||||
@@ -160,46 +143,6 @@ public:
|
||||
RunConfiguration *clone(Target *parent, RunConfiguration *source);
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CustomExecutableConfigurationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc);
|
||||
|
||||
private slots:
|
||||
void changed();
|
||||
|
||||
void executableEdited();
|
||||
void argumentsEdited(const QString &arguments);
|
||||
void workingDirectoryEdited();
|
||||
void termToggled(bool);
|
||||
|
||||
void userChangesChanged();
|
||||
void baseEnvironmentChanged();
|
||||
void userEnvironmentChangesChanged();
|
||||
void baseEnvironmentSelected(int index);
|
||||
void useCppDebuggerToggled(bool toggled);
|
||||
void useQmlDebuggerToggled(bool toggled);
|
||||
void qmlDebugServerPortChanged(uint port);
|
||||
|
||||
private:
|
||||
bool m_ignoreChange;
|
||||
CustomExecutableRunConfiguration *m_runConfiguration;
|
||||
Utils::PathChooser *m_executableChooser;
|
||||
QLineEdit *m_userName;
|
||||
QLineEdit *m_commandLineArgumentsLineEdit;
|
||||
Utils::PathChooser *m_workingDirectory;
|
||||
QCheckBox *m_useTerminalCheck;
|
||||
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
||||
QComboBox *m_baseEnvironmentComboBox;
|
||||
Utils::DetailsWidget *m_detailsContainer;
|
||||
Utils::DebuggerLanguageChooser *m_debuggerLanguageChooser;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // CUSTOMEXECUTABLERUNCONFIGURATION_H
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/buildablehelperlibrary.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <QtCore/QMap>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTimer;
|
||||
class QFileSystemWatcher;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "ioutputparser.h"
|
||||
#include "utils/qtcassert.h"
|
||||
#include "task.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
|
||||
@@ -31,13 +31,12 @@
|
||||
#define IOUTPUTPARSER_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
#include "task.h"
|
||||
#include "buildstep.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Task;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT IOutputParser : public QObject
|
||||
{
|
||||
|
||||
@@ -32,7 +32,9 @@
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QIcon)
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
|
||||
141
src/plugins/projectexplorer/localapplicationruncontrol.cpp
Normal file
141
src/plugins/projectexplorer/localapplicationruncontrol.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 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 "localapplicationruncontrol.h"
|
||||
#include "applicationrunconfiguration.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtCore/QDir>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
LocalApplicationRunControlFactory::LocalApplicationRunControlFactory()
|
||||
{
|
||||
}
|
||||
|
||||
LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool LocalApplicationRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const
|
||||
{
|
||||
return (mode == ProjectExplorer::Constants::RUNMODE)
|
||||
&& (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) != 0);
|
||||
}
|
||||
|
||||
QString LocalApplicationRunControlFactory::displayName() const
|
||||
{
|
||||
return tr("Run");
|
||||
}
|
||||
|
||||
RunControl *LocalApplicationRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
return new LocalApplicationRunControl(qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration), mode);
|
||||
}
|
||||
|
||||
QWidget *LocalApplicationRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
|
||||
{
|
||||
Q_UNUSED(runConfiguration)
|
||||
return new QLabel("TODO add Configuration widget");
|
||||
}
|
||||
|
||||
// ApplicationRunControl
|
||||
|
||||
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, QString mode)
|
||||
: RunControl(rc, mode)
|
||||
{
|
||||
Utils::Environment env = rc->environment();
|
||||
QString dir = rc->workingDirectory();
|
||||
m_applicationLauncher.setEnvironment(env.toStringList());
|
||||
m_applicationLauncher.setWorkingDirectory(dir);
|
||||
|
||||
m_executable = rc->executable();
|
||||
m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode());
|
||||
m_commandLineArguments = rc->commandLineArguments();
|
||||
|
||||
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
|
||||
this, SLOT(slotAppendMessage(QString,bool)));
|
||||
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
|
||||
this, SLOT(slotAddToOutputWindow(QString, bool)));
|
||||
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
|
||||
this, SLOT(processExited(int)));
|
||||
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
|
||||
this, SLOT(bringApplicationToForeground(qint64)));
|
||||
}
|
||||
|
||||
LocalApplicationRunControl::~LocalApplicationRunControl()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::start()
|
||||
{
|
||||
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
|
||||
emit started();
|
||||
|
||||
emit appendMessage(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)), false);
|
||||
}
|
||||
|
||||
LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
|
||||
{
|
||||
m_applicationLauncher.stop();
|
||||
return StoppedSynchronously;
|
||||
}
|
||||
|
||||
bool LocalApplicationRunControl::isRunning() const
|
||||
{
|
||||
return m_applicationLauncher.isRunning();
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::slotAppendMessage(const QString &err,
|
||||
bool isError)
|
||||
{
|
||||
emit appendMessage(this, err, isError);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::slotAddToOutputWindow(const QString &line,
|
||||
bool isError)
|
||||
{
|
||||
emit addToOutputWindowInline(this, line, isError);
|
||||
}
|
||||
|
||||
void LocalApplicationRunControl::processExited(int exitCode)
|
||||
{
|
||||
emit appendMessage(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode), false);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
76
src/plugins/projectexplorer/localapplicationruncontrol.h
Normal file
76
src/plugins/projectexplorer/localapplicationruncontrol.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 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 LOCALAPPLICATIONRUNCONTROL_H
|
||||
#define LOCALAPPLICATIONRUNCONTROL_H
|
||||
|
||||
#include "runconfiguration.h"
|
||||
#include "applicationlauncher.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class LocalApplicationRunConfiguration;
|
||||
namespace Internal {
|
||||
|
||||
class LocalApplicationRunControlFactory : public IRunControlFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocalApplicationRunControlFactory ();
|
||||
virtual ~LocalApplicationRunControlFactory();
|
||||
virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
|
||||
virtual QString displayName() const;
|
||||
virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode);
|
||||
virtual QWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
|
||||
};
|
||||
|
||||
class LocalApplicationRunControl : public RunControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, QString mode);
|
||||
virtual ~LocalApplicationRunControl();
|
||||
virtual void start();
|
||||
virtual StopResult stop();
|
||||
virtual bool isRunning() const;
|
||||
private slots:
|
||||
void processExited(int exitCode);
|
||||
void slotAddToOutputWindow(const QString &line, bool isError);
|
||||
void slotAppendMessage(const QString &err, bool isError);
|
||||
private:
|
||||
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
||||
QString m_executable;
|
||||
QStringList m_commandLineArguments;
|
||||
ProjectExplorer::ApplicationLauncher::Mode m_runMode;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // LOCALAPPLICATIONRUNCONTROL_H
|
||||
@@ -33,6 +33,9 @@
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QColor>
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace TextEditor;
|
||||
|
||||
@@ -33,12 +33,11 @@
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QColor>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QMouseEvent);
|
||||
QT_FORWARD_DECLARE_CLASS(QPlainTextEdit);
|
||||
QT_FORWARD_DECLARE_CLASS(QTextCharFormat);
|
||||
QT_FORWARD_DECLARE_CLASS(QColor);
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "copytaskhandler.h"
|
||||
#include "showineditortaskhandler.h"
|
||||
#include "vcsannotatetaskhandler.h"
|
||||
#include "applicationrunconfiguration.h"
|
||||
#include "localapplicationruncontrol.h"
|
||||
#include "allprojectsfilter.h"
|
||||
#include "allprojectsfind.h"
|
||||
#include "buildmanager.h"
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "runsettingspropertiespage.h"
|
||||
#include "scriptwrappers.h"
|
||||
#include "session.h"
|
||||
#include "projectnodes.h"
|
||||
#include "sessiondialog.h"
|
||||
#include "target.h"
|
||||
#include "projectexplorersettingspage.h"
|
||||
|
||||
@@ -92,7 +92,10 @@ HEADERS += projectexplorer.h \
|
||||
runconfigurationmodel.h \
|
||||
buildconfigurationmodel.h \
|
||||
abstractprocessstep.h \
|
||||
taskhub.h
|
||||
taskhub.h \
|
||||
localapplicationruncontrol.h \
|
||||
customexecutableconfigurationwidget.h \
|
||||
sessionnodeimpl.h
|
||||
SOURCES += projectexplorer.cpp \
|
||||
projectwindow.cpp \
|
||||
buildmanager.cpp \
|
||||
@@ -169,7 +172,10 @@ SOURCES += projectexplorer.cpp \
|
||||
outputformatter.cpp \
|
||||
runconfigurationmodel.cpp \
|
||||
buildconfigurationmodel.cpp \
|
||||
taskhub.cpp
|
||||
taskhub.cpp \
|
||||
localapplicationruncontrol.cpp \
|
||||
customexecutableconfigurationwidget.cpp \
|
||||
sessionnodeimpl.cpp
|
||||
FORMS += processstep.ui \
|
||||
editorsettingspropertiespage.ui \
|
||||
runsettingspropertiespage.ui \
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "projecttreewidget.h"
|
||||
|
||||
#include "projectexplorer.h"
|
||||
#include "projectnodes.h"
|
||||
#include "project.h"
|
||||
#include "session.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "iprojectproperties.h"
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QMenu;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "session.h"
|
||||
#include "sessionnodeimpl.h"
|
||||
|
||||
#include "project.h"
|
||||
#include "projectexplorer.h"
|
||||
@@ -111,7 +112,6 @@ private:
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
|
||||
void SessionFile::sessionLoadingProgress()
|
||||
{
|
||||
future.setProgressValue(future.progressValue() + 1);
|
||||
@@ -305,28 +305,6 @@ void SessionFile::clearFailedProjectFileNames()
|
||||
m_failedProjects.clear();
|
||||
}
|
||||
|
||||
Internal::SessionNodeImpl::SessionNodeImpl(SessionManager *manager)
|
||||
: ProjectExplorer::SessionNode(manager->currentSession(), manager)
|
||||
{
|
||||
setFileName("session");
|
||||
}
|
||||
|
||||
void Internal::SessionNodeImpl::addProjectNode(ProjectNode *projectNode)
|
||||
{
|
||||
addProjectNodes(QList<ProjectNode*>() << projectNode);
|
||||
}
|
||||
|
||||
void Internal::SessionNodeImpl::removeProjectNode(ProjectNode *projectNode)
|
||||
{
|
||||
removeProjectNodes(QList<ProjectNode*>() << projectNode);
|
||||
}
|
||||
|
||||
void Internal::SessionNodeImpl::setFileName(const QString &fileName)
|
||||
{
|
||||
setPath(fileName);
|
||||
setDisplayName(fileName);
|
||||
}
|
||||
|
||||
/* --------------------------------- */
|
||||
|
||||
SessionManager::SessionManager(QObject *parent)
|
||||
|
||||
@@ -31,16 +31,15 @@
|
||||
#define SESSION_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
#include "projectnodes.h"
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractItemModel;
|
||||
class QTimer;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
@@ -58,23 +57,8 @@ class SessionNode;
|
||||
class SessionManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class SessionFile;
|
||||
|
||||
// Must be in header as otherwise moc has issues
|
||||
// with ProjectExplorer::SessionNode on msvc2005
|
||||
class SessionNodeImpl : public ProjectExplorer::SessionNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SessionNodeImpl(SessionManager *manager);
|
||||
|
||||
void addProjectNode(ProjectNode *projectNode);
|
||||
void removeProjectNode(ProjectNode *projectNode);
|
||||
|
||||
void setFileName(const QString &fileName);
|
||||
};
|
||||
|
||||
class SessionNodeImpl;
|
||||
} // namespace Internal
|
||||
|
||||
// TODO the interface of this class is not really great
|
||||
|
||||
59
src/plugins/projectexplorer/sessionnodeimpl.cpp
Normal file
59
src/plugins/projectexplorer/sessionnodeimpl.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 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 "sessionnodeimpl.h"
|
||||
#include "session.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
SessionNodeImpl::SessionNodeImpl(SessionManager *manager)
|
||||
: ProjectExplorer::SessionNode(manager->currentSession(), manager)
|
||||
{
|
||||
setFileName(QLatin1String("session"));
|
||||
}
|
||||
|
||||
void SessionNodeImpl::addProjectNode(ProjectNode *projectNode)
|
||||
{
|
||||
addProjectNodes(QList<ProjectNode*>() << projectNode);
|
||||
}
|
||||
|
||||
void SessionNodeImpl::removeProjectNode(ProjectNode *projectNode)
|
||||
{
|
||||
removeProjectNodes(QList<ProjectNode*>() << projectNode);
|
||||
}
|
||||
|
||||
void SessionNodeImpl::setFileName(const QString &fileName)
|
||||
{
|
||||
setPath(fileName);
|
||||
setDisplayName(fileName);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
57
src/plugins/projectexplorer/sessionnodeimpl.h
Normal file
57
src/plugins/projectexplorer/sessionnodeimpl.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 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 SESSIONNODEIMPL_H
|
||||
#define SESSIONNODEIMPL_H
|
||||
|
||||
#include "projectnodes.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class SessionManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
// Must be in a header as otherwise moc has issues
|
||||
// with ProjectExplorer::SessionNode on msvc2005
|
||||
class SessionNodeImpl : public ProjectExplorer::SessionNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SessionNodeImpl(SessionManager *manager);
|
||||
|
||||
void addProjectNode(ProjectNode *projectNode);
|
||||
void removeProjectNode(ProjectNode *projectNode);
|
||||
|
||||
void setFileName(const QString &fileName);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // SESSIONNODEIMPL_H
|
||||
@@ -30,14 +30,12 @@
|
||||
#ifndef PROJECTEXPLORER_SHOWINEDITORTASKHANDLER_H
|
||||
#define PROJECTEXPLORER_SHOWINEDITORTASKHANDLER_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include "itaskhandler.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ShowInEditorTaskHandler : public ITaskHandler
|
||||
class ShowInEditorTaskHandler : public ITaskHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#ifndef PROJECTEXPLORER_SHOWOUTPUTTASKHANDLER_H
|
||||
#define PROJECTEXPLORER_SHOWOUTPUTTASKHANDLER_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include "itaskhandler.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -39,7 +37,7 @@ namespace Internal {
|
||||
|
||||
class CompileOutputWindow;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ShowOutputTaskHandler : public ITaskHandler
|
||||
class ShowOutputTaskHandler : public ITaskHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#ifndef PROJECTEXPLORER_VCSANNOTATETASKHANDLER_H
|
||||
#define PROJECTEXPLORER_VCSANNOTATETASKHANDLER_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include "itaskhandler.h"
|
||||
|
||||
namespace Core {
|
||||
@@ -41,7 +39,7 @@ class IVersionControl;
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT VcsAnnotateTaskHandler : public ITaskHandler
|
||||
class VcsAnnotateTaskHandler : public ITaskHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user