Commit 4293ee40 authored by Friedemann Kleint's avatar Friedemann Kleint

ProjectExplorer: Remove internal classes from exported headers.

parent 4adeef9a
......@@ -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;
......
/**************************************************************************
**
** 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;